diff --git a/app/assets/javascripts/lib/utils/http_status.js b/app/assets/javascripts/lib/utils/http_status.js index 27fd73affaa..c3adb79bcbe 100644 --- a/app/assets/javascripts/lib/utils/http_status.js +++ b/app/assets/javascripts/lib/utils/http_status.js @@ -18,13 +18,13 @@ export const HTTP_STATUS_BAD_REQUEST = 400; export const HTTP_STATUS_UNAUTHORIZED = 401; export const HTTP_STATUS_FORBIDDEN = 403; export const HTTP_STATUS_NOT_FOUND = 404; +export const HTTP_STATUS_INTERNAL_SERVER_ERROR = 500; +export const HTTP_STATUS_SERVICE_UNAVAILABLE = 503; // TODO move the rest of the status codes to primitive constants // https://docs.gitlab.com/ee/development/fe_guide/style/javascript.html#export-constants-as-primitives const httpStatusCodes = { OK: 200, - INTERNAL_SERVER_ERROR: 500, - SERVICE_UNAVAILABLE: 503, }; export const successCodes = [ diff --git a/app/assets/javascripts/ml/experiment_tracking/components/ml_experiment.vue b/app/assets/javascripts/ml/experiment_tracking/components/ml_experiment.vue index 0e601a67d85..5d13122765a 100644 --- a/app/assets/javascripts/ml/experiment_tracking/components/ml_experiment.vue +++ b/app/assets/javascripts/ml/experiment_tracking/components/ml_experiment.vue @@ -1,7 +1,8 @@ @@ -64,17 +76,46 @@ export default { :items="candidates" :empty-text="$options.i18n.emptyStateLabel" show-empty - class="gl-mt-0!" small + class="gl-mt-0! ml-candidate-table" > + + + + + + diff --git a/app/assets/javascripts/monitoring/requests/index.js b/app/assets/javascripts/monitoring/requests/index.js index 7d415ae4d04..29786a79c56 100644 --- a/app/assets/javascripts/monitoring/requests/index.js +++ b/app/assets/javascripts/monitoring/requests/index.js @@ -1,8 +1,9 @@ import axios from '~/lib/utils/axios_utils'; import { backOff } from '~/lib/utils/common_utils'; -import statusCodes, { +import { HTTP_STATUS_BAD_REQUEST, HTTP_STATUS_NO_CONTENT, + HTTP_STATUS_SERVICE_UNAVAILABLE, HTTP_STATUS_UNPROCESSABLE_ENTITY, } from '~/lib/utils/http_status'; import { PROMETHEUS_TIMEOUT } from '../constants'; @@ -39,7 +40,7 @@ export const getPrometheusQueryData = (prometheusEndpoint, params, opts) => if ( response.status === HTTP_STATUS_BAD_REQUEST || response.status === HTTP_STATUS_UNPROCESSABLE_ENTITY || - response.status === statusCodes.SERVICE_UNAVAILABLE + response.status === HTTP_STATUS_SERVICE_UNAVAILABLE ) { const { data } = response; if (data?.status === 'error' && data?.error) { diff --git a/app/assets/javascripts/monitoring/stores/mutations.js b/app/assets/javascripts/monitoring/stores/mutations.js index d79ce6ef80a..5fab292b6df 100644 --- a/app/assets/javascripts/monitoring/stores/mutations.js +++ b/app/assets/javascripts/monitoring/stores/mutations.js @@ -1,7 +1,7 @@ import { pick } from 'lodash'; import Vue from 'vue'; import { BACKOFF_TIMEOUT } from '~/lib/utils/common_utils'; -import httpStatusCodes, { HTTP_STATUS_BAD_REQUEST } from '~/lib/utils/http_status'; +import { HTTP_STATUS_BAD_REQUEST, HTTP_STATUS_SERVICE_UNAVAILABLE } from '~/lib/utils/http_status'; import { dashboardEmptyStates, endpointKeys, initialStateKeys, metricStates } from '../constants'; import * as types from './mutation_types'; import { mapToDashboardViewModel, mapPanelToViewModel, normalizeQueryResponseData } from './utils'; @@ -43,7 +43,7 @@ const emptyStateFromError = (error) => { // Axios error responses const { response } = error; - if (response && response.status === httpStatusCodes.SERVICE_UNAVAILABLE) { + if (response && response.status === HTTP_STATUS_SERVICE_UNAVAILABLE) { return metricStates.CONNECTION_FAILED; } else if (response && response.status === HTTP_STATUS_BAD_REQUEST) { // Note: "error.response.data.error" may contain Prometheus error information diff --git a/app/assets/javascripts/packages_and_registries/package_registry/components/delete_modal.vue b/app/assets/javascripts/packages_and_registries/package_registry/components/delete_modal.vue index 2a1de2ae4a7..011a2668a8b 100644 --- a/app/assets/javascripts/packages_and_registries/package_registry/components/delete_modal.vue +++ b/app/assets/javascripts/packages_and_registries/package_registry/components/delete_modal.vue @@ -55,6 +55,7 @@ export default { :action-cancel="$options.modal.cancelAction" :title="$options.i18n.DELETE_PACKAGES_MODAL_TITLE" @primary="$emit('confirm')" + @cancel="$emit('cancel')" > {{ description }} diff --git a/app/assets/javascripts/packages_and_registries/package_registry/components/list/packages_list.vue b/app/assets/javascripts/packages_and_registries/package_registry/components/list/packages_list.vue index ddcddf80c15..40bf7b7e143 100644 --- a/app/assets/javascripts/packages_and_registries/package_registry/components/list/packages_list.vue +++ b/app/assets/javascripts/packages_and_registries/package_registry/components/list/packages_list.vue @@ -5,10 +5,14 @@ import DeletePackageModal from '~/packages_and_registries/shared/components/dele import PackagesListRow from '~/packages_and_registries/package_registry/components/list/package_list_row.vue'; import PackagesListLoader from '~/packages_and_registries/shared/components/packages_list_loader.vue'; import RegistryList from '~/packages_and_registries/shared/components/registry_list.vue'; +import DeleteModal from '~/packages_and_registries/package_registry/components/delete_modal.vue'; import { DELETE_PACKAGE_TRACKING_ACTION, + DELETE_PACKAGES_TRACKING_ACTION, REQUEST_DELETE_PACKAGE_TRACKING_ACTION, + REQUEST_DELETE_PACKAGES_TRACKING_ACTION, CANCEL_DELETE_PACKAGE_TRACKING_ACTION, + CANCEL_DELETE_PACKAGES_TRACKING_ACTION, PACKAGE_ERROR_STATUS, } from '~/packages_and_registries/package_registry/constants'; import { packageTypeToTrackCategory } from '~/packages_and_registries/package_registry/utils'; @@ -18,6 +22,7 @@ export default { name: 'PackagesList', components: { GlAlert, + DeleteModal, DeletePackageModal, PackagesListLoader, PackagesListRow, @@ -44,6 +49,7 @@ export default { data() { return { itemToBeDeleted: null, + itemsToBeDeleted: [], errorPackages: [], }; }, @@ -92,7 +98,18 @@ export default { this.setItemToBeDeleted(item); return; } - this.$emit('delete', items); + this.itemsToBeDeleted = items; + this.track(REQUEST_DELETE_PACKAGES_TRACKING_ACTION); + this.$refs.deletePackagesModal.show(); + }, + deleteItemsConfirmation() { + this.$emit('delete', this.itemsToBeDeleted); + this.track(DELETE_PACKAGES_TRACKING_ACTION); + this.itemsToBeDeleted = []; + }, + deleteItemsCanceled() { + this.track(CANCEL_DELETE_PACKAGES_TRACKING_ACTION); + this.itemsToBeDeleted = []; }, deleteItemConfirmation() { this.$emit('package:delete', this.itemToBeDeleted); @@ -159,6 +176,13 @@ export default { @ok="deleteItemConfirmation" @cancel="deleteItemCanceled" /> + + diff --git a/app/assets/javascripts/packages_and_registries/package_registry/constants.js b/app/assets/javascripts/packages_and_registries/package_registry/constants.js index d4e55edf2a3..539b12bd6db 100644 --- a/app/assets/javascripts/packages_and_registries/package_registry/constants.js +++ b/app/assets/javascripts/packages_and_registries/package_registry/constants.js @@ -110,6 +110,11 @@ export const FETCH_PACKAGE_PIPELINES_ERROR_MESSAGE = s__( export const FETCH_PACKAGE_METADATA_ERROR_MESSAGE = s__( 'PackageRegistry|Something went wrong while fetching the package metadata.', ); + +export const DELETE_PACKAGES_TRACKING_ACTION = 'delete_packages'; +export const REQUEST_DELETE_PACKAGES_TRACKING_ACTION = 'request_delete_packages'; +export const CANCEL_DELETE_PACKAGES_TRACKING_ACTION = 'cancel_delete_packages'; + export const DELETE_PACKAGES_ERROR_MESSAGE = s__( 'PackageRegistry|Something went wrong while deleting packages.', ); diff --git a/app/assets/javascripts/packages_and_registries/package_registry/pages/list.vue b/app/assets/javascripts/packages_and_registries/package_registry/pages/list.vue index 6521d56ad4d..396429d60d8 100644 --- a/app/assets/javascripts/packages_and_registries/package_registry/pages/list.vue +++ b/app/assets/javascripts/packages_and_registries/package_registry/pages/list.vue @@ -1,6 +1,6 @@