diff options
Diffstat (limited to 'app/assets/javascripts/pipeline_editor')
9 files changed, 27 insertions, 87 deletions
diff --git a/app/assets/javascripts/pipeline_editor/components/drawer/cards/first_pipeline_card.vue b/app/assets/javascripts/pipeline_editor/components/drawer/cards/first_pipeline_card.vue index 1f74e89f90c..0b57433e894 100644 --- a/app/assets/javascripts/pipeline_editor/components/drawer/cards/first_pipeline_card.vue +++ b/app/assets/javascripts/pipeline_editor/components/drawer/cards/first_pipeline_card.vue @@ -28,13 +28,13 @@ export default { GlSprintf, }, mixins: [Tracking.mixin()], - inject: ['runnerHelpPagePath'], methods: { trackHelpPageClick() { const { label, actions } = pipelineEditorTrackingOptions; this.track(actions.helpDrawerLinks.runners, { label }); }, }, + RUNNER_HELP_URL: 'https://docs.gitlab.com/runner/register/index.html', }; </script> <template> @@ -47,7 +47,7 @@ export default { <p class="gl-mb-0"> <gl-sprintf :message="$options.i18n.note"> <template #link="{ content }"> - <gl-link :href="runnerHelpPagePath" target="_blank" @click="trackHelpPageClick()"> + <gl-link :href="$options.RUNNER_HELP_URL" target="_blank" @click="trackHelpPageClick()"> {{ content }} </gl-link> </template> diff --git a/app/assets/javascripts/pipeline_editor/components/editor/ci_editor_header.vue b/app/assets/javascripts/pipeline_editor/components/editor/ci_editor_header.vue index 65a2a6b56e4..189690ce2c3 100644 --- a/app/assets/javascripts/pipeline_editor/components/editor/ci_editor_header.vue +++ b/app/assets/javascripts/pipeline_editor/components/editor/ci_editor_header.vue @@ -43,7 +43,9 @@ export default { </script> <template> - <div class="gl-bg-gray-10 gl-p-3 gl-border-solid gl-border-gray-100 gl-border-1"> + <div + class="gl-bg-gray-10 gl-display-flex gl-p-3 gl-gap-3 gl-border-solid gl-border-gray-100 gl-border-1" + > <gl-button :href="$options.TEMPLATE_REPOSITORY_URL" size="small" diff --git a/app/assets/javascripts/pipeline_editor/components/lint/ci_lint.vue b/app/assets/javascripts/pipeline_editor/components/lint/ci_lint.vue deleted file mode 100644 index f1cf5630fbf..00000000000 --- a/app/assets/javascripts/pipeline_editor/components/lint/ci_lint.vue +++ /dev/null @@ -1,53 +0,0 @@ -<script> -import { flatten } from 'lodash'; -import CiLintResults from './ci_lint_results.vue'; - -export default { - components: { - CiLintResults, - }, - inject: { - lintHelpPagePath: { - default: '', - }, - }, - props: { - isValid: { - type: Boolean, - required: true, - }, - ciConfig: { - type: Object, - required: true, - }, - }, - computed: { - stages() { - return this.ciConfig?.stages || []; - }, - jobs() { - const groupedJobs = this.stages.reduce((acc, { groups, name: stageName }) => { - return acc.concat( - groups.map(({ jobs }) => { - return jobs.map((job) => ({ - stage: stageName, - ...job, - })); - }), - ); - }, []); - - return flatten(groupedJobs); - }, - }, -}; -</script> - -<template> - <ci-lint-results - :errors="ciConfig.errors" - :is-valid="isValid" - :jobs="jobs" - :lint-help-page-path="lintHelpPagePath" - /> -</template> diff --git a/app/assets/javascripts/pipeline_editor/components/pipeline_editor_tabs.vue b/app/assets/javascripts/pipeline_editor/components/pipeline_editor_tabs.vue index 99ee244577e..4941f22230b 100644 --- a/app/assets/javascripts/pipeline_editor/components/pipeline_editor_tabs.vue +++ b/app/assets/javascripts/pipeline_editor/components/pipeline_editor_tabs.vue @@ -2,7 +2,6 @@ import { GlAlert, GlLoadingIcon, GlTabs } from '@gitlab/ui'; import { s__, __ } from '~/locale'; import PipelineGraph from '~/pipelines/components/pipeline_graph/pipeline_graph.vue'; -import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import { getParameterValues, setUrlParams, updateHistory } from '~/lib/utils/url_utility'; import { CREATE_TAB, @@ -11,7 +10,6 @@ import { EDITOR_APP_STATUS_LOADING, EDITOR_APP_STATUS_VALID, EDITOR_APP_STATUS_LINT_UNAVAILABLE, - LINT_TAB, MERGED_TAB, TAB_QUERY_PARAM, TABS_INDEX, @@ -22,7 +20,6 @@ import { import getAppStatus from '../graphql/queries/client/app_status.query.graphql'; import CiConfigMergedPreview from './editor/ci_config_merged_preview.vue'; import CiEditorHeader from './editor/ci_editor_header.vue'; -import CiLint from './lint/ci_lint.vue'; import CiValidate from './validate/ci_validate.vue'; import TextEditor from './editor/text_editor.vue'; import EditorTab from './ui/editor_tab.vue'; @@ -56,7 +53,6 @@ export default { }, tabConstants: { CREATE_TAB, - LINT_TAB, MERGED_TAB, VALIDATE_TAB, VISUALIZE_TAB, @@ -64,7 +60,6 @@ export default { components: { CiConfigMergedPreview, CiEditorHeader, - CiLint, CiValidate, EditorTab, GlAlert, @@ -74,7 +69,6 @@ export default { TextEditor, WalkthroughPopover, }, - mixins: [glFeatureFlagsMixin()], props: { ciConfigData: { type: Object, @@ -212,7 +206,6 @@ export default { <pipeline-graph v-else :pipeline-data="ciConfigData" /> </editor-tab> <editor-tab - v-if="glFeatures.simulatePipeline" class="gl-mb-3" data-testid="validate-tab" :badge-title="validateTabBadgeTitle" @@ -222,19 +215,6 @@ export default { <ci-validate :ci-file-content="ciFileContent" /> </editor-tab> <editor-tab - v-else - class="gl-mb-3" - :empty-message="$options.i18n.empty.lint" - :is-empty="isEmpty" - :is-unavailable="isLintUnavailable" - :title="$options.i18n.tabLint" - data-testid="lint-tab" - @click="setCurrentTab($options.tabConstants.LINT_TAB)" - > - <gl-loading-icon v-if="isLoading" size="lg" class="gl-m-3" /> - <ci-lint v-else :is-valid="isValid" :ci-config="ciConfigData" /> - </editor-tab> - <editor-tab class="gl-mb-3" :empty-message="$options.i18n.empty.merge" :keep-component-mounted="false" diff --git a/app/assets/javascripts/pipeline_editor/components/validate/ci_validate.vue b/app/assets/javascripts/pipeline_editor/components/validate/ci_validate.vue index 47673119db9..83fcab4b343 100644 --- a/app/assets/javascripts/pipeline_editor/components/validate/ci_validate.vue +++ b/app/assets/javascripts/pipeline_editor/components/validate/ci_validate.vue @@ -11,6 +11,8 @@ import { GlSprintf, } from '@gitlab/ui'; import { s__, __ } from '~/locale'; +import Tracking from '~/tracking'; +import { pipelineEditorTrackingOptions } from '../../constants'; import ValidatePipelinePopover from '../popovers/validate_pipeline_popover.vue'; import CiLintResults from '../lint/ci_lint_results.vue'; import getBlobContent from '../../graphql/queries/blob_content.query.graphql'; @@ -70,6 +72,7 @@ export default { directives: { GlTooltip: GlTooltipDirective, }, + mixins: [Tracking.mixin()], inject: ['ciConfigPath', 'ciLintPath', 'projectFullPath', 'validateTabIllustrationPath'], props: { ciFileContent: { @@ -110,6 +113,9 @@ export default { }; }, computed: { + canResimulatePipeline() { + return this.hasSimulationResults && this.hasCiContentChanged; + }, isInitialCiContentLoading() { return this.$apollo.queries.initialBlobContent.loading; }, @@ -128,6 +134,10 @@ export default { variant: this.isValid ? 'success' : 'danger', }; }, + trackingAction() { + const { actions } = pipelineEditorTrackingOptions; + return this.canResimulatePipeline ? actions.resimulatePipeline : actions.simulatePipeline; + }, }, watch: { ciFileContent(value) { @@ -139,7 +149,12 @@ export default { cancelSimulation() { this.state = VALIDATE_TAB_INIT; }, + trackSimulation() { + const { label } = pipelineEditorTrackingOptions; + this.track(this.trackingAction, { label }); + }, async validateYaml() { + this.trackSimulation(); this.state = VALIDATE_TAB_LOADING; try { @@ -150,7 +165,7 @@ export default { } = await this.$apollo.mutate({ mutation: lintCiMutation, variables: { - dry_run: true, + dry: true, content: this.yaml, endpoint: this.ciLintPath, }, @@ -198,7 +213,7 @@ export default { :aria-label="$options.i18n.help" /> </div> - <div v-if="hasSimulationResults && hasCiContentChanged"> + <div v-if="canResimulatePipeline"> <span class="gl-text-gray-400" data-testid="content-status"> {{ $options.i18n.contentChange }} </span> @@ -232,6 +247,7 @@ export default { class="gl-mt-3" :disabled="isInitialCiContentLoading" data-testid="simulate-pipeline-button" + data-qa-selector="simulate_pipeline_button" @click="validateYaml" > {{ $options.i18n.cta }} diff --git a/app/assets/javascripts/pipeline_editor/constants.js b/app/assets/javascripts/pipeline_editor/constants.js index 05db0afd15d..dd25c4d433b 100644 --- a/app/assets/javascripts/pipeline_editor/constants.js +++ b/app/assets/javascripts/pipeline_editor/constants.js @@ -30,7 +30,6 @@ export const LOAD_FAILURE_UNKNOWN = 'LOAD_FAILURE_UNKNOWN'; export const PIPELINE_FAILURE = 'PIPELINE_FAILURE'; export const CREATE_TAB = 'CREATE_TAB'; -export const LINT_TAB = 'LINT_TAB'; export const MERGED_TAB = 'MERGED_TAB'; export const VALIDATE_TAB = 'VALIDATE_TAB'; export const VISUALIZE_TAB = 'VISUALIZE_TAB'; @@ -38,9 +37,8 @@ export const VISUALIZE_TAB = 'VISUALIZE_TAB'; export const TABS_INDEX = { [CREATE_TAB]: '0', [VISUALIZE_TAB]: '1', - [LINT_TAB]: '2', - [VALIDATE_TAB]: '3', - [MERGED_TAB]: '4', + [VALIDATE_TAB]: '2', + [MERGED_TAB]: '3', }; export const TAB_QUERY_PARAM = 'tab'; @@ -77,6 +75,8 @@ export const pipelineEditorTrackingOptions = { [CI_YAML_LINK]: 'visit_help_drawer_link_yaml', }, openHelpDrawer: 'open_help_drawer', + resimulatePipeline: 'resimulate_pipeline', + simulatePipeline: 'simulate_pipeline', }, }; diff --git a/app/assets/javascripts/pipeline_editor/graphql/mutations/client/lint_ci.mutation.graphql b/app/assets/javascripts/pipeline_editor/graphql/mutations/client/lint_ci.mutation.graphql index 5091d63111f..2d42ebb6ac3 100644 --- a/app/assets/javascripts/pipeline_editor/graphql/mutations/client/lint_ci.mutation.graphql +++ b/app/assets/javascripts/pipeline_editor/graphql/mutations/client/lint_ci.mutation.graphql @@ -13,7 +13,6 @@ mutation lintCI($endpoint: String, $content: String, $dry: Boolean) { only { refs } - afterScript stage tags when diff --git a/app/assets/javascripts/pipeline_editor/graphql/mutations/commit_ci_file.mutation.graphql b/app/assets/javascripts/pipeline_editor/graphql/mutations/commit_ci_file.mutation.graphql index 77a3cdf586c..3495ca51283 100644 --- a/app/assets/javascripts/pipeline_editor/graphql/mutations/commit_ci_file.mutation.graphql +++ b/app/assets/javascripts/pipeline_editor/graphql/mutations/commit_ci_file.mutation.graphql @@ -19,9 +19,7 @@ mutation commitCIFile( ] } ) { - __typename commit { - __typename id sha } diff --git a/app/assets/javascripts/pipeline_editor/index.js b/app/assets/javascripts/pipeline_editor/index.js index 4f5b69107bf..13dad0b2459 100644 --- a/app/assets/javascripts/pipeline_editor/index.js +++ b/app/assets/javascripts/pipeline_editor/index.js @@ -40,7 +40,6 @@ export const initPipelineEditor = (selector = '#js-pipeline-editor') => { projectFullPath, projectPath, projectNamespace, - runnerHelpPagePath, simulatePipelineHelpPagePath, totalBranches, validateTabIllustrationPath, @@ -132,7 +131,6 @@ export const initPipelineEditor = (selector = '#js-pipeline-editor') => { projectFullPath, projectPath, projectNamespace, - runnerHelpPagePath, simulatePipelineHelpPagePath, totalBranches: parseInt(totalBranches, 10), validateTabIllustrationPath, |