Commit 35fa1eb3 authored by Sarah GP's avatar Sarah GP

Make validator utility

Remove from two, add to one
parent 466d3efd
...@@ -4,7 +4,7 @@ import LinksLayer from '../graph_shared/links_layer.vue'; ...@@ -4,7 +4,7 @@ import LinksLayer from '../graph_shared/links_layer.vue';
import { DOWNSTREAM, MAIN, UPSTREAM, ONE_COL_WIDTH } from './constants'; import { DOWNSTREAM, MAIN, UPSTREAM, ONE_COL_WIDTH } from './constants';
import LinkedPipelinesColumn from './linked_pipelines_column.vue'; import LinkedPipelinesColumn from './linked_pipelines_column.vue';
import StageColumnComponent from './stage_column_component.vue'; import StageColumnComponent from './stage_column_component.vue';
import { reportToSentry } from './utils'; import { reportToSentry, validateConfigPaths } from './utils';
export default { export default {
name: 'PipelineGraph', name: 'PipelineGraph',
...@@ -18,11 +18,7 @@ export default { ...@@ -18,11 +18,7 @@ export default {
configPaths: { configPaths: {
type: Object, type: Object,
required: true, required: true,
validator(value) { validator: validateConfigPaths,
return (
Object.keys(value).includes('graphqlResourceEtag') && value.graphqlResourceEtag.length > 0
);
},
}, },
pipeline: { pipeline: {
type: Object, type: Object,
......
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
reportToSentry, reportToSentry,
toggleQueryPollingByVisibility, toggleQueryPollingByVisibility,
unwrapPipelineData, unwrapPipelineData,
validateConfigPaths,
} from './utils'; } from './utils';
export default { export default {
...@@ -23,9 +24,7 @@ export default { ...@@ -23,9 +24,7 @@ export default {
configPaths: { configPaths: {
type: Object, type: Object,
required: true, required: true,
validator(value) { validator: validateConfigPaths,
return Object.keys(value).includes('graphqlResourceEtag');
},
}, },
linkedPipelines: { linkedPipelines: {
type: Array, type: Array,
......
...@@ -77,4 +77,12 @@ const unwrapPipelineData = (mainPipelineProjectPath, data) => { ...@@ -77,4 +77,12 @@ const unwrapPipelineData = (mainPipelineProjectPath, data) => {
}; };
}; };
export { getQueryHeaders, reportToSentry, toggleQueryPollingByVisibility, unwrapPipelineData }; const validateConfigPaths = (value) => value.graphqlResourceEtag?.length > 0;
export {
getQueryHeaders,
reportToSentry,
toggleQueryPollingByVisibility,
unwrapPipelineData,
validateConfigPaths,
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment