From c899c155259ae2e9bd81b1b75caba7100f893795 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Mon, 25 Nov 2024 09:18:29 +0300 Subject: [PATCH] fix lint --- .betterer.results | 13 ++++++ .../saving/SaveDashboardDrawer.tsx | 44 ++++++++++++------- .../dashboard/services/DashboardLoaderSrv.ts | 2 +- public/app/features/provisioning/dashboard.ts | 12 ++--- public/app/features/provisioning/types.ts | 1 - public/app/types/dashboard.ts | 2 - 6 files changed, 47 insertions(+), 27 deletions(-) diff --git a/.betterer.results b/.betterer.results index fc26907e619..7a748db1e03 100644 --- a/.betterer.results +++ b/.betterer.results @@ -2071,6 +2071,11 @@ exports[`better eslint`] = { [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], [0, 0, 0, "No untranslated strings. Wrap text with ", "2"] ], + "public/app/features/dashboard-scene/saving/SaveDashboardDrawer.tsx:5381": [ + [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], + [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], + [0, 0, 0, "No untranslated strings. Wrap text with ", "2"] + ], "public/app/features/dashboard-scene/saving/SaveDashboardForm.tsx:5381": [ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], @@ -3697,6 +3702,14 @@ exports[`better eslint`] = { "public/app/features/provisioning/api/index.ts:5381": [ [0, 0, 0, "Do not use export all (\`export * from ...\`)", "0"] ], + "public/app/features/provisioning/api/types.ts:5381": [ + [0, 0, 0, "Unexpected any. Specify a different type.", "0"], + [0, 0, 0, "Unexpected any. Specify a different type.", "1"], + [0, 0, 0, "Unexpected any. Specify a different type.", "2"] + ], + "public/app/features/provisioning/dashboard.ts:5381": [ + [0, 0, 0, "Do not use any type assertions.", "0"] + ], "public/app/features/query/components/QueryEditorRow.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"], diff --git a/public/app/features/dashboard-scene/saving/SaveDashboardDrawer.tsx b/public/app/features/dashboard-scene/saving/SaveDashboardDrawer.tsx index f8d8d80bb53..d9baec0db40 100644 --- a/public/app/features/dashboard-scene/saving/SaveDashboardDrawer.tsx +++ b/public/app/features/dashboard-scene/saving/SaveDashboardDrawer.tsx @@ -89,29 +89,39 @@ export class SaveDashboardDrawer extends SceneObjectBase -

Loaded from external repository

-

{provisioning.repo}

- {provisioning.file} + return (
- +

Loaded from external repository

+

{provisioning.repo}

+ {provisioning.file} +
+ +
- + ); } // Saved in grafana database, BUT must write to a remote repo for edit if (meta.k8s?.annotations?.[AnnoKeyRepoName]) { - return
-

Saved from external repository

-
{JSON.stringify(meta.k8s.annotations, null, '  ')}
-
+ return ( +
+

Saved from external repository

+
{JSON.stringify(meta.k8s.annotations, null, '  ')}
+
+ ); } if (saveAsCopy || changeInfo.isNew) { diff --git a/public/app/features/dashboard/services/DashboardLoaderSrv.ts b/public/app/features/dashboard/services/DashboardLoaderSrv.ts index a86e2064c53..d3e1e00110b 100644 --- a/public/app/features/dashboard/services/DashboardLoaderSrv.ts +++ b/public/app/features/dashboard/services/DashboardLoaderSrv.ts @@ -54,7 +54,7 @@ export class DashboardLoaderSrv { return this._dashboardLoadFailed('Snapshot not found', true); }); } else if (type === 'provisioning') { - promise = loadDashboardFromProvisioning(slug!, uid!) + promise = loadDashboardFromProvisioning(slug!, uid!); } else if (type === 'public' && uid) { promise = backendSrv .getPublicDashboardByUid(uid) diff --git a/public/app/features/provisioning/dashboard.ts b/public/app/features/provisioning/dashboard.ts index 0f4a824961a..5862666d05f 100644 --- a/public/app/features/provisioning/dashboard.ts +++ b/public/app/features/provisioning/dashboard.ts @@ -17,11 +17,11 @@ export async function loadDashboardFromProvisioning(repo: string, path: string): // Load the results from dryRun const dryRun = v.resource.dryRun as Resource; if (!dryRun) { - return Promise.reject("failed to read provisioned dashboard") + return Promise.reject('failed to read provisioned dashboard'); } - if (!dryRun.apiVersion.startsWith("dashboard.grafana.app")) { - return Promise.reject("unexpected resource type: "+dryRun.apiVersion) + if (!dryRun.apiVersion.startsWith('dashboard.grafana.app')) { + return Promise.reject('unexpected resource type: ' + dryRun.apiVersion); } return { @@ -43,9 +43,9 @@ export async function loadDashboardFromProvisioning(repo: string, path: string): file: url, ref: ref, repo: repo, - } + }, }, - dashboard: dryRun.spec - } + dashboard: dryRun.spec, + }; }); } diff --git a/public/app/features/provisioning/types.ts b/public/app/features/provisioning/types.ts index cadc5bcbf9a..42d7b868ae9 100644 --- a/public/app/features/provisioning/types.ts +++ b/public/app/features/provisioning/types.ts @@ -5,7 +5,6 @@ export type RepositoryFormData = GitHubRepositoryConfig & LocalRepositoryConfig & Omit; - // Added to DashboardDTO to help editor export interface ProvisioningPreview { repo: string; diff --git a/public/app/types/dashboard.ts b/public/app/types/dashboard.ts index a7e627fa179..291e8fc6983 100644 --- a/public/app/types/dashboard.ts +++ b/public/app/types/dashboard.ts @@ -83,8 +83,6 @@ export interface DashboardMeta { reloadOnParamsChange?: boolean; } - - export interface AnnotationActions { canAdd: boolean; canEdit: boolean;