diff options
Diffstat (limited to 'app')
12 files changed, 41 insertions, 8 deletions
diff --git a/app/assets/javascripts/grafana_integration/components/grafana_integration.vue b/app/assets/javascripts/grafana_integration/components/grafana_integration.vue index 2d3212429db..35135792c5b 100644 --- a/app/assets/javascripts/grafana_integration/components/grafana_integration.vue +++ b/app/assets/javascripts/grafana_integration/components/grafana_integration.vue @@ -1,11 +1,12 @@ <script> -import { GlButton, GlFormGroup, GlFormInput, GlLink } from '@gitlab/ui'; +import { GlButton, GlFormGroup, GlFormInput, GlFormCheckbox, GlLink } from '@gitlab/ui'; import Icon from '~/vue_shared/components/icon.vue'; import { mapState, mapActions } from 'vuex'; export default { components: { GlButton, + GlFormCheckbox, GlFormGroup, GlFormInput, GlLink, @@ -15,7 +16,15 @@ export default { return { placeholderUrl: 'https://my-url.grafana.net/my-dashboard' }; }, computed: { - ...mapState(['operationsSettingsEndpoint', 'grafanaToken', 'grafanaUrl']), + ...mapState(['operationsSettingsEndpoint', 'grafanaToken', 'grafanaUrl', 'grafanaEnabled']), + integrationEnabled: { + get() { + return this.grafanaEnabled; + }, + set(grafanaEnabled) { + this.setGrafanaEnabled(grafanaEnabled); + }, + }, localGrafanaToken: { get() { return this.grafanaToken; @@ -34,7 +43,12 @@ export default { }, }, methods: { - ...mapActions(['setGrafanaUrl', 'setGrafanaToken', 'updateGrafanaIntegration']), + ...mapActions([ + 'setGrafanaUrl', + 'setGrafanaToken', + 'setGrafanaEnabled', + 'updateGrafanaIntegration', + ]), }, }; </script> @@ -52,6 +66,13 @@ export default { </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" diff --git a/app/assets/javascripts/grafana_integration/index.js b/app/assets/javascripts/grafana_integration/index.js index 58c28e09f80..a93edab4388 100644 --- a/app/assets/javascripts/grafana_integration/index.js +++ b/app/assets/javascripts/grafana_integration/index.js @@ -4,7 +4,6 @@ import GrafanaIntegration from './components/grafana_integration.vue'; export default () => { const el = document.querySelector('.js-grafana-integration'); - return new Vue({ el, store: store(el.dataset), diff --git a/app/assets/javascripts/grafana_integration/store/actions.js b/app/assets/javascripts/grafana_integration/store/actions.js index 98085fdcb2d..d83f1e0831c 100644 --- a/app/assets/javascripts/grafana_integration/store/actions.js +++ b/app/assets/javascripts/grafana_integration/store/actions.js @@ -9,6 +9,9 @@ export const setGrafanaUrl = ({ commit }, url) => commit(mutationTypes.SET_GRAFA export const setGrafanaToken = ({ commit }, token) => commit(mutationTypes.SET_GRAFANA_TOKEN, token); +export const setGrafanaEnabled = ({ commit }, enabled) => + commit(mutationTypes.SET_GRAFANA_ENABLED, enabled); + export const updateGrafanaIntegration = ({ state, dispatch }) => axios .patch(state.operationsSettingsEndpoint, { @@ -16,6 +19,7 @@ export const updateGrafanaIntegration = ({ state, dispatch }) => grafana_integration_attributes: { grafana_url: state.grafanaUrl, token: state.grafanaToken, + enabled: state.grafanaEnabled, }, }, }) diff --git a/app/assets/javascripts/grafana_integration/store/mutation_types.js b/app/assets/javascripts/grafana_integration/store/mutation_types.js index 33ce3228823..314c3a4039a 100644 --- a/app/assets/javascripts/grafana_integration/store/mutation_types.js +++ b/app/assets/javascripts/grafana_integration/store/mutation_types.js @@ -1,2 +1,3 @@ export const SET_GRAFANA_URL = 'SET_GRAFANA_URL'; export const SET_GRAFANA_TOKEN = 'SET_GRAFANA_TOKEN'; +export const SET_GRAFANA_ENABLED = 'SET_GRAFANA_ENABLED'; diff --git a/app/assets/javascripts/grafana_integration/store/mutations.js b/app/assets/javascripts/grafana_integration/store/mutations.js index e8d63a9a732..0992030d404 100644 --- a/app/assets/javascripts/grafana_integration/store/mutations.js +++ b/app/assets/javascripts/grafana_integration/store/mutations.js @@ -7,4 +7,7 @@ export default { [types.SET_GRAFANA_TOKEN](state, token) { state.grafanaToken = token; }, + [types.SET_GRAFANA_ENABLED](state, enabled) { + state.grafanaEnabled = enabled; + }, }; diff --git a/app/assets/javascripts/grafana_integration/store/state.js b/app/assets/javascripts/grafana_integration/store/state.js index c25742c82bc..a912eb58327 100644 --- a/app/assets/javascripts/grafana_integration/store/state.js +++ b/app/assets/javascripts/grafana_integration/store/state.js @@ -1,5 +1,8 @@ +import { parseBoolean } from '~/lib/utils/common_utils'; + export default (initialState = {}) => ({ operationsSettingsEndpoint: initialState.operationsSettingsEndpoint, grafanaToken: initialState.grafanaIntegrationToken || '', grafanaUrl: initialState.grafanaIntegrationUrl || '', + grafanaEnabled: parseBoolean(initialState.grafanaIntegrationEnabled) || false, }); diff --git a/app/assets/javascripts/reports/components/issue_status_icon.vue b/app/assets/javascripts/reports/components/issue_status_icon.vue index 386653b9444..62a9338b864 100644 --- a/app/assets/javascripts/reports/components/issue_status_icon.vue +++ b/app/assets/javascripts/reports/components/issue_status_icon.vue @@ -50,6 +50,6 @@ export default { }" class="report-block-list-icon" > - <icon :name="iconName" :size="statusIconSize" /> + <icon :name="iconName" :size="statusIconSize" :data-qa-selector="`status_${status}_icon`" /> </div> </template> diff --git a/app/assets/javascripts/reports/components/report_item.vue b/app/assets/javascripts/reports/components/report_item.vue index f3f7d2648a8..3c8a9e6ebef 100644 --- a/app/assets/javascripts/reports/components/report_item.vue +++ b/app/assets/javascripts/reports/components/report_item.vue @@ -46,6 +46,7 @@ export default { <li :class="{ 'is-dismissed': issue.isDismissed }" class="report-block-list-issue align-items-center" + data-qa-selector="report_item_row" > <issue-status-icon v-if="showReportSectionStatusIcon" diff --git a/app/assets/stylesheets/utilities.scss b/app/assets/stylesheets/utilities.scss index 4a0b6ac1ddd..f53b6fbb1e7 100644 --- a/app/assets/stylesheets/utilities.scss +++ b/app/assets/stylesheets/utilities.scss @@ -27,3 +27,4 @@ .border-style-solid { border-style: solid; } .border-color-blue-300 { border-color: $blue-300; } .border-color-default { border-color: $border-color; } +.box-shadow-default { box-shadow: 0 2px 4px 0 $black-transparent; } diff --git a/app/policies/personal_snippet_policy.rb b/app/policies/personal_snippet_policy.rb index 67c66e42d79..91a8f3a7133 100644 --- a/app/policies/personal_snippet_policy.rb +++ b/app/policies/personal_snippet_policy.rb @@ -10,7 +10,7 @@ class PersonalSnippetPolicy < BasePolicy enable :create_note end - rule { is_author }.policy do + rule { is_author | admin }.policy do enable :read_personal_snippet enable :update_personal_snippet enable :destroy_personal_snippet diff --git a/app/views/projects/settings/operations/_grafana_integration.html.haml b/app/views/projects/settings/operations/_grafana_integration.html.haml index ae90b6dd5aa..cd5b5abd9ce 100644 --- a/app/views/projects/settings/operations/_grafana_integration.html.haml +++ b/app/views/projects/settings/operations/_grafana_integration.html.haml @@ -1,2 +1,2 @@ .js-grafana-integration{ data: { operations_settings_endpoint: project_settings_operations_path(@project), - grafana_integration: { url: grafana_integration_url, token: grafana_integration_token } } } + grafana_integration: { url: grafana_integration_url, token: grafana_integration_token, enabled: grafana_integration_enabled?.to_s } } } diff --git a/app/views/shared/projects/_list.html.haml b/app/views/shared/projects/_list.html.haml index d70a1631010..59b4facdbe5 100644 --- a/app/views/shared/projects/_list.html.haml +++ b/app/views/shared/projects/_list.html.haml @@ -32,7 +32,7 @@ - explore_groups_button_label = _('Explore groups') - explore_groups_button_link = explore_groups_path -.js-projects-list-holder +.js-projects-list-holder{ data: { qa_selector: 'projects_list' } } - if any_projects?(projects) - load_pipeline_status(projects) if pipeline_status %ul.projects-list{ class: css_classes } |