fix(provisioning): fix linting errors and regenerate translations
- Fix import order and remove duplicate @grafana/data import - Wrap repositories in useMemo to fix useEffect dependency warning - Remove type assertion and use proper type guard instead - Fix missing closing brace in useEffect - Regenerate i18n translations
This commit is contained in:
+14
-13
@@ -1,12 +1,11 @@
|
||||
import { useState, useCallback, useEffect } from 'react';
|
||||
import { useState, useCallback, useEffect, useMemo } from 'react';
|
||||
import { FormProvider, useForm } from 'react-hook-form';
|
||||
|
||||
import { AppEvents } from '@grafana/data';
|
||||
import { css } from '@emotion/css';
|
||||
import { AppEvents, GrafanaTheme2 } from '@grafana/data';
|
||||
import { Trans, t } from '@grafana/i18n';
|
||||
import { getAppEvents, reportInteraction } from '@grafana/runtime';
|
||||
import { GrafanaTheme2 } from '@grafana/data';
|
||||
import { Alert, Box, Button, Field, Input, Select, Stack, Text, useStyles2 } from '@grafana/ui';
|
||||
import { css } from '@emotion/css';
|
||||
import { RepositoryView, Job, useGetFrontendSettingsQuery } from 'app/api/clients/provisioning/v0alpha1';
|
||||
import { collectSelectedItems } from 'app/features/browse-dashboards/components/utils';
|
||||
import { JobStatus } from 'app/features/provisioning/Job/JobStatus';
|
||||
@@ -51,7 +50,7 @@ function FormContent({ initialValues, selectedItems, workflowOptions, onDismiss
|
||||
|
||||
// Get repositories list from frontend settings (which returns RepositoryView[])
|
||||
const { data: settingsData, isLoading: isLoadingRepos } = useGetFrontendSettingsQuery();
|
||||
const repositories = settingsData?.items ?? [];
|
||||
const repositories = useMemo(() => settingsData?.items ?? [], [settingsData?.items]);
|
||||
|
||||
// Auto-select first repository when repositories are loaded
|
||||
useEffect(() => {
|
||||
@@ -76,15 +75,17 @@ function FormContent({ initialValues, selectedItems, workflowOptions, onDismiss
|
||||
// Update workflow, branch, and path when repository changes
|
||||
useEffect(() => {
|
||||
if (repositoryView && selectedDefaultWorkflow) {
|
||||
methods.setValue('workflow', selectedDefaultWorkflow as 'branch' | 'write');
|
||||
if (selectedDefaultWorkflow === 'branch') {
|
||||
const timestamp = generateTimestamp();
|
||||
methods.setValue('ref', `bulk-export/${timestamp}`);
|
||||
} else if (selectedDefaultWorkflow === 'write' && repositoryView.branch) {
|
||||
methods.setValue('ref', repositoryView.branch);
|
||||
if (selectedDefaultWorkflow === 'branch' || selectedDefaultWorkflow === 'write') {
|
||||
methods.setValue('workflow', selectedDefaultWorkflow);
|
||||
if (selectedDefaultWorkflow === 'branch') {
|
||||
const timestamp = generateTimestamp();
|
||||
methods.setValue('ref', `bulk-export/${timestamp}`);
|
||||
} else if (selectedDefaultWorkflow === 'write' && repositoryView.branch) {
|
||||
methods.setValue('ref', repositoryView.branch);
|
||||
}
|
||||
// Clear the path when repository changes - user will enter sub-path only
|
||||
methods.setValue('path', '');
|
||||
}
|
||||
// Clear the path when repository changes - user will enter sub-path only
|
||||
methods.setValue('path', '');
|
||||
}
|
||||
}, [repositoryView, selectedDefaultWorkflow, methods]);
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export async function collectAllDashboardsUnderFolder(folderUID: string): Promis
|
||||
|
||||
while (foldersToProcess.length > 0) {
|
||||
const currentFolderUID = foldersToProcess.shift()!;
|
||||
|
||||
|
||||
if (processedFolders.has(currentFolderUID)) {
|
||||
continue;
|
||||
}
|
||||
@@ -26,7 +26,7 @@ export async function collectAllDashboardsUnderFolder(folderUID: string): Promis
|
||||
|
||||
while (hasMore) {
|
||||
const dashboards = await listDashboards(currentFolderUID, page, pageSize);
|
||||
|
||||
|
||||
for (const dashboard of dashboards) {
|
||||
dashboardUIDs.push(dashboard.uid);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user