diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-14 12:08:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-14 12:08:43 +0300 |
commit | 733befe96ad19f5a02e442c4a9cc8059d3aabbda (patch) | |
tree | dcabd344df040e536a242edc4e3121fb3efca142 /app/assets/javascripts/jobs | |
parent | 10213bf3b26c3c21f7683471d35d1cd052c41e9c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/jobs')
-rw-r--r-- | app/assets/javascripts/jobs/components/environments_block.vue | 184 | ||||
-rw-r--r-- | app/assets/javascripts/jobs/components/job_app.vue | 1 |
2 files changed, 136 insertions, 49 deletions
diff --git a/app/assets/javascripts/jobs/components/environments_block.vue b/app/assets/javascripts/jobs/components/environments_block.vue index 163849d3c40..797aa15a2b9 100644 --- a/app/assets/javascripts/jobs/components/environments_block.vue +++ b/app/assets/javascripts/jobs/components/environments_block.vue @@ -12,6 +12,11 @@ export default { type: Object, required: true, }, + deploymentCluster: { + type: Object, + required: false, + default: null, + }, iconStatus: { type: Object, required: true, @@ -61,14 +66,14 @@ export default { : ''; }, hasCluster() { - return this.hasLastDeployment && this.lastDeployment.cluster; + return Boolean(this.deploymentCluster) && Boolean(this.deploymentCluster.name); }, clusterNameOrLink() { if (!this.hasCluster) { return ''; } - const { name, path } = this.lastDeployment.cluster; + const { name, path } = this.deploymentCluster; const escapedName = _.escape(name); const escapedPath = _.escape(path); @@ -86,6 +91,9 @@ export default { false, ); }, + kubernetesNamespace() { + return this.hasCluster ? this.deploymentCluster.kubernetes_namespace : null; + }, }, methods: { deploymentLink(name) { @@ -109,75 +117,153 @@ export default { ); }, lastEnvironmentMessage() { - const { environmentLink, clusterNameOrLink, hasCluster } = this; - - const message = hasCluster - ? __('This job is deployed to %{environmentLink} using cluster %{clusterNameOrLink}.') - : __('This job is deployed to %{environmentLink}.'); - - return sprintf(message, { environmentLink, clusterNameOrLink }, false); + const { environmentLink, clusterNameOrLink, hasCluster, kubernetesNamespace } = this; + if (hasCluster) { + if (kubernetesNamespace) { + return sprintf( + __( + 'This job is deployed to %{environmentLink} using cluster %{clusterNameOrLink} and namespace %{kubernetesNamespace}.', + ), + { environmentLink, clusterNameOrLink, kubernetesNamespace }, + false, + ); + } + // we know the cluster but not the namespace + return sprintf( + __('This job is deployed to %{environmentLink} using cluster %{clusterNameOrLink}.'), + { environmentLink, clusterNameOrLink }, + false, + ); + } + // not a cluster deployment + return sprintf(__('This job is deployed to %{environmentLink}.'), { environmentLink }, false); }, outOfDateEnvironmentMessage() { - const { hasLastDeployment, hasCluster, environmentLink, clusterNameOrLink } = this; + const { + hasLastDeployment, + hasCluster, + environmentLink, + clusterNameOrLink, + kubernetesNamespace, + } = this; if (hasLastDeployment) { - const message = hasCluster - ? __( - 'This job is an out-of-date deployment to %{environmentLink} using cluster %{clusterNameOrLink}. View the %{deploymentLink}.', - ) - : __( - 'This job is an out-of-date deployment to %{environmentLink}. View the %{deploymentLink}.', + const deploymentLink = this.deploymentLink(__('most recent deployment')); + if (hasCluster) { + if (kubernetesNamespace) { + return sprintf( + __( + 'This job is an out-of-date deployment to %{environmentLink} using cluster %{clusterNameOrLink} and namespace %{kubernetesNamespace}. View the %{deploymentLink}.', + ), + { environmentLink, clusterNameOrLink, kubernetesNamespace, deploymentLink }, + false, ); - + } + // we know the cluster but not the namespace + return sprintf( + __( + 'This job is an out-of-date deployment to %{environmentLink} using cluster %{clusterNameOrLink}. View the %{deploymentLink}.', + ), + { environmentLink, clusterNameOrLink, deploymentLink }, + false, + ); + } + // not a cluster deployment return sprintf( - message, - { - environmentLink, - clusterNameOrLink, - deploymentLink: this.deploymentLink(__('most recent deployment')), - }, + __( + 'This job is an out-of-date deployment to %{environmentLink}. View the %{deploymentLink}.', + ), + { environmentLink, deploymentLink }, false, ); } - - const message = hasCluster - ? __( + // no last deployment, i.e. this is the first deployment + if (hasCluster) { + if (kubernetesNamespace) { + return sprintf( + __( + 'This job is an out-of-date deployment to %{environmentLink} using cluster %{clusterNameOrLink} and namespace %{kubernetesNamespace}.', + ), + { environmentLink, clusterNameOrLink, kubernetesNamespace }, + false, + ); + } + // we know the cluster but not the namespace + return sprintf( + __( 'This job is an out-of-date deployment to %{environmentLink} using cluster %{clusterNameOrLink}.', - ) - : __('This job is an out-of-date deployment to %{environmentLink}.'); - + ), + { environmentLink, clusterNameOrLink }, + false, + ); + } + // not a cluster deployment return sprintf( - message, - { - environmentLink, - clusterNameOrLink, - }, + __('This job is an out-of-date deployment to %{environmentLink}.'), + { environmentLink }, false, ); }, creatingEnvironmentMessage() { - const { hasLastDeployment, hasCluster, environmentLink, clusterNameOrLink } = this; + const { + hasLastDeployment, + hasCluster, + environmentLink, + clusterNameOrLink, + kubernetesNamespace, + } = this; if (hasLastDeployment) { - const message = hasCluster - ? __( - 'This job is creating a deployment to %{environmentLink} using cluster %{clusterNameOrLink}. This will overwrite the %{deploymentLink}.', - ) - : __( - 'This job is creating a deployment to %{environmentLink}. This will overwrite the %{deploymentLink}.', + const deploymentLink = this.deploymentLink(__('latest deployment')); + if (hasCluster) { + if (kubernetesNamespace) { + return sprintf( + __( + 'This job is creating a deployment to %{environmentLink} using cluster %{clusterNameOrLink} and namespace %{kubernetesNamespace}. This will overwrite the %{deploymentLink}.', + ), + { environmentLink, clusterNameOrLink, kubernetesNamespace, deploymentLink }, + false, ); - + } + // we know the cluster but not the namespace + return sprintf( + __( + 'This job is creating a deployment to %{environmentLink} using cluster %{clusterNameOrLink}. This will overwrite the %{deploymentLink}.', + ), + { environmentLink, clusterNameOrLink, deploymentLink }, + false, + ); + } + // not a cluster deployment return sprintf( - message, - { - environmentLink, - clusterNameOrLink, - deploymentLink: this.deploymentLink(__('latest deployment')), - }, + __( + 'This job is creating a deployment to %{environmentLink}. This will overwrite the %{deploymentLink}.', + ), + { environmentLink, deploymentLink }, false, ); } - + // no last deployment, i.e. this is the first deployment + if (hasCluster) { + if (kubernetesNamespace) { + return sprintf( + __( + 'This job is creating a deployment to %{environmentLink} using cluster %{clusterNameOrLink} and namespace %{kubernetesNamespace}.', + ), + { environmentLink, clusterNameOrLink, kubernetesNamespace }, + false, + ); + } + // we know the cluster but not the namespace + return sprintf( + __( + 'This job is creating a deployment to %{environmentLink} using cluster %{clusterNameOrLink}.', + ), + { environmentLink, clusterNameOrLink }, + false, + ); + } + // not a cluster deployment return sprintf( __('This job is creating a deployment to %{environmentLink}.'), { environmentLink }, diff --git a/app/assets/javascripts/jobs/components/job_app.vue b/app/assets/javascripts/jobs/components/job_app.vue index 0ca13e897f3..bc310f77a58 100644 --- a/app/assets/javascripts/jobs/components/job_app.vue +++ b/app/assets/javascripts/jobs/components/job_app.vue @@ -256,6 +256,7 @@ export default { v-if="hasEnvironment" class="js-job-environment" :deployment-status="job.deployment_status" + :deployment-cluster="job.deployment_cluster" :icon-status="job.status" /> |