Compare commits

...

4 Commits

Author SHA1 Message Date
jkunz 59043b7281 v5.7.1
Docker (tags) / release (push) Failing after 0s
2026-05-21 22:35:19 +00:00
jkunz befd0efdc0 fix(web): clean dashboard console errors 2026-05-21 22:30:38 +00:00
jkunz b1a0ce684a v5.7.0
Docker (tags) / release (push) Failing after 0s
2026-05-21 16:17:21 +00:00
jkunz d0b15ab51b feat(web): add dashboard SPA routing 2026-05-21 16:16:00 +00:00
18 changed files with 363 additions and 44 deletions
+12 -2
View File
@@ -14,7 +14,7 @@
"outputMode": "bundle",
"bundler": "esbuild",
"production": true,
"includeFiles": ["./html/**/*.html"]
"includeFiles": ["./html/**/*"]
}
]
},
@@ -45,7 +45,7 @@
"triggerReload": true,
"bundler": "esbuild",
"production": false,
"includeFiles": ["./html/**/*.html"]
"includeFiles": ["./html/**/*"]
}
]
},
@@ -62,6 +62,7 @@
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
},
"@git.zone/cli": {
"schemaVersion": 2,
"projectType": "service",
"module": {
"githost": "code.foss.global",
@@ -98,6 +99,15 @@
"backend",
"security"
]
},
"release": {
"targets": {
"docker": {
"enabled": true,
"engine": "tsdocker",
"patterns": []
}
}
}
}
}
+18
View File
@@ -3,6 +3,24 @@
## Pending
## 2026-05-21 - 5.7.1
### Fixes
- clean up Cloudly dashboard console and asset errors
- replace invalid Lucide icon references in table actions and context menu items
- add PWA manifest and local SVG favicon assets to avoid 404s
- align local Cloudly custom element tags with canonical kebab-case names
- remove noisy frontend debug logging from login and revenue checks
## 2026-05-21 - 5.7.0
### Features
- add SPA dashboard path navigation (web)
- support direct links to dashboard views and subviews via URL paths
- sync appdash selection with browser history and enable server SPA fallback
## 2026-05-21 - 5.6.0
### Features
+5
View File
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Cloudly">
<rect width="64" height="64" rx="14" fill="#050505"/>
<path d="M19 40h27a9 9 0 0 0 1.5-17.9A14 14 0 0 0 20.2 17 11.5 11.5 0 0 0 19 40Z" fill="none" stroke="#ffffff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M23 32h18" stroke="#7dd3fc" stroke-width="4" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 416 B

