debian-mirror-gitlab/app/assets/javascripts/monitoring/components/graph_group.vue

62 lines
1.2 KiB
Vue
Raw Normal View History

2018-03-17 18:26:18 +05:30
<script>
2019-12-04 20:38:33 +05:30
import Icon from '~/vue_shared/components/icon.vue';
2018-05-09 12:01:36 +05:30
export default {
2019-12-04 20:38:33 +05:30
components: {
Icon,
},
2018-05-09 12:01:36 +05:30
props: {
name: {
type: String,
required: true,
2018-03-17 18:26:18 +05:30
},
2018-05-09 12:01:36 +05:30
showPanels: {
type: Boolean,
required: false,
default: true,
},
2019-10-12 21:52:04 +05:30
collapseGroup: {
type: Boolean,
required: true,
},
2018-05-09 12:01:36 +05:30
},
2019-12-04 20:38:33 +05:30
data() {
return {
showGroup: true,
};
},
computed: {
caretIcon() {
return this.collapseGroup && this.showGroup ? 'angle-down' : 'angle-right';
},
},
created() {
this.showGroup = this.collapseGroup;
},
methods: {
collapse() {
this.showGroup = !this.showGroup;
},
},
2018-05-09 12:01:36 +05:30
};
2018-03-17 18:26:18 +05:30
</script>
<template>
2019-02-15 15:39:39 +05:30
<div v-if="showPanels" class="card prometheus-panel">
2019-12-04 20:38:33 +05:30
<div class="card-header d-flex align-items-center">
<h4 class="flex-grow-1">{{ name }}</h4>
<a role="button" @click="collapse">
<icon :size="16" :aria-label="__('Toggle collapse')" :name="caretIcon" />
</a>
</div>
<div
v-if="collapseGroup"
v-show="collapseGroup && showGroup"
class="card-body prometheus-graph-group"
>
<slot></slot>
2018-03-17 18:26:18 +05:30
</div>
2018-03-27 19:54:05 +05:30
</div>
2019-02-15 15:39:39 +05:30
<div v-else class="prometheus-graph-group"><slot></slot></div>
2018-03-17 18:26:18 +05:30
</template>