2021-10-08 12:11:10 +00:00
|
|
|
import fixture from 'test_fixtures/metrics_dashboard/environment_metrics_dashboard.json';
|
2020-08-21 12:10:22 +00:00
|
|
|
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
|
2021-02-14 18:09:20 +00:00
|
|
|
import { metricStates } from '~/monitoring/constants';
|
|
|
|
import { mapToDashboardViewModel } from '~/monitoring/stores/utils';
|
|
|
|
import { stateAndPropsFromDataset } from '~/monitoring/utils';
|
2020-04-21 15:21:10 +00:00
|
|
|
|
2020-04-16 06:09:39 +00:00
|
|
|
import { metricsResult } from './mock_data';
|
|
|
|
|
2021-10-08 12:11:10 +00:00
|
|
|
export const metricsDashboardResponse = fixture;
|
2020-07-15 21:09:26 +00:00
|
|
|
|
2020-04-16 06:09:39 +00:00
|
|
|
export const metricsDashboardPayload = metricsDashboardResponse.dashboard;
|
2020-06-30 12:08:57 +00:00
|
|
|
|
2020-07-01 21:08:51 +00:00
|
|
|
const datasetState = stateAndPropsFromDataset(
|
2020-08-21 12:10:22 +00:00
|
|
|
convertObjectPropsToCamelCase(metricsDashboardResponse.metrics_data),
|
2020-06-30 12:08:57 +00:00
|
|
|
);
|
|
|
|
|
2022-05-31 00:09:17 +00:00
|
|
|
// new properties like addDashboardDocumentationPath prop
|
2020-07-15 21:09:26 +00:00
|
|
|
// was recently added to dashboard.vue component this needs to be
|
|
|
|
// added to fixtures data
|
|
|
|
// https://gitlab.com/gitlab-org/gitlab/-/issues/229256
|
|
|
|
export const dashboardProps = {
|
|
|
|
...datasetState.dataProps,
|
|
|
|
};
|
2020-06-30 12:08:57 +00:00
|
|
|
|
2020-04-16 06:09:39 +00:00
|
|
|
export const metricsDashboardViewModel = mapToDashboardViewModel(metricsDashboardPayload);
|
|
|
|
|
|
|
|
export const metricsDashboardPanelCount = 22;
|
2020-04-21 15:21:10 +00:00
|
|
|
|
|
|
|
// Graph data
|
|
|
|
|
|
|
|
const firstPanel = metricsDashboardViewModel.panelGroups[0].panels[0];
|
|
|
|
|
|
|
|
export const graphData = {
|
|
|
|
...firstPanel,
|
2020-12-24 00:10:25 +00:00
|
|
|
metrics: firstPanel.metrics.map((metric) => ({
|
2020-04-21 15:21:10 +00:00
|
|
|
...metric,
|
|
|
|
result: metricsResult,
|
|
|
|
state: metricStates.OK,
|
|
|
|
})),
|
|
|
|
};
|
|
|
|
|
|
|
|
export const graphDataEmpty = {
|
|
|
|
...firstPanel,
|
2020-12-24 00:10:25 +00:00
|
|
|
metrics: firstPanel.metrics.map((metric) => ({
|
2020-04-21 15:21:10 +00:00
|
|
|
...metric,
|
|
|
|
result: [],
|
|
|
|
state: metricStates.NO_DATA,
|
|
|
|
})),
|
|
|
|
};
|