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

121 lines
3.3 KiB
Vue
Raw Normal View History

2018-03-17 18:26:18 +05:30
<script>
2019-09-30 21:07:59 +05:30
import { GlEmptyState } from '@gitlab/ui';
2020-01-01 13:55:28 +05:30
import { __ } from '~/locale';
2019-09-30 21:07:59 +05:30
2018-05-09 12:01:36 +05:30
export default {
2019-09-30 21:07:59 +05:30
components: {
GlEmptyState,
},
2018-05-09 12:01:36 +05:30
props: {
documentationPath: {
type: String,
required: true,
},
settingsPath: {
type: String,
required: false,
default: '',
},
clustersPath: {
type: String,
required: false,
default: '',
},
selectedState: {
type: String,
required: true,
},
emptyGettingStartedSvgPath: {
type: String,
required: true,
2018-03-17 18:26:18 +05:30
},
2018-05-09 12:01:36 +05:30
emptyLoadingSvgPath: {
type: String,
required: true,
},
emptyNoDataSvgPath: {
type: String,
required: true,
},
2020-01-01 13:55:28 +05:30
emptyNoDataSmallSvgPath: {
type: String,
required: true,
},
2018-05-09 12:01:36 +05:30
emptyUnableToConnectSvgPath: {
type: String,
required: true,
},
2019-09-30 21:07:59 +05:30
compact: {
type: Boolean,
required: false,
default: false,
},
2018-05-09 12:01:36 +05:30
},
data() {
return {
states: {
gettingStarted: {
svgUrl: this.emptyGettingStartedSvgPath,
2019-09-30 21:07:59 +05:30
title: __('Get started with performance monitoring'),
description: __(`Stay updated about the performance and health
of your environment by configuring Prometheus to monitor your deployments.`),
buttonText: __('Install on clusters'),
2018-05-09 12:01:36 +05:30
buttonPath: this.clustersPath,
2019-09-30 21:07:59 +05:30
secondaryButtonText: __('Configure existing installation'),
2018-05-09 12:01:36 +05:30
secondaryButtonPath: this.settingsPath,
},
loading: {
svgUrl: this.emptyLoadingSvgPath,
2019-09-30 21:07:59 +05:30
title: __('Waiting for performance data'),
description: __(`Creating graphs uses the data from the Prometheus server.
If this takes a long time, ensure that data is available.`),
buttonText: __('View documentation'),
2018-05-09 12:01:36 +05:30
buttonPath: this.documentationPath,
2019-09-30 21:07:59 +05:30
secondaryButtonText: '',
secondaryButtonPath: '',
2018-05-09 12:01:36 +05:30
},
noData: {
svgUrl: this.emptyNoDataSvgPath,
2019-09-30 21:07:59 +05:30
title: __('No data found'),
description: __(`You are connected to the Prometheus server, but there is currently
no data to display.`),
buttonText: __('Configure Prometheus'),
2018-05-09 12:01:36 +05:30
buttonPath: this.settingsPath,
2019-09-30 21:07:59 +05:30
secondaryButtonText: '',
secondaryButtonPath: '',
2018-05-09 12:01:36 +05:30
},
unableToConnect: {
svgUrl: this.emptyUnableToConnectSvgPath,
2019-09-30 21:07:59 +05:30
title: __('Unable to connect to Prometheus server'),
description: __(
'Ensure connectivity is available from the GitLab server to the Prometheus server',
),
buttonText: __('View documentation'),
2018-05-09 12:01:36 +05:30
buttonPath: this.documentationPath,
2019-09-30 21:07:59 +05:30
secondaryButtonText: __('Configure Prometheus'),
secondaryButtonPath: this.settingsPath,
2018-03-17 18:26:18 +05:30
},
},
2018-05-09 12:01:36 +05:30
};
},
computed: {
currentState() {
return this.states[this.selectedState];
},
},
};
2018-03-17 18:26:18 +05:30
</script>
<template>
2019-09-30 21:07:59 +05:30
<gl-empty-state
:title="currentState.title"
:description="currentState.description"
:primary-button-text="currentState.buttonText"
:primary-button-link="currentState.buttonPath"
:secondary-button-text="currentState.secondaryButtonText"
:secondary-button-link="currentState.secondaryButtonPath"
:svg-path="currentState.svgUrl"
:compact="compact"
/>
2018-03-17 18:26:18 +05:30
</template>