-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(gui): gui structure change to make adding more ledgers easier
- change folder structure - each ledger-plugin now has separate folder and configuration - added status page for available plugins Signed-off-by: Tomasz Awramski <[email protected]>
- Loading branch information
Showing
80 changed files
with
779 additions
and
353 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 was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
packages/cacti-ledger-browser-react/src/main/typescript/apps/cacti/index.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,20 @@ | ||
import StatusPage from "./pages/status-page"; | ||
|
||
const appConfig = { | ||
name: "Cacti", | ||
url: "cacti", | ||
menuEntries: [ | ||
{ | ||
title: "Plugin Status", | ||
url: "/", | ||
}, | ||
], | ||
routes: [ | ||
{ | ||
path: "/", | ||
component: StatusPage, | ||
}, | ||
], | ||
}; | ||
|
||
export default appConfig; |
61 changes: 61 additions & 0 deletions
61
packages/cacti-ledger-browser-react/src/main/typescript/apps/cacti/pages/status-page.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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { useEffect, useState } from "react"; | ||
import { supabase } from "../../../common/supabase-client"; | ||
import CardWrapper from "../../../components/ui/CardWrapper"; | ||
|
||
function StatusPage() { | ||
const [getPluginStatus, setPluginStatuse] = useState<unknown[]>([]); | ||
|
||
const fetchPluginStatus = async () => { | ||
try { | ||
const { data, error } = await supabase.from("plugin_status").select(); | ||
if (error) { | ||
throw new Error( | ||
`Could not get plugin statuses from the DB: ${error.message}`, | ||
); | ||
} | ||
|
||
if (data) { | ||
setPluginStatuse( | ||
data.map((p) => { | ||
return { | ||
...p, | ||
is_schema_initialized: p.is_schema_initialized | ||
? "Setup complete" | ||
: "No schema", | ||
}; | ||
}), | ||
); | ||
} | ||
} catch (error) { | ||
console.error("Error when fetching plugin statuses:", error); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
fetchPluginStatus(); | ||
}, []); | ||
|
||
return ( | ||
<div> | ||
<CardWrapper | ||
columns={ | ||
{ | ||
schema: [ | ||
{ display: "Name", objProp: ["name"] }, | ||
{ display: "Instance ID", objProp: ["last_instance_id"] }, | ||
{ display: "Status", objProp: ["is_schema_initialized"] }, | ||
{ display: "Created at", objProp: ["created_at"] }, | ||
{ display: "Connected at", objProp: ["last_connected_at"] }, | ||
], | ||
} as any | ||
} | ||
data={getPluginStatus} | ||
title={"Persistence Plugins"} | ||
display={"All"} | ||
trimmed={false} | ||
></CardWrapper> | ||
</div> | ||
); | ||
} | ||
|
||
export default StatusPage; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.