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/assets/javascripts | |
parent | c8df22c555ab707a705e57c4257fd3ed1ce7c3b0 (diff) | |
download | gitlab-ce-fc1df8c8307fc5022f9e8aae04164c089d8fdf2e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts')
5 files changed, 43 insertions, 20 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); |