Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | 17x 6x 4x 2x 36x 17x 16x 16x 12x 16x 17x 14x 14x 17x 60x 17x 9x 9x 4x 5x 5x 4x 1x 17x 7x | import Api from '~/api'; import { HTTP_STATUS_OK } from '~/lib/utils/http_status'; import { isNumeric } from '~/lib/utils/number_utils'; import { parseBoolean } from '~/lib/utils/common_utils'; import { EDIT_PATH_ID_FORMAT, PIPELINE_CONFIGURATION_PATH_FORMAT } from './constants'; export const injectIdIntoEditPath = (path, id) => { if (!path || !path.match(EDIT_PATH_ID_FORMAT) || !isNumeric(id)) { return ''; } return path.replace(EDIT_PATH_ID_FORMAT, `/${id}/`); }; export const initialiseFormData = () => ({ name: null, description: null, pipelineConfigurationFullPath: null, color: null, }); export const getSubmissionParams = (formData, pipelineConfigurationFullPathEnabled) => { const params = { name: formData.name, description: formData.description, color: formData.color, default: formData.default, }; if ( pipelineConfigurationFullPathEnabled && formData.pipelineConfigurationFullPath !== undefined ) { params.pipelineConfigurationFullPath = formData.pipelineConfigurationFullPath; } return params; }; export const getPipelineConfigurationPathParts = (path) => { const [, file, group, project] = path.match(PIPELINE_CONFIGURATION_PATH_FORMAT) || []; return { file, group, project }; }; export const validatePipelineConfirmationFormat = (path) => { return PIPELINE_CONFIGURATION_PATH_FORMAT.test(path); }; export const fetchPipelineConfigurationFileExists = async (path) => { const { file, group, project } = getPipelineConfigurationPathParts(path); if (!file || !group || !project) { return false; } try { const { status } = await Api.getRawFile(`${group}/${project}`, file); return status === HTTP_STATUS_OK; } catch (e) { return false; } }; export const parseFormProps = ({ canAddEdit, emptyStateSvgPath, graphqlFieldName = null, groupPath, pipelineConfigurationFullPathEnabled, pipelineConfigurationEnabled, }) => ({ canAddEdit: parseBoolean(canAddEdit), emptyStateSvgPath, graphqlFieldName, groupPath, pipelineConfigurationFullPathEnabled: parseBoolean(pipelineConfigurationFullPathEnabled), pipelineConfigurationEnabled: parseBoolean(pipelineConfigurationEnabled), }); |