summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-15 21:06:25 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-15 21:06:25 +0000
commit0ff031c7f4e2c7fe1b671b30fef569eb3fbea942 (patch)
tree0493e9faf4bb9d69c06226901cea12f22714a92a /app
parent7b8ec6e718331dd1f8330f08f49f01ba2c20b84c (diff)
downloadgitlab-ce-0ff031c7f4e2c7fe1b671b30fef569eb3fbea942.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/jobs/components/environments_block.vue151
-rw-r--r--app/models/concerns/atomic_internal_id.rb3
-rw-r--r--app/models/internal_id.rb2
-rw-r--r--app/views/projects/protected_branches/shared/_branches_list.html.haml4
-rw-r--r--app/views/projects/protected_branches/shared/_protected_branch.html.haml19
5 files changed, 101 insertions, 78 deletions
diff --git a/app/assets/javascripts/jobs/components/environments_block.vue b/app/assets/javascripts/jobs/components/environments_block.vue
index 8cda7dac51f..163849d3c40 100644
--- a/app/assets/javascripts/jobs/components/environments_block.vue
+++ b/app/assets/javascripts/jobs/components/environments_block.vue
@@ -19,69 +19,18 @@ export default {
},
computed: {
environment() {
- let environmentText;
switch (this.deploymentStatus.status) {
case 'last':
- environmentText = sprintf(
- __('This job is the most recent deployment to %{link}.'),
- { link: this.environmentLink },
- false,
- );
- break;
+ return this.lastEnvironmentMessage();
case 'out_of_date':
- if (this.hasLastDeployment) {
- environmentText = sprintf(
- __(
- 'This job is an out-of-date deployment to %{environmentLink}. View the most recent deployment %{deploymentLink}.',
- ),
- {
- environmentLink: this.environmentLink,
- deploymentLink: this.deploymentLink(`#${this.lastDeployment.iid}`),
- },
- false,
- );
- } else {
- environmentText = sprintf(
- __('This job is an out-of-date deployment to %{environmentLink}.'),
- { environmentLink: this.environmentLink },
- false,
- );
- }
-
- break;
+ return this.outOfDateEnvironmentMessage();
case 'failed':
- environmentText = sprintf(
- __('The deployment of this job to %{environmentLink} did not succeed.'),
- { environmentLink: this.environmentLink },
- false,
- );
- break;
+ return this.failedEnvironmentMessage();
case 'creating':
- if (this.hasLastDeployment) {
- environmentText = sprintf(
- __(
- 'This job is creating a deployment to %{environmentLink} and will overwrite the %{deploymentLink}.',
- ),
- {
- environmentLink: this.environmentLink,
- deploymentLink: this.deploymentLink(__('latest deployment')),
- },
- false,
- );
- } else {
- environmentText = sprintf(
- __('This job is creating a deployment to %{environmentLink}.'),
- { environmentLink: this.environmentLink },
- false,
- );
- }
- break;
+ return this.creatingEnvironmentMessage();
default:
- break;
+ return '';
}
- return environmentText && this.hasCluster
- ? `${environmentText} ${this.clusterText}`
- : environmentText;
},
environmentLink() {
if (this.hasEnvironment) {
@@ -137,11 +86,6 @@ export default {
false,
);
},
- clusterText() {
- return this.hasCluster
- ? sprintf(__('Cluster %{cluster} was used.'), { cluster: this.clusterNameOrLink }, false)
- : '';
- },
},
methods: {
deploymentLink(name) {
@@ -155,6 +99,91 @@ export default {
false,
);
},
+ failedEnvironmentMessage() {
+ const { environmentLink } = this;
+
+ return sprintf(
+ __('The deployment of this job to %{environmentLink} did not succeed.'),
+ { environmentLink },
+ false,
+ );
+ },
+ 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);
+ },
+ outOfDateEnvironmentMessage() {
+ const { hasLastDeployment, hasCluster, environmentLink, clusterNameOrLink } = 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}.',
+ );
+
+ return sprintf(
+ message,
+ {
+ environmentLink,
+ clusterNameOrLink,
+ deploymentLink: this.deploymentLink(__('most recent deployment')),
+ },
+ false,
+ );
+ }
+
+ const message = hasCluster
+ ? __(
+ 'This job is an out-of-date deployment to %{environmentLink} using cluster %{clusterNameOrLink}.',
+ )
+ : __('This job is an out-of-date deployment to %{environmentLink}.');
+
+ return sprintf(
+ message,
+ {
+ environmentLink,
+ clusterNameOrLink,
+ },
+ false,
+ );
+ },
+ creatingEnvironmentMessage() {
+ const { hasLastDeployment, hasCluster, environmentLink, clusterNameOrLink } = 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}.',
+ );
+
+ return sprintf(
+ message,
+ {
+ environmentLink,
+ clusterNameOrLink,
+ deploymentLink: this.deploymentLink(__('latest deployment')),
+ },
+ false,
+ );
+ }
+
+ return sprintf(
+ __('This job is creating a deployment to %{environmentLink}.'),
+ { environmentLink },
+ false,
+ );
+ },
},
};
</script>
diff --git a/app/models/concerns/atomic_internal_id.rb b/app/models/concerns/atomic_internal_id.rb
index 7a7e485a95a..64df265dc25 100644
--- a/app/models/concerns/atomic_internal_id.rb
+++ b/app/models/concerns/atomic_internal_id.rb
@@ -57,8 +57,7 @@ module AtomicInternalId
end
define_method("track_#{scope}_#{column}!") do
- iid_always_track = Feature.enabled?(:iid_always_track, default_enabled: true)
- return unless @internal_id_needs_tracking || iid_always_track
+ return unless @internal_id_needs_tracking
scope_value = internal_id_read_scope(scope)
return unless scope_value
diff --git a/app/models/internal_id.rb b/app/models/internal_id.rb
index 946a3aafe18..8d3eeaf2461 100644
--- a/app/models/internal_id.rb
+++ b/app/models/internal_id.rb
@@ -54,7 +54,7 @@ class InternalId < ApplicationRecord
last_value
end
- # Temporary instrumentation to track for-update locks
+ # Instrumentation to track for-update locks
def update_and_save_counter
strong_memoize(:update_and_save_counter) do
Gitlab::Metrics.counter(:gitlab_internal_id_for_update_lock, 'Number of ROW SHARE (FOR UPDATE) locks on individual records from internal_ids')
diff --git a/app/views/projects/protected_branches/shared/_branches_list.html.haml b/app/views/projects/protected_branches/shared/_branches_list.html.haml
index ff8dae08ad0..9dff251101b 100644
--- a/app/views/projects/protected_branches/shared/_branches_list.html.haml
+++ b/app/views/projects/protected_branches/shared/_branches_list.html.haml
@@ -16,9 +16,7 @@
%thead
%tr
%th
- = s_("ProtectedBranch|Protected branch (%{protected_branches_count})") % { protected_branches_count: @protected_branches_count }
- %th
- = s_("ProtectedBranch|Last commit")
+ = s_("ProtectedBranch|Branch")
%th
= s_("ProtectedBranch|Allowed to merge")
%th
diff --git a/app/views/projects/protected_branches/shared/_protected_branch.html.haml b/app/views/projects/protected_branches/shared/_protected_branch.html.haml
index 2768e4ac5a5..4ca6ebe9c78 100644
--- a/app/views/projects/protected_branches/shared/_protected_branch.html.haml
+++ b/app/views/projects/protected_branches/shared/_protected_branch.html.haml
@@ -5,17 +5,14 @@
%span.ref-name= protected_branch.name
- if @project.root_ref?(protected_branch.name)
- %span.badge.badge-info.prepend-left-5 default
- %td
- - if protected_branch.wildcard?
- - matching_branches = protected_branch.matching(repository.branches)
- = link_to pluralize(matching_branches.count, "matching branch"), namespace_project_protected_branch_path(@project.namespace, @project, protected_branch)
- - else
- - if commit = protected_branch.commit
- = link_to(commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit.id), class: 'commit-sha')
- = time_ago_with_tooltip(commit.committed_date)
- - else
- (branch was deleted from repository)
+ %span.badge.badge-info.d-inline default
+
+ %div
+ - if protected_branch.wildcard?
+ - matching_branches = protected_branch.matching(repository.branches)
+ = link_to pluralize(matching_branches.count, "matching branch"), namespace_project_protected_branch_path(@project.namespace, @project, protected_branch)
+ - elsif !protected_branch.commit
+ %span.text-muted Branch was deleted.
= yield