Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X-Admin app improvements #761

Merged
merged 28 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
78f055a
adopt hash router and react query
Velua Jun 19, 2024
36bb7a1
remove usePollJson
Velua Jun 20, 2024
2c3d9b6
remove stale logic
Velua Jun 20, 2024
42c6da0
add conect page and logic
Velua Jun 26, 2024
d61ef13
a
Velua Jul 1, 2024
e96466d
update floating words
Velua Jul 2, 2024
88b5110
working
Velua Jul 4, 2024
d5fb92b
add alert and accordion
Velua Jul 10, 2024
65645a4
add multi-steps loading
Velua Jul 11, 2024
3e2048e
prevent default
Velua Jul 15, 2024
f96ef92
Merge remote-tracking branch 'origin/main' into x-admin-wizard
Velua Jul 15, 2024
dbdee91
add toast and installation progression
Velua Jul 16, 2024
0fb4c2a
move chain interactions to single file
Velua Jul 17, 2024
816b460
prevent default
Velua Jul 17, 2024
116cb7d
adopt tabs list
Velua Jul 17, 2024
7c21135
pinning on logs page
Velua Jul 22, 2024
2ec24c3
add changes
Velua Aug 5, 2024
48c1452
clear up files and create psi packages
Velua Aug 7, 2024
cf25ef1
fix bug in additional dependencies and adopt dev/prod defaults
Velua Aug 7, 2024
53af758
fix connection bug
Velua Aug 8, 2024
7f5ef95
cosmetic changes
Velua Aug 8, 2024
6f8b89c
fix bad link
Velua Aug 8, 2024
13633bf
render disconnect only on transient connections
Velua Aug 9, 2024
39ac4c6
fix accordion formatting
Velua Aug 9, 2024
b3cf3e8
Merge remote-tracking branch 'origin/main' into x-admin-wizard
Velua Aug 15, 2024
f317dcc
fix double entry bug
Velua Aug 15, 2024
bb17a34
adopt DevDefault in boot
Velua Aug 19, 2024
14d5a7b
Merge remote-tracking branch 'origin/main' into x-admin-wizard
Velua Aug 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -747,15 +747,26 @@ psibase_package(
)

psibase_package(
OUTPUT ${SERVICE_DIR}/Default.psi
NAME Default
OUTPUT ${SERVICE_DIR}/DevDefault.psi
NAME DevDefault
Comment on lines -750 to +751
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

psibase boot needs to be updated

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tester as well, yeah?

let default_services = vec!["Default".to_string()];

and
let default_services: Vec<String> = vec!["Default".to_string()];

VERSION ${PSIBASE_VERSION}
DESCRIPTION "All default services"
PACKAGE_DEPENDS Accounts AuthAny AuthSig AuthDelegate AuthK1 ClientData CommonApi CpuLimit Docs
DESCRIPTION "All development services"
PACKAGE_DEPENDS Accounts AuthAny AuthSig AuthDelegate AuthK1 CommonApi CpuLimit Docs
Webmail Events Explorer Fractal Invite Nft Packages Producers HttpServer
Sites SetCode Supervisor Symbol TokenUsers Tokens Transact
)

psibase_package(
OUTPUT ${SERVICE_DIR}/ProdDefault.psi
NAME ProdDefault
VERSION ${PSIBASE_VERSION}
DESCRIPTION "All production services"
PACKAGE_DEPENDS Accounts AuthAny AuthSig AuthDelegate AuthK1 CommonApi CpuLimit Docs
Events Explorer Fractal Invite Nft Packages Producers HttpServer
Sites SetCode Supervisor Symbol Tokens Transact
)


