2019-12-26 22:10:19 +05:30
|
|
|
<script>
|
2020-04-22 19:07:51 +05:30
|
|
|
import { GlDeprecatedButton, GlFormGroup, GlFormInput, GlFormCheckbox } from '@gitlab/ui';
|
2019-12-26 22:10:19 +05:30
|
|
|
import { mapState, mapActions } from 'vuex';
|
2020-01-01 13:55:28 +05:30
|
|
|
import Icon from '~/vue_shared/components/icon.vue';
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2020-04-22 19:07:51 +05:30
|
|
|
GlDeprecatedButton,
|
2019-12-26 22:10:19 +05:30
|
|
|
GlFormCheckbox,
|
|
|
|
GlFormGroup,
|
|
|
|
GlFormInput,
|
|
|
|
Icon,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return { placeholderUrl: 'https://my-url.grafana.net/' };
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState(['operationsSettingsEndpoint', 'grafanaToken', 'grafanaUrl', 'grafanaEnabled']),
|
|
|
|
integrationEnabled: {
|
|
|
|
get() {
|
|
|
|
return this.grafanaEnabled;
|
|
|
|
},
|
|
|
|
set(grafanaEnabled) {
|
|
|
|
this.setGrafanaEnabled(grafanaEnabled);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
localGrafanaToken: {
|
|
|
|
get() {
|
|
|
|
return this.grafanaToken;
|
|
|
|
},
|
|
|
|
set(token) {
|
|
|
|
this.setGrafanaToken(token);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
localGrafanaUrl: {
|
|
|
|
get() {
|
|
|
|
return this.grafanaUrl;
|
|
|
|
},
|
|
|
|
set(url) {
|
|
|
|
this.setGrafanaUrl(url);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions([
|
|
|
|
'setGrafanaUrl',
|
|
|
|
'setGrafanaToken',
|
|
|
|
'setGrafanaEnabled',
|
|
|
|
'updateGrafanaIntegration',
|
|
|
|
]),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<section id="grafana" class="settings no-animate js-grafana-integration">
|
|
|
|
<div class="settings-header">
|
2020-04-08 14:13:33 +05:30
|
|
|
<h3 class="js-section-header h4">
|
2019-12-26 22:10:19 +05:30
|
|
|
{{ s__('GrafanaIntegration|Grafana Authentication') }}
|
2020-04-08 14:13:33 +05:30
|
|
|
</h3>
|
2020-04-22 19:07:51 +05:30
|
|
|
<gl-deprecated-button class="js-settings-toggle">{{ __('Expand') }}</gl-deprecated-button>
|
2019-12-26 22:10:19 +05:30
|
|
|
<p class="js-section-sub-header">
|
|
|
|
{{ s__('GrafanaIntegration|Embed Grafana charts in GitLab issues.') }}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div class="settings-content">
|
|
|
|
<form>
|
|
|
|
<gl-form-checkbox
|
|
|
|
id="grafana-integration-enabled"
|
|
|
|
v-model="integrationEnabled"
|
|
|
|
class="mb-4"
|
|
|
|
>
|
|
|
|
{{ s__('GrafanaIntegration|Active') }}
|
|
|
|
</gl-form-checkbox>
|
|
|
|
<gl-form-group
|
|
|
|
:label="s__('GrafanaIntegration|Grafana URL')"
|
|
|
|
label-for="grafana-url"
|
|
|
|
:description="s__('GrafanaIntegration|Enter the base URL of the Grafana instance.')"
|
|
|
|
>
|
|
|
|
<gl-form-input id="grafana-url" v-model="localGrafanaUrl" :placeholder="placeholderUrl" />
|
|
|
|
</gl-form-group>
|
|
|
|
<gl-form-group :label="s__('GrafanaIntegration|API Token')" label-for="grafana-token">
|
|
|
|
<gl-form-input id="grafana-token" v-model="localGrafanaToken" />
|
|
|
|
<p class="form-text text-muted">
|
|
|
|
{{ s__('GrafanaIntegration|Enter the Grafana API Token.') }}
|
|
|
|
<a
|
|
|
|
href="https://grafana.com/docs/http_api/auth/#create-api-token"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
|
|
|
{{ __('More information') }}
|
|
|
|
<icon name="external-link" class="vertical-align-middle" />
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
</gl-form-group>
|
2020-04-22 19:07:51 +05:30
|
|
|
<gl-deprecated-button variant="success" @click="updateGrafanaIntegration">
|
2019-12-26 22:10:19 +05:30
|
|
|
{{ __('Save Changes') }}
|
2020-04-22 19:07:51 +05:30
|
|
|
</gl-deprecated-button>
|
2019-12-26 22:10:19 +05:30
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</template>
|