Skip to content

Commit

Permalink
refactor(gui): gui structure change to make adding more ledgers easier
Browse files Browse the repository at this point in the history
- 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
rwat17 authored and petermetz committed Mar 20, 2024
1 parent 941dbad commit e42cac7
Show file tree
Hide file tree
Showing 80 changed files with 779 additions and 353 deletions.
2 changes: 1 addition & 1 deletion packages/cacti-ledger-browser-react/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script type="module" src="/src/main/typescript/main.tsx"></script>
</body>

</html>
266 changes: 0 additions & 266 deletions packages/cacti-ledger-browser-react/src/main.tsx

This file was deleted.

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;
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;
Loading

0 comments on commit e42cac7

Please sign in to comment.