From 967e88a1ae90d4c43c55f4556709864e1e12ac51 Mon Sep 17 00:00:00 2001 From: Leto Date: Fri, 17 Jan 2025 11:03:09 +0800 Subject: [PATCH 1/5] fix(website): misc --- .../dashboard-links/action-menu/overwrite-with-json/form.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/src/frames/app/navbar/dashboard-links/action-menu/overwrite-with-json/form.tsx b/website/src/frames/app/navbar/dashboard-links/action-menu/overwrite-with-json/form.tsx index 634c4892c..06d2f9871 100644 --- a/website/src/frames/app/navbar/dashboard-links/action-menu/overwrite-with-json/form.tsx +++ b/website/src/frames/app/navbar/dashboard-links/action-menu/overwrite-with-json/form.tsx @@ -70,6 +70,7 @@ export function OverwriteWithJSONForm({ title: 'Successful', message: 'Dashboard is updated', color: 'green', + loading: false, autoClose: true, }); postSubmit(); @@ -79,6 +80,7 @@ export function OverwriteWithJSONForm({ title: 'Failed', message: error.message, color: 'red', + loading: false, autoClose: true, }); } finally { From bf44ae7adc5e21a0b411ed0d493c86d8fedf8f26 Mon Sep 17 00:00:00 2001 From: Leto Date: Fri, 17 Jan 2025 11:43:56 +0800 Subject: [PATCH 2/5] fix: misc --- website/src/frames/app/navbar/import-dashboard/form.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/src/frames/app/navbar/import-dashboard/form.tsx b/website/src/frames/app/navbar/import-dashboard/form.tsx index b446a32b7..6c3d0122a 100644 --- a/website/src/frames/app/navbar/import-dashboard/form.tsx +++ b/website/src/frames/app/navbar/import-dashboard/form.tsx @@ -68,6 +68,7 @@ export const ImportDashboardForm = observer(({ postSubmit }: { postSubmit: () => title: 'Successful', message: 'A new dashboard is created', color: 'green', + loading: false, autoClose: true, }); postSubmit(); @@ -78,6 +79,7 @@ export const ImportDashboardForm = observer(({ postSubmit }: { postSubmit: () => title: 'Failed', message: error.message, color: 'red', + loading: false, autoClose: true, }); } From a8d8d9cecdc1e2f60e1e8d1670738b45372037ca Mon Sep 17 00:00:00 2001 From: Leto Date: Fri, 17 Jan 2025 11:52:24 +0800 Subject: [PATCH 3/5] feat(api): skip validation on dashboard_content create --- api/src/api_models/dashboard_content.ts | 6 ++++-- api/src/controller/dashboard_content.controller.ts | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/api/src/api_models/dashboard_content.ts b/api/src/api_models/dashboard_content.ts index 07c23cac6..7601cfa0d 100644 --- a/api/src/api_models/dashboard_content.ts +++ b/api/src/api_models/dashboard_content.ts @@ -287,14 +287,16 @@ export class DashboardContentCreateRequest { name: string; @IsObject() - @Type(() => Content) + // Don't validate content when creating a content, + // so legacy content could have a chance to migrate. + // @Type(() => Content) @ValidateNested({ each: true }) @ApiModelProperty({ description: 'content stored in json object format', required: true, model: 'Content', }) - content: Content; + content: Record; @IsOptional() @Type(() => Authentication) diff --git a/api/src/controller/dashboard_content.controller.ts b/api/src/controller/dashboard_content.controller.ts index 0af4348fc..1e6d2ff4f 100644 --- a/api/src/controller/dashboard_content.controller.ts +++ b/api/src/controller/dashboard_content.controller.ts @@ -9,6 +9,7 @@ import { Account } from '../api_models/account'; import { DashboardPermissionService } from '../services/dashboard_permission.service'; import { channelBuilder, SERVER_CHANNELS, socketEmit } from '../utils/websocket'; import { + Content, DashboardContentCreateRequest, DashboardContentIDRequest, DashboardContentListRequest, @@ -118,7 +119,7 @@ export class DashboardContentController implements interfaces.Controller { auth_role_id, auth_permissions, ); - const result = await this.dashboardContentService.create(dashboard_id, name, content, req.locale); + const result = await this.dashboardContentService.create(dashboard_id, name, content as Content, req.locale); res.json(result); } catch (err) { next(err); From 1b29347ef62b5f24f26fe4f13d8f713a3055ad20 Mon Sep 17 00:00:00 2001 From: Leto Date: Fri, 17 Jan 2025 11:54:08 +0800 Subject: [PATCH 4/5] feat(api): skip validation on dashboard_content update --- api/src/api_models/dashboard_content.ts | 6 ++++-- api/src/controller/dashboard_content.controller.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/src/api_models/dashboard_content.ts b/api/src/api_models/dashboard_content.ts index 7601cfa0d..45cb435d6 100644 --- a/api/src/api_models/dashboard_content.ts +++ b/api/src/api_models/dashboard_content.ts @@ -332,14 +332,16 @@ export class DashboardContentUpdateRequest { @IsOptional() @IsObject() - @Type(() => Content) + // Don't validate content when updating a content, + // so legacy content from 'Overwrite with JSON file' could have a chance to migrate. + // @Type(() => Content) @ValidateNested({ each: true }) @ApiModelProperty({ description: 'content of the dashboard stored in json object format', required: false, model: 'Content', }) - content?: Content; + content?: Record; @IsOptional() @Type(() => Authentication) diff --git a/api/src/controller/dashboard_content.controller.ts b/api/src/controller/dashboard_content.controller.ts index 1e6d2ff4f..00d3496e2 100644 --- a/api/src/controller/dashboard_content.controller.ts +++ b/api/src/controller/dashboard_content.controller.ts @@ -194,7 +194,7 @@ export class DashboardContentController implements interfaces.Controller { try { const auth: Account | ApiKey | undefined = req.body.auth; const { id, name, content } = req.body as DashboardContentUpdateRequest; - const result = await this.dashboardContentService.update(id, name, content, req.locale, auth); + const result = await this.dashboardContentService.update(id, name, content as Content, req.locale, auth); let auth_id: string | null = null; let auth_type: 'APIKEY' | 'ACCOUNT' | null = null; if (auth) { From 7447e1f73638dc339e20ee2057a497fa45f36d8d Mon Sep 17 00:00:00 2001 From: Leto Date: Fri, 17 Jan 2025 11:54:30 +0800 Subject: [PATCH 5/5] chore: publish v14.5.1 --- api/package.json | 2 +- dashboard/package.json | 2 +- package.json | 2 +- settings-form/package.json | 2 +- website/package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/package.json b/api/package.json index 9f125b199..096a73a7f 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "@devtable/api", - "version": "14.5.0", + "version": "14.5.1", "description": "", "main": "index.js", "scripts": { diff --git a/dashboard/package.json b/dashboard/package.json index 695a96b70..93a7c8fa9 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -1,6 +1,6 @@ { "name": "@devtable/dashboard", - "version": "14.5.0", + "version": "14.5.1", "license": "Apache-2.0", "publishConfig": { "access": "public", diff --git a/package.json b/package.json index 5ef4a8e19..270539f34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devtable/root", - "version": "14.5.0", + "version": "14.5.1", "private": true, "workspaces": [ "api", diff --git a/settings-form/package.json b/settings-form/package.json index 62ba231b4..8a255f9e2 100644 --- a/settings-form/package.json +++ b/settings-form/package.json @@ -1,6 +1,6 @@ { "name": "@devtable/settings-form", - "version": "14.5.0", + "version": "14.5.1", "license": "Apache-2.0", "publishConfig": { "access": "public", diff --git a/website/package.json b/website/package.json index 93d687152..f748956c1 100644 --- a/website/package.json +++ b/website/package.json @@ -2,7 +2,7 @@ "name": "@devtable/website", "private": true, "license": "Apache-2.0", - "version": "14.5.0", + "version": "14.5.1", "scripts": { "dev": "vite", "preview": "vite preview"