2021-10-08 08:11:10 -04:00
|
|
|
import fixture from 'test_fixtures/metrics_dashboard/environment_metrics_dashboard.json';
|
2020-08-21 08:10:22 -04:00
|
|
|
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
|
2021-02-14 13:09:20 -05:00
|
|
|
import { metricStates } from '~/monitoring/constants';
|
|
|
|
import { mapToDashboardViewModel } from '~/monitoring/stores/utils';
|
|
|
|
import { stateAndPropsFromDataset } from '~/monitoring/utils';
|
2020-04-21 11:21:10 -04:00
|
|
|
|
2020-04-16 02:09:39 -04:00
|
|
|
import { metricsResult } from './mock_data';
|
|
|
|
|
2021-10-08 08:11:10 -04:00
|
|
|
export const metricsDashboardResponse = fixture;
|
2020-07-15 17:09:26 -04:00
|
|
|
|
2020-04-16 02:09:39 -04:00
|
|
|
export const metricsDashboardPayload = metricsDashboardResponse.dashboard;
|
2020-06-30 08:08:57 -04:00
|
|
|
|
2020-07-01 17:08:51 -04:00
|
|
|
const datasetState = stateAndPropsFromDataset(
|
2020-08-21 08:10:22 -04:00
|
|
|
convertObjectPropsToCamelCase(metricsDashboardResponse.metrics_data),
|
2020-06-30 08:08:57 -04:00
|
|
|
);
|
|
|
|
|
2022-05-30 20:09:17 -04:00
|
|
|
// new properties like addDashboardDocumentationPath prop
|
2020-07-15 17:09:26 -04: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 08:08:57 -04:00
|
|
|
|
2020-04-16 02:09:39 -04:00
|
|
|
export const metricsDashboardViewModel = mapToDashboardViewModel(metricsDashboardPayload);
|
|
|
|
|
|
|
|
export const metricsDashboardPanelCount = 22;
|
2020-04-21 11:21:10 -04:00
|
|
|
|
|
|
|
// Graph data
|
|
|
|
|
|
|
|
const firstPanel = metricsDashboardViewModel.panelGroups[0].panels[0];
|
|
|
|
|
|
|
|
export const graphData = {
|
|
|
|
...firstPanel,
|
2020-12-23 19:10:25 -05:00
|
|
|
metrics: firstPanel.metrics.map((metric) => ({
|
2020-04-21 11:21:10 -04:00
|
|
|
...metric,
|
|
|
|
result: metricsResult,
|
|
|
|
state: metricStates.OK,
|
|
|
|
})),
|
|
|
|
};
|
|
|
|
|
|
|
|
export const graphDataEmpty = {
|
|
|
|
...firstPanel,
|
2020-12-23 19:10:25 -05:00
|
|
|
metrics: firstPanel.metrics.map((metric) => ({
|
2020-04-21 11:21:10 -04:00
|
|
|
...metric,
|
|
|
|
result: [],
|
|
|
|
state: metricStates.NO_DATA,
|
|
|
|
})),
|
|
|
|
};
|