diff options
Diffstat (limited to 'app/assets/javascripts/ci')
6 files changed, 45 insertions, 36 deletions
diff --git a/app/assets/javascripts/ci/runner/components/runner_create_form.vue b/app/assets/javascripts/ci/runner/components/runner_create_form.vue index 040e42fa938..1b363174d28 100644 --- a/app/assets/javascripts/ci/runner/components/runner_create_form.vue +++ b/app/assets/javascripts/ci/runner/components/runner_create_form.vue @@ -4,7 +4,13 @@ import RunnerFormFields from '~/ci/runner/components/runner_form_fields.vue'; import runnerCreateMutation from '~/ci/runner/graphql/new/runner_create.mutation.graphql'; import { modelToUpdateMutationVariables } from 'ee_else_ce/ci/runner/runner_update_form_utils'; import { captureException } from '../sentry_utils'; -import { RUNNER_TYPES, DEFAULT_ACCESS_LEVEL, PROJECT_TYPE, GROUP_TYPE } from '../constants'; +import { + RUNNER_TYPES, + DEFAULT_ACCESS_LEVEL, + PROJECT_TYPE, + GROUP_TYPE, + I18N_CREATE_ERROR, +} from '../constants'; export default { name: 'RunnerCreateForm', @@ -82,16 +88,29 @@ export default { }); if (errors?.length) { - this.$emit('error', new Error(errors.join(' '))); - this.saving = false; - } else { - this.onSuccess(runner); + this.onError(new Error(errors.join(' ')), true); + return; } + + if (!runner?.ephemeralRegisterUrl) { + // runner is missing information, report issue and + // fail naviation to register page. + this.onError(new Error(I18N_CREATE_ERROR)); + return; + } + + this.onSuccess(runner); } catch (error) { + this.onError(error); + } + }, + onError(error, isValidationError = false) { + if (!isValidationError) { captureException({ error, component: this.$options.name }); - this.$emit('error', error); - this.saving = false; } + + this.$emit('error', error); + this.saving = false; }, onSuccess(runner) { this.$emit('saved', runner); diff --git a/app/assets/javascripts/ci/runner/components/runner_details.vue b/app/assets/javascripts/ci/runner/components/runner_details.vue index 51c752f0dee..8c1280cffb9 100644 --- a/app/assets/javascripts/ci/runner/components/runner_details.vue +++ b/app/assets/javascripts/ci/runner/components/runner_details.vue @@ -10,6 +10,7 @@ import { GROUP_TYPE, PROJECT_TYPE, RUNNER_MANAGERS_HELP_URL, + I18N_STATUS_NEVER_CONTACTED, } from '../constants'; import RunnerDetail from './runner_detail.vue'; import RunnerGroups from './runner_groups.vue'; @@ -85,6 +86,7 @@ export default { }, ACCESS_LEVEL_REF_PROTECTED, RUNNER_MANAGERS_HELP_URL, + I18N_STATUS_NEVER_CONTACTED, }; </script> @@ -99,7 +101,7 @@ export default { <runner-detail :label="s__('Runners|Description')" :value="runner.description" /> <runner-detail :label="s__('Runners|Last contact')" - :empty-value="s__('Runners|Never contacted')" + :empty-value="$options.I18N_STATUS_NEVER_CONTACTED" > <template v-if="runner.contactedAt" #value> <time-ago :time="runner.contactedAt" /> diff --git a/app/assets/javascripts/ci/runner/components/runner_managers_detail.vue b/app/assets/javascripts/ci/runner/components/runner_managers_detail.vue index a9df7f12955..5cc1bbef481 100644 --- a/app/assets/javascripts/ci/runner/components/runner_managers_detail.vue +++ b/app/assets/javascripts/ci/runner/components/runner_managers_detail.vue @@ -1,13 +1,12 @@ <script> -import { GlCollapse, GlButton, GlIcon, GlSkeletonLoader, GlTableLite } from '@gitlab/ui'; -import HelpPopover from '~/vue_shared/components/help_popover.vue'; +import { GlCollapse, GlButton, GlIcon, GlSkeletonLoader } from '@gitlab/ui'; import { __, s__, formatNumber } from '~/locale'; -import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue'; import { createAlert } from '~/alert'; import runnerManagersQuery from '../graphql/show/runner_managers.query.graphql'; import { I18N_FETCH_ERROR } from '../constants'; import { captureException } from '../sentry_utils'; import { tableField } from '../utils'; +import RunnerManagersTable from './runner_managers_table.vue'; export default { name: 'RunnerManagersDetail', @@ -16,9 +15,7 @@ export default { GlButton, GlIcon, GlSkeletonLoader, - GlTableLite, - TimeAgo, - HelpPopover, + RunnerManagersTable, }, props: { runner: { @@ -108,20 +105,7 @@ export default { <gl-collapse :visible="expanded" class="gl-mt-5"> <gl-skeleton-loader v-if="loading" /> - <gl-table-lite v-else-if="managers.length" :fields="$options.fields" :items="managers"> - <template #head(systemId)="{ label }"> - {{ label }} - <help-popover> - {{ s__('Runners|The unique ID for each runner that uses this configuration.') }} - </help-popover> - </template> - <template #cell(contactedAt)="{ item = {} }"> - <template v-if="item.contactedAt"> - <time-ago :time="item.contactedAt" /> - </template> - <template v-else>{{ s__('Runners|Never contacted') }}</template> - </template> - </gl-table-lite> + <runner-managers-table v-else-if="managers.length" :items="managers" /> </gl-collapse> </div> </template> diff --git a/app/assets/javascripts/ci/runner/components/runner_managers_table.vue b/app/assets/javascripts/ci/runner/components/runner_managers_table.vue index 71cf76aed46..2039d76f8f7 100644 --- a/app/assets/javascripts/ci/runner/components/runner_managers_table.vue +++ b/app/assets/javascripts/ci/runner/components/runner_managers_table.vue @@ -4,6 +4,7 @@ import HelpPopover from '~/vue_shared/components/help_popover.vue'; import { s__ } from '~/locale'; import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue'; import { tableField } from '../utils'; +import { I18N_STATUS_NEVER_CONTACTED } from '../constants'; export default { name: 'RunnerManagersTable', @@ -20,13 +21,6 @@ export default { default: () => [], }, }, - data() { - return { - skip: true, - expanded: false, - managers: [], - }; - }, fields: [ tableField({ key: 'systemId', label: s__('Runners|System ID') }), tableField({ key: 'version', label: s__('Runners|Version') }), @@ -40,6 +34,7 @@ export default { thClasses: ['gl-text-right'], }), ], + I18N_STATUS_NEVER_CONTACTED, }; </script> @@ -65,7 +60,7 @@ export default { <template v-if="item.contactedAt"> <time-ago :time="item.contactedAt" /> </template> - <template v-else>{{ s__('Runners|Never contacted') }}</template> + <template v-else>{{ $options.I18N_STATUS_NEVER_CONTACTED }}</template> </template> </gl-table-lite> </template> diff --git a/app/assets/javascripts/ci/runner/constants.js b/app/assets/javascripts/ci/runner/constants.js index 395d9ac0d8e..40841696ead 100644 --- a/app/assets/javascripts/ci/runner/constants.js +++ b/app/assets/javascripts/ci/runner/constants.js @@ -9,6 +9,9 @@ export const RUNNER_DETAILS_PROJECTS_PAGE_SIZE = 5; export const RUNNER_DETAILS_JOBS_PAGE_SIZE = 30; export const I18N_FETCH_ERROR = s__('Runners|Something went wrong while fetching runner data.'); +export const I18N_CREATE_ERROR = s__( + 'Runners|An error occurred while creating the runner. Please try again.', +); export const FILTER_CSS_CLASSES = 'gl-bg-gray-10 gl-p-5 gl-border-solid gl-border-gray-100 gl-border-0 gl-border-t-1 gl-border-b-1'; diff --git a/app/assets/javascripts/ci/runner/graphql/show/runner_managers.query.graphql b/app/assets/javascripts/ci/runner/graphql/show/runner_managers.query.graphql index 65fb5f91b60..c4fb63f2b0d 100644 --- a/app/assets/javascripts/ci/runner/graphql/show/runner_managers.query.graphql +++ b/app/assets/javascripts/ci/runner/graphql/show/runner_managers.query.graphql @@ -6,6 +6,12 @@ query getRunnerManagers($runnerId: CiRunnerID!) { nodes { id systemId + version + revision + executorName + architectureName + platformName + ipAddress contactedAt } } |