debian-mirror-gitlab/app/assets/javascripts/serverless/components/environment_row.vue

66 lines
1.3 KiB
Vue
Raw Normal View History

2019-03-02 22:35:43 +05:30
<script>
import ItemCaret from '~/groups/components/item_caret.vue';
2021-03-11 19:13:27 +05:30
import FunctionRow from './function_row.vue';
2019-03-02 22:35:43 +05:30
export default {
components: {
ItemCaret,
FunctionRow,
},
props: {
env: {
type: Array,
required: true,
},
envName: {
type: String,
required: true,
},
},
data() {
return {
isOpen: true,
};
},
computed: {
envId() {
if (this.envName === '*') {
return 'env-global';
}
return `env-${this.envName}`;
},
isOpenClass() {
return {
'is-open': this.isOpen,
};
},
},
methods: {
toggleOpen() {
this.isOpen = !this.isOpen;
},
},
};
</script>
<template>
<li :id="envId" :class="isOpenClass" class="group-row has-children">
<div
2020-03-13 15:44:24 +05:30
class="group-row-contents d-flex justify-content-end align-items-center py-2"
2019-03-02 22:35:43 +05:30
role="button"
@click.stop="toggleOpen"
>
<div class="folder-toggle-wrap d-flex align-items-center">
<item-caret :is-group-open="isOpen" />
</div>
2020-07-28 23:09:34 +05:30
<div class="group-text flex-grow title namespace-title gl-ml-3">
2019-03-02 22:35:43 +05:30
{{ envName }}
</div>
</div>
<ul v-if="isOpen" class="content-list group-list-tree">
<function-row v-for="(f, index) in env" :key="f.name" :index="index" :func="f" />
</ul>
</li>
</template>