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

95 lines
2.3 KiB
Vue
Raw Normal View History

2019-03-02 22:35:43 +05:30
<script>
2020-03-13 15:44:24 +05:30
import { isString } from 'lodash';
2019-07-07 11:18:12 +05:30
import { mapState, mapActions, mapGetters } from 'vuex';
import AreaChart from './area.vue';
import MissingPrometheus from './missing_prometheus.vue';
2021-03-11 19:13:27 +05:30
import PodBox from './pod_box.vue';
import Url from './url.vue';
2019-03-02 22:35:43 +05:30
export default {
components: {
PodBox,
Url,
2019-07-07 11:18:12 +05:30
AreaChart,
MissingPrometheus,
2019-03-02 22:35:43 +05:30
},
props: {
func: {
type: Object,
required: true,
},
2019-07-07 11:18:12 +05:30
hasPrometheus: {
type: Boolean,
required: false,
default: false,
},
},
data() {
return {
elWidth: 0,
};
2019-03-02 22:35:43 +05:30
},
computed: {
name() {
return this.func.name;
},
description() {
2020-03-13 15:44:24 +05:30
return isString(this.func.description) ? this.func.description : '';
2019-03-02 22:35:43 +05:30
},
funcUrl() {
return this.func.url;
},
podCount() {
2019-07-07 11:18:12 +05:30
return Number(this.func.podcount) || 0;
2019-03-02 22:35:43 +05:30
},
2019-07-07 11:18:12 +05:30
...mapState(['graphData', 'hasPrometheusData']),
...mapGetters(['hasPrometheusMissingData']),
},
created() {
this.fetchMetrics({
metricsPath: this.func.metricsUrl,
hasPrometheus: this.hasPrometheus,
});
},
mounted() {
this.elWidth = this.$el.clientWidth;
},
methods: {
...mapActions(['fetchMetrics']),
2019-03-02 22:35:43 +05:30
},
};
</script>
<template>
<section id="serverless-function-details">
2019-07-07 11:18:12 +05:30
<h3 class="serverless-function-name">{{ name }}</h3>
2020-07-28 23:09:34 +05:30
<div class="gl-mb-3 serverless-function-description">
2019-03-02 22:35:43 +05:30
<div v-for="(line, index) in description.split('\n')" :key="index">{{ line }}</div>
</div>
<url :uri="funcUrl" />
<h4>{{ s__('ServerlessDetails|Kubernetes Pods') }}</h4>
<div v-if="podCount > 0">
<p>
<b v-if="podCount == 1">{{ podCount }} {{ s__('ServerlessDetails|pod in use') }}</b>
<b v-else>{{ podCount }} {{ s__('ServerlessDetails|pods in use') }}</b>
</p>
<pod-box :count="podCount" />
<p>
{{
s__('ServerlessDetails|Number of Kubernetes pods in use over time based on necessity.')
}}
</p>
</div>
2019-09-30 21:07:59 +05:30
<div v-else>
<p>{{ s__('ServerlessDetails|No pods loaded at this time.') }}</p>
</div>
2019-07-07 11:18:12 +05:30
<area-chart v-if="hasPrometheusData" :graph-data="graphData" :container-width="elWidth" />
<missing-prometheus
v-if="!hasPrometheus || hasPrometheusMissingData"
:missing-data="hasPrometheusMissingData"
/>
2019-03-02 22:35:43 +05:30
</section>
</template>