diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js index 8675c47c4a7..ef066f87a4a 100644 --- a/app/assets/javascripts/clusters/clusters_bundle.js +++ b/app/assets/javascripts/clusters/clusters_bundle.js @@ -3,16 +3,12 @@ import Visibility from 'visibilityjs'; import Vue from 'vue'; import AccessorUtilities from '~/lib/utils/accessor'; import initProjectSelectDropdown from '~/project_select'; -import initServerlessSurveyBanner from '~/serverless/survey_banner'; import createFlash from '../flash'; import Poll from '../lib/utils/poll'; -import { s__, sprintf } from '../locale'; +import { s__ } from '../locale'; import PersistentUserCallout from '../persistent_user_callout'; import initSettingsPanels from '../settings_panels'; -import Applications from './components/applications.vue'; import RemoveClusterConfirmation from './components/remove_cluster_confirmation.vue'; -import { APPLICATION_STATUS, CROSSPLANE, KNATIVE } from './constants'; -import eventHub from './event_hub'; import ClustersService from './services/clusters_service'; import ClustersStore from './stores/clusters_store'; @@ -20,46 +16,20 @@ const Environments = () => import('ee_component/clusters/components/environments Vue.use(GlToast); -/** - * Cluster page has 2 separate parts: - * Toggle button and applications section - * - * - Polling status while creating or scheduled - * - Update status area with the response result - */ - export default class Clusters { constructor() { const { statusPath, - installHelmPath, - installIngressPath, - installCertManagerPath, - installRunnerPath, - installJupyterPath, - installKnativePath, - updateKnativePath, - installElasticStackPath, - installCrossplanePath, - installPrometheusPath, - managePrometheusPath, clusterEnvironmentsPath, hasRbac, providerType, - preInstalledKnative, - clusterType, clusterStatus, clusterStatusReason, helpPath, - helmHelpPath, - ingressHelpPath, - ingressDnsHelpPath, environmentsHelpPath, clustersHelpPath, deployBoardsHelpPath, - cloudRunHelpPath, clusterId, - ciliumHelpPath, } = document.querySelector('.js-edit-cluster-form').dataset; this.clusterId = clusterId; @@ -69,38 +39,19 @@ export default class Clusters { this.store = new ClustersStore(); this.store.setHelpPaths({ helpPath, - helmHelpPath, - ingressHelpPath, - ingressDnsHelpPath, environmentsHelpPath, clustersHelpPath, deployBoardsHelpPath, - cloudRunHelpPath, - ciliumHelpPath, }); - this.store.setManagePrometheusPath(managePrometheusPath); this.store.updateStatus(clusterStatus); this.store.updateStatusReason(clusterStatusReason); this.store.updateProviderType(providerType); - this.store.updatePreInstalledKnative(preInstalledKnative); this.store.updateRbac(hasRbac); this.service = new ClustersService({ endpoint: statusPath, - installHelmEndpoint: installHelmPath, - installIngressEndpoint: installIngressPath, - installCertManagerEndpoint: installCertManagerPath, - installCrossplaneEndpoint: installCrossplanePath, - installRunnerEndpoint: installRunnerPath, - installPrometheusEndpoint: installPrometheusPath, - installJupyterEndpoint: installJupyterPath, - installKnativeEndpoint: installKnativePath, - updateKnativeEndpoint: updateKnativePath, - installElasticStackEndpoint: installElasticStackPath, clusterEnvironmentsEndpoint: clusterEnvironmentsPath, }); - this.installApplication = this.installApplication.bind(this); - this.errorContainer = document.querySelector('.js-cluster-error'); this.successContainer = document.querySelector('.js-cluster-success'); this.creatingContainer = document.querySelector('.js-cluster-creating'); @@ -109,14 +60,12 @@ export default class Clusters { '.js-cluster-authentication-failure', ); this.errorReasonContainer = this.errorContainer.querySelector('.js-error-reason'); - this.successApplicationContainer = document.querySelector('.js-cluster-application-notice'); this.tokenField = document.querySelector('.js-cluster-token'); initProjectSelectDropdown(); Clusters.initDismissableCallout(); initSettingsPanels(); - this.initApplications(clusterType); this.initEnvironments(); if (clusterEnvironmentsPath && this.environments) { @@ -143,38 +92,6 @@ export default class Clusters { this.initRemoveClusterActions(); } - initApplications(type) { - const { store } = this; - const el = document.querySelector('#js-cluster-applications'); - - this.applications = new Vue({ - el, - data() { - return { - state: store.state, - }; - }, - render(createElement) { - return createElement(Applications, { - props: { - type, - applications: this.state.applications, - helpPath: this.state.helpPath, - helmHelpPath: this.state.helmHelpPath, - ingressHelpPath: this.state.ingressHelpPath, - managePrometheusPath: this.state.managePrometheusPath, - ingressDnsHelpPath: this.state.ingressDnsHelpPath, - cloudRunHelpPath: this.state.cloudRunHelpPath, - providerType: this.state.providerType, - preInstalledKnative: this.state.preInstalledKnative, - rbac: this.state.rbac, - ciliumHelpPath: this.state.ciliumHelpPath, - }, - }); - }, - }); - } - initEnvironments() { const { store } = this; const el = document.querySelector('#js-cluster-environments'); @@ -242,30 +159,11 @@ export default class Clusters { } addListeners() { - eventHub.$on('installApplication', this.installApplication); - eventHub.$on('updateApplication', (data) => this.updateApplication(data)); - eventHub.$on('saveKnativeDomain', (data) => this.saveKnativeDomain(data)); - eventHub.$on('setKnativeDomain', (data) => this.setKnativeDomain(data)); - eventHub.$on('uninstallApplication', (data) => this.uninstallApplication(data)); - eventHub.$on('setCrossplaneProviderStack', (data) => this.setCrossplaneProviderStack(data)); // Add event listener to all the banner close buttons this.addBannerCloseHandler(this.unreachableContainer, 'unreachable'); this.addBannerCloseHandler(this.authenticationFailureContainer, 'authentication_failure'); } - removeListeners() { - eventHub.$off('installApplication', this.installApplication); - eventHub.$off('updateApplication', this.updateApplication); - // eslint-disable-next-line @gitlab/no-global-event-off - eventHub.$off('saveKnativeDomain'); - // eslint-disable-next-line @gitlab/no-global-event-off - eventHub.$off('setKnativeDomain'); - // eslint-disable-next-line @gitlab/no-global-event-off - eventHub.$off('setCrossplaneProviderStack'); - // eslint-disable-next-line @gitlab/no-global-event-off - eventHub.$off('uninstallApplication'); - } - initPolling(method, successCallback, errorCallback) { this.poll = new Poll({ resource: this.service, @@ -305,16 +203,10 @@ export default class Clusters { handleClusterStatusSuccess(data) { const prevStatus = this.store.state.status; - const prevApplicationMap = { ...this.store.state.applications }; this.store.updateStateFromServer(data.data); - this.checkForNewInstalls(prevApplicationMap, this.store.state.applications); this.updateContainer(prevStatus, this.store.state.status, this.store.state.statusReason); - - if (this.store.state.applications[KNATIVE]?.status === APPLICATION_STATUS.INSTALLED) { - initServerlessSurveyBanner(); - } } hideAll() { @@ -325,31 +217,6 @@ export default class Clusters { this.authenticationFailureContainer.classList.add('hidden'); } - checkForNewInstalls(prevApplicationMap, newApplicationMap) { - const appTitles = Object.keys(newApplicationMap) - .filter( - (appId) => - newApplicationMap[appId].status === APPLICATION_STATUS.INSTALLED && - prevApplicationMap[appId].status !== APPLICATION_STATUS.INSTALLED && - prevApplicationMap[appId].status !== null, - ) - .map((appId) => newApplicationMap[appId].title); - - if (appTitles.length > 0) { - const text = sprintf( - s__('ClusterIntegration|%{appList} was successfully installed on your Kubernetes cluster'), - { - appList: appTitles.join(', '), - }, - ); - createFlash({ - message: text, - type: 'notice', - parent: this.successApplicationContainer, - }); - } - } - setBannerDismissedState(status, isDismissed) { if (AccessorUtilities.isLocalStorageAccessSafe()) { window.localStorage.setItem(this.clusterBannerDismissedKey, `${status}_${isDismissed}`); @@ -422,91 +289,9 @@ export default class Clusters { } } - installApplication({ id: appId, params }) { - return Clusters.validateInstallation(appId, params) - .then(() => { - this.store.updateAppProperty(appId, 'requestReason', null); - this.store.updateAppProperty(appId, 'statusReason', null); - this.store.installApplication(appId); - - // eslint-disable-next-line promise/no-nesting - this.service.installApplication(appId, params).catch(() => { - this.store.notifyInstallFailure(appId); - this.store.updateAppProperty( - appId, - 'requestReason', - s__('ClusterIntegration|Request to begin installing failed'), - ); - }); - }) - .catch((error) => this.store.updateAppProperty(appId, 'validationError', error)); - } - - static validateInstallation(appId, params) { - return new Promise((resolve, reject) => { - if (appId === CROSSPLANE && !params.stack) { - reject(s__('ClusterIntegration|Select a stack to install Crossplane.')); - return; - } - - if (appId === KNATIVE && !params.hostname && !params.pages_domain_id) { - reject(s__('ClusterIntegration|You must specify a domain before you can install Knative.')); - return; - } - - resolve(); - }); - } - - uninstallApplication({ id: appId }) { - this.store.updateAppProperty(appId, 'requestReason', null); - this.store.updateAppProperty(appId, 'statusReason', null); - - this.store.uninstallApplication(appId); - - return this.service.uninstallApplication(appId).catch(() => { - this.store.notifyUninstallFailure(appId); - this.store.updateAppProperty( - appId, - 'requestReason', - s__('ClusterIntegration|Request to begin uninstalling failed'), - ); - }); - } - - updateApplication({ id: appId, params }) { - this.store.updateApplication(appId); - this.service.installApplication(appId, params).catch(() => { - this.store.notifyUpdateFailure(appId); - }); - } - - saveKnativeDomain(data) { - const appId = data.id; - this.store.updateApplication(appId); - this.service.updateApplication(appId, data.params).catch(() => { - this.store.notifyUpdateFailure(appId); - }); - } - - setKnativeDomain({ id: appId, domain, domainId }) { - this.store.updateAppProperty(appId, 'isEditingDomain', true); - this.store.updateAppProperty(appId, 'hostname', domain); - this.store.updateAppProperty(appId, 'pagesDomain', domainId ? { id: domainId, domain } : null); - this.store.updateAppProperty(appId, 'validationError', null); - } - - setCrossplaneProviderStack(data) { - const appId = data.id; - this.store.updateAppProperty(appId, 'stack', data.stack.code); - this.store.updateAppProperty(appId, 'validationError', null); - } - destroy() { this.destroyed = true; - this.removeListeners(); - if (this.poll) { this.poll.stop(); } @@ -514,7 +299,5 @@ export default class Clusters { if (this.environments) { this.environments.$destroy(); } - - this.applications.$destroy(); } } diff --git a/app/assets/javascripts/clusters/components/application_row.vue b/app/assets/javascripts/clusters/components/application_row.vue deleted file mode 100644 index a53b63ea592..00000000000 --- a/app/assets/javascripts/clusters/components/application_row.vue +++ /dev/null @@ -1,478 +0,0 @@ - - - diff --git a/app/assets/javascripts/clusters/components/applications.vue b/app/assets/javascripts/clusters/components/applications.vue deleted file mode 100644 index ddee1711975..00000000000 --- a/app/assets/javascripts/clusters/components/applications.vue +++ /dev/null @@ -1,662 +0,0 @@ - - - diff --git a/app/assets/javascripts/clusters/components/crossplane_provider_stack.vue b/app/assets/javascripts/clusters/components/crossplane_provider_stack.vue deleted file mode 100644 index 6b99bb09504..00000000000 --- a/app/assets/javascripts/clusters/components/crossplane_provider_stack.vue +++ /dev/null @@ -1,93 +0,0 @@ - - - diff --git a/app/assets/javascripts/clusters/components/knative_domain_editor.vue b/app/assets/javascripts/clusters/components/knative_domain_editor.vue deleted file mode 100644 index 89446680173..00000000000 --- a/app/assets/javascripts/clusters/components/knative_domain_editor.vue +++ /dev/null @@ -1,232 +0,0 @@ - - - diff --git a/app/assets/javascripts/clusters/components/uninstall_application_button.vue b/app/assets/javascripts/clusters/components/uninstall_application_button.vue deleted file mode 100644 index 73191d6d84d..00000000000 --- a/app/assets/javascripts/clusters/components/uninstall_application_button.vue +++ /dev/null @@ -1,36 +0,0 @@ - - - diff --git a/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue b/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue deleted file mode 100644 index 2a197e40b60..00000000000 --- a/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue +++ /dev/null @@ -1,101 +0,0 @@ - - diff --git a/app/assets/javascripts/clusters/components/update_application_confirmation_modal.vue b/app/assets/javascripts/clusters/components/update_application_confirmation_modal.vue deleted file mode 100644 index 0aedc6e84fa..00000000000 --- a/app/assets/javascripts/clusters/components/update_application_confirmation_modal.vue +++ /dev/null @@ -1,66 +0,0 @@ - - diff --git a/app/assets/javascripts/clusters/constants.js b/app/assets/javascripts/clusters/constants.js index 846e5950b8b..c6ca895778d 100644 --- a/app/assets/javascripts/clusters/constants.js +++ b/app/assets/javascripts/clusters/constants.js @@ -10,64 +10,7 @@ export const PROVIDER_TYPE = { GCP: 'gcp', }; -// These need to match what is returned from the server -export const APPLICATION_STATUS = { - NO_STATUS: null, - NOT_INSTALLABLE: 'not_installable', - INSTALLABLE: 'installable', - SCHEDULED: 'scheduled', - INSTALLING: 'installing', - INSTALLED: 'installed', - UPDATING: 'updating', - UPDATED: 'updated', - UPDATE_ERRORED: 'update_errored', - UNINSTALLING: 'uninstalling', - UNINSTALL_ERRORED: 'uninstall_errored', - ERROR: 'errored', - PRE_INSTALLED: 'pre_installed', - UNINSTALLED: 'uninstalled', - EXTERNALLY_INSTALLED: 'externally_installed', -}; - -/* - * The application cannot be in any of the following states without - * not being installed. - */ -export const APPLICATION_INSTALLED_STATUSES = [ - APPLICATION_STATUS.INSTALLED, - APPLICATION_STATUS.UPDATING, - APPLICATION_STATUS.UNINSTALLING, - APPLICATION_STATUS.PRE_INSTALLED, -]; - // These are only used client-side -export const UPDATE_EVENT = 'update'; -export const INSTALL_EVENT = 'install'; -export const UNINSTALL_EVENT = 'uninstall'; - -export const HELM = 'helm'; -export const INGRESS = 'ingress'; -export const JUPYTER = 'jupyter'; -export const KNATIVE = 'knative'; -export const RUNNER = 'runner'; -export const CERT_MANAGER = 'cert_manager'; -export const CROSSPLANE = 'crossplane'; -export const PROMETHEUS = 'prometheus'; -export const ELASTIC_STACK = 'elastic_stack'; - -export const APPLICATIONS = [ - HELM, - INGRESS, - JUPYTER, - KNATIVE, - RUNNER, - CERT_MANAGER, - PROMETHEUS, - ELASTIC_STACK, -]; - -export const INGRESS_DOMAIN_SUFFIX = '.nip.io'; - export const LOGGING_MODE = 'logging'; export const BLOCKING_MODE = 'blocking'; diff --git a/app/assets/javascripts/clusters/services/application_state_machine.js b/app/assets/javascripts/clusters/services/application_state_machine.js deleted file mode 100644 index 2ff604af9a7..00000000000 --- a/app/assets/javascripts/clusters/services/application_state_machine.js +++ /dev/null @@ -1,250 +0,0 @@ -import { APPLICATION_STATUS, UPDATE_EVENT, INSTALL_EVENT, UNINSTALL_EVENT } from '../constants'; - -const { - NO_STATUS, - SCHEDULED, - NOT_INSTALLABLE, - INSTALLABLE, - INSTALLING, - INSTALLED, - ERROR, - UPDATING, - UPDATED, - UPDATE_ERRORED, - UNINSTALLING, - UNINSTALL_ERRORED, - PRE_INSTALLED, - UNINSTALLED, - EXTERNALLY_INSTALLED, -} = APPLICATION_STATUS; - -const applicationStateMachine = { - /* When the application initially loads, it will have `NO_STATUS` - * It will transition from `NO_STATUS` once the async backend call is completed - */ - [NO_STATUS]: { - on: { - [SCHEDULED]: { - target: INSTALLING, - }, - [NOT_INSTALLABLE]: { - target: NOT_INSTALLABLE, - }, - [INSTALLABLE]: { - target: INSTALLABLE, - }, - [INSTALLING]: { - target: INSTALLING, - }, - [INSTALLED]: { - target: INSTALLED, - }, - [ERROR]: { - target: INSTALLABLE, - effects: { - installFailed: true, - }, - }, - [UPDATING]: { - target: UPDATING, - }, - [UPDATED]: { - target: INSTALLED, - }, - [UPDATE_ERRORED]: { - target: INSTALLED, - effects: { - updateFailed: true, - }, - }, - [UNINSTALLING]: { - target: UNINSTALLING, - }, - [UNINSTALL_ERRORED]: { - target: INSTALLED, - effects: { - uninstallFailed: true, - }, - }, - [PRE_INSTALLED]: { - target: PRE_INSTALLED, - }, - [UNINSTALLED]: { - target: UNINSTALLED, - }, - [EXTERNALLY_INSTALLED]: { - target: EXTERNALLY_INSTALLED, - }, - }, - }, - [NOT_INSTALLABLE]: { - on: { - [INSTALLABLE]: { - target: INSTALLABLE, - }, - }, - }, - [INSTALLABLE]: { - on: { - [INSTALL_EVENT]: { - target: INSTALLING, - effects: { - installFailed: false, - }, - }, - [NOT_INSTALLABLE]: { - target: NOT_INSTALLABLE, - }, - [INSTALLED]: { - target: INSTALLED, - effects: { - installFailed: false, - }, - }, - [UNINSTALLED]: { - target: UNINSTALLED, - effects: { - installFailed: false, - }, - }, - }, - }, - [INSTALLING]: { - on: { - [INSTALLED]: { - target: INSTALLED, - }, - [ERROR]: { - target: INSTALLABLE, - effects: { - installFailed: true, - }, - }, - }, - }, - [INSTALLED]: { - on: { - [UPDATE_EVENT]: { - target: UPDATING, - effects: { - updateFailed: false, - updateSuccessful: false, - }, - }, - [NOT_INSTALLABLE]: { - target: NOT_INSTALLABLE, - }, - [UNINSTALL_EVENT]: { - target: UNINSTALLING, - effects: { - uninstallFailed: false, - uninstallSuccessful: false, - }, - }, - [UNINSTALLED]: { - target: UNINSTALLED, - }, - [ERROR]: { - target: INSTALLABLE, - effects: { - installFailed: true, - }, - }, - }, - }, - [PRE_INSTALLED]: { - on: { - [UPDATE_EVENT]: { - target: UPDATING, - effects: { - updateFailed: false, - updateSuccessful: false, - }, - }, - [NOT_INSTALLABLE]: { - target: NOT_INSTALLABLE, - }, - [UNINSTALL_EVENT]: { - target: UNINSTALLING, - effects: { - uninstallFailed: false, - uninstallSuccessful: false, - }, - }, - }, - }, - [UPDATING]: { - on: { - [UPDATED]: { - target: INSTALLED, - effects: { - updateSuccessful: true, - }, - }, - [UPDATE_ERRORED]: { - target: INSTALLED, - effects: { - updateFailed: true, - }, - }, - }, - }, - [UNINSTALLING]: { - on: { - [INSTALLABLE]: { - target: INSTALLABLE, - effects: { - uninstallSuccessful: true, - }, - }, - [NOT_INSTALLABLE]: { - target: NOT_INSTALLABLE, - effects: { - uninstallSuccessful: true, - }, - }, - [UNINSTALL_ERRORED]: { - target: INSTALLED, - effects: { - uninstallFailed: true, - }, - }, - }, - }, - [UNINSTALLED]: { - on: { - [INSTALLED]: { - target: INSTALLED, - }, - [ERROR]: { - target: INSTALLABLE, - effects: { - installFailed: true, - }, - }, - }, - }, -}; - -/** - * Determines an application new state based on the application current state - * and an event. If the application current state cannot handle a given event, - * the current state is returned. - * - * @param {*} application - * @param {*} event - */ -const transitionApplicationState = (application, event) => { - const stateMachine = applicationStateMachine[application.status]; - const newState = stateMachine !== undefined ? stateMachine.on[event] : false; - - return newState - ? { - ...application, - status: newState.target, - ...newState.effects, - } - : application; -}; - -export default transitionApplicationState; diff --git a/app/assets/javascripts/clusters/services/clusters_service.js b/app/assets/javascripts/clusters/services/clusters_service.js index 333fb293a15..7300bb3137a 100644 --- a/app/assets/javascripts/clusters/services/clusters_service.js +++ b/app/assets/javascripts/clusters/services/clusters_service.js @@ -3,38 +3,12 @@ import axios from '../../lib/utils/axios_utils'; export default class ClusterService { constructor(options = {}) { this.options = options; - this.appInstallEndpointMap = { - helm: this.options.installHelmEndpoint, - ingress: this.options.installIngressEndpoint, - cert_manager: this.options.installCertManagerEndpoint, - crossplane: this.options.installCrossplaneEndpoint, - runner: this.options.installRunnerEndpoint, - prometheus: this.options.installPrometheusEndpoint, - jupyter: this.options.installJupyterEndpoint, - knative: this.options.installKnativeEndpoint, - elastic_stack: this.options.installElasticStackEndpoint, - }; - this.appUpdateEndpointMap = { - knative: this.options.updateKnativeEndpoint, - }; } fetchClusterStatus() { return axios.get(this.options.endpoint); } - installApplication(appId, params) { - return axios.post(this.appInstallEndpointMap[appId], params); - } - - updateApplication(appId, params) { - return axios.patch(this.appUpdateEndpointMap[appId], params); - } - - uninstallApplication(appId, params) { - return axios.delete(this.appInstallEndpointMap[appId], params); - } - fetchClusterEnvironments() { return axios.get(this.options.clusterEnvironmentsEndpoint); } diff --git a/app/assets/javascripts/clusters/stores/clusters_store.js b/app/assets/javascripts/clusters/stores/clusters_store.js index 50689a6142f..db6e7bad6cc 100644 --- a/app/assets/javascripts/clusters/stores/clusters_store.js +++ b/app/assets/javascripts/clusters/stores/clusters_store.js @@ -1,112 +1,16 @@ import { parseBoolean } from '../../lib/utils/common_utils'; -import { s__ } from '../../locale'; -import { - INGRESS, - JUPYTER, - KNATIVE, - CERT_MANAGER, - CROSSPLANE, - RUNNER, - APPLICATION_INSTALLED_STATUSES, - APPLICATION_STATUS, - INSTALL_EVENT, - UPDATE_EVENT, - UNINSTALL_EVENT, - ELASTIC_STACK, -} from '../constants'; -import transitionApplicationState from '../services/application_state_machine'; - -const isApplicationInstalled = (appStatus) => APPLICATION_INSTALLED_STATUSES.includes(appStatus); - -const applicationInitialState = { - status: null, - statusReason: null, - requestReason: null, - installable: true, - installed: false, - installFailed: false, - uninstallable: false, - uninstallFailed: false, - uninstallSuccessful: false, - validationError: null, -}; export default class ClusterStore { constructor() { this.state = { helpPath: null, - helmHelpPath: null, - ingressHelpPath: null, environmentsHelpPath: null, clustersHelpPath: null, deployBoardsHelpPath: null, - cloudRunHelpPath: null, status: null, providerType: null, - preInstalledKnative: false, rbac: false, statusReason: null, - applications: { - helm: { - ...applicationInitialState, - title: s__('ClusterIntegration|Legacy Helm Tiller server'), - }, - ingress: { - ...applicationInitialState, - title: s__('ClusterIntegration|Ingress'), - externalIp: null, - externalHostname: null, - updateFailed: false, - updateAvailable: false, - }, - cert_manager: { - ...applicationInitialState, - title: s__('ClusterIntegration|Cert-Manager'), - email: null, - }, - crossplane: { - ...applicationInitialState, - title: s__('ClusterIntegration|Crossplane'), - stack: null, - }, - runner: { - ...applicationInitialState, - title: s__('ClusterIntegration|GitLab Runner'), - version: null, - chartRepo: 'https://gitlab.com/gitlab-org/charts/gitlab-runner', - updateAvailable: null, - updateSuccessful: false, - updateFailed: false, - }, - prometheus: { - ...applicationInitialState, - title: s__('ClusterIntegration|Prometheus'), - }, - jupyter: { - ...applicationInitialState, - title: s__('ClusterIntegration|JupyterHub'), - hostname: null, - }, - knative: { - ...applicationInitialState, - title: s__('ClusterIntegration|Knative'), - hostname: null, - isEditingDomain: false, - externalIp: null, - externalHostname: null, - updateSuccessful: false, - updateFailed: false, - }, - elastic_stack: { - ...applicationInitialState, - title: s__('ClusterIntegration|Elastic Stack'), - }, - cilium: { - ...applicationInitialState, - title: s__('ClusterIntegration|GitLab Container Network Policies'), - installable: false, - }, - }, environments: [], fetchingEnvironments: false, }; @@ -118,10 +22,6 @@ export default class ClusterStore { }); } - setManagePrometheusPath(managePrometheusPath) { - this.state.managePrometheusPath = managePrometheusPath; - } - updateStatus(status) { this.state.status = status; } @@ -130,10 +30,6 @@ export default class ClusterStore { this.state.providerType = providerType; } - updatePreInstalledKnative(preInstalledKnative) { - this.state.preInstalledKnative = parseBoolean(preInstalledKnative); - } - updateRbac(rbac) { this.state.rbac = parseBoolean(rbac); } @@ -142,112 +38,9 @@ export default class ClusterStore { this.state.statusReason = reason; } - installApplication(appId) { - this.handleApplicationEvent(appId, INSTALL_EVENT); - } - - notifyInstallFailure(appId) { - this.handleApplicationEvent(appId, APPLICATION_STATUS.ERROR); - } - - updateApplication(appId) { - this.handleApplicationEvent(appId, UPDATE_EVENT); - } - - notifyUpdateFailure(appId) { - this.handleApplicationEvent(appId, APPLICATION_STATUS.UPDATE_ERRORED); - } - - uninstallApplication(appId) { - this.handleApplicationEvent(appId, UNINSTALL_EVENT); - } - - notifyUninstallFailure(appId) { - this.handleApplicationEvent(appId, APPLICATION_STATUS.UNINSTALL_ERRORED); - } - - handleApplicationEvent(appId, event) { - const currentAppState = this.state.applications[appId]; - - this.state.applications[appId] = transitionApplicationState(currentAppState, event); - } - - updateAppProperty(appId, prop, value) { - this.state.applications[appId][prop] = value; - } - updateStateFromServer(serverState = {}) { this.state.status = serverState.status; this.state.statusReason = serverState.status_reason; - - serverState.applications.forEach((serverAppEntry) => { - const { - name: appId, - status, - status_reason: statusReason, - version, - update_available: updateAvailable, - can_uninstall: uninstallable, - } = serverAppEntry; - const currentApplicationState = this.state.applications[appId] || {}; - const nextApplicationState = transitionApplicationState(currentApplicationState, status); - - this.state.applications[appId] = { - ...currentApplicationState, - ...nextApplicationState, - statusReason, - installed: isApplicationInstalled(nextApplicationState.status), - uninstallable, - }; - - if (appId === INGRESS) { - this.state.applications.ingress.externalIp = serverAppEntry.external_ip; - this.state.applications.ingress.externalHostname = serverAppEntry.external_hostname; - this.state.applications.ingress.updateAvailable = updateAvailable; - } else if (appId === CERT_MANAGER) { - this.state.applications.cert_manager.email = - this.state.applications.cert_manager.email || serverAppEntry.email; - } else if (appId === CROSSPLANE) { - this.state.applications.crossplane.stack = - this.state.applications.crossplane.stack || serverAppEntry.stack; - } else if (appId === JUPYTER) { - this.state.applications.jupyter.hostname = this.updateHostnameIfUnset( - this.state.applications.jupyter.hostname, - serverAppEntry.hostname, - 'jupyter', - ); - } else if (appId === KNATIVE) { - if (serverAppEntry.available_domains) { - this.state.applications.knative.availableDomains = serverAppEntry.available_domains; - } - if (!this.state.applications.knative.isEditingDomain) { - this.state.applications.knative.pagesDomain = - serverAppEntry.pages_domain || this.state.applications.knative.pagesDomain; - this.state.applications.knative.hostname = - serverAppEntry.hostname || this.state.applications.knative.hostname; - } - this.state.applications.knative.externalIp = - serverAppEntry.external_ip || this.state.applications.knative.externalIp; - this.state.applications.knative.externalHostname = - serverAppEntry.external_hostname || this.state.applications.knative.externalHostname; - } else if (appId === RUNNER) { - this.state.applications.runner.version = version; - this.state.applications.runner.updateAvailable = updateAvailable; - } else if (appId === ELASTIC_STACK) { - this.state.applications.elastic_stack.version = version; - this.state.applications.elastic_stack.updateAvailable = updateAvailable; - } - }); - } - - updateHostnameIfUnset(current, updated, fallback) { - return ( - current || - updated || - (this.state.applications.ingress.externalIp - ? `${fallback}.${this.state.applications.ingress.externalIp}.nip.io` - : '') - ); } toggleFetchEnvironments(isFetching) { diff --git a/app/assets/javascripts/diffs/components/diff_content.vue b/app/assets/javascripts/diffs/components/diff_content.vue index cb74c7dc7cd..858d9e221ae 100644 --- a/app/assets/javascripts/diffs/components/diff_content.vue +++ b/app/assets/javascripts/diffs/components/diff_content.vue @@ -1,7 +1,7 @@ - - diff --git a/app/assets/javascripts/diffs/components/inline_diff_view.vue b/app/assets/javascripts/diffs/components/inline_diff_view.vue deleted file mode 100644 index e407609d9e9..00000000000 --- a/app/assets/javascripts/diffs/components/inline_diff_view.vue +++ /dev/null @@ -1,117 +0,0 @@ - - - diff --git a/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue b/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue deleted file mode 100644 index 2d33926c8aa..00000000000 --- a/app/assets/javascripts/diffs/components/parallel_diff_table_row.vue +++ /dev/null @@ -1,310 +0,0 @@ - - - diff --git a/app/assets/javascripts/diffs/components/parallel_diff_view.vue b/app/assets/javascripts/diffs/components/parallel_diff_view.vue deleted file mode 100644 index b167081a379..00000000000 --- a/app/assets/javascripts/diffs/components/parallel_diff_view.vue +++ /dev/null @@ -1,142 +0,0 @@ - - - diff --git a/app/assets/javascripts/diffs/store/getters.js b/app/assets/javascripts/diffs/store/getters.js index a536db5c417..1b6a673925f 100644 --- a/app/assets/javascripts/diffs/store/getters.js +++ b/app/assets/javascripts/diffs/store/getters.js @@ -151,11 +151,7 @@ export const currentDiffIndex = (state) => state.diffFiles.findIndex((diff) => diff.file_hash === state.currentDiffFileId), ); -export const diffLines = (state) => (file, unifiedDiffComponents) => { - if (!unifiedDiffComponents && state.diffViewType === INLINE_DIFF_VIEW_TYPE) { - return null; - } - +export const diffLines = (state) => (file) => { return parallelizeDiffLines( file.highlighted_diff_lines || [], state.diffViewType === INLINE_DIFF_VIEW_TYPE, diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js b/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js index 37436de907f..571d24b50cf 100644 --- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js +++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_utils.js @@ -215,35 +215,35 @@ export function urlQueryToFilter(query = '', options = {}) { /** * Returns array of token values from localStorage - * based on provided recentTokenValuesStorageKey + * based on provided recentSuggestionsStorageKey * - * @param {String} recentTokenValuesStorageKey + * @param {String} recentSuggestionsStorageKey * @returns */ -export function getRecentlyUsedTokenValues(recentTokenValuesStorageKey) { - let recentlyUsedTokenValues = []; +export function getRecentlyUsedSuggestions(recentSuggestionsStorageKey) { + let recentlyUsedSuggestions = []; if (AccessorUtilities.isLocalStorageAccessSafe()) { - recentlyUsedTokenValues = JSON.parse(localStorage.getItem(recentTokenValuesStorageKey)) || []; + recentlyUsedSuggestions = JSON.parse(localStorage.getItem(recentSuggestionsStorageKey)) || []; } - return recentlyUsedTokenValues; + return recentlyUsedSuggestions; } /** * Sets provided token value to recently used array - * within localStorage for provided recentTokenValuesStorageKey + * within localStorage for provided recentSuggestionsStorageKey * - * @param {String} recentTokenValuesStorageKey + * @param {String} recentSuggestionsStorageKey * @param {Object} tokenValue */ -export function setTokenValueToRecentlyUsed(recentTokenValuesStorageKey, tokenValue) { - const recentlyUsedTokenValues = getRecentlyUsedTokenValues(recentTokenValuesStorageKey); +export function setTokenValueToRecentlyUsed(recentSuggestionsStorageKey, tokenValue) { + const recentlyUsedSuggestions = getRecentlyUsedSuggestions(recentSuggestionsStorageKey); - recentlyUsedTokenValues.splice(0, 0, { ...tokenValue }); + recentlyUsedSuggestions.splice(0, 0, { ...tokenValue }); if (AccessorUtilities.isLocalStorageAccessSafe()) { localStorage.setItem( - recentTokenValuesStorageKey, - JSON.stringify(uniqWith(recentlyUsedTokenValues, isEqual).slice(0, MAX_RECENT_TOKENS_SIZE)), + recentSuggestionsStorageKey, + JSON.stringify(uniqWith(recentlyUsedSuggestions, isEqual).slice(0, MAX_RECENT_TOKENS_SIZE)), ); } } diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue b/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue index 3b261f5ac25..a25a19a006c 100644 --- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue +++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/author_token.vue @@ -74,13 +74,13 @@ export default { :config="config" :value="value" :active="active" - :tokens-list-loading="loading" - :token-values="authors" + :suggestions-loading="loading" + :suggestions="authors" :fn-active-token-value="getActiveAuthor" - :default-token-values="defaultAuthors" - :preloaded-token-values="preloadedAuthors" - :recent-token-values-storage-key="config.recentTokenValuesStorageKey" - @fetch-token-values="fetchAuthorBySearchTerm" + :default-suggestions="defaultAuthors" + :preloaded-suggestions="preloadedAuthors" + :recent-suggestions-storage-key="config.recentSuggestionsStorageKey" + @fetch-suggestions="fetchAuthorBySearchTerm" v-on="$listeners" > -