Skip to content
Snippets Groups Projects

Add runner registration instructions (2)

Merged Miguel Rincon requested to merge 383139-add-runner-registration-instructions into master
All threads resolved!
9 files
+ 389
1
Compare changes
  • Side-by-side
  • Inline
Files
9
 
<script>
 
import { GlButton } from '@gitlab/ui';
 
import { s__, sprintf } from '~/locale';
 
import { createAlert } from '~/flash';
 
import { getParameterByName } from '~/lib/utils/url_utility';
 
import { convertToGraphQLId } from '~/graphql_shared/utils';
 
import { TYPENAME_CI_RUNNER } from '~/graphql_shared/constants';
 
import runnerForRegistrationQuery from '../graphql/register/runner_for_registration.query.graphql';
 
import { I18N_FETCH_ERROR, PARAM_KEY_PLATFORM } from '../constants';
 
import RegistrationInstructions from '../components/registration/registration_instructions.vue';
 
 
export default {
 
components: {
 
GlButton,
 
RegistrationInstructions,
 
},
 
props: {
 
runnerId: {
 
type: String,
 
required: true,
 
},
 
runnersPath: {
 
type: String,
 
required: true,
 
},
 
},
 
data() {
 
return {
 
platform: getParameterByName(PARAM_KEY_PLATFORM),
 
runner: null,
 
};
 
},
 
apollo: {
 
runner: {
 
query: runnerForRegistrationQuery,
 
variables() {
 
return {
 
id: convertToGraphQLId(TYPENAME_CI_RUNNER, this.runnerId),
 
};
 
},
 
error(error) {
 
createAlert({ message: I18N_FETCH_ERROR });
 
 
this.reportToSentry(error);
 
},
 
},
 
},
 
computed: {
 
id() {
 
return this.runner?.id;
 
},
 
description() {
 
return this.runner?.description;
 
},
 
heading() {
 
return sprintf(s__('Runners|Register "%{runnerDescription}" runner'), {
 
runnerDescription: this.description,
 
});
 
},
 
ephemeralAuthenticationToken() {
 
return this.runner?.ephemeralAuthenticationToken;
 
},
 
},
 
};
 
</script>
 
<template>
 
<div>
 
<h1 class="gl-font-size-h1">{{ heading }}</h1>
 
 
<registration-instructions
 
v-if="runner"
 
:platform="platform"
 
:token="ephemeralAuthenticationToken"
 
/>
 
 
<gl-button :href="runnersPath" variant="confirm">{{
 
s__('Runners|Go to runners page')
 
}}</gl-button>
 
</div>
 
</template>
Loading