diff options
Diffstat (limited to 'spec/frontend/monitoring/fixture_data.js')
-rw-r--r-- | spec/frontend/monitoring/fixture_data.js | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/spec/frontend/monitoring/fixture_data.js b/spec/frontend/monitoring/fixture_data.js index b7b72a15992..97edf7bda74 100644 --- a/spec/frontend/monitoring/fixture_data.js +++ b/spec/frontend/monitoring/fixture_data.js @@ -1,5 +1,8 @@ +import { stateAndPropsFromDataset } from '~/monitoring/utils'; import { mapToDashboardViewModel } from '~/monitoring/stores/utils'; import { metricStates } from '~/monitoring/constants'; +import { convertObjectProps } from '~/lib/utils/common_utils'; +import { convertToCamelCase } from '~/lib/utils/text_utility'; import { metricsResult } from './mock_data'; @@ -7,23 +10,54 @@ import { metricsResult } from './mock_data'; export const metricsDashboardResponse = getJSONFixture( 'metrics_dashboard/environment_metrics_dashboard.json', ); + export const metricsDashboardPayload = metricsDashboardResponse.dashboard; + +const datasetState = stateAndPropsFromDataset( + // It's preferable to have props in snake_case, this will be addressed at: + // https://gitlab.com/gitlab-org/gitlab/-/merge_requests/33574 + convertObjectProps( + // Some props use kebab-case, convert to snake_case first + key => convertToCamelCase(key.replace(/-/g, '_')), + metricsDashboardResponse.metrics_data, + ), +); + +// 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, + addDashboardDocumentationPath: 'https://path/to/docs', + alertsEndpoint: null, +}; + export const metricsDashboardViewModel = mapToDashboardViewModel(metricsDashboardPayload); export const metricsDashboardPanelCount = 22; export const metricResultStatus = { // First metric in fixture `metrics_dashboard/environment_metrics_dashboard.json` metricId: 'NO_DB_response_metrics_nginx_ingress_throughput_status_code', - result: metricsResult, + data: { + resultType: 'matrix', + result: metricsResult, + }, }; export const metricResultPods = { // Second metric in fixture `metrics_dashboard/environment_metrics_dashboard.json` metricId: 'NO_DB_response_metrics_nginx_ingress_latency_pod_average', - result: metricsResult, + data: { + resultType: 'matrix', + result: metricsResult, + }, }; export const metricResultEmpty = { metricId: 'NO_DB_response_metrics_nginx_ingress_16_throughput_status_code', - result: [], + data: { + resultType: 'matrix', + result: [], + }, }; // Graph data |