Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-26 16:48:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-26 16:48:43 +0300
commit00ed89bc218dc88eae9a4e8de1ce5813729ebfdc (patch)
tree789519e95d46b536ea01292ae58945f2ded55277 /app
parent37caeffc694e7b6b937eb8c0043ca1f14625c196 (diff)
Add latest changes from gitlab-org/security/gitlab@13-0-stable-ee
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/clusters/clusters_bundle.js16
-rw-r--r--app/assets/javascripts/monitoring/components/duplicate_dashboard_form.vue3
-rw-r--r--app/services/clusters/update_service.rb6
-rw-r--r--app/views/clusters/clusters/_provider_details_form.html.haml14
4 files changed, 12 insertions, 27 deletions
diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js
index 3699a3b8b2b..d8bfbdb458c 100644
--- a/app/assets/javascripts/clusters/clusters_bundle.js
+++ b/app/assets/javascripts/clusters/clusters_bundle.js
@@ -108,7 +108,6 @@ export default class Clusters {
});
this.installApplication = this.installApplication.bind(this);
- this.showToken = this.showToken.bind(this);
this.errorContainer = document.querySelector('.js-cluster-error');
this.successContainer = document.querySelector('.js-cluster-success');
@@ -119,7 +118,6 @@ export default class Clusters {
);
this.errorReasonContainer = this.errorContainer.querySelector('.js-error-reason');
this.successApplicationContainer = document.querySelector('.js-cluster-application-notice');
- this.showTokenButton = document.querySelector('.js-show-cluster-token');
this.tokenField = document.querySelector('.js-cluster-token');
this.ingressDomainHelpText = document.querySelector('.js-ingress-domain-help-text');
this.ingressDomainSnippet =
@@ -258,7 +256,6 @@ export default class Clusters {
}
addListeners() {
- if (this.showTokenButton) this.showTokenButton.addEventListener('click', this.showToken);
eventHub.$on('installApplication', this.installApplication);
eventHub.$on('updateApplication', data => this.updateApplication(data));
eventHub.$on('saveKnativeDomain', data => this.saveKnativeDomain(data));
@@ -275,7 +272,6 @@ export default class Clusters {
}
removeListeners() {
- if (this.showTokenButton) this.showTokenButton.removeEventListener('click', this.showToken);
eventHub.$off('installApplication', this.installApplication);
eventHub.$off('updateApplication', this.updateApplication);
eventHub.$off('saveKnativeDomain');
@@ -344,18 +340,6 @@ export default class Clusters {
}
}
- showToken() {
- const type = this.tokenField.getAttribute('type');
-
- if (type === 'password') {
- this.tokenField.setAttribute('type', 'text');
- this.showTokenButton.textContent = s__('ClusterIntegration|Hide');
- } else {
- this.tokenField.setAttribute('type', 'password');
- this.showTokenButton.textContent = s__('ClusterIntegration|Show');
- }
- }
-
hideAll() {
this.errorContainer.classList.add('hidden');
this.successContainer.classList.add('hidden');
diff --git a/app/assets/javascripts/monitoring/components/duplicate_dashboard_form.vue b/app/assets/javascripts/monitoring/components/duplicate_dashboard_form.vue
index 58eb8a9df8e..001cd0d47f1 100644
--- a/app/assets/javascripts/monitoring/components/duplicate_dashboard_form.vue
+++ b/app/assets/javascripts/monitoring/components/duplicate_dashboard_form.vue
@@ -1,6 +1,7 @@
<script>
import { __, s__, sprintf } from '~/locale';
import { GlFormGroup, GlFormInput, GlFormRadioGroup, GlFormTextarea } from '@gitlab/ui';
+import { escape as esc } from 'lodash';
const defaultFileName = dashboard => dashboard.path.split('/').reverse()[0];
@@ -42,7 +43,7 @@ export default {
html: sprintf(
__('Commit to %{branchName} branch'),
{
- branchName: `<strong>${this.defaultBranch}</strong>`,
+ branchName: `<strong>${esc(this.defaultBranch)}</strong>`,
},
false,
),
diff --git a/app/services/clusters/update_service.rb b/app/services/clusters/update_service.rb
index 2315df612a1..ba20826848d 100644
--- a/app/services/clusters/update_service.rb
+++ b/app/services/clusters/update_service.rb
@@ -10,6 +10,12 @@ module Clusters
def execute(cluster)
if validate_params(cluster)
+ token = params.dig(:platform_kubernetes_attributes, :token)
+
+ if token.blank?
+ params[:platform_kubernetes_attributes]&.delete(:token)
+ end
+
cluster.update(params)
else
false
diff --git a/app/views/clusters/clusters/_provider_details_form.html.haml b/app/views/clusters/clusters/_provider_details_form.html.haml
index dd7d6182e3c..fcb5d4402d6 100644
--- a/app/views/clusters/clusters/_provider_details_form.html.haml
+++ b/app/views/clusters/clusters/_provider_details_form.html.haml
@@ -25,16 +25,10 @@
label: s_('ClusterIntegration|CA Certificate'), label_class: 'label-bold',
input_group_class: 'gl-field-error-anchor', append: copy_ca_cert_btn
- - show_token_btn = (platform_field.button s_('ClusterIntegration|Show'),
- type: 'button', class: 'js-show-cluster-token btn btn-default')
- - copy_token_btn = clipboard_button(text: platform.token, title: s_('ClusterIntegration|Copy Service Token'),
- class: 'input-group-text btn-default') if cluster.read_only_kubernetes_platform_fields?
-
- = platform_field.text_field :token, type: 'password', class: 'js-select-on-focus js-cluster-token',
- required: true, title: s_('ClusterIntegration|Service token is required.'),
- readonly: cluster.read_only_kubernetes_platform_fields?,
- label: s_('ClusterIntegration|Service Token'), label_class: 'label-bold',
- input_group_class: 'gl-field-error-anchor', append: show_token_btn + copy_token_btn
+ = platform_field.password_field :token, type: 'password', class: 'js-select-on-focus js-cluster-token',
+ readonly: cluster.read_only_kubernetes_platform_fields?, autocomplete: 'new-password',
+ label: s_('ClusterIntegration|Enter new Service Token'), label_class: 'label-bold',
+ input_group_class: 'gl-field-error-anchor'
= platform_field.form_group :authorization_type do
= platform_field.check_box :authorization_type, { disabled: true, label: s_('ClusterIntegration|RBAC-enabled cluster'),