From 62a3deaa9f6e1e1986c43b49a41a917201ec2734 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 28 Aug 2023 12:10:42 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../jobs/components/table/cells/duration_cell.vue | 9 +- .../jobs/components/table/cells/pipeline_cell.vue | 2 +- .../javascripts/notes/components/comment_form.vue | 4 - .../javascripts/notes/components/notes_app.vue | 2 - app/assets/javascripts/notes/stores/actions.js | 112 ++++----------------- .../dependency_proxy/app.vue | 31 ++---- .../dependency_proxy/index.js | 14 ++- .../dependency_proxy/router.js | 14 +++ .../dependency_proxy/utils.js | 24 +++++ .../linked_pipelines_mini_list.vue | 2 +- .../pipeline_mini_graph/pipeline_stages.vue | 2 +- .../failure_widget/pipeline_failed_jobs_widget.vue | 2 +- .../security_configuration/components/app.vue | 13 ++- .../security_configuration/components/constants.js | 2 + .../assignees/uncollapsed_assignee_list.vue | 13 ++- .../components/participants/participants.vue | 11 +- app/assets/javascripts/tracking/constants.js | 5 + .../components/mr_widget_pipeline.vue | 6 +- .../vue_merge_request_widget/mr_widget_options.vue | 3 +- app/assets/stylesheets/framework/sidebar.scss | 23 ----- .../stylesheets/page_bundles/merge_requests.scss | 5 +- app/channels/noteable/notes_channel.rb | 1 - .../concerns/preferred_language_switcher.rb | 30 ++++++ .../environments/sample_metrics_controller.rb | 16 --- app/controllers/projects/issues_controller.rb | 1 - .../projects/merge_requests_controller.rb | 1 - app/finders/group_members_finder.rb | 16 ++- app/models/concerns/noteable.rb | 2 +- app/models/metrics/users_starred_dashboard.rb | 18 ---- app/models/project.rb | 1 - app/models/user.rb | 2 - app/services/compare_service.rb | 5 +- app/services/concerns/rate_limited_service.rb | 8 +- .../copy_design_collection/copy_service.rb | 4 +- .../design_management/delete_designs_service.rb | 6 +- .../design_management/runs_design_actions.rb | 10 +- .../design_management/save_designs_service.rb | 8 +- app/services/error_tracking/base_service.rb | 6 +- app/services/event_create_service.rb | 12 ++- app/services/files/update_service.rb | 22 ++-- .../create_cloudsql_instance_service.rb | 38 +++---- .../google_cloud/fetch_google_ip_list_service.rb | 8 +- app/services/issuable_base_service.rb | 32 +++--- app/services/issues/close_service.rb | 10 +- app/services/issues/create_service.rb | 11 +- app/services/issues/move_service.rb | 20 ++-- app/services/metrics/sample_metrics_service.rb | 36 ------- app/views/groups/dependency_proxies/show.html.haml | 1 + app/views/profiles/preferences/show.html.haml | 2 +- 49 files changed, 291 insertions(+), 335 deletions(-) create mode 100644 app/assets/javascripts/packages_and_registries/dependency_proxy/router.js create mode 100644 app/assets/javascripts/packages_and_registries/dependency_proxy/utils.js delete mode 100644 app/controllers/projects/environments/sample_metrics_controller.rb delete mode 100644 app/models/metrics/users_starred_dashboard.rb delete mode 100644 app/services/metrics/sample_metrics_service.rb (limited to 'app') diff --git a/app/assets/javascripts/jobs/components/table/cells/duration_cell.vue b/app/assets/javascripts/jobs/components/table/cells/duration_cell.vue index 11593fa355a..dbf1dfe7a29 100644 --- a/app/assets/javascripts/jobs/components/table/cells/duration_cell.vue +++ b/app/assets/javascripts/jobs/components/table/cells/duration_cell.vue @@ -27,6 +27,9 @@ export default { durationFormatted() { return formatTime(this.duration * 1000); }, + hasDurationAndFinishedTime() { + return this.finishedTime && this.duration; + }, }, }; @@ -37,7 +40,11 @@ export default { {{ durationFormatted }} -
+
diff --git a/app/assets/javascripts/jobs/components/table/cells/pipeline_cell.vue b/app/assets/javascripts/jobs/components/table/cells/pipeline_cell.vue index 1a6d1a341b0..c8f0fdd4439 100644 --- a/app/assets/javascripts/jobs/components/table/cells/pipeline_cell.vue +++ b/app/assets/javascripts/jobs/components/table/cells/pipeline_cell.vue @@ -41,7 +41,7 @@ export default { {{ pipelineId }}
-
+
{{ __('created by') }} diff --git a/app/assets/javascripts/notes/components/comment_form.vue b/app/assets/javascripts/notes/components/comment_form.vue index a009f2975bb..1a4add30f9f 100644 --- a/app/assets/javascripts/notes/components/comment_form.vue +++ b/app/assets/javascripts/notes/components/comment_form.vue @@ -210,8 +210,6 @@ export default { methods: { ...mapActions([ 'saveNote', - 'stopPolling', - 'restartPolling', 'removePlaceholderNotes', 'closeIssuable', 'reopenIssuable', @@ -253,7 +251,6 @@ export default { } this.note = ''; // Empty textarea while being requested. Repopulate in catch - this.stopPolling(); this.isSubmitting = true; @@ -264,7 +261,6 @@ export default { this.saveNote(noteData) .then(() => { - this.restartPolling(); this.discard(); if (withIssueAction) { diff --git a/app/assets/javascripts/notes/components/notes_app.vue b/app/assets/javascripts/notes/components/notes_app.vue index 6fb958e810b..2524b9efdb6 100644 --- a/app/assets/javascripts/notes/components/notes_app.vue +++ b/app/assets/javascripts/notes/components/notes_app.vue @@ -169,7 +169,6 @@ export default { }); }, beforeDestroy() { - this.stopPolling(); window.removeEventListener('hashchange', this.handleHashChanged); eventHub.$off('notesApp.updateIssuableConfidentiality', this.setConfidentiality); }, @@ -182,7 +181,6 @@ export default { 'expandDiscussion', 'startTaskList', 'convertToDiscussion', - 'stopPolling', 'setConfidentiality', 'fetchNotes', ]), diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index 0444eca9aa7..a20bce2e53a 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -1,5 +1,4 @@ import $ from 'jquery'; -import Visibility from 'visibilityjs'; import Vue from 'vue'; import actionCable from '~/actioncable_consumer'; import Api from '~/api'; @@ -14,8 +13,6 @@ import updateIssueLockMutation from '~/sidebar/queries/update_issue_lock.mutatio import updateMergeRequestLockMutation from '~/sidebar/queries/update_merge_request_lock.mutation.graphql'; import loadAwardsHandler from '~/awards_handler'; import { isInViewport, scrollToElement, isInMRPage } from '~/lib/utils/common_utils'; -import Poll from '~/lib/utils/poll'; -import { create } from '~/lib/utils/recurrence'; import { mergeUrlParams } from '~/lib/utils/url_utility'; import sidebarTimeTrackingEventHub from '~/sidebar/event_hub'; import TaskList from '~/task_list'; @@ -30,9 +27,6 @@ import * as constants from '../constants'; import * as types from './mutation_types'; import * as utils from './utils'; -const NOTES_POLLING_INTERVAL = 6000; -let eTagPoll; - export const updateLockedAttribute = ({ commit, getters }, { locked, fullPath }) => { const { iid, targetType } = getters.getNoteableData; @@ -152,29 +146,25 @@ export const initPolling = ({ state, dispatch, getters, commit }) => { dispatch('setLastFetchedAt', getters.getNotesDataByProp('lastFetchedAt')); - if (gon.features?.actionCableNotes) { - actionCable.subscriptions.create( - { - channel: 'Noteable::NotesChannel', - project_id: state.notesData.projectId, - group_id: state.notesData.groupId, - noteable_type: state.notesData.noteableType, - noteable_id: state.notesData.noteableId, + actionCable.subscriptions.create( + { + channel: 'Noteable::NotesChannel', + project_id: state.notesData.projectId, + group_id: state.notesData.groupId, + noteable_type: state.notesData.noteableType, + noteable_id: state.notesData.noteableId, + }, + { + connected() { + dispatch('fetchUpdatedNotes'); }, - { - connected() { + received(data) { + if (data.event === 'updated') { dispatch('fetchUpdatedNotes'); - }, - received(data) { - if (data.event === 'updated') { - dispatch('fetchUpdatedNotes'); - } - }, + } }, - ); - } else { - dispatch('poll'); - } + }, + ); commit(types.SET_IS_POLLING_INITIALIZED, true); }; @@ -515,8 +505,6 @@ export const saveNote = ({ commit, dispatch }, noteData) => { {"commands_changes":{},"valid":false,"errors":{"commands_only":["Commands applied"]}} */ if (hasQuickActions && message) { - if (eTagPoll) eTagPoll.makeRequest(); - // synchronizing the quick action with the sidebar widget // this is a temporary solution until we have confidentiality real-time updates if ( @@ -624,69 +612,7 @@ export const fetchUpdatedNotes = ({ commit, state, getters, dispatch }) => { .then(({ data }) => { pollSuccessCallBack(data, commit, state, getters, dispatch); }) - .catch(() => { - createAlert({ - message: __('Something went wrong while fetching latest comments.'), - }); - }); -}; - -export const poll = ({ commit, state, getters, dispatch }) => { - const notePollOccurrenceTracking = create(); - let alert; - - notePollOccurrenceTracking.handle(1, () => { - // Since polling halts internally after 1 failure, we manually try one more time - setTimeout(() => eTagPoll.restart(), NOTES_POLLING_INTERVAL); - }); - notePollOccurrenceTracking.handle(2, () => { - // On the second failure in a row, show the alert and try one more time (hoping to succeed and clear the error) - alert = createAlert({ - message: __('Something went wrong while fetching latest comments.'), - }); - setTimeout(() => eTagPoll.restart(), NOTES_POLLING_INTERVAL); - }); - - eTagPoll = new Poll({ - resource: { - poll: () => { - const { endpoint, options } = getFetchDataParams(state); - return axios.get(endpoint, options); - }, - }, - method: 'poll', - successCallback: ({ data }) => { - pollSuccessCallBack(data, commit, state, getters, dispatch); - - if (notePollOccurrenceTracking.count) { - notePollOccurrenceTracking.reset(); - } - alert?.dismiss(); - }, - errorCallback: () => notePollOccurrenceTracking.occur(), - }); - - if (!Visibility.hidden()) { - eTagPoll.makeDelayedRequest(2500); - } else { - eTagPoll.makeRequest(); - } - - Visibility.change(() => { - if (!Visibility.hidden()) { - eTagPoll.restart(); - } else { - eTagPoll.stop(); - } - }); -}; - -export const stopPolling = () => { - if (eTagPoll) eTagPoll.stop(); -}; - -export const restartPolling = () => { - if (eTagPoll) eTagPoll.restart(); + .catch(() => {}); }; export const toggleAward = ({ commit, getters }, { awardName, noteId }) => { @@ -766,7 +692,6 @@ export const submitSuggestion = ( dispatch('resolveDiscussion', { discussionId }).catch(() => {}); commit(types.SET_RESOLVING_DISCUSSION, true); - dispatch('stopPolling'); return Api.applySuggestion(suggestionId, message) .then(dispatchResolveDiscussion) @@ -786,7 +711,6 @@ export const submitSuggestion = ( }) .finally(() => { commit(types.SET_RESOLVING_DISCUSSION, false); - dispatch('restartPolling'); }); }; @@ -801,7 +725,6 @@ export const submitSuggestionBatch = ({ commit, dispatch, state }, { message, fl commit(types.SET_APPLYING_BATCH_STATE, true); commit(types.SET_RESOLVING_DISCUSSION, true); - dispatch('stopPolling'); return Api.applySuggestionBatch(suggestionIds, message) .then(() => Promise.all(resolveAllDiscussions())) @@ -823,7 +746,6 @@ export const submitSuggestionBatch = ({ commit, dispatch, state }, { message, fl .finally(() => { commit(types.SET_APPLYING_BATCH_STATE, false); commit(types.SET_RESOLVING_DISCUSSION, false); - dispatch('restartPolling'); }); }; diff --git a/app/assets/javascripts/packages_and_registries/dependency_proxy/app.vue b/app/assets/javascripts/packages_and_registries/dependency_proxy/app.vue index e18e6f7ed1a..6e0d1043502 100644 --- a/app/assets/javascripts/packages_and_registries/dependency_proxy/app.vue +++ b/app/assets/javascripts/packages_and_registries/dependency_proxy/app.vue @@ -18,6 +18,8 @@ import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import TitleArea from '~/vue_shared/components/registry/title_area.vue'; import ManifestsList from '~/packages_and_registries/dependency_proxy/components/manifests_list.vue'; import { GRAPHQL_PAGE_SIZE } from '~/packages_and_registries/dependency_proxy/constants'; +import { getPageParams } from '~/packages_and_registries/dependency_proxy/utils'; +import { extractPageInfo } from '~/packages_and_registries/shared/utils'; import getDependencyProxyDetailsQuery from '~/packages_and_registries/dependency_proxy/graphql/queries/get_dependency_proxy_details.query.graphql'; @@ -79,11 +81,15 @@ export default { }, computed: { queryVariables() { - return { fullPath: this.groupPath, first: GRAPHQL_PAGE_SIZE }; + return { fullPath: this.groupPath, first: GRAPHQL_PAGE_SIZE, ...this.pageParams }; }, pageInfo() { return this.group.dependencyProxyManifests?.pageInfo; }, + pageParams() { + const pageInfo = extractPageInfo(this.$route.query); + return getPageParams(pageInfo); + }, manifests() { return this.group.dependencyProxyManifests?.nodes ?? []; }, @@ -123,25 +129,10 @@ export default { }, methods: { fetchNextPage() { - this.fetchMore({ - first: GRAPHQL_PAGE_SIZE, - after: this.pageInfo?.endCursor, - }); + this.$router.push({ query: { after: this.pageInfo?.endCursor } }); }, fetchPreviousPage() { - this.fetchMore({ - first: null, - last: GRAPHQL_PAGE_SIZE, - before: this.pageInfo?.startCursor, - }); - }, - fetchMore(variables) { - this.$apollo.queries.group.fetchMore({ - variables: { ...this.queryVariables, ...variables }, - updateQuery(_, { fetchMoreResult }) { - return fetchMoreResult; - }, - }); + this.$router.push({ query: { before: this.pageInfo?.startCursor } }); }, async submit() { try { @@ -198,14 +189,14 @@ export default { diff --git a/app/assets/javascripts/packages_and_registries/dependency_proxy/index.js b/app/assets/javascripts/packages_and_registries/dependency_proxy/index.js index 74444d2c7ec..c115898c75b 100644 --- a/app/assets/javascripts/packages_and_registries/dependency_proxy/index.js +++ b/app/assets/javascripts/packages_and_registries/dependency_proxy/index.js @@ -1,8 +1,8 @@ import Vue from 'vue'; import { parseBoolean } from '~/lib/utils/common_utils'; -import app from '~/packages_and_registries/dependency_proxy/app.vue'; import { apolloProvider } from '~/packages_and_registries/dependency_proxy/graphql'; import Translate from '~/vue_shared/translate'; +import createRouter from './router'; Vue.use(Translate); @@ -11,10 +11,18 @@ export const initDependencyProxyApp = () => { if (!el) { return null; } - const { groupPath, groupId, noManifestsIllustration, canClearCache, settingsPath } = el.dataset; + const { + endpoint, + groupPath, + groupId, + noManifestsIllustration, + canClearCache, + settingsPath, + } = el.dataset; return new Vue({ el, apolloProvider, + router: createRouter(endpoint), provide: { groupPath, groupId, @@ -23,7 +31,7 @@ export const initDependencyProxyApp = () => { settingsPath, }, render(createElement) { - return createElement(app); + return createElement('router-view'); }, }); }; diff --git a/app/assets/javascripts/packages_and_registries/dependency_proxy/router.js b/app/assets/javascripts/packages_and_registries/dependency_proxy/router.js new file mode 100644 index 00000000000..087d8c189c4 --- /dev/null +++ b/app/assets/javascripts/packages_and_registries/dependency_proxy/router.js @@ -0,0 +1,14 @@ +import Vue from 'vue'; +import VueRouter from 'vue-router'; +import App from '~/packages_and_registries/dependency_proxy/app.vue'; + +Vue.use(VueRouter); + +export default function createRouter(base) { + const routes = [{ path: '/', name: 'dependencyProxyApp', component: App }]; + return new VueRouter({ + mode: 'history', + base, + routes, + }); +} diff --git a/app/assets/javascripts/packages_and_registries/dependency_proxy/utils.js b/app/assets/javascripts/packages_and_registries/dependency_proxy/utils.js new file mode 100644 index 00000000000..e6b97fac896 --- /dev/null +++ b/app/assets/javascripts/packages_and_registries/dependency_proxy/utils.js @@ -0,0 +1,24 @@ +import { GRAPHQL_PAGE_SIZE } from './constants'; + +const getNextPageParams = (cursor) => ({ + after: cursor, + first: GRAPHQL_PAGE_SIZE, +}); + +const getPreviousPageParams = (cursor) => ({ + first: null, + before: cursor, + last: GRAPHQL_PAGE_SIZE, +}); + +export const getPageParams = (pageInfo = {}) => { + if (pageInfo.before) { + return getPreviousPageParams(pageInfo.before); + } + + if (pageInfo.after) { + return getNextPageParams(pageInfo.after); + } + + return {}; +}; diff --git a/app/assets/javascripts/pipelines/components/pipeline_mini_graph/linked_pipelines_mini_list.vue b/app/assets/javascripts/pipelines/components/pipeline_mini_graph/linked_pipelines_mini_list.vue index a5c6dc98694..8567654a89e 100644 --- a/app/assets/javascripts/pipelines/components/pipeline_mini_graph/linked_pipelines_mini_list.vue +++ b/app/assets/javascripts/pipelines/components/pipeline_mini_graph/linked_pipelines_mini_list.vue @@ -105,7 +105,7 @@ export default { v-gl-tooltip="{ title: pipelineTooltipText(pipeline) }" :href="pipeline.path" :class="triggerButtonClass(pipeline)" - class="linked-pipeline-mini-item gl-display-inline-block gl-h-6 gl-mr-2 gl-my-2 gl-rounded-full gl-vertical-align-middle" + class="linked-pipeline-mini-item gl-display-inline-flex gl-mr-2 gl-my-2 gl-rounded-full gl-vertical-align-middle" data-testid="linked-pipeline-mini-item" > diff --git a/app/assets/javascripts/security_configuration/components/app.vue b/app/assets/javascripts/security_configuration/components/app.vue index c7d89113895..32d46a0d4af 100644 --- a/app/assets/javascripts/security_configuration/components/app.vue +++ b/app/assets/javascripts/security_configuration/components/app.vue @@ -1,13 +1,18 @@