diff options
Diffstat (limited to 'app/assets')
48 files changed, 306 insertions, 536 deletions
diff --git a/app/assets/javascripts/blob/template_selector.js b/app/assets/javascripts/blob/template_selector.js index 9e69c7d7164..37e348d93d3 100644 --- a/app/assets/javascripts/blob/template_selector.js +++ b/app/assets/javascripts/blob/template_selector.js @@ -1,4 +1,4 @@ -/* eslint-disable class-methods-use-this */ +/* eslint-disable class-methods-use-this, no-unused-vars */ import $ from 'jquery'; @@ -61,7 +61,7 @@ export default class TemplateSelector { return this.requestFile(item); } - requestFile() { + requestFile(item) { // This `requestFile` method is an abstract method that should // be added by all subclasses. } diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js index 28850710f80..d386960f3b6 100644 --- a/app/assets/javascripts/clusters/clusters_bundle.js +++ b/app/assets/javascripts/clusters/clusters_bundle.js @@ -111,15 +111,25 @@ export default class Clusters { this.initApplications(clusterType); this.initEnvironments(); - if (clusterEnvironmentsPath) { - this.fetchEnvironments(); + if (clusterEnvironmentsPath && this.environments) { + this.store.toggleFetchEnvironments(true); + + this.initPolling( + 'fetchClusterEnvironments', + data => this.handleClusterEnvironmentsSuccess(data), + () => this.handleEnvironmentsPollError(), + ); } this.updateContainer(null, this.store.state.status, this.store.state.statusReason); this.addListeners(); if (statusPath && !this.environments) { - this.initPolling(); + this.initPolling( + 'fetchClusterStatus', + data => this.handleClusterStatusSuccess(data), + () => this.handlePollError(), + ); } } @@ -179,16 +189,9 @@ export default class Clusters { }); } - fetchEnvironments() { - this.store.toggleFetchEnvironments(true); - - this.service - .fetchClusterEnvironments() - .then(data => { - this.store.toggleFetchEnvironments(false); - this.store.updateEnvironments(data.data); - }) - .catch(() => Clusters.handleError()); + handleClusterEnvironmentsSuccess(data) { + this.store.toggleFetchEnvironments(false); + this.store.updateEnvironments(data.data); } static initDismissableCallout() { @@ -224,21 +227,16 @@ export default class Clusters { eventHub.$off('uninstallApplication'); } - initPolling() { + initPolling(method, successCallback, errorCallback) { this.poll = new Poll({ resource: this.service, - method: 'fetchData', - successCallback: data => this.handleSuccess(data), - errorCallback: () => Clusters.handleError(), + method, + successCallback, + errorCallback, }); if (!Visibility.hidden()) { this.poll.makeRequest(); - } else { - this.service - .fetchData() - .then(data => this.handleSuccess(data)) - .catch(() => Clusters.handleError()); } Visibility.change(() => { @@ -250,11 +248,21 @@ export default class Clusters { }); } + handlePollError() { + this.constructor.handleError(); + } + + handleEnvironmentsPollError() { + this.store.toggleFetchEnvironments(false); + + this.handlePollError(); + } + static handleError() { Flash(s__('ClusterIntegration|Something went wrong on our end.')); } - handleSuccess(data) { + handleClusterStatusSuccess(data) { const prevStatus = this.store.state.status; const prevApplicationMap = Object.assign({}, this.store.state.applications); diff --git a/app/assets/javascripts/clusters/services/clusters_service.js b/app/assets/javascripts/clusters/services/clusters_service.js index 9139e0beafb..fa12802b3de 100644 --- a/app/assets/javascripts/clusters/services/clusters_service.js +++ b/app/assets/javascripts/clusters/services/clusters_service.js @@ -17,7 +17,7 @@ export default class ClusterService { }; } - fetchData() { + fetchClusterStatus() { return axios.get(this.options.endpoint); } diff --git a/app/assets/javascripts/clusters/stores/clusters_store.js b/app/assets/javascripts/clusters/stores/clusters_store.js index a032f589ee4..5cddb4cc098 100644 --- a/app/assets/javascripts/clusters/stores/clusters_store.js +++ b/app/assets/javascripts/clusters/stores/clusters_store.js @@ -218,6 +218,7 @@ export default class ClusterStore { environmentPath: environment.environment_path, lastDeployment: environment.last_deployment, rolloutStatus: { + status: environment.rollout_status ? environment.rollout_status.status : null, instances: environment.rollout_status ? environment.rollout_status.instances : [], }, updatedAt: environment.updated_at, diff --git a/app/assets/javascripts/commit/image_file.js b/app/assets/javascripts/commit/image_file.js index 9454f760df8..bc666aef54b 100644 --- a/app/assets/javascripts/commit/image_file.js +++ b/app/assets/javascripts/commit/image_file.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, no-var, prefer-arrow-callback, no-else-return, consistent-return, prefer-template, one-var, no-return-assign, no-unused-expressions, no-sequences */ +/* eslint-disable func-names, no-var, prefer-arrow-callback, no-else-return, consistent-return, prefer-template, one-var, no-unused-vars, no-return-assign, no-unused-expressions, no-sequences */ import $ from 'jquery'; @@ -12,8 +12,11 @@ export default class ImageFile { this.requestImageInfo( $('.two-up.view .frame.deleted img', this.file), (function(_this) { - return function() { - return _this.requestImageInfo($('.two-up.view .frame.added img', _this.file), function() { + return function(deletedWidth, deletedHeight) { + return _this.requestImageInfo($('.two-up.view .frame.added img', _this.file), function( + width, + height, + ) { _this.initViewModes(); // Load two-up view after images are loaded @@ -109,7 +112,7 @@ export default class ImageFile { maxHeight = 0; $('.frame', view) .each( - (function() { + (function(_this) { return function(index, frame) { var height, width; width = $(frame).width(); @@ -193,7 +196,13 @@ export default class ImageFile { return $('.onion-skin.view', this.file).each( (function(_this) { return function(index, view) { - var $frame, $track, $dragger, $frameAdded, framePadding, ref; + var $frame, + $track, + $dragger, + $frameAdded, + framePadding, + ref, + dragging = false; (ref = _this.prepareFrames(view)), ([maxWidth, maxHeight] = ref); $frame = $('.onion-skin-frame', view); $frameAdded = $('.frame.added', view); diff --git a/app/assets/javascripts/create_cluster/eks_cluster/components/cluster_form_dropdown.vue b/app/assets/javascripts/create_cluster/eks_cluster/components/cluster_form_dropdown.vue deleted file mode 100644 index f9465da6fda..00000000000 --- a/app/assets/javascripts/create_cluster/eks_cluster/components/cluster_form_dropdown.vue +++ /dev/null @@ -1,182 +0,0 @@ -<script> -import DropdownSearchInput from '~/vue_shared/components/dropdown/dropdown_search_input.vue'; -import DropdownHiddenInput from '~/vue_shared/components/dropdown/dropdown_hidden_input.vue'; -import DropdownButton from '~/vue_shared/components/dropdown/dropdown_button.vue'; - -export default { - components: { - DropdownButton, - DropdownSearchInput, - DropdownHiddenInput, - }, - props: { - fieldName: { - type: String, - required: false, - default: '', - }, - placeholder: { - type: String, - required: false, - default: '', - }, - defaultValue: { - type: String, - required: false, - default: '', - }, - value: { - type: Object, - required: false, - default: () => null, - }, - labelProperty: { - type: String, - required: false, - default: 'name', - }, - valueProperty: { - type: String, - required: false, - default: 'value', - }, - items: { - type: Array, - required: false, - default: () => [], - }, - loading: { - type: Boolean, - required: false, - default: false, - }, - disabled: { - type: Boolean, - required: false, - default: false, - }, - loadingText: { - type: String, - required: false, - default: '', - }, - disabledText: { - type: String, - required: false, - default: '', - }, - hasErrors: { - type: Boolean, - required: false, - default: false, - }, - errorMessage: { - type: String, - required: false, - default: '', - }, - searchFieldPlaceholder: { - type: String, - required: false, - default: '', - }, - emptyText: { - type: String, - required: false, - default: '', - }, - searchFn: { - type: Function, - required: false, - default: searchQuery => item => item.name.toLowerCase().indexOf(searchQuery) > -1, - }, - }, - data() { - return { - searchQuery: '', - selectedItem: null, - }; - }, - computed: { - toggleText() { - if (this.loading && this.loadingText) { - return this.loadingText; - } - - if (this.disabled && this.disabledText) { - return this.disabledText; - } - - if (!this.selectedItem) { - return this.placeholder; - } - - return this.selectedItemLabel; - }, - results() { - if (!this.items) { - return []; - } - - return this.items.filter(this.searchFn(this.searchQuery)); - }, - selectedItemLabel() { - return this.selectedItem && this.selectedItem[this.labelProperty]; - }, - selectedItemValue() { - return (this.selectedItem && this.selectedItem[this.valueProperty]) || ''; - }, - }, - methods: { - select(item) { - this.selectedItem = item; - this.$emit('input', item); - }, - }, -}; -</script> - -<template> - <div> - <div class="js-gcp-machine-type-dropdown dropdown"> - <dropdown-hidden-input :name="fieldName" :value="selectedItemValue" /> - <dropdown-button - :class="{ 'border-danger': hasErrors }" - :is-disabled="disabled" - :is-loading="loading" - :toggle-text="toggleText" - /> - <div class="dropdown-menu dropdown-select"> - <dropdown-search-input v-model="searchQuery" :placeholder-text="searchFieldPlaceholder" /> - <div class="dropdown-content"> - <ul> - <li v-if="!results.length"> - <span class="js-empty-text menu-item"> - {{ emptyText }} - </span> - </li> - <li v-for="item in results" :key="item.id"> - <button class="js-dropdown-item" type="button" @click.prevent="select(item)"> - <slot name="item" :item="item"> - {{ item.name }} - </slot> - </button> - </li> - </ul> - </div> - </div> - </div> - <span - v-if="hasErrors && errorMessage" - :class="[ - 'form-text js-eks-dropdown-error-message', - { - 'text-danger': hasErrors, - 'text-muted': !hasErrors, - }, - ]" - > - {{ errorMessage }} - </span> - </div> -</template> diff --git a/app/assets/javascripts/create_cluster/eks_cluster/components/eks_cluster_configuration_form.vue b/app/assets/javascripts/create_cluster/eks_cluster/components/eks_cluster_configuration_form.vue index 6e74963dcb0..1ec45c8b651 100644 --- a/app/assets/javascripts/create_cluster/eks_cluster/components/eks_cluster_configuration_form.vue +++ b/app/assets/javascripts/create_cluster/eks_cluster/components/eks_cluster_configuration_form.vue @@ -14,12 +14,5 @@ export default { }; </script> <template> - <form name="eks-cluster-configuration-form"> - <div class="form-group"> - <label class="label-bold" name="role" for="eks-role"> - {{ s__('ClusterIntegration|Role name') }} - </label> - <role-name-dropdown /> - </div> - </form> + <form name="eks-cluster-configuration-form"></form> </template> diff --git a/app/assets/javascripts/create_cluster/eks_cluster/components/role_name_dropdown.vue b/app/assets/javascripts/create_cluster/eks_cluster/components/role_name_dropdown.vue index 70230b294ac..e69de29bb2d 100644 --- a/app/assets/javascripts/create_cluster/eks_cluster/components/role_name_dropdown.vue +++ b/app/assets/javascripts/create_cluster/eks_cluster/components/role_name_dropdown.vue @@ -1,53 +0,0 @@ -<script> -import { sprintf, s__ } from '~/locale'; - -import ClusterFormDropdown from './cluster_form_dropdown.vue'; - -export default { - components: { - ClusterFormDropdown, - }, - props: { - roles: { - type: Array, - required: false, - default: () => [], - }, - loading: { - type: Boolean, - required: false, - default: false, - }, - }, - computed: { - helpText() { - return sprintf( - s__( - 'ClusterIntegration|Select the IAM Role to allow Amazon EKS and the Kubernetes control plane to manage AWS resources on your behalf. To use a new role name, first create one on %{startLink}Amazon Web Services%{endLink}.', - ), - { - startLink: - '<a href="https://console.aws.amazon.com/iam/home?#roles" target="_blank" rel="noopener noreferrer">', - endLink: '</a>', - }, - false, - ); - }, - }, -}; -</script> -<template> - <div> - <cluster-form-dropdown - field-id="eks-role-name" - field-name="eks-role-name" - :items="roles" - :loading="loading" - :loading-text="s__('ClusterIntegration|Loading IAM Roles')" - :placeholder="s__('ClusterIntergation|Select role name')" - :search-field-placeholder="s__('ClusterIntegration|Search IAM Roles')" - :empty-text="s__('ClusterIntegration|No IAM Roles found')" - /> - <p class="form-text text-muted" v-html="helpText"></p> - </div> -</template> diff --git a/app/assets/javascripts/gl_dropdown.js b/app/assets/javascripts/gl_dropdown.js index f49246cf07b..515402fc506 100644 --- a/app/assets/javascripts/gl_dropdown.js +++ b/app/assets/javascripts/gl_dropdown.js @@ -1,4 +1,5 @@ -/* eslint-disable func-names, no-underscore-dangle, no-var, one-var, vars-on-top, no-shadow, no-cond-assign, prefer-arrow-callback, no-return-assign, no-else-return, camelcase, no-lonely-if, guard-for-in, no-restricted-syntax, consistent-return, prefer-template, no-param-reassign, no-loop-func */ +/* eslint-disable func-names, no-underscore-dangle, no-var, one-var, vars-on-top, no-unused-vars, no-shadow, no-cond-assign, prefer-arrow-callback, no-return-assign, no-else-return, camelcase, no-lonely-if, guard-for-in, no-restricted-syntax, consistent-return, prefer-template, no-param-reassign, no-loop-func */ +/* global fuzzaldrinPlus */ import $ from 'jquery'; import _ from 'underscore'; @@ -65,10 +66,12 @@ GitLabDropdownInput = (function() { })(); GitLabDropdownFilter = (function() { - var BLUR_KEYCODES, HAS_VALUE_CLASS; + var ARROW_KEY_CODES, BLUR_KEYCODES, HAS_VALUE_CLASS; BLUR_KEYCODES = [27, 40]; + ARROW_KEY_CODES = [38, 40]; + HAS_VALUE_CLASS = 'has-value'; function GitLabDropdownFilter(input, options) { @@ -874,8 +877,9 @@ GitLabDropdown = (function() { }; GitLabDropdown.prototype.addArrowKeyEvent = function() { - var ARROW_KEY_CODES, selector; + var $input, ARROW_KEY_CODES, selector; ARROW_KEY_CODES = [38, 40]; + $input = this.dropdown.find('.dropdown-input-field'); selector = SELECTABLE_CLASSES; if (this.dropdown.find('.dropdown-toggle-page').length) { selector = '.dropdown-page-one ' + selector; diff --git a/app/assets/javascripts/issue.js b/app/assets/javascripts/issue.js index a9e086fade8..db4607ca58d 100644 --- a/app/assets/javascripts/issue.js +++ b/app/assets/javascripts/issue.js @@ -1,9 +1,10 @@ -/* eslint-disable no-var, one-var, consistent-return */ +/* eslint-disable no-var, one-var, no-unused-vars, consistent-return */ import $ from 'jquery'; import axios from './lib/utils/axios_utils'; import { addDelimiter } from './lib/utils/text_utility'; import flash from './flash'; +import TaskList from './task_list'; import CreateMergeRequestDropdown from './create_merge_request_dropdown'; import IssuablesHelper from './helpers/issuables_helper'; import { __ } from './locale'; diff --git a/app/assets/javascripts/jobs/components/log/duration_badge.vue b/app/assets/javascripts/jobs/components/log/duration_badge.vue deleted file mode 100644 index 83f62703d27..00000000000 --- a/app/assets/javascripts/jobs/components/log/duration_badge.vue +++ /dev/null @@ -1,13 +0,0 @@ -<script> -export default { - props: { - duration: { - type: String, - required: true, - }, - }, -}; -</script> -<template> - <div class="duration rounded align-self-start px-2 ml-2 flex-shrink-0">{{ duration }}</div> -</template> diff --git a/app/assets/javascripts/jobs/components/log/line.vue b/app/assets/javascripts/jobs/components/log/line.vue index 336ae623f0f..86d0fcc3b74 100644 --- a/app/assets/javascripts/jobs/components/log/line.vue +++ b/app/assets/javascripts/jobs/components/log/line.vue @@ -21,7 +21,7 @@ export default { <template> <div class="line"> <line-number :line-number="line.lineNumber" :path="path" /> - <span v-for="(content, i) in line.content" :key="i" :class="content.style">{{ + <span v-for="(content, i) in line.content" :key="i" class="line-text" :class="content.style">{{ content.text }}</span> </div> diff --git a/app/assets/javascripts/jobs/components/log/line_header.vue b/app/assets/javascripts/jobs/components/log/line_header.vue index af8de9ec0fa..4ec212d2333 100644 --- a/app/assets/javascripts/jobs/components/log/line_header.vue +++ b/app/assets/javascripts/jobs/components/log/line_header.vue @@ -1,13 +1,11 @@ <script> import Icon from '~/vue_shared/components/icon.vue'; import LineNumber from './line_number.vue'; -import DurationBadge from './duration_badge.vue'; export default { components: { Icon, LineNumber, - DurationBadge, }, props: { line: { @@ -22,11 +20,6 @@ export default { type: String, required: true, }, - duration: { - type: String, - required: false, - default: '', - }, }, computed: { iconName() { @@ -42,16 +35,11 @@ export default { </script> <template> - <div - class="line collapsible-line d-flex justify-content-between" - role="button" - @click="handleOnClick" - > - <icon :name="iconName" class="arrow position-absolute" /> + <div class="line collapsible-line" role="button" @click="handleOnClick"> + <icon :name="iconName" class="arrow" /> <line-number :line-number="line.lineNumber" :path="path" /> <span v-for="(content, i) in line.content" :key="i" class="line-text" :class="content.style">{{ content.text }}</span> - <duration-badge v-if="duration" :duration="duration" /> </div> </template> diff --git a/app/assets/javascripts/jobs/components/log/line_number.vue b/app/assets/javascripts/jobs/components/log/line_number.vue index 6c76bef13d3..e06836e2e97 100644 --- a/app/assets/javascripts/jobs/components/log/line_number.vue +++ b/app/assets/javascripts/jobs/components/log/line_number.vue @@ -46,10 +46,7 @@ export default { }; </script> <template> - <gl-link - :id="lineNumberId" - class="d-inline-block text-right position-absolute line-number" - :href="buildLineNumber" - >{{ parsedLineNumber }}</gl-link - > + <gl-link :id="lineNumberId" class="line-number" :href="buildLineNumber">{{ + parsedLineNumber + }}</gl-link> </template> diff --git a/app/assets/javascripts/jobs/components/log/log.vue b/app/assets/javascripts/jobs/components/log/log.vue index 429796aeb4e..5db866afe5a 100644 --- a/app/assets/javascripts/jobs/components/log/log.vue +++ b/app/assets/javascripts/jobs/components/log/log.vue @@ -9,7 +9,7 @@ export default { LogLineHeader, }, computed: { - ...mapState(['traceEndpoint', 'trace', 'isTraceComplete']), + ...mapState(['traceEndpoint', 'trace']), }, methods: { ...mapActions(['toggleCollapsibleLine']), @@ -20,13 +20,12 @@ export default { }; </script> <template> - <code class="job-log d-block"> + <code class="job-log"> <template v-for="(section, index) in trace"> <template v-if="section.isHeader"> <log-line-header :key="`collapsible-${index}`" :line="section.line" - :duration="section.section_duration" :path="traceEndpoint" :is-closed="section.isClosed" @toggleLine="handleOnClickCollapsibleLine(section)" @@ -42,11 +41,5 @@ export default { </template> <log-line v-else :key="section.offset" :line="section" :path="traceEndpoint" /> </template> - - <div v-if="!isTraceComplete" class="js-log-animation loader-animation pt-3 pl-3"> - <div class="dot"></div> - <div class="dot"></div> - <div class="dot"></div> - </div> </code> </template> diff --git a/app/assets/javascripts/jobs/store/utils.js b/app/assets/javascripts/jobs/store/utils.js index 261ec90cd12..f6a87b9a212 100644 --- a/app/assets/javascripts/jobs/store/utils.js +++ b/app/assets/javascripts/jobs/store/utils.js @@ -1,21 +1,10 @@ /** - * Adds the line number property - * @param Object line - * @param Number lineNumber - */ -export const parseLine = (line = {}, lineNumber) => ({ - ...line, - lineNumber, -}); - -/** * Parses the job log content into a structure usable by the template * * For collaspible lines (section_header = true): * - creates a new array to hold the lines that are collpasible, * - adds a isClosed property to handle toggle * - adds a isHeader property to handle template logic - * - adds the section_duration * For each line: * - adds the index as lineNumber * @@ -25,21 +14,27 @@ export const parseLine = (line = {}, lineNumber) => ({ export const logLinesParser = (lines = [], lineNumberStart) => lines.reduce((acc, line, index) => { const lineNumber = lineNumberStart ? lineNumberStart + index : index; - const last = acc[acc.length - 1]; - if (line.section_header) { acc.push({ isClosed: true, isHeader: true, - line: parseLine(line, lineNumber), + line: { + ...line, + lineNumber, + }, + lines: [], }); - } else if (acc.length && last.isHeader && !line.section_duration && line.content.length) { - last.lines.push(parseLine(line, lineNumber)); - } else if (acc.length && last.isHeader && line.section_duration) { - last.section_duration = line.section_duration; - } else if (line.content.length) { - acc.push(parseLine(line, lineNumber)); + } else if (acc.length && acc[acc.length - 1].isHeader) { + acc[acc.length - 1].lines.push({ + ...line, + lineNumber, + }); + } else { + acc.push({ + ...line, + lineNumber, + }); } return acc; diff --git a/app/assets/javascripts/label_manager.js b/app/assets/javascripts/label_manager.js index 5dcc719f7c3..7064731a5ea 100644 --- a/app/assets/javascripts/label_manager.js +++ b/app/assets/javascripts/label_manager.js @@ -1,4 +1,4 @@ -/* eslint-disable class-methods-use-this, no-underscore-dangle, no-param-reassign, func-names */ +/* eslint-disable class-methods-use-this, no-underscore-dangle, no-param-reassign, no-unused-vars, func-names */ import $ from 'jquery'; import Sortable from 'sortablejs'; @@ -50,7 +50,7 @@ export default class LabelManager { $(e.currentTarget).tooltip('hide'); } - toggleEmptyState() { + toggleEmptyState($label, $btn, action) { this.emptyState.classList.toggle( 'hidden', Boolean(this.prioritizedLabels[0].querySelector(':scope > li')), @@ -61,6 +61,7 @@ export default class LabelManager { if (persistState == null) { persistState = true; } + const _this = this; const url = $label.find('.js-toggle-priority').data('url'); let $target = this.prioritizedLabels; let $from = this.otherLabels; diff --git a/app/assets/javascripts/labels_select.js b/app/assets/javascripts/labels_select.js index 8cc3bc8373f..177aa02b8e0 100644 --- a/app/assets/javascripts/labels_select.js +++ b/app/assets/javascripts/labels_select.js @@ -1,4 +1,4 @@ -/* eslint-disable no-useless-return, func-names, no-var, no-underscore-dangle, prefer-arrow-callback, one-var, prefer-template, no-new, consistent-return, object-shorthand, no-shadow, no-param-reassign, vars-on-top, no-lonely-if, no-else-return, dot-notation, no-empty */ +/* eslint-disable no-useless-return, func-names, no-var, no-underscore-dangle, prefer-arrow-callback, one-var, no-unused-vars, prefer-template, no-new, consistent-return, object-shorthand, no-shadow, no-param-reassign, vars-on-top, no-lonely-if, no-else-return, dot-notation, no-empty */ /* global Issuable */ /* global ListLabel */ @@ -26,6 +26,7 @@ export default class LabelsSelect { $els.each(function(i, dropdown) { var $block, + $colorPreview, $dropdown, $form, $loading, @@ -34,6 +35,8 @@ export default class LabelsSelect { $value, abilityName, defaultLabel, + enableLabelCreateButton, + issueURLSplit, issueUpdateURL, labelUrl, namespacePath, @@ -44,11 +47,16 @@ export default class LabelsSelect { showNo, $sidebarLabelTooltip, initialSelected, + $toggleText, fieldName, + useId, + propertyName, showMenuAbove, + $container, $dropdownContainer; $dropdown = $(dropdown); $dropdownContainer = $dropdown.closest('.labels-filter'); + $toggleText = $dropdown.find('.dropdown-toggle-text'); namespacePath = $dropdown.data('namespacePath'); projectPath = $dropdown.data('projectPath'); issueUpdateURL = $dropdown.data('issueUpdate'); @@ -69,6 +77,10 @@ export default class LabelsSelect { $value = $block.find('.value'); $loading = $block.find('.block-loading').fadeOut(); fieldName = $dropdown.data('fieldName'); + useId = $dropdown.is( + '.js-issuable-form-dropdown, .js-filter-bulk-update, .js-label-sidebar-dropdown', + ); + propertyName = useId ? 'id' : 'title'; initialSelected = $selectbox .find('input[name="' + $dropdown.data('fieldName') + '"]') .map(function() { @@ -112,7 +124,7 @@ export default class LabelsSelect { axios .put(issueUpdateURL, data) .then(({ data }) => { - var labelCount, template, labelTooltipTitle, labelTitles; + var labelCount, template, labelTooltipTitle, labelTitles, formattedLabels; $loading.fadeOut(); $dropdown.trigger('loaded.gl.dropdown'); $selectbox.hide(); @@ -234,10 +246,12 @@ export default class LabelsSelect { renderRow: function(label) { var linkEl, listItemEl, + color, colorEl, indeterminate, removesAll, selectedClass, + spacing, i, marked, dropdownValue; @@ -364,7 +378,7 @@ export default class LabelsSelect { } }, hidden: function() { - var isIssueIndex, isMRIndex, page; + var isIssueIndex, isMRIndex, page, selectedLabels; page = $('body').attr('data-page'); isIssueIndex = page === 'projects:issues:index'; isMRIndex = page === 'projects:merge_requests:index'; @@ -381,6 +395,9 @@ export default class LabelsSelect { } if ($dropdown.hasClass('js-multiselect')) { if ($dropdown.hasClass('js-filter-submit') && (isIssueIndex || isMRIndex)) { + selectedLabels = $dropdown + .closest('form') + .find("input:hidden[name='" + $dropdown.data('fieldName') + "']"); Issuable.filterResults($dropdown.closest('form')); } else if ($dropdown.hasClass('js-filter-submit')) { $dropdown.closest('form').submit(); @@ -478,7 +495,7 @@ export default class LabelsSelect { } } }, - opened: function() { + opened: function(e) { if ($dropdown.hasClass('js-issue-board-sidebar')) { const previousSelection = $dropdown.attr('data-selected'); this.selected = previousSelection ? previousSelection.split(',') : []; diff --git a/app/assets/javascripts/lib/utils/text_markdown.js b/app/assets/javascripts/lib/utils/text_markdown.js index 7873eaf059f..b7922e29bb0 100644 --- a/app/assets/javascripts/lib/utils/text_markdown.js +++ b/app/assets/javascripts/lib/utils/text_markdown.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, no-var, no-param-reassign, one-var, operator-assignment, no-else-return, prefer-template, prefer-arrow-callback, consistent-return */ +/* eslint-disable func-names, no-var, no-param-reassign, one-var, operator-assignment, no-else-return, prefer-template, prefer-arrow-callback, consistent-return, no-unused-vars */ import $ from 'jquery'; import { insertText } from '~/lib/utils/common_utils'; @@ -157,7 +157,7 @@ export function insertMarkdownText({ if (tag === LINK_TAG_PATTERN) { if (URL) { try { - new URL(selected); // eslint-disable-line no-new + const ignoredUrl = new URL(selected); // valid url tag = '[text]({text})'; select = 'text'; diff --git a/app/assets/javascripts/milestone_select.js b/app/assets/javascripts/milestone_select.js index 9c0d55326ee..8f077685b07 100644 --- a/app/assets/javascripts/milestone_select.js +++ b/app/assets/javascripts/milestone_select.js @@ -1,4 +1,4 @@ -/* eslint-disable one-var, object-shorthand, no-else-return, no-self-compare, consistent-return, no-param-reassign, no-shadow */ +/* eslint-disable one-var, no-unused-vars, object-shorthand, no-else-return, no-self-compare, consistent-return, no-param-reassign, no-shadow */ /* global Issuable */ /* global ListMilestone */ @@ -37,6 +37,7 @@ export default class MilestoneSelect { selectedMilestone, selectedMilestoneDefault; const $dropdown = $(dropdown); + const projectId = $dropdown.data('projectId'); const milestonesUrl = $dropdown.data('milestones'); const issueUpdateURL = $dropdown.data('issueUpdate'); const showNo = $dropdown.data('showNo'); @@ -47,6 +48,7 @@ export default class MilestoneSelect { const useId = $dropdown.data('useId'); const defaultLabel = $dropdown.data('defaultLabel'); const defaultNo = $dropdown.data('defaultNo'); + const issuableId = $dropdown.data('issuableId'); const abilityName = $dropdown.data('abilityName'); const $selectBox = $dropdown.closest('.selectbox'); const $block = $selectBox.closest('.block'); @@ -119,7 +121,7 @@ export default class MilestoneSelect { fields: ['title'], }, selectable: true, - toggleLabel: (selected, el) => { + toggleLabel: (selected, el, e) => { if (selected && 'id' in selected && $(el).hasClass('is-active')) { return selected.title; } else { @@ -151,7 +153,7 @@ export default class MilestoneSelect { }, vue: $dropdown.hasClass('js-issue-board-sidebar'), clicked: clickEvent => { - const { e } = clickEvent; + const { $el, e } = clickEvent; let selected = clickEvent.selectedObj; let data, modalStoreFilter; diff --git a/app/assets/javascripts/monitoring/components/charts/column.vue b/app/assets/javascripts/monitoring/components/charts/column.vue index ee6aaeb7dde..83136d43479 100644 --- a/app/assets/javascripts/monitoring/components/charts/column.vue +++ b/app/assets/javascripts/monitoring/components/charts/column.vue @@ -100,7 +100,7 @@ export default { }; </script> <template> - <div class="prometheus-graph"> + <div class="prometheus-graph col-12 col-lg-6"> <div class="prometheus-graph-header"> <h5 ref="graphTitle" class="prometheus-graph-title">{{ graphData.title }}</h5> <div ref="graphWidgets" class="prometheus-graph-widgets"><slot></slot></div> diff --git a/app/assets/javascripts/monitoring/components/charts/empty_chart.vue b/app/assets/javascripts/monitoring/components/charts/empty_chart.vue index eedc5162e0c..73682adc4ee 100644 --- a/app/assets/javascripts/monitoring/components/charts/empty_chart.vue +++ b/app/assets/javascripts/monitoring/components/charts/empty_chart.vue @@ -27,7 +27,7 @@ export default { }; </script> <template> - <div class="prometheus-graph d-flex flex-column justify-content-center"> + <div class="prometheus-graph col-12 col-lg-6 d-flex flex-column justify-content-center"> <div class="prometheus-graph-header"> <h5 ref="graphTitle" class="prometheus-graph-title">{{ graphTitle }}</h5> </div> diff --git a/app/assets/javascripts/monitoring/components/charts/single_stat.vue b/app/assets/javascripts/monitoring/components/charts/single_stat.vue index 076682820e6..7428b27a9c3 100644 --- a/app/assets/javascripts/monitoring/components/charts/single_stat.vue +++ b/app/assets/javascripts/monitoring/components/charts/single_stat.vue @@ -29,7 +29,7 @@ export default { }; </script> <template> - <div class="prometheus-graph"> + <div class="prometheus-graph col-12 col-lg-6"> <div class="prometheus-graph-header"> <h5 ref="graphTitle" class="prometheus-graph-title">{{ graphTitle }}</h5> </div> diff --git a/app/assets/javascripts/monitoring/components/charts/time_series.vue b/app/assets/javascripts/monitoring/components/charts/time_series.vue index 5f1d742d952..02e7a7ba0a6 100644 --- a/app/assets/javascripts/monitoring/components/charts/time_series.vue +++ b/app/assets/javascripts/monitoring/components/charts/time_series.vue @@ -43,6 +43,11 @@ export default { required: false, default: '', }, + showBorder: { + type: Boolean, + required: false, + default: false, + }, singleEmbed: { type: Boolean, required: false, @@ -267,66 +272,71 @@ export default { </script> <template> - <div class="prometheus-graph"> - <div class="prometheus-graph-header"> - <h5 class="prometheus-graph-title js-graph-title">{{ graphData.title }}</h5> - <gl-button - v-if="exportMetricsToCsvEnabled" - :href="downloadLink" - :title="__('Download CSV')" - :aria-label="__('Download CSV')" - style="margin-left: 200px;" - download="chart_metrics.csv" - > - {{ __('Download CSV') }} - </gl-button> - <div class="prometheus-graph-widgets js-graph-widgets"> - <slot></slot> + <div + class="prometheus-graph col-12" + :class="[showBorder ? 'p-2' : 'p-0', { 'col-lg-6': !singleEmbed }]" + > + <div :class="{ 'prometheus-graph-embed w-100 p-3': showBorder }"> + <div class="prometheus-graph-header"> + <h5 class="prometheus-graph-title js-graph-title">{{ graphData.title }}</h5> + <gl-button + v-if="exportMetricsToCsvEnabled" + :href="downloadLink" + :title="__('Download CSV')" + :aria-label="__('Download CSV')" + style="margin-left: 200px;" + download="chart_metrics.csv" + > + {{ __('Download CSV') }} + </gl-button> + <div class="prometheus-graph-widgets js-graph-widgets"> + <slot></slot> + </div> </div> - </div> - <component - :is="glChartComponent" - ref="chart" - v-bind="$attrs" - :data="chartData" - :option="chartOptions" - :format-tooltip-text="formatTooltipText" - :thresholds="thresholds" - :width="width" - :height="height" - @updated="onChartUpdated" - > - <template v-if="tooltip.isDeployment"> - <template slot="tooltipTitle"> - {{ __('Deployed') }} - </template> - <div slot="tooltipContent" class="d-flex align-items-center"> - <icon name="commit" class="mr-2" /> - <gl-link :href="tooltip.commitUrl">{{ tooltip.sha }}</gl-link> - </div> - </template> - <template v-else> - <template slot="tooltipTitle"> - <div class="text-nowrap"> - {{ tooltip.title }} + <component + :is="glChartComponent" + ref="chart" + v-bind="$attrs" + :data="chartData" + :option="chartOptions" + :format-tooltip-text="formatTooltipText" + :thresholds="thresholds" + :width="width" + :height="height" + @updated="onChartUpdated" + > + <template v-if="tooltip.isDeployment"> + <template slot="tooltipTitle"> + {{ __('Deployed') }} + </template> + <div slot="tooltipContent" class="d-flex align-items-center"> + <icon name="commit" class="mr-2" /> + <gl-link :href="tooltip.commitUrl">{{ tooltip.sha }}</gl-link> </div> </template> - <template slot="tooltipContent"> - <div - v-for="(content, key) in tooltip.content" - :key="key" - class="d-flex justify-content-between" - > - <gl-chart-series-label :color="isMultiSeries ? content.color : ''"> - {{ content.name }} - </gl-chart-series-label> - <div class="prepend-left-32"> - {{ content.value }} + <template v-else> + <template slot="tooltipTitle"> + <div class="text-nowrap"> + {{ tooltip.title }} </div> - </div> + </template> + <template slot="tooltipContent"> + <div + v-for="(content, key) in tooltip.content" + :key="key" + class="d-flex justify-content-between" + > + <gl-chart-series-label :color="isMultiSeries ? content.color : ''"> + {{ content.name }} + </gl-chart-series-label> + <div class="prepend-left-32"> + {{ content.value }} + </div> + </div> + </template> </template> - </template> - </component> + </component> + </div> </div> </template> diff --git a/app/assets/javascripts/monitoring/components/dashboard.vue b/app/assets/javascripts/monitoring/components/dashboard.vue index 7a5a3789bd6..d330ceb836c 100644 --- a/app/assets/javascripts/monitoring/components/dashboard.vue +++ b/app/assets/javascripts/monitoring/components/dashboard.vue @@ -456,7 +456,6 @@ export default { <panel-type v-for="(graphData, graphIndex) in groupData.metrics" :key="`panel-type-${graphIndex}`" - class="col-12 col-lg-6 pb-3" :clipboard-text="generateLink(groupData.group, graphData.title, graphData.y_label)" :graph-data="graphData" :dashboard-width="elWidth" @@ -469,7 +468,6 @@ export default { <monitor-time-series-chart v-for="(graphData, graphIndex) in chartsWithData(groupData.metrics)" :key="graphIndex" - class="col-12 col-lg-6 pb-3" :graph-data="graphData" :deployment-data="deploymentData" :thresholds="getGraphAlertValues(graphData.queries)" diff --git a/app/assets/javascripts/monitoring/components/embed.vue b/app/assets/javascripts/monitoring/components/embed.vue index da1e88071ab..b516a82c170 100644 --- a/app/assets/javascripts/monitoring/components/embed.vue +++ b/app/assets/javascripts/monitoring/components/embed.vue @@ -95,7 +95,6 @@ export default { <monitor-time-series-chart v-for="graphData in charts" :key="graphData.title" - class="w-100" :graph-data="graphData" :container-width="elWidth" group-id="monitor-area-chart" diff --git a/app/assets/javascripts/network/branch_graph.js b/app/assets/javascripts/network/branch_graph.js index fcfc2570b3d..d1fa9f5e2a2 100644 --- a/app/assets/javascripts/network/branch_graph.js +++ b/app/assets/javascripts/network/branch_graph.js @@ -1,8 +1,9 @@ -/* eslint-disable func-names, no-var, one-var, no-loop-func, consistent-return, prefer-template, prefer-arrow-callback, camelcase */ +/* eslint-disable func-names, no-var, one-var, no-loop-func, consistent-return, no-unused-vars, prefer-template, prefer-arrow-callback, camelcase */ import $ from 'jquery'; import { __ } from '../locale'; import axios from '../lib/utils/axios_utils'; +import flash from '../flash'; import Raphael from './raphael'; export default (function() { @@ -103,7 +104,7 @@ export default (function() { }; BranchGraph.prototype.buildGraph = function() { - var cuday, cumonth, day, len, mm, ref; + var cuday, cumonth, day, j, len, mm, ref; const { r } = this; cuday = 0; cumonth = ''; @@ -177,7 +178,7 @@ export default (function() { return $(element).scroll( (function(_this) { - return function() { + return function(event) { return _this.renderPartialGraph(); }; })(this), @@ -213,7 +214,7 @@ export default (function() { }; BranchGraph.prototype.appendLabel = function(x, y, commit) { - var label, rect, shortrefs, text, textbox; + var label, rect, shortrefs, text, textbox, triangle; if (!commit.refs) { return; @@ -238,8 +239,7 @@ export default (function() { 'fill-opacity': 0.5, stroke: 'none', }); - // Generate the triangle right of the tag box - r.path(['M', x - 5, y, 'L', x - 15, y - 4, 'L', x - 15, y + 4, 'Z']).attr({ + triangle = r.path(['M', x - 5, y, 'L', x - 15, y - 4, 'L', x - 15, y + 4, 'Z']).attr({ fill: '#000', 'fill-opacity': 0.5, stroke: 'none', diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 9cc56b34c75..9cc31e26648 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -2,9 +2,10 @@ no-unused-expressions, one-var, default-case, prefer-template, consistent-return, no-alert, no-return-assign, no-param-reassign, prefer-arrow-callback, no-else-return, vars-on-top, -no-shadow, no-useless-escape, class-methods-use-this */ +no-unused-vars, no-shadow, no-useless-escape, class-methods-use-this */ /* global ResolveService */ +/* global mrRefreshWidgetUrl */ /* old_notes_spec.js is the spec for the legacy, jQuery notes application. It has nothing to do with the new, fancy Vue notes app. @@ -36,6 +37,7 @@ import { isMetaKey, isInMRPage, } from './lib/utils/common_utils'; +import imageDiffHelper from './image_diff/helpers/index'; import { localTimeAgo } from './lib/utils/datetime_utility'; import { sprintf, s__, __ } from './locale'; @@ -681,7 +683,7 @@ export default class Notes { ); } - updateNoteError() { + updateNoteError($parentTimeline) { // eslint-disable-next-line no-new new Flash( __('Your comment could not be updated! Please check your network connection and try again.'), @@ -695,6 +697,7 @@ export default class Notes { */ addDiscussionNote($form, note, isNewDiffComment) { if ($form.attr('data-resolve-all') != null) { + var projectPath = $form.data('projectPath'); var discussionId = $form.data('discussionId'); var mergeRequestId = $form.data('noteableIid'); @@ -743,6 +746,7 @@ export default class Notes { if (currentContent === initialContent) { this.removeNoteEditForm($el); } else { + var $buttons = $el.find('.note-form-actions'); var isWidgetVisible = isInViewport($el.get(0)); if (!isWidgetVisible) { @@ -762,7 +766,7 @@ export default class Notes { * Replaces the note text with the note edit form * Adds a data attribute to the form with the original content of the note for cancellations */ - showEditForm(e) { + showEditForm(e, scrollTo, myLastNote) { e.preventDefault(); var $target = $(e.target); @@ -846,11 +850,16 @@ export default class Notes { * Removes the whole discussion if the last note is being removed. */ removeNote(e) { - var noteElId, $note; + var noteElId, noteId, dataNoteId, $note, lineHolder; $note = $(e.currentTarget).closest('.note'); noteElId = $note.attr('id'); + noteId = $note.attr('data-note-id'); + lineHolder = $(e.currentTarget) + .closest('.notes[data-discussion-id]') + .closest('.notes_holder') + .prev('.line_holder'); $(`.note[id="${noteElId}"]`).each( - (function() { + (function(_this) { // A same note appears in the "Discussion" and in the "Changes" tab, we have // to remove all. Using $('.note[id='noteId']') ensure we get all the notes, // where $('#noteId') would return only one. @@ -1055,8 +1064,25 @@ export default class Notes { this.setupDiscussionNoteForm($link, newForm); } - toggleDiffNote({ target, lineType, forceShow, showReplyInput = false }) { - var $link, addForm, hasNotes, newForm, noteForm, replyButton, row, rowCssToAdd; + toggleDiffNote({ + target, + lineType, + forceShow, + showReplyInput = false, + currentUsername, + currentUserAvatar, + currentUserFullname, + }) { + var $link, + addForm, + hasNotes, + newForm, + noteForm, + replyButton, + row, + rowCssToAdd, + targetContent, + isDiffCommentAvatar; $link = $(target); row = $link.closest('tr'); const nextRow = row.next(); @@ -1489,7 +1515,7 @@ export default class Notes { let tempFormContent; // Identify executed quick actions from `formContent` - const executedCommands = availableQuickActions.filter(command => { + const executedCommands = availableQuickActions.filter((command, index) => { const commandRegex = new RegExp(`/${command.name}`); return commandRegex.test(formContent); }); @@ -1814,6 +1840,8 @@ export default class Notes { const $noteBody = $editingNote.find('.js-task-list-container'); const $noteBodyText = $noteBody.find('.note-text'); const { formData, formContent, formAction } = this.getFormData($form); + const $diffFile = $form.closest('.diff-file'); + const $notesContainer = $form.closest('.notes'); // Cache original comment content const cachedNoteBodyText = $noteBodyText.html(); diff --git a/app/assets/javascripts/notes/components/discussion_actions.vue b/app/assets/javascripts/notes/components/discussion_actions.vue index e3be91a4966..6bbf2fa6ee4 100644 --- a/app/assets/javascripts/notes/components/discussion_actions.vue +++ b/app/assets/javascripts/notes/components/discussion_actions.vue @@ -36,10 +36,11 @@ export default { }, }, computed: { + resolvableNotes() { + return this.discussion.notes.filter(x => x.resolvable); + }, userCanResolveDiscussion() { - return this.discussion.notes.every( - note => note.current_user && note.current_user.can_resolve, - ); + return this.resolvableNotes.every(note => note.current_user && note.current_user.can_resolve); }, }, }; diff --git a/app/assets/javascripts/pages/admin/application_settings/general/index.js b/app/assets/javascripts/pages/admin/application_settings/show/index.js index 5ec9688a6e4..5ec9688a6e4 100644 --- a/app/assets/javascripts/pages/admin/application_settings/general/index.js +++ b/app/assets/javascripts/pages/admin/application_settings/show/index.js diff --git a/app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js b/app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js index ec3919dd073..988ae164955 100644 --- a/app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js +++ b/app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, object-shorthand, no-var, one-var, camelcase, no-param-reassign, no-return-assign, prefer-arrow-callback, consistent-return, no-cond-assign, no-else-return */ +/* eslint-disable func-names, object-shorthand, no-var, one-var, camelcase, no-param-reassign, no-return-assign, prefer-arrow-callback, consistent-return, no-unused-vars, no-cond-assign, no-else-return */ import _ from 'underscore'; export default { @@ -126,7 +126,7 @@ export default { _.each( _.omit(log_entry, 'author_name', 'author_email'), (function(_this) { - return function(value) { + return function(value, key) { if (_this.in_range(value.date, date_range)) { parsed_entry.dates[value.date] = value[field]; parsed_entry.commits += value.commits; diff --git a/app/assets/javascripts/performance_bar/services/performance_bar_service.js b/app/assets/javascripts/performance_bar/services/performance_bar_service.js index 61b35b4b8f5..d8c23c82f7f 100644 --- a/app/assets/javascripts/performance_bar/services/performance_bar_service.js +++ b/app/assets/javascripts/performance_bar/services/performance_bar_service.js @@ -1,6 +1,10 @@ +import Vue from 'vue'; +import _ from 'underscore'; import axios from '../../lib/utils/axios_utils'; import { parseBoolean } from '~/lib/utils/common_utils'; +let vueResourceInterceptor; + export default class PerformanceBarService { static fetchRequestDetails(peekUrl, requestId) { return axios.get(peekUrl, { params: { request_id: requestId } }); @@ -20,11 +24,16 @@ export default class PerformanceBarService { return response; }; + vueResourceInterceptor = (request, next) => next(interceptor); + + Vue.http.interceptors.push(vueResourceInterceptor); + return axios.interceptors.response.use(interceptor); } static removeInterceptor(interceptor) { axios.interceptors.response.eject(interceptor); + Vue.http.interceptors = _.without(Vue.http.interceptors, vueResourceInterceptor); } static callbackParams(response, peekUrl) { diff --git a/app/assets/javascripts/profile/gl_crop.js b/app/assets/javascripts/profile/gl_crop.js index 6a07ccc7586..befe91c332f 100644 --- a/app/assets/javascripts/profile/gl_crop.js +++ b/app/assets/javascripts/profile/gl_crop.js @@ -1,10 +1,10 @@ -/* eslint-disable no-useless-escape, no-var, no-underscore-dangle, func-names, no-return-assign, object-shorthand, one-var, consistent-return, class-methods-use-this */ +/* eslint-disable no-useless-escape, no-var, no-underscore-dangle, func-names, no-unused-vars, no-return-assign, object-shorthand, one-var, consistent-return, class-methods-use-this */ import $ from 'jquery'; import 'cropper'; import _ from 'underscore'; -(() => { +(global => { // Matches everything but the file name const FILENAMEREGEX = /^.*[\\\/]/; @@ -69,7 +69,7 @@ import _ from 'underscore'; this.modalCrop.on('shown.bs.modal', this.onModalShow); this.modalCrop.on('hidden.bs.modal', this.onModalHide); this.uploadImageBtn.on('click', this.onUploadImageBtnClick); - this.cropActionsBtn.on('click', function() { + this.cropActionsBtn.on('click', function(e) { var btn; btn = this; return _this.onActionBtnClick(btn); @@ -128,10 +128,10 @@ import _ from 'underscore'; } onActionBtnClick(btn) { - var data; + var data, result; data = $(btn).data(); if (this.modalCropImg.data('cropper') && data.method) { - return this.modalCropImg.cropper(data.method, data.option); + return (result = this.modalCropImg.cropper(data.method, data.option)); } } @@ -151,11 +151,12 @@ import _ from 'underscore'; } dataURLtoBlob(dataURL) { - var array, binary, i, len; + var array, binary, i, len, v; binary = atob(dataURL.split(',')[1]); array = []; for (i = 0, len = binary.length; i < len; i += 1) { + v = binary[i]; array.push(binary.charCodeAt(i)); } return new Blob([new Uint8Array(array)], { diff --git a/app/assets/javascripts/project_find_file.js b/app/assets/javascripts/project_find_file.js index e73a828c0ae..765cb868f80 100644 --- a/app/assets/javascripts/project_find_file.js +++ b/app/assets/javascripts/project_find_file.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, no-var, consistent-return, one-var, no-cond-assign, prefer-template, no-return-assign */ +/* eslint-disable func-names, no-var, consistent-return, one-var, no-cond-assign, prefer-template, no-unused-vars, no-return-assign */ import $ from 'jquery'; import fuzzaldrinPlus from 'fuzzaldrin-plus'; @@ -8,8 +8,9 @@ import { __ } from '~/locale'; // highlight text(awefwbwgtc -> <b>a</b>wefw<b>b</b>wgt<b>c</b> ) const highlighter = function(element, text, matches) { - var j, lastIndex, len, matchIndex, matchedChars, unmatched; + var highlightText, j, lastIndex, len, matchIndex, matchedChars, unmatched; lastIndex = 0; + highlightText = ''; matchedChars = []; for (j = 0, len = matches.length; j < len; j += 1) { matchIndex = matches[j]; diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js index 0cc7a22325b..40a2158de78 100644 --- a/app/assets/javascripts/right_sidebar.js +++ b/app/assets/javascripts/right_sidebar.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, no-var, consistent-return, one-var, prefer-template, no-else-return, no-param-reassign */ +/* eslint-disable func-names, no-var, no-unused-vars, consistent-return, one-var, prefer-template, no-else-return, no-param-reassign */ import $ from 'jquery'; import _ from 'underscore'; @@ -7,7 +7,7 @@ import flash from './flash'; import axios from './lib/utils/axios_utils'; import { sprintf, s__, __ } from './locale'; -function Sidebar() { +function Sidebar(currentUser) { this.toggleTodo = this.toggleTodo.bind(this); this.sidebar = $('aside'); @@ -15,9 +15,9 @@ function Sidebar() { this.addEventListeners(); } -Sidebar.initialize = function() { +Sidebar.initialize = function(currentUser) { if (!this.instance) { - this.instance = new Sidebar(); + this.instance = new Sidebar(currentUser); } }; @@ -77,7 +77,7 @@ Sidebar.prototype.sidebarToggleClicked = function(e, triggered) { }; Sidebar.prototype.toggleTodo = function(e) { - var $this, ajaxType, url; + var $btnText, $this, $todoLoading, ajaxType, url; $this = $(e.currentTarget); ajaxType = $this.data('deletePath') ? 'delete' : 'post'; @@ -140,7 +140,7 @@ Sidebar.prototype.todoUpdateDone = function(data) { }); }; -Sidebar.prototype.sidebarDropdownLoading = function() { +Sidebar.prototype.sidebarDropdownLoading = function(e) { var $loading, $sidebarCollapsedIcon, i, img; $sidebarCollapsedIcon = $(this) .closest('.block') @@ -157,7 +157,7 @@ Sidebar.prototype.sidebarDropdownLoading = function() { } }; -Sidebar.prototype.sidebarDropdownLoaded = function() { +Sidebar.prototype.sidebarDropdownLoaded = function(e) { var $sidebarCollapsedIcon, i, img; $sidebarCollapsedIcon = $(this) .closest('.block') diff --git a/app/assets/javascripts/search_autocomplete.js b/app/assets/javascripts/search_autocomplete.js index f02c55c3d5b..510a2441924 100644 --- a/app/assets/javascripts/search_autocomplete.js +++ b/app/assets/javascripts/search_autocomplete.js @@ -1,10 +1,11 @@ -/* eslint-disable no-return-assign, one-var, no-var, consistent-return, object-shorthand, prefer-template, class-methods-use-this, no-lonely-if, vars-on-top */ +/* eslint-disable no-return-assign, one-var, no-var, no-unused-vars, consistent-return, object-shorthand, prefer-template, class-methods-use-this, no-lonely-if, vars-on-top */ import $ from 'jquery'; import { escape, throttle } from 'underscore'; -import { s__, __ } from '~/locale'; +import { s__, __, sprintf } from '~/locale'; import { getIdenticonBackgroundClass, getIdenticonTitle } from '~/helpers/avatar_helper'; import axios from './lib/utils/axios_utils'; +import DropdownUtils from './filtered_search/dropdown_utils'; import { isInGroupsPage, isInProjectPage, @@ -141,7 +142,7 @@ export class SearchAutocomplete { }); } - getSearchText(selectedObject) { + getSearchText(selectedObject, el) { return selectedObject.id ? selectedObject.text : ''; } @@ -401,7 +402,7 @@ export class SearchAutocomplete { return this.searchInput.val('').focus(); } - onSearchInputBlur() { + onSearchInputBlur(e) { this.isFocused = false; this.wrap.removeClass('search-active'); // If input is blank then restore state diff --git a/app/assets/javascripts/test_utils/simulate_drag.js b/app/assets/javascripts/test_utils/simulate_drag.js index f4090de3f1e..c9bf234fcce 100644 --- a/app/assets/javascripts/test_utils/simulate_drag.js +++ b/app/assets/javascripts/test_utils/simulate_drag.js @@ -2,8 +2,8 @@ function simulateEvent(el, type, options = {}) { let event; if (!el) return null; - if (/^(pointer|mouse)/.test(type)) { - event = el.ownerDocument.createEvent('MouseEvent'); + if (/^mouse/.test(type)) { + event = el.ownerDocument.createEvent('MouseEvents'); event.initMouseEvent( type, true, @@ -125,7 +125,7 @@ export default function simulateDrag(options) { const startTime = new Date().getTime(); const duration = options.duration || 1000; - simulateEvent(fromEl, 'pointerdown', { + simulateEvent(fromEl, 'mousedown', { button: 0, clientX: fromRect.cx, clientY: fromRect.cy, @@ -146,7 +146,7 @@ export default function simulateDrag(options) { const y = fromRect.cy + (toRect.cy - fromRect.cy) * progress; const overEl = fromEl.ownerDocument.elementFromPoint(x, y); - simulateEvent(overEl, 'pointermove', { + simulateEvent(overEl, 'mousemove', { clientX: x, clientY: y, }); diff --git a/app/assets/javascripts/users_select.js b/app/assets/javascripts/users_select.js index 4b3c42ae848..57efde7f027 100644 --- a/app/assets/javascripts/users_select.js +++ b/app/assets/javascripts/users_select.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, one-var, no-var, prefer-rest-params, vars-on-top, prefer-arrow-callback, consistent-return, object-shorthand, no-shadow, no-else-return, no-self-compare, prefer-template, no-unused-expressions, yoda, prefer-spread, camelcase, no-param-reassign */ +/* eslint-disable func-names, one-var, no-var, prefer-rest-params, vars-on-top, prefer-arrow-callback, consistent-return, object-shorthand, no-shadow, no-unused-vars, no-else-return, no-self-compare, prefer-template, no-unused-expressions, yoda, prefer-spread, camelcase, no-param-reassign */ /* global Issuable */ /* global emitSidebarEvent */ @@ -405,7 +405,7 @@ function UsersSelect(currentUser, els, options = {}) { } }, defaultLabel: defaultLabel, - hidden: function() { + hidden: function(e) { if ($dropdown.hasClass('js-multiselect')) { emitSidebarEvent('sidebar.saveAssignees'); } @@ -442,6 +442,7 @@ function UsersSelect(currentUser, els, options = {}) { if (user.beforeDivider && user.name.toLowerCase() === 'unassigned') { // Unassigned selected previouslySelected.each((index, element) => { + const id = parseInt(element.value, 10); element.remove(); }); emitSidebarEvent('sidebar.removeAllAssignees'); @@ -547,7 +548,7 @@ function UsersSelect(currentUser, els, options = {}) { }, updateLabel: $dropdown.data('dropdownTitle'), renderRow: function(user) { - var avatar, img, username; + var avatar, img, listClosingTags, listWithName, listWithUserName, username; username = user.username ? '@' + user.username : ''; avatar = user.avatar_url ? user.avatar_url : gon.default_avatar_url; diff --git a/app/assets/javascripts/zen_mode.js b/app/assets/javascripts/zen_mode.js index 5438572eadf..e98c4d7bf7a 100644 --- a/app/assets/javascripts/zen_mode.js +++ b/app/assets/javascripts/zen_mode.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, prefer-arrow-callback, consistent-return, camelcase, class-methods-use-this */ +/* eslint-disable func-names, prefer-arrow-callback, no-unused-vars, consistent-return, camelcase, class-methods-use-this */ // Zen Mode (full screen) textarea // @@ -62,7 +62,7 @@ export default class ZenMode { $(document).on( 'zen_mode:leave', (function(_this) { - return function() { + return function(e) { return _this.exit(); }; })(this), diff --git a/app/assets/stylesheets/framework/flash.scss b/app/assets/stylesheets/framework/flash.scss index af05d069f97..7e7b08797b2 100644 --- a/app/assets/stylesheets/framework/flash.scss +++ b/app/assets/stylesheets/framework/flash.scss @@ -131,16 +131,16 @@ $notification-box-shadow-color: rgba(0, 0, 0, 0.25); } } -.with-system-header .flash-container { +.with-system-header .flash-container.sticky { top: $flash-container-top + $system-header-height; } .with-performance-bar { - .flash-container { + .flash-container.sticky { top: $flash-container-top + $performance-bar-height; } - &.with-system-header .flash-container { + &.with-system-header .flash-container.sticky { top: $flash-container-top + $performance-bar-height + $system-header-height; } } diff --git a/app/assets/stylesheets/framework/job_log.scss b/app/assets/stylesheets/framework/job_log.scss deleted file mode 100644 index 5c2491c8233..00000000000 --- a/app/assets/stylesheets/framework/job_log.scss +++ /dev/null @@ -1,49 +0,0 @@ -.job-log { - font-family: $monospace-font; - padding: $gl-padding-8 $input-horizontal-padding; - margin: 0 0 $gl-padding-8; - font-size: 13px; - word-break: break-all; - word-wrap: break-word; - color: $gl-text-color-inverted; - border-radius: $border-radius-small; - min-height: 42px; - background-color: $builds-trace-bg; -} - -.line { - padding: 1px $gl-padding 1px $job-log-line-padding; -} - -.line-number { - color: $gl-text-color-inverted; - padding: 0 $gl-padding-8; - min-width: $job-line-number-width; - margin-left: -$job-line-number-width; - padding-right: 1em; - - &:hover, - &:active, - &:visited { - text-decoration: underline; - color: $gl-text-color-inverted; - } -} - -.collapsible-line { - &:hover { - background-color: rgba($white-light, 0.2); - } - - .arrow { - margin-left: -$job-arrow-margin; - } -} - -.duration { - background: $gl-gray-400; -} - -.loader-animation { - @include build-loader-animation; -} diff --git a/app/assets/stylesheets/framework/snippets.scss b/app/assets/stylesheets/framework/snippets.scss index f57b1d9f351..3ab83f4c8e6 100644 --- a/app/assets/stylesheets/framework/snippets.scss +++ b/app/assets/stylesheets/framework/snippets.scss @@ -39,6 +39,10 @@ min-height: $header-height; } +.snippet-edited-ago { + color: $gray-darkest; +} + .snippet-actions { @include media-breakpoint-up(sm) { float: right; diff --git a/app/assets/stylesheets/framework/sortable.scss b/app/assets/stylesheets/framework/sortable.scss index 25868061d04..8c070200135 100644 --- a/app/assets/stylesheets/framework/sortable.scss +++ b/app/assets/stylesheets/framework/sortable.scss @@ -90,21 +90,3 @@ padding: 0; } } - -.is-dragging { - // Important because plugin sets inline CSS - opacity: 1 !important; - - * { - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - // !important to make sure no style can override this when dragging - cursor: grabbing !important; - } - - &.no-drop * { - cursor: no-drop !important; - } -} diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss index e77527ac130..faa0a9909d5 100644 --- a/app/assets/stylesheets/framework/variables.scss +++ b/app/assets/stylesheets/framework/variables.scss @@ -606,9 +606,6 @@ $blame-blue: #254e77; */ $builds-trace-bg: #111; $job-log-highlight-height: 18px; -$job-log-line-padding: 62px; -$job-line-number-width: 40px; -$job-arrow-margin: 50px; /* * Commit Page diff --git a/app/assets/stylesheets/pages/boards.scss b/app/assets/stylesheets/pages/boards.scss index 4bf0abccd00..e77a2d1e333 100644 --- a/app/assets/stylesheets/pages/boards.scss +++ b/app/assets/stylesheets/pages/boards.scss @@ -2,6 +2,20 @@ cursor: grab; } +.is-dragging { + // Important because plugin sets inline CSS + opacity: 1 !important; + + * { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + // !important to make sure no style can override this when dragging + cursor: grabbing !important; + } +} + .is-ghost { opacity: 0.3; pointer-events: none; diff --git a/app/assets/stylesheets/pages/issues.scss b/app/assets/stylesheets/pages/issues.scss index a37cbda8558..8359a60ec9f 100644 --- a/app/assets/stylesheets/pages/issues.scss +++ b/app/assets/stylesheets/pages/issues.scss @@ -29,6 +29,10 @@ .author-link { display: inline-block; } + + .issuable-comments { + height: 18px; + } } .icon-merge-request-unmerged { diff --git a/app/assets/stylesheets/pages/merge_requests.scss b/app/assets/stylesheets/pages/merge_requests.scss index e6feded1d4f..c8d155706a9 100644 --- a/app/assets/stylesheets/pages/merge_requests.scss +++ b/app/assets/stylesheets/pages/merge_requests.scss @@ -461,6 +461,10 @@ .author-link { display: inline-block; } + + .issuable-comments { + height: 18px; + } } .merge-request-title { diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index 801e9e7204c..c80beceae52 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -889,7 +889,11 @@ pre.light-well { @include basic-list-stats; display: flex; align-items: center; - padding: $gl-padding-12 0; + padding: $gl-padding 0; + + @include media-breakpoint-up(lg) { + padding: $gl-padding 0; + } &.no-description { @include media-breakpoint-up(sm) { @@ -905,7 +909,7 @@ pre.light-well { } h2 { - font-size: $gl-font-size; + font-size: $gl-font-size-large; font-weight: $gl-font-weight-bold; margin-bottom: 0; @@ -947,7 +951,6 @@ pre.light-well { .description { line-height: 1.5; - color: $gl-text-color-secondary; } @include media-breakpoint-down(md) { @@ -1093,6 +1096,7 @@ pre.light-well { &:not(.explore) { .forks { display: none; + } } |