Provisioning: Update API imports (#102226)

* Update API

* Format
pull/102250/head
Alex Khomenko 2 months ago committed by GitHub
parent f2ec1a2b55
commit 4236ac3423
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      pkg/tests/apis/openapi_snapshots/provisioning.grafana.app-v0alpha1.json
  2. 4
      public/app/api/clients/provisioning/endpoints.gen.ts
  3. 2
      public/app/features/provisioning/dashboardLoader.ts
  4. 2
      public/app/features/provisioning/hooks/useCreateOrUpdateRepository.ts
  5. 2
      public/app/features/provisioning/hooks/useCreateOrUpdateRepositoryFile.ts
  6. 3
      public/app/features/provisioning/hooks/useIsProvisionedInstance.ts
  7. 2
      public/app/features/provisioning/hooks/useIsProvisionedNG.ts
  8. 2
      public/app/features/provisioning/hooks/useRepositoryJobs.ts
  9. 2
      public/app/features/provisioning/hooks/useRepositoryList.ts
  10. 2
      public/app/features/provisioning/utils/checkSyncSettings.ts
  11. 3
      public/app/features/provisioning/utils/data.ts
  12. 12
      public/app/features/provisioning/utils/git.ts

@ -2644,6 +2644,10 @@
"description": "Whether we should show dashboard previews for pull requests. By default, this is false (i.e. we will not create previews).",
"type": "boolean"
},
"path": {
"description": "Path is the subdirectory for the Grafana data. If specified, Grafana will ignore anything that is outside this directory in the repository. This is usually something like `grafana/`. Trailing and leading slash are not required. They are always added when needed. The path is relative to the root of the repository, regardless of the leading slash.\n\nWhen specifying something like `grafana-`, we will not look for `grafana-*`; we will only look for files under the directory `/grafana-/`. That means `/grafana-example.json` would not be found.",
"type": "string"
},
"token": {
"description": "Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again.",
"type": "string"

@ -857,6 +857,10 @@ export type GitHubRepositoryConfig = {
encryptedToken?: string;
/** Whether we should show dashboard previews for pull requests. By default, this is false (i.e. we will not create previews). */
generateDashboardPreviews?: boolean;
/** Path is the subdirectory for the Grafana data. If specified, Grafana will ignore anything that is outside this directory in the repository. This is usually something like `grafana/`. Trailing and leading slash are not required. They are always added when needed. The path is relative to the root of the repository, regardless of the leading slash.
When specifying something like `grafana-`, we will not look for `grafana-*`; we will only look for files under the directory `/grafana-/`. That means `/grafana-example.json` would not be found. */
path?: string;
/** Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again. */
token?: string;
/** The repository URL (e.g. `https://github.com/example/test`). */

@ -1,7 +1,7 @@
import { getBackendSrv } from '@grafana/runtime';
import { BASE_URL } from 'app/api/clients/provisioning/baseAPI';
import { DashboardDTO } from 'app/types';
import { BASE_URL } from '../../api/clients/provisioning/baseAPI';
import { AnnoKeyManagerIdentity, AnnoKeyManagerKind, AnnoKeySourcePath } from '../apiserver/types';
/**

@ -4,7 +4,7 @@ import {
RepositorySpec,
useCreateRepositoryMutation,
useReplaceRepositoryMutation,
} from '../../../api/clients/provisioning';
} from 'app/api/clients/provisioning';
export function useCreateOrUpdateRepository(name?: string) {
const [create, createRequest] = useCreateRepositoryMutation();

@ -4,7 +4,7 @@ import {
ReplaceRepositoryFilesWithPathApiArg,
useCreateRepositoryFilesWithPathMutation,
useReplaceRepositoryFilesWithPathMutation,
} from '../../../api/clients/provisioning';
} from 'app/api/clients/provisioning';
export function useCreateOrUpdateRepositoryFile(name?: string) {
const [create, createRequest] = useCreateRepositoryFilesWithPathMutation();

@ -1,6 +1,7 @@
import { skipToken } from '@reduxjs/toolkit/query';
import { RepositoryViewList, useGetFrontendSettingsQuery } from '../../../api/clients/provisioning';
import { RepositoryViewList, useGetFrontendSettingsQuery } from 'app/api/clients/provisioning';
import { checkSyncSettings } from '../utils/checkSyncSettings';
export function useIsProvisionedInstance(settings?: RepositoryViewList) {

@ -1,6 +1,6 @@
import { useGetFrontendSettingsQuery } from 'app/api/clients/provisioning';
import { useUrlParams } from 'app/core/navigation/hooks';
import { useGetFrontendSettingsQuery } from '../../../api/clients/provisioning';
import { DashboardScene } from '../../dashboard-scene/scene/DashboardScene';
import { useGetResourceRepository } from './useGetResourceRepository';

@ -1,6 +1,6 @@
import { skipToken } from '@reduxjs/toolkit/query/react';
import { Job, useListJobQuery } from '../../../api/clients/provisioning';
import { Job, useListJobQuery } from 'app/api/clients/provisioning';
interface RepositoryJobsArgs {
name?: string;

@ -1,6 +1,6 @@
import { skipToken } from '@reduxjs/toolkit/query';
import { ListRepositoryApiArg, Repository, useListRepositoryQuery } from '../../../api/clients/provisioning';
import { ListRepositoryApiArg, Repository, useListRepositoryQuery } from 'app/api/clients/provisioning';
// Sort repositories alphabetically by title
export function useRepositoryList(

@ -1,4 +1,4 @@
import { RepositoryViewList } from '../../../api/clients/provisioning';
import { RepositoryViewList } from 'app/api/clients/provisioning';
export function checkSyncSettings(settings?: RepositoryViewList): [boolean, boolean] {
if (!settings?.items?.length) {

@ -1,4 +1,5 @@
import { RepositorySpec } from '../../../api/clients/provisioning';
import { RepositorySpec } from 'app/api/clients/provisioning';
import { RepositoryFormData } from '../types';
export const dataToSpec = (data: RepositoryFormData): RepositorySpec => {

@ -1,3 +1,5 @@
import { RepositorySpec } from 'app/api/clients/provisioning';
/**
* Validates a Git branch name according to the following rules:
* 1. The branch name cannot start with `/`, end with `/`, `.`, or whitespace.
@ -12,3 +14,13 @@ export function validateBranchName(branchName?: string) {
return branchName && branchNameRegex.test(branchName!);
}
export const getRepoHref = (github?: RepositorySpec['github']) => {
if (!github?.url) {
return undefined;
}
if (!github.branch) {
return github.url;
}
return `${github.url}/tree/${github.branch}`;
};

Loading…
Cancel
Save