diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 09:09:20 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 09:09:20 +0000 |
commit | fc1df8c8307fc5022f9e8aae04164c089d8fdf2e (patch) | |
tree | a759f58abf9e41200c48a60de73c84cab47a250d /app | |
parent | c8df22c555ab707a705e57c4257fd3ed1ce7c3b0 (diff) | |
download | gitlab-ce-fc1df8c8307fc5022f9e8aae04164c089d8fdf2e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
9 files changed, 225 insertions, 218 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index dc6ea148047..022d79ecf49 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -1,5 +1,3 @@ -import $ from 'jquery'; -import _ from 'underscore'; import axios from './lib/utils/axios_utils'; import { joinPaths } from './lib/utils/url_utility'; import flash from '~/flash'; @@ -70,7 +68,7 @@ const Api = { }, // Return groups list. Filtered by query - groups(query, options, callback = $.noop) { + groups(query, options, callback = () => {}) { const url = Api.buildUrl(Api.groupsPath); return axios .get(url, { @@ -108,7 +106,7 @@ const Api = { }, // Return projects list. Filtered by query - projects(query, options, callback = _.noop) { + projects(query, options, callback = () => {}) { const url = Api.buildUrl(Api.projectsPath); const defaults = { search: query, diff --git a/app/assets/javascripts/environments/components/enable_review_app_button.vue b/app/assets/javascripts/environments/components/enable_review_app_button.vue index 2f9e9cb628f..8fbbc5189bf 100644 --- a/app/assets/javascripts/environments/components/enable_review_app_button.vue +++ b/app/assets/javascripts/environments/components/enable_review_app_button.vue @@ -26,15 +26,17 @@ export default { modalInfo: { closeText: s__('EnableReviewApp|Close'), copyToClipboardText: s__('EnableReviewApp|Copy snippet text'), - copyString: `deploy_review + copyString: `deploy_review: stage: deploy script: - echo "Deploy a review app" environment: name: review/$CI_COMMIT_REF_NAME url: https://$CI_ENVIRONMENT_SLUG.example.com - only: branches - except: master`, + only: + - branches + except: + - master`, id: 'enable-review-app-info', title: s__('ReviewApp|Enable Review App'), }, diff --git a/app/assets/javascripts/ide/components/commit_sidebar/list.vue b/app/assets/javascripts/ide/components/commit_sidebar/list.vue index 2e273d45506..a15e22d4742 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/list.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/list.vue @@ -94,7 +94,7 @@ export default { data-boundary="viewport" @click="openDiscardModal" > - <icon :size="16" name="remove-all" class="ml-auto mr-auto" /> + <icon :size="16" name="remove-all" class="ml-auto mr-auto position-top-0" /> </button> </div> </div> diff --git a/app/assets/javascripts/ide/components/pipelines/list.vue b/app/assets/javascripts/ide/components/pipelines/list.vue index b61d0a47795..3a63fc32639 100644 --- a/app/assets/javascripts/ide/components/pipelines/list.vue +++ b/app/assets/javascripts/ide/components/pipelines/list.vue @@ -59,7 +59,7 @@ export default { <gl-loading-icon v-if="showLoadingIcon" :size="2" class="prepend-top-default" /> <template v-else-if="hasLoadedPipeline"> <header v-if="latestPipeline" class="ide-tree-header ide-pipeline-header"> - <ci-icon :status="latestPipeline.details.status" :size="24" /> + <ci-icon :status="latestPipeline.details.status" :size="24" class="d-flex" /> <span class="prepend-left-8"> <strong> {{ __('Pipeline') }} </strong> <a @@ -76,6 +76,7 @@ export default { :help-page-path="links.ciHelpPagePath" :empty-state-svg-path="pipelinesEmptyStateSvgPath" :can-set-ci="true" + class="mb-auto mt-auto" /> <div v-else-if="latestPipeline.yamlError" class="bs-callout bs-callout-danger"> <p class="append-bottom-0">{{ __('Found errors in your .gitlab-ci.yml:') }}</p> diff --git a/app/assets/javascripts/lib/utils/icon_utils.js b/app/assets/javascripts/lib/utils/icon_utils.js index 7b8dd9bbef7..97ee773358d 100644 --- a/app/assets/javascripts/lib/utils/icon_utils.js +++ b/app/assets/javascripts/lib/utils/icon_utils.js @@ -1,18 +1,40 @@ -/* eslint-disable import/prefer-default-export */ - +import { memoize } from 'lodash'; import axios from '~/lib/utils/axios_utils'; /** - * Retrieve SVG icon path content from gitlab/svg sprite icons - * @param {String} name + * Resolves to a DOM that contains GitLab icons + * in svg format. Memoized to avoid duplicate requests */ -export const getSvgIconPathContent = name => +const getSvgDom = memoize(() => axios .get(gon.sprite_icons) - .then(({ data: svgs }) => - new DOMParser() - .parseFromString(svgs, 'text/xml') - .querySelector(`#${name} path`) - .getAttribute('d'), - ) + .then(({ data: svgs }) => new DOMParser().parseFromString(svgs, 'text/xml')) + .catch(() => { + getSvgDom.cache.clear(); + }), +); + +/** + * Clears the memoized SVG content. + * + * You probably don't need to invoke this function unless + * sprite_icons are updated. + */ +export const clearSvgIconPathContentCache = () => { + getSvgDom.cache.clear(); +}; + +/** + * Retrieve SVG icon path content from gitlab/svg sprite icons. + * + * Content loaded is cached. + * + * @param {String} name - Icon name + * @returns A promise that resolves to the svg path + */ +export const getSvgIconPathContent = name => + getSvgDom() + .then(doc => { + return doc.querySelector(`#${name} path`).getAttribute('d'); + }) .catch(() => null); diff --git a/app/assets/stylesheets/page_bundles/_ide_monaco_overrides.scss b/app/assets/stylesheets/page_bundles/_ide_monaco_overrides.scss new file mode 100644 index 00000000000..c47901dc177 --- /dev/null +++ b/app/assets/stylesheets/page_bundles/_ide_monaco_overrides.scss @@ -0,0 +1,146 @@ + +// stylelint-disable selector-class-pattern +// stylelint-disable selector-max-compound-selectors +// stylelint-disable stylelint-gitlab/duplicate-selectors +// stylelint-disable stylelint-gitlab/utility-classes + +.blob-editor-container { + flex: 1; + height: 0; + display: flex; + flex-direction: column; + justify-content: center; + + .vertical-center { + min-height: auto; + } + + .monaco-editor .lines-content .cigr { + display: none; + } + + .monaco-editor .selected-text { + z-index: 1; + } + + .monaco-editor .view-lines { + z-index: 2; + } + + .is-readonly, + .editor.original { + .view-lines { + cursor: default; + } + + .cursors-layer { + display: none; + } + } + + .is-deleted { + .editor.modified { + .margin-view-overlays, + .lines-content, + .decorationsOverviewRuler { + // !important to override monaco inline styles + display: none !important; + } + } + + .diffOverviewRuler.modified { + // !important to override monaco inline styles + display: none !important; + } + } + + .is-added { + .editor.original { + .margin-view-overlays, + .lines-content, + .decorationsOverviewRuler { + // !important to override monaco inline styles + display: none !important; + } + } + + .diffOverviewRuler.original { + // !important to override monaco inline styles + display: none !important; + } + } + + .monaco-diff-editor.vs { + .editor.modified { + box-shadow: none; + } + + .diagonal-fill { + display: none !important; + } + + .diffOverview { + background-color: $white-light; + border-left: 1px solid $white-dark; + cursor: ns-resize; + } + + .diffViewport { + display: none; + } + + .char-insert { + background-color: $line-added-dark; + } + + .char-delete { + background-color: $line-removed-dark; + } + + .line-numbers { + color: $black-transparent; + } + + .view-overlays { + .line-insert { + background-color: $line-added; + } + + .line-delete { + background-color: $line-removed; + } + } + + .margin { + background-color: $white-light; + border-right: 1px solid $gray-100; + + .line-insert { + border-right: 1px solid $line-added-dark; + } + + .line-delete { + border-right: 1px solid $line-removed-dark; + } + } + + .margin-view-overlays .insert-sign, + .margin-view-overlays .delete-sign { + opacity: 0.4; + } + } +} + +.multi-file-editor-holder { + height: 100%; + min-height: 0; // firefox fix + + &.is-readonly .vs, + .vs .editor.original { + .monaco-editor, + .monaco-editor-background, + .monaco-editor .inputarea.ime-input { + background-color: $gray-50; + } + } +} diff --git a/app/assets/stylesheets/page_bundles/ide.scss b/app/assets/stylesheets/page_bundles/ide.scss index a748c669ee8..c37f75d1533 100644 --- a/app/assets/stylesheets/page_bundles/ide.scss +++ b/app/assets/stylesheets/page_bundles/ide.scss @@ -1,6 +1,7 @@ @import 'framework/variables'; @import 'framework/mixins'; @import './ide_mixins'; +@import './ide_monaco_overrides'; $search-list-icon-width: 18px; $ide-activity-bar-width: 60px; @@ -16,11 +17,6 @@ $ide-commit-header-height: 48px; display: inline-block; } -.fade-enter, -.fade-leave-to { - opacity: 0; -} - .commit-message { @include str-truncated(250px); } @@ -49,10 +45,6 @@ $ide-commit-header-height: 48px; flex-direction: column; flex: 1; min-height: 0; // firefox fix - - a { - color: $gl-text-color; - } } .multi-file-loading-container { @@ -160,157 +152,6 @@ $ide-commit-header-height: 48px; height: 0; } -// stylelint-disable selector-class-pattern -// stylelint-disable selector-max-compound-selectors -// stylelint-disable stylelint-gitlab/duplicate-selectors -// stylelint-disable stylelint-gitlab/utility-classes - -.blob-editor-container { - flex: 1; - height: 0; - display: flex; - flex-direction: column; - justify-content: center; - - .vertical-center { - min-height: auto; - } - - .monaco-editor .lines-content .cigr { - display: none; - } - - .monaco-editor .selected-text { - z-index: 1; - } - - .monaco-editor .view-lines { - z-index: 2; - } - - .is-readonly, - .editor.original { - .view-lines { - cursor: default; - } - - .cursors-layer { - display: none; - } - } - - .is-deleted { - .editor.modified { - .margin-view-overlays, - .lines-content, - .decorationsOverviewRuler { - // !important to override monaco inline styles - display: none !important; - } - } - - .diffOverviewRuler.modified { - // !important to override monaco inline styles - display: none !important; - } - } - - .is-added { - .editor.original { - .margin-view-overlays, - .lines-content, - .decorationsOverviewRuler { - // !important to override monaco inline styles - display: none !important; - } - } - - .diffOverviewRuler.original { - // !important to override monaco inline styles - display: none !important; - } - } - - .monaco-diff-editor.vs { - .editor.modified { - box-shadow: none; - } - - .diagonal-fill { - display: none !important; - } - - .diffOverview { - background-color: $white-light; - border-left: 1px solid $white-dark; - cursor: ns-resize; - } - - .diffViewport { - display: none; - } - - .char-insert { - background-color: $line-added-dark; - } - - .char-delete { - background-color: $line-removed-dark; - } - - .line-numbers { - color: $black-transparent; - } - - .view-overlays { - .line-insert { - background-color: $line-added; - } - - .line-delete { - background-color: $line-removed; - } - } - - .margin { - background-color: $white-light; - border-right: 1px solid $gray-100; - - .line-insert { - border-right: 1px solid $line-added-dark; - } - - .line-delete { - border-right: 1px solid $line-removed-dark; - } - } - - .margin-view-overlays .insert-sign, - .margin-view-overlays .delete-sign { - opacity: 0.4; - } - } -} - -.multi-file-editor-holder { - height: 100%; - min-height: 0; // firefox fix - - &.is-readonly .vs, - .vs .editor.original { - .monaco-editor, - .monaco-editor-background, - .monaco-editor .inputarea.ime-input { - background-color: $gray-50; - } - } -} - -// stylelint-enable selector-class-pattern -// stylelint-enable selector-max-compound-selectors -// stylelint-enable stylelint-gitlab/duplicate-selectors -// stylelint-enable stylelint-gitlab/utility-classes - .preview-container { flex-grow: 1; position: relative; @@ -671,10 +512,6 @@ $ide-commit-header-height: 48px; width: $ide-commit-row-height; height: $ide-commit-row-height; color: inherit; - - > svg { - top: 0; - } } .ide-commit-file-count { @@ -864,39 +701,39 @@ $ide-commit-header-height: 48px; margin-left: auto; } - .ide-nav-dropdown { - width: 100%; - margin-bottom: 12px; + button { + color: $gl-text-color; + } +} - .dropdown-menu { - width: 385px; - max-height: initial; - } +.ide-nav-dropdown { + width: 100%; + margin-bottom: 12px; - .dropdown-menu-toggle { - svg { - vertical-align: middle; - color: $gray-700; + .dropdown-menu { + width: 385px; + max-height: initial; + } - &:hover { - color: $gray-700; - } - } + .dropdown-menu-toggle { + svg { + vertical-align: middle; + color: $gray-700; &:hover { - background-color: $white-normal; + color: $gray-700; } } - &.show { - .dropdown-menu-toggle { - background-color: $white-dark; - } + &:hover { + background-color: $white-normal; } } - button { - color: $gl-text-color; + &.show { + .dropdown-menu-toggle { + background-color: $white-dark; + } } } @@ -945,6 +782,8 @@ $ide-commit-header-height: 48px; transform: translateY(0); } +.fade-enter, +.fade-leave-to, .commit-form-slide-up-enter, .commit-form-slide-up-leave-to { opacity: 0; @@ -1063,9 +902,6 @@ $ide-commit-header-height: 48px; @include ide-trace-view(); .empty-state { - margin-top: auto; - margin-bottom: auto; - p { margin: $grid-size 0; text-align: center; @@ -1092,10 +928,6 @@ $ide-commit-header-height: 48px; min-height: 55px; padding-left: $gl-padding; padding-right: $gl-padding; - - .ci-status-icon { - display: flex; - } } .ide-job-item { @@ -1135,7 +967,7 @@ $ide-commit-header-height: 48px; } .ide-nav-form { - .nav-links li { + li { width: 50%; padding-left: 0; padding-right: 0; @@ -1222,10 +1054,6 @@ $ide-commit-header-height: 48px; background-color: $blue-500; outline: 0; } - - svg { - fill: currentColor; - } } .ide-new-btn { diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index 8a0f44b4e93..1b9f5971f73 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -241,6 +241,10 @@ module SystemNoteService def zoom_link_removed(issue, project, author) ::SystemNotes::ZoomService.new(noteable: issue, project: project, author: author).zoom_link_removed end + + def auto_resolve_prometheus_alert(noteable, project, author) + ::SystemNotes::IssuablesService.new(noteable: noteable, project: project, author: author).auto_resolve_prometheus_alert + end end SystemNoteService.prepend_if_ee('EE::SystemNoteService') diff --git a/app/services/system_notes/issuables_service.rb b/app/services/system_notes/issuables_service.rb index b555760f88e..275c64bea89 100644 --- a/app/services/system_notes/issuables_service.rb +++ b/app/services/system_notes/issuables_service.rb @@ -288,6 +288,12 @@ module SystemNotes create_note(NoteSummary.new(noteable, project, author, body, action: 'closed')) end + def auto_resolve_prometheus_alert + body = 'automatically closed this issue because the alert resolved.' + + create_note(NoteSummary.new(noteable, project, author, body, action: 'closed')) + end + private def cross_reference_note_content(gfm_reference) |