-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ledger-browser): refactor home page
- Remove status apps, its functionality has been moved to the home page. - Add status components for persistence apps. - Add home page that contains cards for each configured app. Clicking on it naviagtes to specific app, clicking on Status button shows status component. - Remove app drawer, replace it with a button that navigates to root path (i.e. the home app, navigation between apps is handled here). - Remove all the remaining dead and legacy code, apply small structure upgrades. - Since this PR removes all old code, and all the current code was written by me and Tomasz, I've also removed previous inactive package contributors. Depends on #3320 Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
- Loading branch information
Showing
36 changed files
with
414 additions
and
1,024 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
packages/cacti-ledger-browser/src/main/typescript/apps/cacti/index.tsx
This file was deleted.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
packages/cacti-ledger-browser/src/main/typescript/apps/cacti/pages/status-page.tsx
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
packages/cacti-ledger-browser/src/main/typescript/apps/cacti/queries.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 1 addition & 6 deletions
7
packages/cacti-ledger-browser/src/main/typescript/common/config.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import cactiGuiConfig from "../apps/cacti/index"; | ||
import ethereumGuiConfig from "../apps/eth"; | ||
import fabricAppConfig from "../apps/fabric"; | ||
import { AppConfig } from "./types/app"; | ||
|
||
export const appConfig: AppConfig[] = [ | ||
cactiGuiConfig, | ||
ethereumGuiConfig, | ||
fabricAppConfig, | ||
]; | ||
export const appConfig: AppConfig[] = [ethereumGuiConfig, fabricAppConfig]; |
31 changes: 31 additions & 0 deletions
31
packages/cacti-ledger-browser/src/main/typescript/common/hook/use-persistence-app-status.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from "react"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
import { GetStatusResponse } from "../types/app"; | ||
import { useNotification } from "../context/NotificationContext"; | ||
import { persistencePluginStatus } from "../queries"; | ||
|
||
/** | ||
* Return status of given persistence plugin from the database. | ||
* | ||
* @param pluginName name of the plugin (as set by the persistence plugin itself) | ||
*/ | ||
export function usePersistenceAppStatus(pluginName: string): GetStatusResponse { | ||
const { isError, isPending, data, error } = useQuery( | ||
persistencePluginStatus(pluginName), | ||
); | ||
const { showNotification } = useNotification(); | ||
|
||
React.useEffect(() => { | ||
isError && | ||
showNotification(`Could get ${pluginName} status: ${error}`, "error"); | ||
}, [isError]); | ||
|
||
return { | ||
isPending, | ||
isInitialized: data?.is_schema_initialized ?? false, | ||
status: { | ||
severity: "info", | ||
message: "Unknown", | ||
}, | ||
}; | ||
} |
41 changes: 41 additions & 0 deletions
41
packages/cacti-ledger-browser/src/main/typescript/common/queries.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { createClient } from "@supabase/supabase-js"; | ||
import { queryOptions } from "@tanstack/react-query"; | ||
import { PluginStatus } from "./supabase-types"; | ||
|
||
const supabaseQueryKey = "supabase"; | ||
const supabaseUrl = "http://localhost:8000"; | ||
const supabaseKey = | ||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE"; | ||
|
||
export const supabase = createClient(supabaseUrl, supabaseKey); | ||
|
||
/** | ||
* Get persistence plugin status from the database using it's name. | ||
*/ | ||
export function persistencePluginStatus(name: string) { | ||
const tableName = "plugin_status"; | ||
|
||
return queryOptions({ | ||
queryKey: [supabaseQueryKey, tableName, name], | ||
queryFn: async () => { | ||
const { data, error } = await supabase | ||
.from(tableName) | ||
.select() | ||
.match({ name }); | ||
|
||
if (error) { | ||
throw new Error( | ||
`Could not get persistence plugin status with name ${name}: ${error.message}`, | ||
); | ||
} | ||
|
||
if (data.length !== 1) { | ||
throw new Error( | ||
`Invalid response when persistence plugin status with name ${name}: ${data}`, | ||
); | ||
} | ||
|
||
return data.pop() as PluginStatus; | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
packages/cacti-ledger-browser/src/main/typescript/common/token-standards.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.