+1 -2
View File
@@ -14,7 +14,7 @@
<!--Lets make sure we recognize this as an PWA-->
<link rel="manifest" href="/manifest.json" />
<link rel="icon" type="image/png" href="/assetbroker/manifest/favicon.png" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<!--Lets load standard fonts-->
<link rel="preconnect" href="https://assetbroker.lossless.one/" crossorigin>
@@ -114,7 +114,6 @@
} else {
window.revenueEnabled = false;
}
console.log(`revenue enabled: ${window.revenueEnabled}`);
};
runRevenueCheck();
+18
View File
@@ -0,0 +1,18 @@
{
"name": "Cloudly",
"short_name": "Cloudly",
"description": "Cloudly infrastructure management dashboard",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#000000",
"theme_color": "#000000",
"icons": [
{
"src": "/favicon.svg",
"sizes": "any",
"type": "image/svg+xml",
"purpose": "any maskable"
}
]
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@serve.zone/cloudly",
"version": "5.6.0",
"version": "5.7.1",
"private": true,
"description": "A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.",
"type": "module",
+1 -1
View File
@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@serve.zone/cloudly',
version: '5.6.0',
version: '5.7.1',
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
}
+1
View File
@@ -71,6 +71,7 @@ export class CloudlyServer {
: {}),
injectReload: true,
serveDir: paths.distServeDir,
spaFallback: true,
watch: true,
compression: {
enabled: true,
+1 -1
View File
@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@serve.zone/cloudly',
version: '5.6.0',
version: '5.7.1',
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
}
+27
View File
@@ -11,6 +11,33 @@ export const loginStatePart: plugins.smartstate.StatePart<unknown, ILoginState>
'persistent'
);
export interface IUiState {
activeView: string;
activeSubview: string | null;
}
const getInitialView = (): string => {
const path = typeof window !== 'undefined' ? window.location.pathname : '/';
const validViews = ['overview', 'platform', 'runtime', 'registry', 'secrets', 'domains', 'storage', 'logs'];
const segments = path.split('/').filter(Boolean);
const view = segments[0];
return validViews.includes(view) ? view : 'overview';
};
const getInitialSubview = (): string | null => {
const path = typeof window !== 'undefined' ? window.location.pathname : '/';
const segments = path.split('/').filter(Boolean);
return segments[1] ?? null;
};
export const uiStatePart = await appstate.getStatePart<IUiState>(
'ui',
{
activeView: getInitialView(),
activeSubview: getInitialSubview(),
},
);
export const loginAction = loginStatePart.createAction<{ username: string; password: string }>(
async (statePartArg, payloadArg) => {
const currentState = statePartArg.getState() || { identity: null };
+102 -24
View File
@@ -2,6 +2,7 @@ import { commitinfo } from '../00_commitinfo_data.js';
import * as plugins from '../plugins.js';
import * as appstate from '../appstate.js';
import { appRouter } from '../router.js';
import {
DeesElement,
@@ -36,6 +37,11 @@ declare global {
}
}
interface ICloudlyView extends plugins.deesCatalog.IView {
slug?: string;
subViews?: ICloudlyView[];
}
@customElement('cloudly-dashboard')
export class CloudlyDashboard extends DeesElement {
@state() private accessor identity: plugins.interfaces.data.IIdentity | null = null;
@@ -44,75 +50,108 @@ export class CloudlyDashboard extends DeesElement {
secretBundles: [],
clusters: [],
};
@state() private accessor uiState: appstate.IUiState = {
activeView: 'overview',
activeSubview: null,
};
// Keep view tabs stable across renders to preserve active selection
private readonly viewTabs: plugins.deesCatalog.IView[] = [
private readonly viewTabs: ICloudlyView[] = [
{
slug: 'overview',
name: 'Overview',
iconName: 'lucide:LayoutDashboard',
element: CloudlyViewOverview,
},
{
slug: 'platform',
name: 'Platform',
iconName: 'lucide:Settings',
subViews: [
{ name: 'Settings', iconName: 'lucide:Settings', element: CloudlyViewSettings },
{ name: 'BaseOS', iconName: 'lucide:HardDriveDownload', element: CloudlyViewBaseOs },
{ name: 'Fleet', iconName: 'lucide:Truck', element: CloudlyViewBackups },
{ slug: 'settings', name: 'Settings', iconName: 'lucide:Settings', element: CloudlyViewSettings },
{ slug: 'baseos', name: 'BaseOS', iconName: 'lucide:HardDriveDownload', element: CloudlyViewBaseOs },
{ slug: 'fleet', name: 'Fleet', iconName: 'lucide:Truck', element: CloudlyViewBackups },
],
},
{
slug: 'runtime',
name: 'Runtime',
iconName: 'lucide:Network',
subViews: [
{ name: 'Clusters', iconName: 'lucide:Network', element: CloudlyViewClusters },
{ name: 'Services', iconName: 'lucide:Layers', element: CloudlyViewServices },
{ name: 'Images', iconName: 'lucide:Image', element: CloudlyViewImages },
{ name: 'Deployments', iconName: 'lucide:Rocket', element: CloudlyViewDeployments },
{ name: 'Tasks', iconName: 'lucide:ListChecks', element: CloudlyViewTasks },
{ slug: 'clusters', name: 'Clusters', iconName: 'lucide:Network', element: CloudlyViewClusters },
{ slug: 'services', name: 'Services', iconName: 'lucide:Layers', element: CloudlyViewServices },
{ slug: 'images', name: 'Images', iconName: 'lucide:Image', element: CloudlyViewImages },
{ slug: 'deployments', name: 'Deployments', iconName: 'lucide:Rocket', element: CloudlyViewDeployments },
{ slug: 'tasks', name: 'Tasks', iconName: 'lucide:ListChecks', element: CloudlyViewTasks },
],
},
{
slug: 'registry',
name: 'Registry & Build',
iconName: 'lucide:Package',
subViews: [
{ name: 'ExternalRegistries', iconName: 'lucide:Package', element: CloudlyViewExternalRegistries },
{ name: 'Testing & Building', iconName: 'lucide:HardHat', element: CloudlyViewServices },
{ slug: 'externalregistries', name: 'ExternalRegistries', iconName: 'lucide:Package', element: CloudlyViewExternalRegistries },
{ slug: 'testing', name: 'Testing & Building', iconName: 'lucide:HardHat', element: CloudlyViewServices },
],
},
{
slug: 'secrets',
name: 'Secrets',
iconName: 'lucide:ShieldCheck',
subViews: [
{ name: 'SecretGroups', iconName: 'lucide:ShieldCheck', element: CloudlyViewSecretGroups },
{ name: 'SecretBundles', iconName: 'lucide:LockKeyhole', element: CloudlyViewSecretBundles },
{ slug: 'secretgroups', name: 'SecretGroups', iconName: 'lucide:ShieldCheck', element: CloudlyViewSecretGroups },
{ slug: 'secretbundles', name: 'SecretBundles', iconName: 'lucide:LockKeyhole', element: CloudlyViewSecretBundles },
],
},
{
slug: 'domains',
name: 'Domains & Messaging',
iconName: 'lucide:Globe2',
subViews: [
{ name: 'Domains', iconName: 'lucide:Globe2', element: CloudlyViewDomains },
{ name: 'DNS', iconName: 'lucide:Globe', element: CloudlyViewDns },
{ name: 'Mails', iconName: 'lucide:Mail', element: CloudlyViewMails },
{ slug: 'domains', name: 'Domains', iconName: 'lucide:Globe2', element: CloudlyViewDomains },
{ slug: 'dns', name: 'DNS', iconName: 'lucide:Globe', element: CloudlyViewDns },
{ slug: 'mails', name: 'Mails', iconName: 'lucide:Mail', element: CloudlyViewMails },
],
},
{
slug: 'storage',
name: 'Storage',
iconName: 'lucide:Database',
subViews: [
{ name: 's3', iconName: 'lucide:Cloud', element: CloudlyViewS3 },
{ name: 'DBs', iconName: 'lucide:Database', element: CloudlyViewDbs },
{ name: 'Backups', iconName: 'lucide:Save', element: CloudlyViewBackups },
{ slug: 's3', name: 's3', iconName: 'lucide:Cloud', element: CloudlyViewS3 },
{ slug: 'dbs', name: 'DBs', iconName: 'lucide:Database', element: CloudlyViewDbs },
{ slug: 'backups', name: 'Backups', iconName: 'lucide:Save', element: CloudlyViewBackups },
],
},
{
slug: 'logs',
name: 'Logs',
iconName: 'lucide:FileText',
element: CloudlyViewLogs,
},
];
private slugFor(view: ICloudlyView): string {
return view.slug ?? view.name.toLowerCase().replace(/\s+/g, '');
}
private findParent(view: ICloudlyView): ICloudlyView | undefined {
return this.viewTabs.find((viewTab) => viewTab.subViews?.includes(view));
}
private findViewBySlug(viewSlug: string, subviewSlug: string | null): ICloudlyView | undefined {
const topLevelView = this.viewTabs.find((view) => this.slugFor(view) === viewSlug);
if (!topLevelView) return undefined;
if (subviewSlug && topLevelView.subViews) {
return topLevelView.subViews.find((subview) => this.slugFor(subview) === subviewSlug) ?? topLevelView;
}
return topLevelView;
}
private get currentViewTab(): ICloudlyView {
return this.findViewBySlug(this.uiState.activeView, this.uiState.activeSubview) ?? this.viewTabs[0];
}
constructor() {
super();
document.title = `cloudly v${commitinfo.version}`;
@@ -122,6 +161,24 @@ export class CloudlyDashboard extends DeesElement {
this.data = dataArg;
});
this.rxSubscriptions.push(subcription);
const uiSubscription = appstate.uiStatePart
.select((stateArg) => stateArg)
.subscribe((uiState) => {
this.uiState = uiState;
this.syncAppdashView(uiState.activeView, uiState.activeSubview);
});
this.rxSubscriptions.push(uiSubscription);
}
private syncAppdashView(viewSlug: string, subviewSlug: string | null): void {
const appDash = this.shadowRoot?.querySelector('dees-simple-appdash') as any;
if (!appDash) return;
const targetView = this.findViewBySlug(viewSlug, subviewSlug);
if (!targetView || appDash.selectedView === targetView) return;
appDash.loadView(targetView);
}
public static styles = [
@@ -146,6 +203,7 @@ export class CloudlyDashboard extends DeesElement {
<dees-simple-login name="cloudly v${commitinfo.version}">
<dees-simple-appdash name="cloudly v${commitinfo.version}"
.viewTabs=${this.viewTabs}
.selectedView=${this.currentViewTab}
></dees-simple-appdash>
</dees-simple-login>
</div>
@@ -155,14 +213,37 @@ export class CloudlyDashboard extends DeesElement {
const simpleLogin = this.shadowRoot!.querySelector('dees-simple-login') as any;
simpleLogin.addEventListener('login', (eventArg: Event) => {
const loginEvent = eventArg as CustomEvent;
console.log(loginEvent.detail);
this.login(loginEvent.detail.data.username, loginEvent.detail.data.password);
});
const appDash = this.shadowRoot!.querySelector('dees-simple-appdash');
if (appDash) {
appDash.addEventListener('view-select', (eventArg: Event) => {
const view = (eventArg as CustomEvent).detail.view as ICloudlyView;
const parent = this.findParent(view);
const currentState = appstate.uiStatePart.getState();
if (parent) {
const parentSlug = this.slugFor(parent);
const subviewSlug = this.slugFor(view);
if (currentState?.activeView === parentSlug && currentState?.activeSubview === subviewSlug) {
return;
}
appRouter.navigateToView(parentSlug, subviewSlug);
} else {
const slug = this.slugFor(view);
if (currentState?.activeView === slug && !currentState?.activeSubview) {
return;
}
appRouter.navigateToView(slug);
}
});
}
this.addEventListener('contextmenu', (eventArg) => {
plugins.deesCatalog.DeesContextmenu.openContextMenuWithOptions(eventArg, [
{
name: 'About',
iconName: 'mugHot',
iconName: 'lucide:Coffee',
action: async () => {
await plugins.deesCatalog.DeesModal.createAndShow({
heading: 'About',
@@ -185,7 +266,6 @@ export class CloudlyDashboard extends DeesElement {
// lets deal with initial state
const domtools = await this.domtoolsPromise;
const loginState = appstate.loginStatePart.getState();
console.log(loginState);
if (loginState?.identity) {
this.identity = loginState.identity;
try {
@@ -202,7 +282,6 @@ export class CloudlyDashboard extends DeesElement {
private async login(username: string, password: string) {
const domtools = await this.domtoolsPromise;
console.log(`attempting to login...`);
const simpleLogin = this.shadowRoot!.querySelector('dees-simple-login') as any;
const form = simpleLogin.shadowRoot.querySelector('dees-form') as any;
form.setStatus('pending', 'Logging in...');
@@ -211,7 +290,6 @@ export class CloudlyDashboard extends DeesElement {
password,
});
if (state?.identity) {
console.log('got jwt');
this.identity = state.identity;
form.setStatus('success', 'Logged in!');
await simpleLogin.switchToSlottedContent();
+2 -2
View File
@@ -23,7 +23,7 @@ const sourcePresetArchitectures: Record<TBaseOsImageSourcePreset, string> = {
'balena-raspberrypi4-64': 'rpi',
};
@customElement('cloudly-view-baseos')
@customElement('cloudly-view-base-os')
export class CloudlyViewBaseOs extends DeesElement {
@state() private accessor builds: TBaseOsImageBuild[] = [];
@state() private accessor isLoading = false;
@@ -300,6 +300,6 @@ export class CloudlyViewBaseOs extends DeesElement {
declare global {
interface HTMLElementTagNameMap {
'cloudly-view-baseos': CloudlyViewBaseOs;
'cloudly-view-base-os': CloudlyViewBaseOs;
}
}
@@ -12,7 +12,7 @@ import {
import * as appstate from '../../../appstate.js';
@customElement('cloudly-view-externalregistries')
@customElement('cloudly-view-external-registries')
export class CloudlyViewExternalRegistries extends DeesElement {
@state()
private accessor data: appstate.IDataState = { secretGroups: [], secretBundles: [], externalRegistries: [] } as any;
@@ -114,4 +114,4 @@ export class CloudlyViewExternalRegistries extends DeesElement {
}
}
declare global { interface HTMLElementTagNameMap { 'cloudly-view-externalregistries': CloudlyViewExternalRegistries; } }
declare global { interface HTMLElementTagNameMap { 'cloudly-view-external-registries': CloudlyViewExternalRegistries; } }
+2 -2
View File
@@ -64,7 +64,7 @@ export class CloudlyViewImages extends DeesElement {
{
name: 'edit',
type: ['contextmenu', 'inRow', 'doubleClick'],
iconName: 'penToSquare',
iconName: 'lucide:SquarePen',
actionFunc: async (dataArg: plugins.deesCatalog.ITableActionDataArg<plugins.interfaces.data.ISecretGroup>) => {
const environmentsArray: Array<plugins.interfaces.data.ISecretGroup['data']['environments'][any] & { environment: string; }> = [];
for (const environmentName of Object.keys(dataArg.item.data.environments)) {
@@ -94,7 +94,7 @@ export class CloudlyViewImages extends DeesElement {
},
{
name: 'history',
iconName: 'clockRotateLeft',
iconName: 'lucide:History',
type: ['contextmenu', 'inRow'],
actionFunc: async (dataArg: plugins.deesCatalog.ITableActionDataArg<plugins.interfaces.data.ISecretGroup>) => {
const historyArray: Array<{ environment: string; value: string; }> = [];
+3 -3
View File
@@ -12,7 +12,7 @@ import {
import * as appstate from '../../../appstate.js';
@customElement('cloudly-view-secretbundles')
@customElement('cloudly-view-secret-bundles')
export class CloudlyViewSecretBundles extends DeesElement {
@state()
private accessor data: appstate.IDataState = {} as any;
@@ -63,7 +63,7 @@ export class CloudlyViewSecretBundles extends DeesElement {
<div style="font-size: 0.8em; color: red; text-align:center; padding: 16px; margin-top: 24px; border: 1px solid #444; font-family: Intel One Mono; font-size: 16px;">${actionDataArg.item.id}</div>
`, menuOptions: [ { name: 'cancel', action: async (modalArg: any) => { await modalArg.destroy(); } }, { name: 'delete', action: async (modalArg: any) => { appstate.dataState.dispatchAction(appstate.deleteSecretBundleAction, { configBundleId: actionDataArg.item.id, }); await modalArg.destroy(); } } ] });
} },
{ name: 'edit', iconName: 'penToSquare', type: ['doubleClick', 'contextmenu', 'inRow'], actionFunc: async () => {
{ name: 'edit', iconName: 'lucide:SquarePen', type: ['doubleClick', 'contextmenu', 'inRow'], actionFunc: async () => {
await plugins.deesCatalog.DeesModal.createAndShow({ heading: 'Edit SecretBundle', content: html`<dees-form><dees-input-text .label=${'purpose'}></dees-input-text></dees-form>`, menuOptions: [ { name: 'save', action: async (modalArg: any) => {} }, { name: 'cancel', action: async (modalArg: any) => { modalArg.destroy(); } } ] });
} },
] as plugins.deesCatalog.ITableAction[]}
@@ -72,4 +72,4 @@ export class CloudlyViewSecretBundles extends DeesElement {
}
}
declare global { interface HTMLElementTagNameMap { 'cloudly-view-secretbundles': CloudlyViewSecretBundles; } }
declare global { interface HTMLElementTagNameMap { 'cloudly-view-secret-bundles': CloudlyViewSecretBundles; } }
+4 -4
View File
@@ -5,7 +5,7 @@ import { DeesElement, customElement, html, state, css, cssManager } from '@desig
import * as appstate from '../../../appstate.js';
@customElement('cloudly-view-secretsgroups')
@customElement('cloudly-view-secret-groups')
export class CloudlyViewSecretGroups extends DeesElement {
@state()
private accessor data: appstate.IDataState = {} as any;
@@ -46,7 +46,7 @@ export class CloudlyViewSecretGroups extends DeesElement {
</dees-form>
`, menuOptions: [ { name: 'cancel', action: async (modalArg: any) => { await modalArg.destroy(); } }, { name: 'save', action: async (modalArg: any) => { const deesForm = modalArg.shadowRoot.querySelector('dees-form'); const formData = await deesForm.collectFormData(); const environments: plugins.interfaces.data.ISecretGroup['data']['environments'] = {}; for (const itemArg of formData['environments'] as any[]) { environments[itemArg.environment] = { value: itemArg.value, history: [], lastUpdated: Date.now(), }; } await appstate.dataState.dispatchAction(appstate.createSecretGroupAction, { data: { name: formData['data.name'] as string, description: formData['data.description'] as string, key: formData['data.key'] as string, environments, tags: [], }, }); await modalArg.destroy(); } } ] });
} },
{ name: 'edit', type: ['contextmenu', 'inRow', 'doubleClick'], iconName: 'penToSquare', actionFunc: async (dataArg: plugins.deesCatalog.ITableActionDataArg<plugins.interfaces.data.ISecretGroup>) => {
{ name: 'edit', type: ['contextmenu', 'inRow', 'doubleClick'], iconName: 'lucide:SquarePen', actionFunc: async (dataArg: plugins.deesCatalog.ITableActionDataArg<plugins.interfaces.data.ISecretGroup>) => {
const environmentsArray: Array<plugins.interfaces.data.ISecretGroup['data']['environments'][any] & { environment: string; }> = [];
for (const environmentName of Object.keys(dataArg.item.data.environments)) { environmentsArray.push({ environment: environmentName, ...dataArg.item.data.environments[environmentName], }); }
await plugins.deesCatalog.DeesModal.createAndShow({ heading: 'Edit Secret', content: html`
@@ -60,7 +60,7 @@ export class CloudlyViewSecretGroups extends DeesElement {
</dees-form>
`, menuOptions: [ { name: 'Cancel', iconName: undefined, action: async (modalArg: any) => { await modalArg.destroy(); } }, { name: 'Save', iconName: undefined, action: async (modalArg: any) => { const data = await modalArg.shadowRoot.querySelector('dees-form').collectFormData(); console.log(data); } } ] });
} },
{ name: 'history', iconName: 'clockRotateLeft', type: ['contextmenu', 'inRow'], actionFunc: async (dataArg: plugins.deesCatalog.ITableActionDataArg<plugins.interfaces.data.ISecretGroup>) => {
{ name: 'history', iconName: 'lucide:History', type: ['contextmenu', 'inRow'], actionFunc: async (dataArg: plugins.deesCatalog.ITableActionDataArg<plugins.interfaces.data.ISecretGroup>) => {
const historyArray: Array<{ environment: string; value: string; }> = []; for (const environment of Object.keys(dataArg.item.data.environments)) { for (const historyItem of dataArg.item.data.environments[environment].history) { historyArray.push({ environment, value: historyItem.value, }); } }
await plugins.deesCatalog.DeesModal.createAndShow({ heading: `history for ${dataArg.item.data.key}`, content: html`<dees-table .data=${historyArray} .dataActions=${[{ name: 'delete', iconName: 'trash', type: ['contextmenu', 'inRow'], actionFunc: async (itemArg: plugins.deesCatalog.ITableActionDataArg<(typeof historyArray)[0]>) => { console.log('delete', itemArg); }, }] as plugins.deesCatalog.ITableAction[]}></dees-table>`, menuOptions: [ { name: 'close', action: async (modalArg: any) => { await modalArg.destroy(); } } ] });
} },
@@ -73,4 +73,4 @@ export class CloudlyViewSecretGroups extends DeesElement {
}
}
declare global { interface HTMLElementTagNameMap { 'cloudly-view-secretsgroups': CloudlyViewSecretGroups; } }
declare global { interface HTMLElementTagNameMap { 'cloudly-view-secret-groups': CloudlyViewSecretGroups; } }
+3
View File
@@ -3,6 +3,9 @@ import * as plugins from './plugins.js';
import { html } from '@design.estate/dees-element';
import './elements/index.js';
import { appRouter } from './router.js';
appRouter.init();
plugins.deesElement.render(html`
<cloudly-dashboard></cloudly-dashboard>
+160
View File
@@ -0,0 +1,160 @@
import * as plugins from './plugins.js';
import * as appstate from './appstate.js';
const SmartRouter = plugins.deesDomtools.plugins.smartrouter.SmartRouter;
const flatViews = ['overview', 'logs'] as const;
const subviewMap: Record<string, readonly string[]> = {
platform: ['settings', 'baseos', 'fleet'] as const,
runtime: ['clusters', 'services', 'images', 'deployments', 'tasks'] as const,
registry: ['externalregistries', 'testing'] as const,
secrets: ['secretgroups', 'secretbundles'] as const,
domains: ['domains', 'dns', 'mails'] as const,
storage: ['s3', 'dbs', 'backups'] as const,
};
const defaultSubview: Record<string, string> = {
platform: 'settings',
runtime: 'clusters',
registry: 'externalregistries',
secrets: 'secretgroups',
domains: 'domains',
storage: 's3',
};
export const validTopLevelViews = [...flatViews, ...Object.keys(subviewMap)] as const;
export function isValidView(view: string): boolean {
return (validTopLevelViews as readonly string[]).includes(view);
}
export function isValidSubview(view: string, subview: string): boolean {
return subviewMap[view]?.includes(subview) ?? false;
}
class AppRouter {
private router: InstanceType<typeof SmartRouter>;
private initialized = false;
private suppressStateUpdate = false;
constructor() {
this.router = new SmartRouter({ debug: false });
}
public init(): void {
if (this.initialized) return;
this.setupRoutes();
this.setupStateSync();
this.handleInitialRoute();
this.initialized = true;
}
private setupRoutes(): void {
for (const view of flatViews) {
this.router.on(`/${view}`, async () => {
this.updateViewState(view, null);
});
}
for (const view of Object.keys(subviewMap)) {
this.router.on(`/${view}`, async () => {
this.navigateTo(`/${view}/${defaultSubview[view]}`);
});
for (const subview of subviewMap[view]) {
this.router.on(`/${view}/${subview}`, async () => {
this.updateViewState(view, subview);
});
}
}
this.router.on('/', async () => {
this.navigateTo('/overview');
});
}
private setupStateSync(): void {
appstate.uiStatePart.select().subscribe((uiState) => {
if (this.suppressStateUpdate) return;
const currentPath = window.location.pathname;
const expectedPath = uiState.activeSubview
? `/${uiState.activeView}/${uiState.activeSubview}`
: `/${uiState.activeView}`;
if (currentPath !== expectedPath) {
this.suppressStateUpdate = true;
this.router.pushUrl(expectedPath);
this.suppressStateUpdate = false;
}
});
}
private handleInitialRoute(): void {
const path = window.location.pathname;
if (!path || path === '/') {
this.router.pushUrl('/overview');
return;
}
const segments = path.split('/').filter(Boolean);
const view = segments[0];
const subview = segments[1];
if (!isValidView(view)) {
this.router.pushUrl('/overview');
return;
}
if (subviewMap[view]) {
if (subview && isValidSubview(view, subview)) {
this.updateViewState(view, subview);
} else {
this.router.pushUrl(`/${view}/${defaultSubview[view]}`);
}
} else {
this.updateViewState(view, null);
}
}
private updateViewState(view: string, subview: string | null): void {
this.suppressStateUpdate = true;
const currentState = appstate.uiStatePart.getState()!;
if (currentState.activeView !== view || currentState.activeSubview !== subview) {
appstate.uiStatePart.setState({
...currentState,
activeView: view,
activeSubview: subview,
});
}
this.suppressStateUpdate = false;
}
public navigateTo(path: string): void {
this.router.pushUrl(path);
}
public navigateToView(view: string, subview?: string): void {
if (!isValidView(view)) {
this.navigateTo('/overview');
return;
}
if (subview && isValidSubview(view, subview)) {
this.navigateTo(`/${view}/${subview}`);
} else if (subviewMap[view]) {
this.navigateTo(`/${view}/${defaultSubview[view]}`);
} else {
this.navigateTo(`/${view}`);
}
}
public destroy(): void {
this.router.destroy();
this.initialized = false;
}
}
export const appRouter = new AppRouter();