From ed925c81d4a437f0a38c6b81057f7c9b34e81325 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Fri, 2 Feb 2024 08:42:43 -0800 Subject: [PATCH] Chore: deprecate/remove folderId from more typescript (#81194) --- .../alerting/unified/PanelAlertTabContent.test.tsx | 2 +- .../__snapshots__/PanelAlertTabContent.test.tsx.snap | 4 ++++ .../DashboardSettings/GeneralSettings.test.tsx | 2 +- public/app/features/dashboard/services/DashboardSrv.ts | 2 -- public/app/features/search/service/sql.ts | 9 +++------ public/app/features/search/types.ts | 1 + public/app/types/dashboard.ts | 1 - 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/public/app/features/alerting/unified/PanelAlertTabContent.test.tsx b/public/app/features/alerting/unified/PanelAlertTabContent.test.tsx index add93de4b69..a1df6a1be3e 100644 --- a/public/app/features/alerting/unified/PanelAlertTabContent.test.tsx +++ b/public/app/features/alerting/unified/PanelAlertTabContent.test.tsx @@ -153,7 +153,7 @@ const dashboard = { }, meta: { canSave: true, - folderId: 1, + folderUid: 'abc', folderTitle: 'super folder', }, } as DashboardModel; diff --git a/public/app/features/alerting/unified/__snapshots__/PanelAlertTabContent.test.tsx.snap b/public/app/features/alerting/unified/__snapshots__/PanelAlertTabContent.test.tsx.snap index c6d28162c50..eecab06dfdb 100644 --- a/public/app/features/alerting/unified/__snapshots__/PanelAlertTabContent.test.tsx.snap +++ b/public/app/features/alerting/unified/__snapshots__/PanelAlertTabContent.test.tsx.snap @@ -13,6 +13,10 @@ exports[`PanelAlertTabContent Will render alerts belonging to panel and a button }, ], "condition": "C", + "folder": { + "title": "super folder", + "uid": "abc", + }, "name": "mypanel", "queries": [ { diff --git a/public/app/features/dashboard/components/DashboardSettings/GeneralSettings.test.tsx b/public/app/features/dashboard/components/DashboardSettings/GeneralSettings.test.tsx index 331d65c5dfe..89c168ed6f0 100644 --- a/public/app/features/dashboard/components/DashboardSettings/GeneralSettings.test.tsx +++ b/public/app/features/dashboard/components/DashboardSettings/GeneralSettings.test.tsx @@ -35,7 +35,7 @@ const setupTestContext = (options: Partial) => { timezone: 'utc', }, { - folderId: 1, + folderUid: 'abc', folderTitle: 'test', } ), diff --git a/public/app/features/dashboard/services/DashboardSrv.ts b/public/app/features/dashboard/services/DashboardSrv.ts index c1168e31099..d79ebf2253c 100644 --- a/public/app/features/dashboard/services/DashboardSrv.ts +++ b/public/app/features/dashboard/services/DashboardSrv.ts @@ -18,8 +18,6 @@ export interface SaveDashboardOptions { dashboard: DashboardModel; /** Set a commit message for the version history. */ message?: string; - /** The id of the folder to save the dashboard in. */ - folderId?: number; /** The UID of the folder to save the dashboard in. Overrides `folderId`. */ folderUid?: string; /** Set to `true` if you want to overwrite existing dashboard with newer version, diff --git a/public/app/features/search/service/sql.ts b/public/app/features/search/service/sql.ts index 372883537cc..af240ca2c10 100644 --- a/public/app/features/search/service/sql.ts +++ b/public/app/features/search/service/sql.ts @@ -17,9 +17,7 @@ interface APIQuery { limit?: number; page?: number; type?: DashboardSearchItemType; - // DashboardIds []int64 dashboardUID?: string[]; - folderIds?: number[]; folderUIDs?: string[]; sort?: string; starred?: boolean; @@ -27,7 +25,7 @@ interface APIQuery { // Internal object to hold folderId interface LocationInfoEXT extends LocationInfo { - folderId?: number; + folderUid?: string; } export class SQLSearcher implements GrafanaSearcher { @@ -36,7 +34,6 @@ export class SQLSearcher implements GrafanaSearcher { kind: 'folder', name: 'General', url: '/dashboards', - folderId: 0, }, }; // share location info with everyone @@ -182,14 +179,14 @@ export class SQLSearcher implements GrafanaSearcher { kind: 'folder', name: hit.folderTitle, url: hit.folderUrl!, - folderId: hit.folderId, + folderUid: hit.folderUid, }; } else if (k === 'folder') { this.locationInfo[hit.uid] = { kind: k, name: hit.title!, url: hit.url, - folderId: hit.id, + folderUid: hit.folderUid, }; } } diff --git a/public/app/features/search/types.ts b/public/app/features/search/types.ts index 21cf30fd456..46cd8734b4d 100644 --- a/public/app/features/search/types.ts +++ b/public/app/features/search/types.ts @@ -17,6 +17,7 @@ export enum DashboardSearchItemType { * extraneous properties */ export interface DashboardSearchHit extends WithAccessControlMetadata { + /** @deprecated use folderUid */ folderId?: number; folderTitle?: string; folderUid?: string; diff --git a/public/app/types/dashboard.ts b/public/app/types/dashboard.ts index 0cfac312315..6f896de205e 100644 --- a/public/app/types/dashboard.ts +++ b/public/app/types/dashboard.ts @@ -27,7 +27,6 @@ export interface DashboardMeta { canStar?: boolean; canAdmin?: boolean; url?: string; - folderId?: number; folderUid?: string; canMakeEditable?: boolean; provisioned?: boolean;