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