debian-mirror-gitlab/spec/frontend/monitoring/fixture_data.js

51 lines
1.5 KiB
JavaScript
Raw Normal View History

2021-11-18 22:05:49 +05:30
import fixture from 'test_fixtures/metrics_dashboard/environment_metrics_dashboard.json';
2020-11-24 15:15:51 +05:30
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
2021-03-11 19:13:27 +05:30
import { metricStates } from '~/monitoring/constants';
import { mapToDashboardViewModel } from '~/monitoring/stores/utils';
import { stateAndPropsFromDataset } from '~/monitoring/utils';
2020-04-22 19:07:51 +05:30
import { metricsResult } from './mock_data';
2021-11-18 22:05:49 +05:30
export const metricsDashboardResponse = fixture;
2020-07-28 23:09:34 +05:30
2020-04-22 19:07:51 +05:30
export const metricsDashboardPayload = metricsDashboardResponse.dashboard;
2020-07-28 23:09:34 +05:30
const datasetState = stateAndPropsFromDataset(
2020-11-24 15:15:51 +05:30
convertObjectPropsToCamelCase(metricsDashboardResponse.metrics_data),
2020-07-28 23:09:34 +05:30
);
// new properties like addDashboardDocumentationPath prop and alertsEndpoint
// 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,
alertsEndpoint: null,
};
2020-04-22 19:07:51 +05:30
export const metricsDashboardViewModel = mapToDashboardViewModel(metricsDashboardPayload);
export const metricsDashboardPanelCount = 22;
// Graph data
const firstPanel = metricsDashboardViewModel.panelGroups[0].panels[0];
export const graphData = {
...firstPanel,
2021-03-08 18:12:59 +05:30
metrics: firstPanel.metrics.map((metric) => ({
2020-04-22 19:07:51 +05:30
...metric,
result: metricsResult,
state: metricStates.OK,
})),
};
export const graphDataEmpty = {
...firstPanel,
2021-03-08 18:12:59 +05:30
metrics: firstPanel.metrics.map((metric) => ({
2020-04-22 19:07:51 +05:30
...metric,
result: [],
state: metricStates.NO_DATA,
})),
};