diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-25 21:12:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-25 21:12:16 +0300 |
commit | 942229d2b424e0c505aa676cbd8e173e4c99d83a (patch) | |
tree | 027906274143f48ba7aa67829a4ca898b23bc94d /app/assets/javascripts/vue_shared/components/runner_instructions | |
parent | 82c63f420c7fc2229a44aa336d656a9712884f83 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/vue_shared/components/runner_instructions')
-rw-r--r-- | app/assets/javascripts/vue_shared/components/runner_instructions/constants.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/vue_shared/components/runner_instructions/runner_instructions_modal.vue | 21 |
2 files changed, 20 insertions, 3 deletions
diff --git a/app/assets/javascripts/vue_shared/components/runner_instructions/constants.js b/app/assets/javascripts/vue_shared/components/runner_instructions/constants.js index facace0d809..34845e3d9e4 100644 --- a/app/assets/javascripts/vue_shared/components/runner_instructions/constants.js +++ b/app/assets/javascripts/vue_shared/components/runner_instructions/constants.js @@ -2,6 +2,8 @@ import { s__ } from '~/locale'; export const PLATFORMS_WITHOUT_ARCHITECTURES = ['docker', 'kubernetes']; +export const REGISTRATION_TOKEN_PLACEHOLDER = '$REGISTRATION_TOKEN'; + export const INSTRUCTIONS_PLATFORMS_WITHOUT_ARCHITECTURES = { docker: { instructions: s__( diff --git a/app/assets/javascripts/vue_shared/components/runner_instructions/runner_instructions_modal.vue b/app/assets/javascripts/vue_shared/components/runner_instructions/runner_instructions_modal.vue index 27c671ffc44..d5493aa5a66 100644 --- a/app/assets/javascripts/vue_shared/components/runner_instructions/runner_instructions_modal.vue +++ b/app/assets/javascripts/vue_shared/components/runner_instructions/runner_instructions_modal.vue @@ -16,8 +16,9 @@ import { isEmpty } from 'lodash'; import { __, s__ } from '~/locale'; import ModalCopyButton from '~/vue_shared/components/modal_copy_button.vue'; import { - PLATFORMS_WITHOUT_ARCHITECTURES, INSTRUCTIONS_PLATFORMS_WITHOUT_ARCHITECTURES, + PLATFORMS_WITHOUT_ARCHITECTURES, + REGISTRATION_TOKEN_PLACEHOLDER, } from './constants'; import getRunnerPlatformsQuery from './graphql/queries/get_runner_platforms.query.graphql'; import getRunnerSetupInstructionsQuery from './graphql/queries/get_runner_setup.query.graphql'; @@ -44,6 +45,11 @@ export default { required: false, default: 'runner-instructions-modal', }, + registrationToken: { + type: String, + required: false, + default: null, + }, }, apollo: { platforms: { @@ -118,6 +124,15 @@ export default { runnerInstallationLink() { return INSTRUCTIONS_PLATFORMS_WITHOUT_ARCHITECTURES[this.selectedPlatformName]?.link; }, + registerInstructionsWithToken() { + const { registerInstructions } = this.instructions || {}; + + if (this.registrationToken) { + return registerInstructions.replace(REGISTRATION_TOKEN_PLACEHOLDER, this.registrationToken); + } + + return registerInstructions; + }, }, methods: { show() { @@ -249,11 +264,11 @@ export default { <pre class="gl-bg-gray gl-flex-grow-1 gl-white-space-pre-line" data-testid="register-command" - >{{ instructions.registerInstructions }}</pre + >{{ registerInstructionsWithToken }}</pre > <modal-copy-button :title="$options.i18n.copyInstructions" - :text="instructions.registerInstructions" + :text="registerInstructionsWithToken" :modal-id="$options.modalId" css-classes="gl-align-self-start gl-ml-2 gl-mt-2" category="tertiary" |