From 76358aee81a471a5e71eaf3e8c2d91b7c9a0a5a9 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 8 Apr 2020 21:09:50 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../components/custom_metrics_form.vue | 96 +++++++ .../components/custom_metrics_form_fields.vue | 294 +++++++++++++++++++++ .../components/delete_custom_metric_modal.vue | 54 ++++ app/assets/javascripts/custom_metrics/constants.js | 12 + app/assets/javascripts/custom_metrics/index.js | 47 ++++ app/assets/javascripts/dropzone_input.js | 3 +- app/assets/javascripts/gl_form.js | 2 +- app/assets/javascripts/monitoring/constants.js | 6 + .../queries/getEnvironments.query.graphql | 4 +- .../javascripts/monitoring/stores/actions.js | 3 +- .../components/accessibility_issue_body.vue | 62 +++++ .../javascripts/reports/components/issue_body.js | 3 + app/assets/stylesheets/bootstrap_migration.scss | 10 - app/assets/stylesheets/framework/typography.scss | 10 - .../stylesheets/framework/variables_overrides.scss | 2 + app/helpers/groups_helper.rb | 2 +- app/uploaders/import_export_uploader.rb | 8 + app/views/layouts/nav/sidebar/_group.html.haml | 2 +- 18 files changed, 593 insertions(+), 27 deletions(-) create mode 100644 app/assets/javascripts/custom_metrics/components/custom_metrics_form.vue create mode 100644 app/assets/javascripts/custom_metrics/components/custom_metrics_form_fields.vue create mode 100644 app/assets/javascripts/custom_metrics/components/delete_custom_metric_modal.vue create mode 100644 app/assets/javascripts/custom_metrics/constants.js create mode 100644 app/assets/javascripts/custom_metrics/index.js create mode 100644 app/assets/javascripts/reports/accessibility_report/components/accessibility_issue_body.vue (limited to 'app') diff --git a/app/assets/javascripts/custom_metrics/components/custom_metrics_form.vue b/app/assets/javascripts/custom_metrics/components/custom_metrics_form.vue new file mode 100644 index 00000000000..e5c0d1e4970 --- /dev/null +++ b/app/assets/javascripts/custom_metrics/components/custom_metrics_form.vue @@ -0,0 +1,96 @@ + + diff --git a/app/assets/javascripts/custom_metrics/components/custom_metrics_form_fields.vue b/app/assets/javascripts/custom_metrics/components/custom_metrics_form_fields.vue new file mode 100644 index 00000000000..f5207b47f69 --- /dev/null +++ b/app/assets/javascripts/custom_metrics/components/custom_metrics_form_fields.vue @@ -0,0 +1,294 @@ + + + diff --git a/app/assets/javascripts/custom_metrics/components/delete_custom_metric_modal.vue b/app/assets/javascripts/custom_metrics/components/delete_custom_metric_modal.vue new file mode 100644 index 00000000000..34e4aeb290f --- /dev/null +++ b/app/assets/javascripts/custom_metrics/components/delete_custom_metric_modal.vue @@ -0,0 +1,54 @@ + + diff --git a/app/assets/javascripts/custom_metrics/constants.js b/app/assets/javascripts/custom_metrics/constants.js new file mode 100644 index 00000000000..2526445fdf9 --- /dev/null +++ b/app/assets/javascripts/custom_metrics/constants.js @@ -0,0 +1,12 @@ +export const queryTypes = { + business: 'business', + response: 'response', + system: 'system', +}; + +export const formDataValidator = val => { + const fieldNames = Object.keys(val); + const requiredFields = ['title', 'query', 'yLabel', 'unit', 'group', 'legend']; + + return requiredFields.every(name => fieldNames.includes(name)); +}; diff --git a/app/assets/javascripts/custom_metrics/index.js b/app/assets/javascripts/custom_metrics/index.js new file mode 100644 index 00000000000..4c279daf5f0 --- /dev/null +++ b/app/assets/javascripts/custom_metrics/index.js @@ -0,0 +1,47 @@ +import Vue from 'vue'; +import { parseBoolean } from '~/lib/utils/common_utils'; +import CustomMetricsForm from './components/custom_metrics_form.vue'; + +export default () => { + // eslint-disable-next-line no-new + new Vue({ + el: '#js-custom-metrics', + components: { + CustomMetricsForm, + }, + render(createElement) { + const domEl = document.querySelector(this.$options.el); + const { + customMetricsPath, + editProjectServicePath, + validateQueryPath, + title, + query, + yLabel, + unit, + group, + legend, + } = domEl.dataset; + let { metricPersisted } = domEl.dataset; + + metricPersisted = parseBoolean(metricPersisted); + + return createElement('custom-metrics-form', { + props: { + customMetricsPath, + metricPersisted, + editProjectServicePath, + validateQueryPath, + formData: { + title, + query, + yLabel, + unit, + group, + legend, + }, + }, + }); + }, + }); +}; diff --git a/app/assets/javascripts/dropzone_input.js b/app/assets/javascripts/dropzone_input.js index 6c158ad8990..f839e9acf04 100644 --- a/app/assets/javascripts/dropzone_input.js +++ b/app/assets/javascripts/dropzone_input.js @@ -23,7 +23,7 @@ function getErrorMessage(res) { return res.message; } -export default function dropzoneInput(form) { +export default function dropzoneInput(form, config = { parallelUploads: 2 }) { const divHover = '
'; const iconPaperclip = ''; const $attachButton = form.find('.button-attach-file'); @@ -69,6 +69,7 @@ export default function dropzoneInput(form) { uploadMultiple: false, headers: csrf.headers, previewContainer: false, + ...config, processing: () => $('.div-dropzone-alert').alert('close'), dragover: () => { $mdArea.addClass('is-dropzone-hover'); diff --git a/app/assets/javascripts/gl_form.js b/app/assets/javascripts/gl_form.js index a66555838ba..1811a942beb 100644 --- a/app/assets/javascripts/gl_form.js +++ b/app/assets/javascripts/gl_form.js @@ -45,7 +45,7 @@ export default class GLForm { ); this.autoComplete = new GfmAutoComplete(gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources); this.autoComplete.setup(this.form.find('.js-gfm-input'), this.enableGFM); - dropzoneInput(this.form); + dropzoneInput(this.form, { parallelUploads: 1 }); autosize(this.textarea); } // form and textarea event listeners diff --git a/app/assets/javascripts/monitoring/constants.js b/app/assets/javascripts/monitoring/constants.js index b2911bcae8f..e092c0ccae0 100644 --- a/app/assets/javascripts/monitoring/constants.js +++ b/app/assets/javascripts/monitoring/constants.js @@ -109,3 +109,9 @@ export const initialStateKeys = [...endpointKeys, 'currentEnvironmentName']; * Constant to indicate if a metric exists in the database */ export const NOT_IN_DB_PREFIX = 'NO_DB'; + +/** + * graphQL environments API value for active environments. + * Used as a value for the 'states' query filter + */ +export const ENVIRONMENT_AVAILABLE_STATE = 'available'; diff --git a/app/assets/javascripts/monitoring/queries/getEnvironments.query.graphql b/app/assets/javascripts/monitoring/queries/getEnvironments.query.graphql index fd3a4348509..17cd1b2c342 100644 --- a/app/assets/javascripts/monitoring/queries/getEnvironments.query.graphql +++ b/app/assets/javascripts/monitoring/queries/getEnvironments.query.graphql @@ -1,6 +1,6 @@ -query getEnvironments($projectPath: ID!, $search: String) { +query getEnvironments($projectPath: ID!, $search: String, $states: [String!]) { project(fullPath: $projectPath) { - data: environments(search: $search) { + data: environments(search: $search, states: $states) { environments: nodes { name id diff --git a/app/assets/javascripts/monitoring/stores/actions.js b/app/assets/javascripts/monitoring/stores/actions.js index acc09fa6305..8427a72a68e 100644 --- a/app/assets/javascripts/monitoring/stores/actions.js +++ b/app/assets/javascripts/monitoring/stores/actions.js @@ -10,7 +10,7 @@ import statusCodes from '../../lib/utils/http_status'; import { backOff, convertObjectPropsToCamelCase } from '../../lib/utils/common_utils'; import { s__, sprintf } from '../../locale'; -import { PROMETHEUS_TIMEOUT } from '../constants'; +import { PROMETHEUS_TIMEOUT, ENVIRONMENT_AVAILABLE_STATE } from '../constants'; function prometheusMetricQueryParams(timeRange) { const { start, end } = convertToFixedRange(timeRange); @@ -238,6 +238,7 @@ export const fetchEnvironmentsData = ({ state, dispatch }) => { variables: { projectPath: removeLeadingSlash(state.projectPath), search: state.environmentsSearchTerm, + states: [ENVIRONMENT_AVAILABLE_STATE], }, }) .then(resp => diff --git a/app/assets/javascripts/reports/accessibility_report/components/accessibility_issue_body.vue b/app/assets/javascripts/reports/accessibility_report/components/accessibility_issue_body.vue new file mode 100644 index 00000000000..6aae9195be1 --- /dev/null +++ b/app/assets/javascripts/reports/accessibility_report/components/accessibility_issue_body.vue @@ -0,0 +1,62 @@ + + diff --git a/app/assets/javascripts/reports/components/issue_body.js b/app/assets/javascripts/reports/components/issue_body.js index 8b5af263d50..e106e60951b 100644 --- a/app/assets/javascripts/reports/components/issue_body.js +++ b/app/assets/javascripts/reports/components/issue_body.js @@ -1,9 +1,12 @@ import TestIssueBody from './test_issue_body.vue'; +import AccessibilityIssueBody from '../accessibility_report/components/accessibility_issue_body.vue'; export const components = { + AccessibilityIssueBody, TestIssueBody, }; export const componentNames = { + AccessibilityIssueBody: AccessibilityIssueBody.name, TestIssueBody: TestIssueBody.name, }; diff --git a/app/assets/stylesheets/bootstrap_migration.scss b/app/assets/stylesheets/bootstrap_migration.scss index 875de57cfcc..ed5c133950d 100644 --- a/app/assets/stylesheets/bootstrap_migration.scss +++ b/app/assets/stylesheets/bootstrap_migration.scss @@ -41,16 +41,6 @@ html [type="button"], cursor: pointer; } -h1, -h2, -h3, -h4, -h5, -h6 { - color: $gl-text-color; - font-weight: 600; -} - h1, .h1, h2, diff --git a/app/assets/stylesheets/framework/typography.scss b/app/assets/stylesheets/framework/typography.scss index b2bbc09664c..69aed2fc20a 100644 --- a/app/assets/stylesheets/framework/typography.scss +++ b/app/assets/stylesheets/framework/typography.scss @@ -567,16 +567,6 @@ body { font-weight: $gl-font-weight-bold; } -h1, -h2, -h3, -h4, -h5, -h6 { - color: $gl-text-color; - font-weight: $gl-font-weight-bold; -} - .light-header { font-weight: $gl-font-weight-bold; } diff --git a/app/assets/stylesheets/framework/variables_overrides.scss b/app/assets/stylesheets/framework/variables_overrides.scss index 7538459c97b..ef75dabbda4 100644 --- a/app/assets/stylesheets/framework/variables_overrides.scss +++ b/app/assets/stylesheets/framework/variables_overrides.scss @@ -35,6 +35,8 @@ $h3-font-size: 14px * 1.75; $h4-font-size: 14px * 1.5; $h5-font-size: 14px * 1.25; $h6-font-size: 14px; +$headings-color: $gl-text-color; +$headings-font-weight: $gl-font-weight-bold; $spacer: $grid-size; $spacers: ( 0: 0, diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 0d7e2a7bd38..2cd685ddcd4 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -10,7 +10,7 @@ module GroupsHelper ] end - def group_nav_link_paths + def group_settings_nav_link_paths %w[ groups#projects groups#edit diff --git a/app/uploaders/import_export_uploader.rb b/app/uploaders/import_export_uploader.rb index b0e6464f5b1..369afba2bae 100644 --- a/app/uploaders/import_export_uploader.rb +++ b/app/uploaders/import_export_uploader.rb @@ -14,4 +14,12 @@ class ImportExportUploader < AttachmentUploader def move_to_cache false end + + def work_dir + File.join(Settings.shared['path'], 'tmp', 'work') + end + + def cache_dir + File.join(Settings.shared['path'], 'tmp', 'cache') + end end diff --git a/app/views/layouts/nav/sidebar/_group.html.haml b/app/views/layouts/nav/sidebar/_group.html.haml index 89bcccb6185..8115c713a4f 100644 --- a/app/views/layouts/nav/sidebar/_group.html.haml +++ b/app/views/layouts/nav/sidebar/_group.html.haml @@ -133,7 +133,7 @@ = _('Members') - if group_sidebar_link?(:settings) - = nav_link(path: group_nav_link_paths) do + = nav_link(path: group_settings_nav_link_paths) do = link_to edit_group_path(@group) do .nav-icon-container = sprite_icon('settings') -- cgit v1.2.3