summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/operation_settings/components/external_dashboard.vue
blob: ed518611d0b7238141a58345cd45d232b89aea3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<script>
import { mapState, mapActions } from 'vuex';
import { GlButton, GlFormGroup, GlFormInput, GlLink } from '@gitlab/ui';

export default {
  components: {
    GlButton,
    GlFormGroup,
    GlFormInput,
    GlLink,
  },
  computed: {
    ...mapState([
      'externalDashboardHelpPagePath',
      'externalDashboardUrl',
      'operationsSettingsEndpoint',
    ]),
    userDashboardUrl: {
      get() {
        return this.externalDashboardUrl;
      },
      set(url) {
        this.setExternalDashboardUrl(url);
      },
    },
  },
  methods: {
    ...mapActions(['setExternalDashboardUrl', 'updateExternalDashboardUrl']),
  },
};
</script>

<template>
  <section class="settings no-animate">
    <div class="settings-header">
      <h4 class="js-section-header">
        {{ s__('ExternalMetrics|External Dashboard') }}
      </h4>
      <gl-button class="js-settings-toggle">{{ __('Expand') }}</gl-button>
      <p class="js-section-sub-header">
        {{
          s__(
            'ExternalMetrics|Add a button to the metrics dashboard linking directly to your existing external dashboards.',
          )
        }}
        <gl-link :href="externalDashboardHelpPagePath">{{ __('Learn more') }}</gl-link>
      </p>
    </div>
    <div class="settings-content">
      <form>
        <gl-form-group
          :label="s__('ExternalMetrics|Full dashboard URL')"
          :description="s__('ExternalMetrics|Enter the URL of the dashboard you want to link to')"
        >
          <gl-form-input
            v-model="userDashboardUrl"
            placeholder="https://my-org.gitlab.io/my-dashboards"
            @keydown.enter.native.prevent="updateExternalDashboardUrl"
          />
        </gl-form-group>
        <gl-button variant="success" @click="updateExternalDashboardUrl">
          {{ __('Save Changes') }}
        </gl-button>
      </form>
    </div>
  </section>
</template>