diff options
Diffstat (limited to 'app/assets/javascripts/pages/admin')
15 files changed, 7 insertions, 732 deletions
diff --git a/app/assets/javascripts/pages/admin/abuse_reports/abuse_reports.js b/app/assets/javascripts/pages/admin/abuse_reports/abuse_reports.js deleted file mode 100644 index 29e92a8abad..00000000000 --- a/app/assets/javascripts/pages/admin/abuse_reports/abuse_reports.js +++ /dev/null @@ -1,38 +0,0 @@ -import $ from 'jquery'; -import { parseBoolean } from '~/lib/utils/common_utils'; -import { truncate } from '~/lib/utils/text_utility'; - -const MAX_MESSAGE_LENGTH = 500; -const MESSAGE_CELL_SELECTOR = '.abuse-reports .message'; - -export default class AbuseReports { - constructor() { - $(MESSAGE_CELL_SELECTOR).each(this.truncateLongMessage); - $(document) - .off('click', MESSAGE_CELL_SELECTOR) - .on('click', MESSAGE_CELL_SELECTOR, this.toggleMessageTruncation); - } - - truncateLongMessage() { - const $messageCellElement = $(this); - const reportMessage = $messageCellElement.text(); - if (reportMessage.length > MAX_MESSAGE_LENGTH) { - $messageCellElement.data('originalMessage', reportMessage); - $messageCellElement.data('messageTruncated', 'true'); - $messageCellElement.text(truncate(reportMessage, MAX_MESSAGE_LENGTH)); - } - } - - toggleMessageTruncation() { - const $messageCellElement = $(this); - const originalMessage = $messageCellElement.data('originalMessage'); - if (!originalMessage) return; - if (parseBoolean($messageCellElement.data('messageTruncated'))) { - $messageCellElement.data('messageTruncated', 'false'); - $messageCellElement.text(originalMessage); - } else { - $messageCellElement.data('messageTruncated', 'true'); - $messageCellElement.text(truncate(originalMessage, MAX_MESSAGE_LENGTH)); - } - } -} diff --git a/app/assets/javascripts/pages/admin/abuse_reports/index.js b/app/assets/javascripts/pages/admin/abuse_reports/index.js index 7634f131e4d..78fef1b5531 100644 --- a/app/assets/javascripts/pages/admin/abuse_reports/index.js +++ b/app/assets/javascripts/pages/admin/abuse_reports/index.js @@ -1,10 +1,3 @@ import { initAbuseReportsApp } from '~/admin/abuse_reports'; -import initDeprecatedRemoveRowBehavior from '~/behaviors/deprecated_remove_row_behavior'; -import UsersSelect from '~/users_select'; -import AbuseReports from './abuse_reports'; -new AbuseReports(); /* eslint-disable-line no-new */ -new UsersSelect(); /* eslint-disable-line no-new */ - -initDeprecatedRemoveRowBehavior(); initAbuseReportsApp(); diff --git a/app/assets/javascripts/pages/admin/application_settings/general/index.js b/app/assets/javascripts/pages/admin/application_settings/general/index.js index 8a810ca649c..d0593c82ac1 100644 --- a/app/assets/javascripts/pages/admin/application_settings/general/index.js +++ b/app/assets/javascripts/pages/admin/application_settings/general/index.js @@ -1,3 +1,4 @@ +import { initSilentModeSettings } from '~/silent_mode_settings'; import initAccountAndLimitsSection from '../account_and_limits'; import initGitpod from '../gitpod'; import initSignupRestrictions from '../signup_restrictions'; @@ -6,4 +7,5 @@ import initSignupRestrictions from '../signup_restrictions'; initAccountAndLimitsSection(); initGitpod(); initSignupRestrictions(); + initSilentModeSettings(); })(); diff --git a/app/assets/javascripts/pages/admin/jobs/components/cancel_jobs.vue b/app/assets/javascripts/pages/admin/jobs/components/cancel_jobs.vue deleted file mode 100644 index 72cfc005782..00000000000 --- a/app/assets/javascripts/pages/admin/jobs/components/cancel_jobs.vue +++ /dev/null @@ -1,37 +0,0 @@ -<script> -import { GlButton, GlModalDirective, GlTooltipDirective } from '@gitlab/ui'; -import CancelJobsModal from './cancel_jobs_modal.vue'; -import { CANCEL_JOBS_MODAL_ID, CANCEL_JOBS_BUTTON_TEXT, CANCEL_BUTTON_TOOLTIP } from './constants'; - -export default { - name: 'CancelJobs', - components: { - GlButton, - CancelJobsModal, - }, - directives: { - GlModal: GlModalDirective, - GlTooltip: GlTooltipDirective, - }, - props: { - url: { - type: String, - required: true, - }, - }, - modalId: CANCEL_JOBS_MODAL_ID, - buttonText: CANCEL_JOBS_BUTTON_TEXT, - buttonTooltip: CANCEL_BUTTON_TOOLTIP, -}; -</script> -<template> - <div> - <gl-button - v-gl-modal="$options.modalId" - v-gl-tooltip="$options.buttonTooltip" - variant="danger" - >{{ $options.buttonText }}</gl-button - > - <cancel-jobs-modal :modal-id="$options.modalId" :url="url" @confirm="$emit('confirm')" /> - </div> -</template> diff --git a/app/assets/javascripts/pages/admin/jobs/components/cancel_jobs_modal.vue b/app/assets/javascripts/pages/admin/jobs/components/cancel_jobs_modal.vue deleted file mode 100644 index b2c5326fefd..00000000000 --- a/app/assets/javascripts/pages/admin/jobs/components/cancel_jobs_modal.vue +++ /dev/null @@ -1,66 +0,0 @@ -<script> -import { GlModal } from '@gitlab/ui'; -import { createAlert } from '~/alert'; -import axios from '~/lib/utils/axios_utils'; -import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated -import { - CANCEL_TEXT, - CANCEL_JOBS_FAILED_TEXT, - CANCEL_JOBS_MODAL_TITLE, - CANCEL_JOBS_WARNING, - PRIMARY_ACTION_TEXT, -} from './constants'; - -export default { - components: { - GlModal, - }, - props: { - url: { - type: String, - required: true, - }, - modalId: { - type: String, - required: true, - }, - }, - methods: { - onSubmit() { - return axios - .post(this.url) - .then((response) => { - // follow the rediect to refresh the page - redirectTo(response.request.responseURL); // eslint-disable-line import/no-deprecated - }) - .catch((error) => { - createAlert({ - message: CANCEL_JOBS_FAILED_TEXT, - }); - throw error; - }); - }, - }, - primaryAction: { - text: PRIMARY_ACTION_TEXT, - attributes: { variant: 'danger' }, - }, - cancelAction: { - text: CANCEL_TEXT, - }, - CANCEL_JOBS_WARNING, - CANCEL_JOBS_MODAL_TITLE, -}; -</script> - -<template> - <gl-modal - :modal-id="modalId" - :action-primary="$options.primaryAction" - :action-cancel="$options.cancelAction" - :title="$options.CANCEL_JOBS_MODAL_TITLE" - @primary="onSubmit" - > - {{ $options.CANCEL_JOBS_WARNING }} - </gl-modal> -</template> diff --git a/app/assets/javascripts/pages/admin/jobs/components/constants.js b/app/assets/javascripts/pages/admin/jobs/components/constants.js deleted file mode 100644 index 4af8cb355fc..00000000000 --- a/app/assets/javascripts/pages/admin/jobs/components/constants.js +++ /dev/null @@ -1,35 +0,0 @@ -import { s__, __ } from '~/locale'; -import { RAW_TEXT_WARNING } from '~/jobs/components/table/constants'; - -export const JOBS_COUNT_ERROR_MESSAGE = __('There was an error fetching the number of jobs.'); -export const JOBS_FETCH_ERROR_MSG = __('There was an error fetching the jobs.'); -export const LOADING_ARIA_LABEL = __('Loading'); -export const CANCELABLE_JOBS_ERROR_MSG = __('There was an error fetching the cancelable jobs.'); -export const CANCEL_JOBS_MODAL_ID = 'cancel-jobs-modal'; -export const CANCEL_JOBS_MODAL_TITLE = s__('AdminArea|Are you sure?'); -export const CANCEL_JOBS_BUTTON_TEXT = s__('AdminArea|Cancel all jobs'); -export const CANCEL_BUTTON_TOOLTIP = s__('AdminArea|Cancel all running and pending jobs'); -export const CANCEL_TEXT = __('Cancel'); -export const CANCEL_JOBS_FAILED_TEXT = s__('AdminArea|Canceling jobs failed'); -export const PRIMARY_ACTION_TEXT = s__('AdminArea|Yes, proceed'); -export const CANCEL_JOBS_WARNING = s__( - "AdminArea|You're about to cancel all running and pending jobs across this instance. Do you want to proceed?", -); -export const RUNNER_EMPTY_TEXT = __('None'); -export const RUNNER_NO_DESCRIPTION = s__('Runners|No description'); - -/* Admin Table constants */ -/* The field list is based on app/assets/javascripts/jobs/components/table/constants.js */ -export const DEFAULT_FIELDS_ADMIN = [ - { key: 'status', label: __('Status'), columnClass: 'gl-w-15p' }, - { key: 'job', label: __('Job'), columnClass: 'gl-w-20p' }, - { key: 'project', label: __('Project'), columnClass: 'gl-w-20p' }, - { key: 'runner', label: __('Runner'), columnClass: 'gl-w-15p' }, - { key: 'pipeline', label: __('Pipeline'), columnClass: 'gl-w-10p' }, - { key: 'stage', label: __('Stage'), columnClass: 'gl-w-10p' }, - { key: 'name', label: __('Name'), columnClass: 'gl-w-15p' }, - { key: 'duration', label: __('Duration'), columnClass: 'gl-w-15p' }, - { key: 'actions', label: '', columnClass: 'gl-w-10p' }, -]; - -export const RAW_TEXT_WARNING_ADMIN = RAW_TEXT_WARNING; diff --git a/app/assets/javascripts/pages/admin/jobs/components/jobs_skeleton_loader.vue b/app/assets/javascripts/pages/admin/jobs/components/jobs_skeleton_loader.vue deleted file mode 100644 index c305e09af0d..00000000000 --- a/app/assets/javascripts/pages/admin/jobs/components/jobs_skeleton_loader.vue +++ /dev/null @@ -1,26 +0,0 @@ -<script> -import { GlSkeletonLoader } from '@gitlab/ui'; - -export default { - components: { - GlSkeletonLoader, - }, -}; -</script> - -<template> - <gl-skeleton-loader :width="1248" :height="73"> - <circle cx="748.031" cy="37.7193" r="15.0307" /> - <circle cx="787.241" cy="37.7193" r="15.0307" /> - <circle cx="827.759" cy="37.7193" r="15.0307" /> - <circle cx="866.969" cy="37.7193" r="15.0307" /> - <circle cx="380" cy="37" r="18" /> - <rect x="432" y="19" width="126.587" height="15" /> - <rect x="432" y="41" width="247" height="15" /> - <rect x="158" y="19" width="86.1" height="15" /> - <rect x="158" y="41" width="168" height="15" /> - <rect x="22" y="19" width="96" height="36" /> - <rect x="924" y="30" width="96" height="15" /> - <rect x="1057" y="20" width="166" height="35" /> - </gl-skeleton-loader> -</template> diff --git a/app/assets/javascripts/pages/admin/jobs/components/table/admin_jobs_table_app.vue b/app/assets/javascripts/pages/admin/jobs/components/table/admin_jobs_table_app.vue deleted file mode 100644 index daa4119f44d..00000000000 --- a/app/assets/javascripts/pages/admin/jobs/components/table/admin_jobs_table_app.vue +++ /dev/null @@ -1,259 +0,0 @@ -<script> -import { GlAlert, GlIntersectionObserver, GlLoadingIcon } from '@gitlab/ui'; -import { setUrlParams, updateHistory, queryToObject } from '~/lib/utils/url_utility'; -import { validateQueryString } from '~/jobs/components/filtered_search/utils'; -import JobsTable from '~/jobs/components/table/jobs_table.vue'; -import JobsTableTabs from '~/jobs/components/table/jobs_table_tabs.vue'; -import JobsFilteredSearch from '~/jobs/components/filtered_search/jobs_filtered_search.vue'; -import JobsTableEmptyState from '~/jobs/components/table/jobs_table_empty_state.vue'; -import { createAlert } from '~/alert'; -import JobsSkeletonLoader from '../jobs_skeleton_loader.vue'; -import { - DEFAULT_FIELDS_ADMIN, - RAW_TEXT_WARNING_ADMIN, - JOBS_COUNT_ERROR_MESSAGE, - JOBS_FETCH_ERROR_MSG, - LOADING_ARIA_LABEL, - CANCELABLE_JOBS_ERROR_MSG, -} from '../constants'; -import GetAllJobs from './graphql/queries/get_all_jobs.query.graphql'; -import GetAllJobsCount from './graphql/queries/get_all_jobs_count.query.graphql'; -import CancelableJobs from './graphql/queries/get_cancelable_jobs_count.query.graphql'; - -export default { - i18n: { - jobsCountErrorMsg: JOBS_COUNT_ERROR_MESSAGE, - jobsFetchErrorMsg: JOBS_FETCH_ERROR_MSG, - loadingAriaLabel: LOADING_ARIA_LABEL, - cancelableJobsErrorMsg: CANCELABLE_JOBS_ERROR_MSG, - }, - filterSearchBoxStyles: - 'gl-my-0 gl-p-5 gl-bg-gray-10 gl-text-gray-900 gl-border-b gl-border-gray-100', - components: { - JobsSkeletonLoader, - JobsTableEmptyState, - GlAlert, - JobsFilteredSearch, - JobsTable, - JobsTableTabs, - GlIntersectionObserver, - GlLoadingIcon, - }, - inject: { - jobStatuses: { - default: null, - required: false, - }, - url: { - default: '', - required: false, - }, - emptyStateSvgPath: { - default: '', - required: false, - }, - }, - apollo: { - jobs: { - query: GetAllJobs, - variables() { - return this.variables; - }, - update(data) { - const { jobs: { nodes: list = [], pageInfo = {} } = {} } = data || {}; - return { - list, - pageInfo, - }; - }, - error() { - this.error = this.$options.i18n.jobsFetchErrorMsg; - }, - }, - jobsCount: { - query: GetAllJobsCount, - update(data) { - return data?.jobs?.count || 0; - }, - context: { - isSingleRequest: true, - }, - error() { - this.error = this.$options.i18n.jobsCountErrorMsg; - }, - }, - cancelable: { - query: CancelableJobs, - update(data) { - this.isCancelable = data.cancelable.count !== 0; - }, - error() { - this.error = this.$options.i18n.cancelableJobsErrorMsg; - }, - }, - }, - data() { - return { - jobs: { - list: [], - }, - error: '', - count: 0, - scope: null, - infiniteScrollingTriggered: false, - filterSearchTriggered: false, - DEFAULT_FIELDS_ADMIN, - isCancelable: false, - jobsCount: null, - }; - }, - computed: { - loading() { - return this.$apollo.queries.jobs.loading; - }, - // Show when on All tab with no jobs - // Show only when not loading and filtered search has not been triggered - // So we don't show empty state when results are empty on a filtered search - showEmptyState() { - return ( - this.jobs.list.length === 0 && !this.scope && !this.loading && !this.filterSearchTriggered - ); - }, - hasNextPage() { - return this.jobs?.pageInfo?.hasNextPage; - }, - variables() { - return { ...this.validatedQueryString }; - }, - validatedQueryString() { - const queryStringObject = queryToObject(window.location.search); - - return validateQueryString(queryStringObject); - }, - showFilteredSearch() { - return !this.scope; - }, - showLoadingSpinner() { - return this.loading && this.infiniteScrollingTriggered; - }, - showSkeletonLoader() { - return this.loading && !this.showLoadingSpinner; - }, - }, - watch: { - // this watcher ensures that the count on the all tab - // is not updated when switching to the finished tab - jobsCount(newCount) { - if (this.scope) return; - - this.count = newCount; - }, - }, - methods: { - updateHistoryAndFetchCount(status = null) { - this.$apollo.queries.jobsCount.refetch({ statuses: status }); - - updateHistory({ - url: setUrlParams({ statuses: status }, window.location.href, true), - }); - }, - fetchJobsByStatus(scope) { - this.infiniteScrollingTriggered = false; - - if (this.scope === scope) return; - - this.scope = scope; - - if (!this.scope) this.updateHistoryAndFetchCount(); - - this.$apollo.queries.jobs.refetch({ statuses: scope }); - }, - fetchMoreJobs() { - if (!this.loading) { - this.infiniteScrollingTriggered = true; - - const parameters = this.variables; - parameters.after = this.jobs?.pageInfo?.endCursor; - - this.$apollo.queries.jobs.fetchMore({ - variables: parameters, - }); - } - }, - filterJobsBySearch(filters) { - this.infiniteScrollingTriggered = false; - this.filterSearchTriggered = true; - - // all filters have been cleared reset query param - // and refetch jobs/count with defaults - if (!filters.length) { - this.updateHistoryAndFetchCount(); - this.$apollo.queries.jobs.refetch({ statuses: null }); - - return; - } - - // Eventually there will be more tokens available - // this code is written to scale for those tokens - filters.forEach((filter) => { - // Raw text input in filtered search does not have a type - // when a user enters raw text we alert them that it is - // not supported and we do not make an additional API call - if (!filter.type) { - createAlert({ - message: RAW_TEXT_WARNING_ADMIN, - type: 'warning', - }); - } - - if (filter.type === 'status') { - this.updateHistoryAndFetchCount(filter.value.data); - this.$apollo.queries.jobs.refetch({ statuses: filter.value.data }); - } - }); - }, - }, -}; -</script> - -<template> - <div> - <gl-alert v-if="error" class="gl-mt-2" variant="danger" dismissible @dismiss="error = ''"> - {{ error }} - </gl-alert> - - <jobs-table-tabs - :all-jobs-count="count" - :loading="loading" - :show-cancel-all-jobs-button="isCancelable" - @fetchJobsByStatus="fetchJobsByStatus" - /> - - <div v-if="showFilteredSearch" :class="$options.filterSearchBoxStyles"> - <jobs-filtered-search - :query-string="validatedQueryString" - @filterJobsBySearch="filterJobsBySearch" - /> - </div> - - <jobs-skeleton-loader v-if="showSkeletonLoader" class="gl-mt-5" /> - - <jobs-table-empty-state v-else-if="showEmptyState" /> - - <jobs-table - v-else - :jobs="jobs.list" - :table-fields="DEFAULT_FIELDS_ADMIN" - admin - class="gl-table-no-top-border" - /> - - <gl-intersection-observer v-if="hasNextPage" @appear="fetchMoreJobs"> - <gl-loading-icon - v-if="showLoadingSpinner" - size="lg" - :aria-label="$options.i18n.loadingAriaLabel" - /> - </gl-intersection-observer> - </div> -</template> diff --git a/app/assets/javascripts/pages/admin/jobs/components/table/cell/project_cell.vue b/app/assets/javascripts/pages/admin/jobs/components/table/cell/project_cell.vue deleted file mode 100644 index cbb80a5175f..00000000000 --- a/app/assets/javascripts/pages/admin/jobs/components/table/cell/project_cell.vue +++ /dev/null @@ -1,28 +0,0 @@ -<script> -import { GlLink } from '@gitlab/ui'; - -export default { - components: { - GlLink, - }, - props: { - job: { - type: Object, - required: true, - }, - }, - computed: { - projectName() { - return this.job.pipeline?.project?.fullPath; - }, - projectUrl() { - return this.job.pipeline?.project?.webUrl; - }, - }, -}; -</script> -<template> - <div class="gl-text-truncate"> - <gl-link :href="projectUrl"> {{ projectName }}</gl-link> - </div> -</template> diff --git a/app/assets/javascripts/pages/admin/jobs/components/table/cells/runner_cell.vue b/app/assets/javascripts/pages/admin/jobs/components/table/cells/runner_cell.vue deleted file mode 100644 index 33bcee5b34b..00000000000 --- a/app/assets/javascripts/pages/admin/jobs/components/table/cells/runner_cell.vue +++ /dev/null @@ -1,39 +0,0 @@ -<script> -import { GlLink } from '@gitlab/ui'; -import { RUNNER_EMPTY_TEXT, RUNNER_NO_DESCRIPTION } from '~/pages/admin/jobs/components/constants'; - -export default { - i18n: { - emptyRunnerText: RUNNER_EMPTY_TEXT, - noRunnerDescription: RUNNER_NO_DESCRIPTION, - }, - components: { - GlLink, - }, - props: { - job: { - type: Object, - required: true, - }, - }, - computed: { - adminUrl() { - return this.job.runner?.adminUrl; - }, - description() { - return this.job.runner?.description - ? this.job.runner.description - : this.$options.i18n.noRunnerDescription; - }, - }, -}; -</script> - -<template> - <div class="gl-text-truncate"> - <gl-link v-if="adminUrl" :href="adminUrl"> - {{ description }} - </gl-link> - <span v-else data-testid="empty-runner-text"> {{ $options.i18n.emptyRunnerText }}</span> - </div> -</template> diff --git a/app/assets/javascripts/pages/admin/jobs/components/table/graphql/cache_config.js b/app/assets/javascripts/pages/admin/jobs/components/table/graphql/cache_config.js deleted file mode 100644 index fd7ee2a6f8c..00000000000 --- a/app/assets/javascripts/pages/admin/jobs/components/table/graphql/cache_config.js +++ /dev/null @@ -1,62 +0,0 @@ -import { isEqual } from 'lodash'; - -export default { - typePolicies: { - Query: { - fields: { - jobs: { - keyArgs: ['statuses'], - }, - }, - }, - CiJobConnection: { - merge(existing = {}, incoming, { args = {} }) { - if (incoming.nodes) { - let nodes; - - const areNodesEqual = isEqual(existing.nodes, incoming.nodes); - const statuses = Array.isArray(args.statuses) ? [...args.statuses] : args.statuses; - const { pageInfo } = incoming; - - if (Object.keys(existing).length !== 0 && isEqual(existing?.statuses, args?.statuses)) { - if (areNodesEqual) { - if (incoming.pageInfo.hasNextPage) { - nodes = [...existing.nodes, ...incoming.nodes]; - } else { - nodes = [...incoming.nodes]; - } - } else { - if (!existing.pageInfo?.hasNextPage) { - nodes = [...incoming.nodes]; - - return { - nodes, - statuses, - pageInfo, - count: incoming.count, - }; - } - - nodes = [...existing.nodes, ...incoming.nodes]; - } - } else { - nodes = [...incoming.nodes]; - } - - return { - nodes, - statuses, - pageInfo, - count: incoming.count, - }; - } - - return { - nodes: existing.nodes, - pageInfo: existing.pageInfo, - statuses: args.statuses, - }; - }, - }, - }, -}; diff --git a/app/assets/javascripts/pages/admin/jobs/components/table/graphql/queries/get_all_jobs.query.graphql b/app/assets/javascripts/pages/admin/jobs/components/table/graphql/queries/get_all_jobs.query.graphql deleted file mode 100644 index 9e2795966e0..00000000000 --- a/app/assets/javascripts/pages/admin/jobs/components/table/graphql/queries/get_all_jobs.query.graphql +++ /dev/null @@ -1,85 +0,0 @@ -query getAllJobs($after: String, $first: Int = 50, $statuses: [CiJobStatus!]) { - jobs(after: $after, first: $first, statuses: $statuses) { - pageInfo { - endCursor - hasNextPage - hasPreviousPage - startCursor - } - nodes { - runner { - id - description - adminUrl - } - artifacts { - nodes { - id - downloadPath - fileType - } - } - allowFailure - status - scheduledAt - manualJob - triggered - createdByTag - detailedStatus { - id - detailsPath - group - icon - label - text - tooltip - action { - id - buttonTitle - icon - method - path - title - } - } - id - refName - refPath - tags - shortSha - commitPath - pipeline { - id - project { - id - fullPath - webUrl - } - path - user { - id - webPath - avatarUrl - } - } - stage { - id - name - } - name - duration - finishedAt - coverage - retryable - playable - cancelable - active - stuck - userPermissions { - readBuild - readJobArtifacts - updateBuild - } - } - } -} diff --git a/app/assets/javascripts/pages/admin/jobs/components/table/graphql/queries/get_all_jobs_count.query.graphql b/app/assets/javascripts/pages/admin/jobs/components/table/graphql/queries/get_all_jobs_count.query.graphql deleted file mode 100644 index 8c59230b2b8..00000000000 --- a/app/assets/javascripts/pages/admin/jobs/components/table/graphql/queries/get_all_jobs_count.query.graphql +++ /dev/null @@ -1,5 +0,0 @@ -query getAllJobsCount($statuses: [CiJobStatus!]) { - jobs(statuses: $statuses) { - count - } -} diff --git a/app/assets/javascripts/pages/admin/jobs/components/table/graphql/queries/get_cancelable_jobs_count.query.graphql b/app/assets/javascripts/pages/admin/jobs/components/table/graphql/queries/get_cancelable_jobs_count.query.graphql deleted file mode 100644 index 9b90abebbf7..00000000000 --- a/app/assets/javascripts/pages/admin/jobs/components/table/graphql/queries/get_cancelable_jobs_count.query.graphql +++ /dev/null @@ -1,5 +0,0 @@ -query canelableJobs { - cancelable: jobs(statuses: [PENDING, RUNNING]) { - count - } -} diff --git a/app/assets/javascripts/pages/admin/jobs/index/index.js b/app/assets/javascripts/pages/admin/jobs/index/index.js index 9c2a255a1a3..52e4d5dd19f 100644 --- a/app/assets/javascripts/pages/admin/jobs/index/index.js +++ b/app/assets/javascripts/pages/admin/jobs/index/index.js @@ -1,12 +1,9 @@ import Vue from 'vue'; import VueApollo from 'vue-apollo'; -import { BV_SHOW_MODAL } from '~/lib/utils/constants'; import Translate from '~/vue_shared/translate'; import createDefaultClient from '~/lib/graphql'; -import { CANCEL_JOBS_MODAL_ID } from '../components/constants'; -import CancelJobsModal from '../components/cancel_jobs_modal.vue'; -import AdminJobsTableApp from '../components/table/admin_jobs_table_app.vue'; -import cacheConfig from '../components/table/graphql/cache_config'; +import AdminJobsTableApp from '~/ci/admin/jobs_table/admin_jobs_table_app.vue'; +import cacheConfig from '~/ci/admin/jobs_table/graphql/cache_config'; Vue.use(Translate); Vue.use(VueApollo); @@ -17,35 +14,7 @@ const apolloProvider = new VueApollo({ defaultClient: client, }); -function initJobs() { - const buttonId = 'js-stop-jobs-button'; - const cancelJobsButton = document.getElementById(buttonId); - if (cancelJobsButton) { - // eslint-disable-next-line no-new - new Vue({ - el: `#js-${CANCEL_JOBS_MODAL_ID}`, - components: { - CancelJobsModal, - }, - mounted() { - cancelJobsButton.classList.remove('disabled'); - cancelJobsButton.addEventListener('click', () => { - this.$root.$emit(BV_SHOW_MODAL, CANCEL_JOBS_MODAL_ID, `#${buttonId}`); - }); - }, - render(createElement) { - return createElement(CANCEL_JOBS_MODAL_ID, { - props: { - url: cancelJobsButton.dataset.url, - modalId: CANCEL_JOBS_MODAL_ID, - }, - }); - }, - }); - } -} - -export function initAdminJobsApp() { +const initAdminJobsApp = () => { const containerEl = document.getElementById('admin-jobs-app'); if (!containerEl) return false; @@ -64,10 +33,6 @@ export function initAdminJobsApp() { return createElement(AdminJobsTableApp); }, }); -} +}; -if (gon.features.adminJobsVue) { - initAdminJobsApp(); -} else { - initJobs(); -} +initAdminJobsApp(); |