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
|
<script>
import { GlButton } from '@gitlab/ui';
import { getParameterByName, updateHistory, mergeUrlParams } from '~/lib/utils/url_utility';
import { PARAM_KEY_PLATFORM, DEFAULT_PLATFORM } from '../constants';
import RegistrationInstructions from '../components/registration/registration_instructions.vue';
import PlatformsDrawer from '../components/registration/platforms_drawer.vue';
export default {
name: 'AdminRegisterRunnerApp',
components: {
GlButton,
RegistrationInstructions,
PlatformsDrawer,
},
props: {
runnerId: {
type: String,
required: true,
},
runnersPath: {
type: String,
required: true,
},
},
data() {
return {
platform: getParameterByName(PARAM_KEY_PLATFORM) || DEFAULT_PLATFORM,
isDrawerOpen: false,
};
},
watch: {
platform(platform) {
updateHistory({
url: mergeUrlParams({ [PARAM_KEY_PLATFORM]: platform }, window.location.href),
});
},
},
methods: {
onSelectPlatform(platform) {
this.platform = platform;
},
onToggleDrawer(val = !this.isDrawerOpen) {
this.isDrawerOpen = val;
},
},
};
</script>
<template>
<div>
<registration-instructions
:runner-id="runnerId"
:platform="platform"
@toggleDrawer="onToggleDrawer"
>
<template #runner-list-name>{{ s__('Runners|Admin area › Runners') }}</template>
</registration-instructions>
<platforms-drawer
:platform="platform"
:open="isDrawerOpen"
@selectPlatform="onSelectPlatform"
@close="onToggleDrawer(false)"
/>
<gl-button :href="runnersPath" variant="confirm">{{
s__('Runners|Go to runners page')
}}</gl-button>
</div>
</template>
|