psibase_package(
OUTPUT ${SERVICE_DIR}/Minimal.psi
NAME Minimal
Expand All @@ -779,7 +790,7 @@ function(write_package_index target dir)
endfunction()

write_package_index(package-index ${SERVICE_DIR}
Accounts AuthAny AuthSig AuthK1 ClientData CommonApi CpuLimit Default
Accounts AuthAny AuthSig AuthK1 ClientData CommonApi CpuLimit DevDefault ProdDefault
Docs Events Explorer Fractal Invite Nft Nop Minimal Packages Producers HttpServer
Sites SetCode Supervisor Symbol TokenUsers Tokens Transact)

Expand All @@ -792,7 +803,8 @@ install(
${SERVICE_DIR}/AuthK1.psi
${SERVICE_DIR}/ClientData.psi
${SERVICE_DIR}/CommonApi.psi
${SERVICE_DIR}/Default.psi
${SERVICE_DIR}/DevDefault.psi
${SERVICE_DIR}/ProdDefault.psi
${SERVICE_DIR}/CpuLimit.psi
${SERVICE_DIR}/Docs.psi
${SERVICE_DIR}/Events.psi
Expand Down
2 changes: 1 addition & 1 deletion rust/psibase/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ async fn boot(
let expiration = TimePointSec {
seconds: now_plus_120secs.timestamp() as u32,
};
let default_services = vec!["Default".to_string()];
let default_services = vec!["DevDefault".to_string()];
let package_registry = get_package_registry(package_source, client.clone()).await?;
let mut packages = package_registry
.resolve(if services.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion rust/psibase/src/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Chain {

/// Boot the tester chain with default services being deployed
pub fn boot(&self) -> Result<(), Error> {
let default_services: Vec<String> = vec!["Default".to_string()];
let default_services: Vec<String> = vec!["DevDefault".to_string()];

let psibase_data_dir = std::env::var("PSIBASE_DATADIR")
.expect("Cannot find package directory: PSIBASE_DATADIR not defined");
Expand Down
18 changes: 15 additions & 3 deletions services/user/XAdmin/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
"preview": "vite preview"
},
"dependencies": {
"@hookform/resolvers": "^3.5.0",
"@hookform/resolvers": "^3.6.0",
"@radix-ui/react-accordion": "^1.2.0",
"@radix-ui/react-alert-dialog": "^1.1.1",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-progress": "^1.0.3",
Expand All @@ -21,17 +24,25 @@
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-toast": "^1.2.1",
"@radix-ui/react-toggle": "^1.0.3",
"@radix-ui/react-toggle-group": "^1.0.4",
"@rollup/plugin-alias": "^5.0.0",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-table": "^8.19.2",
"@types/node": "^20.12.13",
"axios": "^1.7.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"framer-motion": "^11.2.11",
"jszip": "^3.10.1",
"lucide-react": "^0.383.0",
"lodash.partition": "^4.6.0",
"lucide-react": "^0.419.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.51.5",
"react-hook-form": "^7.52.0",
"react-router-dom": "^6.23.1",
"recharts": "^2.12.7",
"tailwind-merge": "^2.3.0",
"tailwindcss-animate": "^1.0.7",
"vite-plugin-top-level-await": "^1.3.1",
Expand All @@ -42,6 +53,7 @@
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.2",
"@types/lodash.partition": "^4.6.9",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-react": "^4.0.0",
Expand Down
76 changes: 6 additions & 70 deletions services/user/XAdmin/ui/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,81 +1,17 @@
import { useEffect, useState } from "react";

import { PsinodeConfig } from "./configuration/interfaces";
import { NavHeader } from "./components/nav-header";
import { StatusBanner } from "./components/status-banner";
import { BootPage } from "./boot-wizard/boot-page";
import { ConfigurationPage } from "./configuration/configuration-page";
import { usePollJson } from "./hooks";
import { LogsPage } from "./log/logs-page";
import { DashboardPage } from "./dashboard/dashboard-page";
import { PeersPage } from "./peers/peers-page";
import { Peer } from "./peers/interfaces";

const MENU_ITEMS = ["Dashboard", "Peers", "Logs", "Configuration", "Boot"];
import { Outlet } from "react-router-dom";

function App() {
const [activeItem, setActiveItem] = useState("");

useEffect(() => {
if (!activeItem) {
setActiveItem(getPageTab());
}
window.addEventListener("hashchange", () => {
setActiveItem(getPageTab());
});
return () => window.removeEventListener("hashchange", () => {});
}, []);

const [peers, peersError, refetchPeers] = usePollJson<Peer[]>(
"/native/admin/peers"
);

const [config, configError, refetchConfig] = usePollJson<PsinodeConfig>(
"/native/admin/config"
);
const [status, statusError] = usePollJson<string[]>("/native/admin/status");

let activeMenuItems = ["Dashboard", "Peers", "Logs", "Configuration"];
if (status && status.includes("needgenesis")) {
activeMenuItems.push("Boot");
}

return (
<div className="mx-auto max-w-screen-xl">
<NavHeader menuItems={activeMenuItems} activeItem={activeItem} />

<StatusBanner
status={status}
statusError={statusError}
peersError={peersError}
configError={configError}
/>
{activeItem === "Dashboard" ? (
<DashboardPage />
) : activeItem === "Logs" ? (
<LogsPage />
) : activeItem === "Peers" ? (
<PeersPage
config={config}
peers={peers || []}
refetchConfig={refetchConfig}
refetchPeers={refetchPeers}
/>
) : activeItem === "Configuration" ? (
<ConfigurationPage
config={config}
refetchConfig={refetchConfig}
/>
) : activeItem === "Boot" ? (
<BootPage config={config} refetchConfig={refetchConfig} />
) : null}
<NavHeader />
<div className="py-2">
<StatusBanner />
</div>
<Outlet />
</div>
);
}

export default App;

const getPageTab = () => {
const tab = window.location.hash.substring(1) || "Unknown";
return MENU_ITEMS.includes(tab) ? tab : "Dashboard";
};
Loading
Loading