From edaa50778c7a3cac5d1248901497fbb31979292f Mon Sep 17 00:00:00 2001 From: Leto Date: Mon, 27 Nov 2023 13:04:27 +0800 Subject: [PATCH 1/6] fix(dashboard): outdated version of initial dashboard content --- dashboard/src/types/dashboard.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard/src/types/dashboard.ts b/dashboard/src/types/dashboard.ts index fe6fd482b..83aa2d024 100644 --- a/dashboard/src/types/dashboard.ts +++ b/dashboard/src/types/dashboard.ts @@ -113,5 +113,5 @@ export const initialDashboardContent: TDashboardContent = { ], panels: [], filters: [], - version: '9.19.0', + version: '10.41.0', }; From b0809500b07777b7c3dc5e659ff6234664946ff9 Mon Sep 17 00:00:00 2001 From: Leto Date: Mon, 27 Nov 2023 13:07:07 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix(api):=20don=E2=80=99t=20throw=20error?= =?UTF-8?q?=20in=2010.41.0=E2=80=99s=20migration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/src/dashboard_migration/handlers/10.41.0.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/src/dashboard_migration/handlers/10.41.0.ts b/api/src/dashboard_migration/handlers/10.41.0.ts index 78e7cc1c5..3a5f6fb43 100644 --- a/api/src/dashboard_migration/handlers/10.41.0.ts +++ b/api/src/dashboard_migration/handlers/10.41.0.ts @@ -2,8 +2,7 @@ function upgradePanels(panels: Record[]) { return panels.map((p) => { const { title, ...rest } = p; if (typeof title !== 'string') { - console.log(p); - throw new Error(`Unexpected type of panel.title: ${typeof title}`); + return p; } const name = title ? title : p.id; return { From 670f8dbac824022fcd08e33336098e2f6346f7a6 Mon Sep 17 00:00:00 2001 From: Leto Date: Mon, 27 Nov 2023 13:48:54 +0800 Subject: [PATCH 3/6] fix(dashboard): include invalid run_by conditions in conditionOptions --- .../dashboard/content/queries/mute-query.ts | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/dashboard/src/model/render-model/dashboard/content/queries/mute-query.ts b/dashboard/src/model/render-model/dashboard/content/queries/mute-query.ts index 3efd73594..832f8ff82 100644 --- a/dashboard/src/model/render-model/dashboard/content/queries/mute-query.ts +++ b/dashboard/src/model/render-model/dashboard/content/queries/mute-query.ts @@ -17,10 +17,8 @@ export const MuteQueryModel = QueryMeta.views((self) => ({ if (!isAlive(self)) { return []; } - // @ts-expect-error untyped getRoot(self) - const contentModel = getRoot(self).content; - const { context } = contentModel.payloadForSQL; + const { context } = this.contentModel.payloadForSQL; const contextOptions: SelectItem[] = Object.keys(context).map((k) => ({ group: 'Context', label: k, @@ -28,14 +26,28 @@ export const MuteQueryModel = QueryMeta.views((self) => ({ description: undefined, })); - const filterOptions: SelectItem[] = contentModel.filters.keyLabelOptions.map((o: SelectItem) => ({ + const filterOptions: SelectItem[] = this.contentModel.filters.keyLabelOptions.map((o: SelectItem) => ({ group: 'Filters', label: o.label, value: `filters.${o.value}`, description: o.value, })); - return [...contextOptions, ...filterOptions]; + const ret = [...contextOptions, ...filterOptions]; + const validValues = new Set(ret.map((r) => r.value)); + self.run_by.forEach((c) => { + if (validValues.has(c)) { + return; + } + + ret.push({ + group: 'Invalid', + label: c, + value: c, + }); + }); + + return ret; }, get unmetRunByConditions() { // this computed has dependencies on reactive values outside the model, From c6470063c3b80df9e11bb0292869d6710b80f04d Mon Sep 17 00:00:00 2001 From: Leto Date: Mon, 27 Nov 2023 13:49:17 +0800 Subject: [PATCH 4/6] refactor(dashboard): rm some getRoot callings --- .../render-model/dashboard/content/queries/mute-query.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dashboard/src/model/render-model/dashboard/content/queries/mute-query.ts b/dashboard/src/model/render-model/dashboard/content/queries/mute-query.ts index 832f8ff82..a28c0f331 100644 --- a/dashboard/src/model/render-model/dashboard/content/queries/mute-query.ts +++ b/dashboard/src/model/render-model/dashboard/content/queries/mute-query.ts @@ -59,8 +59,7 @@ export const MuteQueryModel = QueryMeta.views((self) => ({ if (run_by.length === 0) { return []; } - // @ts-expect-error untyped getRoot(self) - const payload = getRoot(self).content.payloadForSQL; + const payload = this.contentModel.payloadForSQL; return run_by.filter((c) => { const value = _.get(payload, c); @@ -103,8 +102,7 @@ export const MuteQueryModel = QueryMeta.views((self) => ({ if (react_to.length === 0) { return ''; } - // @ts-expect-error untyped getRoot(self) - const source = getRoot(self).content.payloadForSQL; + const source = self.contentModel.payloadForSQL; const payload = [...react_to].reduce((acc, path) => { acc[path] = _.get(source, path); return acc; From fcd135c01354311ed7a4b8b88a697fa617e4eb15 Mon Sep 17 00:00:00 2001 From: Leto Date: Mon, 27 Nov 2023 13:49:53 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix(dashboard):=20don=E2=80=99t=20show=20in?= =?UTF-8?q?valid=20runByConditions=20as=20empty=20in=20queryStateMessage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../render-model/dashboard/content/queries/mute-query.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dashboard/src/model/render-model/dashboard/content/queries/mute-query.ts b/dashboard/src/model/render-model/dashboard/content/queries/mute-query.ts index a28c0f331..1d33d7765 100644 --- a/dashboard/src/model/render-model/dashboard/content/queries/mute-query.ts +++ b/dashboard/src/model/render-model/dashboard/content/queries/mute-query.ts @@ -117,14 +117,13 @@ export const MuteQueryModel = QueryMeta.views((self) => ({ if (self.unmetRunByConditions.length === 0) { return { context: [], filters: [] }; } - // @ts-expect-error untyped getRoot(self) - const { keyLabelMap } = getRoot(self).content.filters; + const { keyLabelMap } = self.contentModel.filters; const contextNames = self.unmetRunByConditions .filter((k) => k.startsWith('context.')) - .map((k) => k.split('context.')[0]); + .map((k) => k.replace('context.', '')); const filterNames = self.unmetRunByConditions .filter((k) => k.startsWith('filters.')) - .map((k) => _.get({ filters: keyLabelMap }, k)) + .map((k) => _.get({ filters: keyLabelMap }, k, k.replace('filters.', ''))) .filter((v) => !!v); return { context: contextNames, From aca7eea5c14808c4d3ce39b6b0e783cdf69a6d59 Mon Sep 17 00:00:00 2001 From: Leto Date: Mon, 27 Nov 2023 13:56:19 +0800 Subject: [PATCH 6/6] chore: publish v10.58.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 b4a287ea3..e9a661a94 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "@devtable/api", - "version": "10.58.0", + "version": "10.58.1", "description": "", "main": "index.js", "scripts": { diff --git a/dashboard/package.json b/dashboard/package.json index b8f61708b..ebafd1a53 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -1,6 +1,6 @@ { "name": "@devtable/dashboard", - "version": "10.58.0", + "version": "10.58.1", "license": "Apache-2.0", "publishConfig": { "access": "public", diff --git a/package.json b/package.json index 61d5e4504..d661d726d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devtable/root", - "version": "10.58.0", + "version": "10.58.1", "private": true, "workspaces": [ "api", diff --git a/settings-form/package.json b/settings-form/package.json index 2d3c3f9ca..55439345a 100644 --- a/settings-form/package.json +++ b/settings-form/package.json @@ -1,6 +1,6 @@ { "name": "@devtable/settings-form", - "version": "10.58.0", + "version": "10.58.1", "license": "Apache-2.0", "publishConfig": { "access": "public", diff --git a/website/package.json b/website/package.json index 5ffee321c..6f6d02e38 100644 --- a/website/package.json +++ b/website/package.json @@ -2,7 +2,7 @@ "name": "@devtable/website", "private": true, "license": "Apache-2.0", - "version": "10.58.0", + "version": "10.58.1", "scripts": { "dev": "vite", "preview": "vite preview"