diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-29 12:09:33 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-29 12:09:33 +0300 |
commit | b4dc6516ae8662e23e6fd8331656a91f9e853417 (patch) | |
tree | dc661c605af627ea9306dc592433c40b9cc0e832 /app/assets/javascripts/clusters | |
parent | 3fa28959b9c657503c98caa0e535d39f51ad2c31 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/clusters')
6 files changed, 101 insertions, 5 deletions
diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js index 0a8af7c9a9a..d0a4073cc00 100644 --- a/app/assets/javascripts/clusters/clusters_bundle.js +++ b/app/assets/javascripts/clusters/clusters_bundle.js @@ -67,6 +67,7 @@ export default class Clusters { deployBoardsHelpPath, cloudRunHelpPath, clusterId, + ciliumHelpPath, } = document.querySelector('.js-edit-cluster-form').dataset; this.clusterId = clusterId; @@ -83,6 +84,7 @@ export default class Clusters { clustersHelpPath, deployBoardsHelpPath, cloudRunHelpPath, + ciliumHelpPath, ); this.store.setManagePrometheusPath(managePrometheusPath); this.store.updateStatus(clusterStatus); @@ -179,6 +181,7 @@ export default class Clusters { providerType: this.state.providerType, preInstalledKnative: this.state.preInstalledKnative, rbac: this.state.rbac, + ciliumHelpPath: this.state.ciliumHelpPath, }, }); }, diff --git a/app/assets/javascripts/clusters/components/application_row.vue b/app/assets/javascripts/clusters/components/application_row.vue index 5006301c6be..c86db28515f 100644 --- a/app/assets/javascripts/clusters/components/application_row.vue +++ b/app/assets/javascripts/clusters/components/application_row.vue @@ -52,6 +52,11 @@ export default { required: false, default: false, }, + installable: { + type: Boolean, + required: false, + default: true, + }, uninstallable: { type: Boolean, required: false, @@ -141,6 +146,7 @@ export default { return ( this.status === APPLICATION_STATUS.NOT_INSTALLABLE || this.status === APPLICATION_STATUS.INSTALLABLE || + this.status === APPLICATION_STATUS.UNINSTALLED || this.isUnknownStatus ); }, @@ -164,14 +170,20 @@ export default { return !this.status || this.isInstalling; }, installButtonDisabled() { + // Applications installed through the management project can + // only be installed through the CI pipeline. Installation should + // be disable in all states. + if (!this.installable) return true; + // Avoid the potential for the real-time data to say APPLICATION_STATUS.INSTALLABLE but // we already made a request to install and are just waiting for the real-time // to sync up. + if (this.isInstalling) return true; + + if (!this.isKnownStatus) return false; + return ( - ((this.status !== APPLICATION_STATUS.INSTALLABLE && - this.status !== APPLICATION_STATUS.ERROR) || - this.isInstalling) && - this.isKnownStatus + this.status !== APPLICATION_STATUS.INSTALLABLE && this.status !== APPLICATION_STATUS.ERROR ); }, installButtonLabel() { diff --git a/app/assets/javascripts/clusters/components/applications.vue b/app/assets/javascripts/clusters/components/applications.vue index 6e3db2f6297..556eaccb385 100644 --- a/app/assets/javascripts/clusters/components/applications.vue +++ b/app/assets/javascripts/clusters/components/applications.vue @@ -88,6 +88,11 @@ export default { required: false, default: false, }, + ciliumHelpPath: { + type: String, + required: false, + default: '', + }, }, computed: { managedAppsLocalTillerEnabled() { @@ -687,6 +692,39 @@ export default { /> </template> </application-row> + + <div class="gl-mt-7 gl-border-1 gl-border-t-solid gl-border-gray-100"> + <!-- This empty div serves as a separator between applications that have a dependency on Helm and those that can be enabled without Helm. --> + </div> + + <application-row + id="cilium" + :title="applications.cilium.title" + :logo-url="$options.logos.gitlabLogo" + :status="applications.cilium.status" + :status-reason="applications.cilium.statusReason" + :installable="applications.cilium.installable" + :uninstallable="applications.cilium.uninstallable" + :installed="applications.cilium.installed" + :install-failed="applications.cilium.installFailed" + :title-link="ciliumHelpPath" + > + <template #description> + <p data-testid="ciliumDescription"> + <gl-sprintf + :message=" + s__( + 'ClusterIntegration|Protect your clusters with GitLab Container Network Policies by enforcing how pods communicate with each other and other network endpoints. %{linkStart}Learn more about configuring Network Policies here.%{linkEnd}', + ) + " + > + <template #link="{ content }"> + <gl-link :href="ciliumHelpPath" target="_blank">{{ content }}</gl-link> + </template> + </gl-sprintf> + </p> + </template> + </application-row> </div> </section> </template> diff --git a/app/assets/javascripts/clusters/constants.js b/app/assets/javascripts/clusters/constants.js index 60e179c54eb..e2227c61cee 100644 --- a/app/assets/javascripts/clusters/constants.js +++ b/app/assets/javascripts/clusters/constants.js @@ -25,6 +25,7 @@ export const APPLICATION_STATUS = { UNINSTALL_ERRORED: 'uninstall_errored', ERROR: 'errored', PRE_INSTALLED: 'pre_installed', + UNINSTALLED: 'uninstalled', }; /* diff --git a/app/assets/javascripts/clusters/services/application_state_machine.js b/app/assets/javascripts/clusters/services/application_state_machine.js index 6af9b10f12f..683b0e18534 100644 --- a/app/assets/javascripts/clusters/services/application_state_machine.js +++ b/app/assets/javascripts/clusters/services/application_state_machine.js @@ -14,6 +14,7 @@ const { UNINSTALLING, UNINSTALL_ERRORED, PRE_INSTALLED, + UNINSTALLED, } = APPLICATION_STATUS; const applicationStateMachine = { @@ -67,6 +68,9 @@ const applicationStateMachine = { [PRE_INSTALLED]: { target: PRE_INSTALLED, }, + [UNINSTALLED]: { + target: UNINSTALLED, + }, }, }, [NOT_INSTALLABLE]: { @@ -87,9 +91,17 @@ const applicationStateMachine = { [NOT_INSTALLABLE]: { target: NOT_INSTALLABLE, }, - // This is possible in artificial environments for E2E testing [INSTALLED]: { target: INSTALLED, + effects: { + installFailed: false, + }, + }, + [UNINSTALLED]: { + target: UNINSTALLED, + effects: { + installFailed: false, + }, }, }, }, @@ -125,6 +137,15 @@ const applicationStateMachine = { uninstallSuccessful: false, }, }, + [UNINSTALLED]: { + target: UNINSTALLED, + }, + [ERROR]: { + target: INSTALLABLE, + effects: { + installFailed: true, + }, + }, }, }, [PRE_INSTALLED]: { @@ -180,6 +201,19 @@ const applicationStateMachine = { }, }, }, + [UNINSTALLED]: { + on: { + [INSTALLED]: { + target: INSTALLED, + }, + [ERROR]: { + target: INSTALLABLE, + effects: { + installFailed: true, + }, + }, + }, + }, }; /** diff --git a/app/assets/javascripts/clusters/stores/clusters_store.js b/app/assets/javascripts/clusters/stores/clusters_store.js index 9d354e66661..53868b7c02d 100644 --- a/app/assets/javascripts/clusters/stores/clusters_store.js +++ b/app/assets/javascripts/clusters/stores/clusters_store.js @@ -23,6 +23,7 @@ const applicationInitialState = { status: null, statusReason: null, requestReason: null, + installable: true, installed: false, installFailed: false, uninstallable: false, @@ -114,6 +115,11 @@ export default class ClusterStore { ciliumLogEnabled: null, isEditingSettings: false, }, + cilium: { + ...applicationInitialState, + title: s__('ClusterIntegration|GitLab Container Network Policies'), + installable: false, + }, }, environments: [], fetchingEnvironments: false, @@ -129,6 +135,7 @@ export default class ClusterStore { clustersHelpPath, deployBoardsHelpPath, cloudRunHelpPath, + ciliumHelpPath, ) { this.state.helpPath = helpPath; this.state.ingressHelpPath = ingressHelpPath; @@ -138,6 +145,7 @@ export default class ClusterStore { this.state.clustersHelpPath = clustersHelpPath; this.state.deployBoardsHelpPath = deployBoardsHelpPath; this.state.cloudRunHelpPath = cloudRunHelpPath; + this.state.ciliumHelpPath = ciliumHelpPath; } setManagePrometheusPath(managePrometheusPath) { |