debian-mirror-gitlab/app/assets/javascripts/jobs/components/trigger_block.vue

79 lines
1.5 KiB
Vue
Raw Normal View History

2018-11-20 20:47:30 +05:30
<script>
2018-12-13 13:39:08 +05:30
export default {
props: {
trigger: {
type: Object,
required: true,
2018-11-20 20:47:30 +05:30
},
2018-12-13 13:39:08 +05:30
},
data() {
return {
2019-01-03 12:48:30 +05:30
areVariablesVisible: false,
2018-12-13 13:39:08 +05:30
};
},
computed: {
hasVariables() {
return this.trigger.variables && this.trigger.variables.length > 0;
2018-11-20 20:47:30 +05:30
},
2018-12-13 13:39:08 +05:30
},
methods: {
2019-01-03 12:48:30 +05:30
revealVariables() {
this.areVariablesVisible = true;
2018-11-20 20:47:30 +05:30
},
2018-12-13 13:39:08 +05:30
},
};
2018-11-20 20:47:30 +05:30
</script>
<template>
<div class="build-widget block">
2019-01-03 12:48:30 +05:30
<h4 class="title">
{{ __('Trigger') }}
</h4>
2018-11-20 20:47:30 +05:30
<p
2018-12-05 23:21:45 +05:30
v-if="trigger.short_token"
2018-11-20 20:47:30 +05:30
class="js-short-token"
>
2019-01-03 12:48:30 +05:30
<span class="build-light-text">
{{ __('Token') }}
</span>
{{ trigger.short_token }}
2018-11-20 20:47:30 +05:30
</p>
2019-01-03 12:48:30 +05:30
<p v-if="hasVariables">
<button
v-if="!areVariablesVisible"
type="button"
class="btn btn-default group js-reveal-variables"
@click="revealVariables"
>
{{ __('Reveal Variables') }}
</button>
</p>
2018-11-20 20:47:30 +05:30
2019-01-03 12:48:30 +05:30
<dl
v-if="areVariablesVisible"
class="js-build-variables trigger-build-variables"
>
<template
v-for="variable in trigger.variables"
>
<dt
:key="`${variable.key}-variable`"
class="js-build-variable trigger-build-variable"
>
{{ variable.key }}
</dt>
2018-11-20 20:47:30 +05:30
2019-01-03 12:48:30 +05:30
<dd
:key="`${variable.key}-value`"
class="js-build-value trigger-build-value"
>
{{ variable.value }}
</dd>
</template>
</dl>
2018-11-20 20:47:30 +05:30
</div>
</template>