mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 02:15:54 +08:00

* CloudMigrations: create snapshots of Library Elements * CloudMigrations: render library element resource in resources table * CloudMigrations: create newtype with necessary fields for library element creation
46 lines
1021 B
TypeScript
46 lines
1021 B
TypeScript
import { Chance } from 'chance';
|
|
|
|
import { MigrateDataResponseItemDto } from '../api';
|
|
|
|
export function wellFormedDatasourceMigrationItem(
|
|
seed = 1,
|
|
partial: Partial<MigrateDataResponseItemDto> = {}
|
|
): MigrateDataResponseItemDto {
|
|
const random = Chance(seed);
|
|
|
|
return {
|
|
type: 'DATASOURCE',
|
|
refId: random.guid(),
|
|
status: random.pickone(['OK', 'ERROR']),
|
|
...partial,
|
|
};
|
|
}
|
|
|
|
export function wellFormedDashboardMigrationItem(
|
|
seed = 1,
|
|
partial: Partial<MigrateDataResponseItemDto> = {}
|
|
): MigrateDataResponseItemDto {
|
|
const random = Chance(seed);
|
|
|
|
return {
|
|
type: 'DASHBOARD',
|
|
refId: random.guid(),
|
|
status: random.pickone(['OK', 'ERROR']),
|
|
...partial,
|
|
};
|
|
}
|
|
|
|
export function wellFormedLibraryElementMigrationItem(
|
|
seed = 1,
|
|
partial: Partial<MigrateDataResponseItemDto> = {}
|
|
): MigrateDataResponseItemDto {
|
|
const random = Chance(seed);
|
|
|
|
return {
|
|
type: 'LIBRARY_ELEMENT',
|
|
refId: random.guid(),
|
|
status: random.pickone(['OK', 'ERROR']),
|
|
...partial,
|
|
};
|
|
}
|