summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-29 12:08:19 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-29 12:08:19 +0000
commitbae24262df90b1b16e012360d04a28d54a07be3f (patch)
treeab1dc4eba454832b1514d074de1e4a79624ad2c3 /app
parent589c0d68c188079dd5fd463e70d0c93631086998 (diff)
downloadgitlab-ce-bae24262df90b1b16e012360d04a28d54a07be3f.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/clusters/components/applications.vue132
-rw-r--r--app/models/snippet_input_action.rb9
-rw-r--r--app/models/snippet_repository.rb23
-rw-r--r--app/services/snippets/update_service.rb6
-rw-r--r--app/views/projects/_find_file_link.html.haml3
-rw-r--r--app/views/projects/_import_project_pane.html.haml6
6 files changed, 95 insertions, 84 deletions
diff --git a/app/assets/javascripts/clusters/components/applications.vue b/app/assets/javascripts/clusters/components/applications.vue
index 71d0563ac7e..3b1b6662a11 100644
--- a/app/assets/javascripts/clusters/components/applications.vue
+++ b/app/assets/javascripts/clusters/components/applications.vue
@@ -2,16 +2,13 @@
import { escape } from 'lodash';
import helmInstallIllustration from '@gitlab/svgs/dist/illustrations/kubernetes-installation.svg';
import { GlLoadingIcon } from '@gitlab/ui';
-import elasticsearchLogo from 'images/cluster_app_logos/elasticsearch.png';
import gitlabLogo from 'images/cluster_app_logos/gitlab.png';
import helmLogo from 'images/cluster_app_logos/helm.png';
-import jeagerLogo from 'images/cluster_app_logos/jeager.png';
import jupyterhubLogo from 'images/cluster_app_logos/jupyterhub.png';
import kubernetesLogo from 'images/cluster_app_logos/kubernetes.png';
import certManagerLogo from 'images/cluster_app_logos/cert_manager.png';
import crossplaneLogo from 'images/cluster_app_logos/crossplane.png';
import knativeLogo from 'images/cluster_app_logos/knative.png';
-import meltanoLogo from 'images/cluster_app_logos/meltano.png';
import prometheusLogo from 'images/cluster_app_logos/prometheus.png';
import elasticStackLogo from 'images/cluster_app_logos/elastic_stack.png';
import fluentdLogo from 'images/cluster_app_logos/fluentd.png';
@@ -92,25 +89,7 @@ export default {
default: false,
},
},
- data: () => ({
- elasticsearchLogo,
- gitlabLogo,
- helmLogo,
- jeagerLogo,
- jupyterhubLogo,
- kubernetesLogo,
- certManagerLogo,
- crossplaneLogo,
- knativeLogo,
- meltanoLogo,
- prometheusLogo,
- elasticStackLogo,
- fluentdLogo,
- }),
computed: {
- isProjectCluster() {
- return this.type === CLUSTER_TYPE.PROJECT;
- },
managedAppsLocalTillerEnabled() {
return Boolean(gon.features?.managedAppsLocalTiller);
},
@@ -133,9 +112,6 @@ export default {
certManagerInstalled() {
return this.applications.cert_manager.status === APPLICATION_STATUS.INSTALLED;
},
- crossplaneInstalled() {
- return this.applications.crossplane.status === APPLICATION_STATUS.INSTALLED;
- },
ingressDescription() {
return sprintf(
escape(
@@ -208,9 +184,6 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
jupyterHostname() {
return this.applications.jupyter.hostname;
},
- elasticStackInstalled() {
- return this.applications.elastic_stack.status === APPLICATION_STATUS.INSTALLED;
- },
knative() {
return this.applications.knative;
},
@@ -240,9 +213,6 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
return this.applications.ingress;
},
},
- created() {
- this.helmInstallIllustration = helmInstallIllustration;
- },
methods: {
saveKnativeDomain() {
eventHub.$emit('saveKnativeDomain', {
@@ -267,6 +237,19 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
});
},
},
+ logos: {
+ gitlabLogo,
+ helmLogo,
+ jupyterhubLogo,
+ kubernetesLogo,
+ certManagerLogo,
+ crossplaneLogo,
+ knativeLogo,
+ prometheusLogo,
+ elasticStackLogo,
+ fluentdLogo,
+ },
+ helmInstallIllustration,
};
</script>
@@ -284,7 +267,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
<application-row
v-if="!managedAppsLocalTillerEnabled"
id="helm"
- :logo-url="helmLogo"
+ :logo-url="$options.logos.helmLogo"
:title="applications.helm.title"
:status="applications.helm.status"
:status-reason="applications.helm.statusReason"
@@ -308,7 +291,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
</div>
</application-row>
<div v-show="!helmInstalled" class="cluster-application-warning">
- <div class="svg-container" v-html="helmInstallIllustration"></div>
+ <div class="svg-container" v-html="$options.helmInstallIllustration"></div>
{{
s__(`ClusterIntegration|You must first install Helm Tiller before
installing the applications below`)
@@ -316,7 +299,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
</div>
<application-row
:id="ingressId"
- :logo-url="kubernetesLogo"
+ :logo-url="$options.logos.kubernetesLogo"
:title="applications.ingress.title"
:status="applications.ingress.status"
:status-reason="applications.ingress.statusReason"
@@ -352,27 +335,29 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
<template v-if="ingressInstalled">
<div class="form-group">
<label for="ingress-endpoint">{{ s__('ClusterIntegration|Ingress Endpoint') }}</label>
- <div v-if="ingressExternalEndpoint" class="input-group">
- <input
- id="ingress-endpoint"
- :value="ingressExternalEndpoint"
- type="text"
- class="form-control js-endpoint"
- readonly
- />
- <span class="input-group-append">
- <clipboard-button
- :text="ingressExternalEndpoint"
- :title="s__('ClusterIntegration|Copy Ingress Endpoint')"
- class="input-group-text js-clipboard-btn"
+ <div class="input-group">
+ <template v-if="ingressExternalEndpoint">
+ <input
+ id="ingress-endpoint"
+ :value="ingressExternalEndpoint"
+ type="text"
+ class="form-control js-endpoint"
+ readonly
/>
- </span>
- </div>
- <div v-else class="input-group">
- <input type="text" class="form-control js-endpoint" readonly />
- <gl-loading-icon
- class="position-absolute align-self-center ml-2 js-ingress-ip-loading-icon"
- />
+ <span class="input-group-append">
+ <clipboard-button
+ :text="ingressExternalEndpoint"
+ :title="s__('ClusterIntegration|Copy Ingress Endpoint')"
+ class="input-group-text js-clipboard-btn"
+ />
+ </span>
+ </template>
+ <template v-else>
+ <input type="text" class="form-control js-endpoint" readonly />
+ <gl-loading-icon
+ class="position-absolute align-self-center ml-2 js-ingress-ip-loading-icon"
+ />
+ </template>
</div>
<p class="form-text text-muted">
{{
@@ -397,7 +382,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
</a>
</p>
</template>
- <template v-if="!ingressInstalled">
+ <template v-else>
<div class="bs-callout bs-callout-info">
<strong v-html="ingressDescription"></strong>
</div>
@@ -406,7 +391,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
</application-row>
<application-row
id="cert_manager"
- :logo-url="certManagerLogo"
+ :logo-url="$options.logos.certManagerLogo"
:title="applications.cert_manager.title"
:status="applications.cert_manager.status"
:status-reason="applications.cert_manager.statusReason"
@@ -430,6 +415,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
</label>
<div class="input-group">
<input
+ id="cert-manager-issuer-email"
v-model="applications.cert_manager.email"
:readonly="certManagerInstalled"
type="text"
@@ -454,7 +440,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
</application-row>
<application-row
id="prometheus"
- :logo-url="prometheusLogo"
+ :logo-url="$options.logos.prometheusLogo"
:title="applications.prometheus.title"
:manage-link="managePrometheusPath"
:status="applications.prometheus.status"
@@ -473,7 +459,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
</application-row>
<application-row
id="runner"
- :logo-url="gitlabLogo"
+ :logo-url="$options.logos.gitlabLogo"
:title="applications.runner.title"
:status="applications.runner.status"
:status-reason="applications.runner.statusReason"
@@ -503,7 +489,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
</application-row>
<application-row
id="crossplane"
- :logo-url="crossplaneLogo"
+ :logo-url="$options.logos.crossplaneLogo"
:title="applications.crossplane.title"
:status="applications.crossplane.status"
:status-reason="applications.crossplane.statusReason"
@@ -530,7 +516,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
<application-row
id="jupyter"
- :logo-url="jupyterhubLogo"
+ :logo-url="$options.logos.jupyterhubLogo"
:title="applications.jupyter.title"
:status="applications.jupyter.status"
:status-reason="applications.jupyter.statusReason"
@@ -562,6 +548,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
<div class="input-group">
<input
+ id="jupyter-hostname"
v-model="applications.jupyter.hostname"
:readonly="jupyterInstalled"
type="text"
@@ -591,7 +578,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
</application-row>
<application-row
id="knative"
- :logo-url="knativeLogo"
+ :logo-url="$options.logos.knativeLogo"
:title="applications.knative.title"
:status="applications.knative.status"
:status-reason="applications.knative.statusReason"
@@ -613,18 +600,15 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
title-link="https://github.com/knative/docs"
>
<div slot="description">
- <span v-if="!rbac">
- <p v-if="!rbac" class="rbac-notice bs-callout bs-callout-info gl-mb-0">
- {{
- s__(`ClusterIntegration|You must have an RBAC-enabled cluster
- to install Knative.`)
- }}
- <a :href="helpPath" target="_blank" rel="noopener noreferrer">
- {{ __('More information') }}
- </a>
- </p>
- <br />
- </span>
+ <p v-if="!rbac" class="rbac-notice bs-callout bs-callout-info">
+ {{
+ s__(`ClusterIntegration|You must have an RBAC-enabled cluster
+ to install Knative.`)
+ }}
+ <a :href="helpPath" target="_blank" rel="noopener noreferrer">
+ {{ __('More information') }}
+ </a>
+ </p>
<p>
{{
s__(`ClusterIntegration|Knative extends Kubernetes to provide
@@ -645,7 +629,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
</application-row>
<application-row
id="elastic_stack"
- :logo-url="elasticStackLogo"
+ :logo-url="$options.logos.elasticStackLogo"
:title="applications.elastic_stack.title"
:status="applications.elastic_stack.status"
:status-reason="applications.elastic_stack.statusReason"
@@ -677,7 +661,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
<application-row
id="fluentd"
- :logo-url="fluentdLogo"
+ :logo-url="$options.logos.fluentdLogo"
:title="applications.fluentd.title"
:status="applications.fluentd.status"
:status-reason="applications.fluentd.statusReason"
diff --git a/app/models/snippet_input_action.rb b/app/models/snippet_input_action.rb
index 64276085682..cfc33852c51 100644
--- a/app/models/snippet_input_action.rb
+++ b/app/models/snippet_input_action.rb
@@ -16,7 +16,8 @@ class SnippetInputAction
validates :action, inclusion: { in: ACTIONS, message: "%{value} is not a valid action" }
validates :previous_path, presence: true, if: :move_action?
validates :file_path, presence: true
- validates :content, presence: true, if: :create_action?
+ validates :content, presence: true, if: -> (action) { action.create_action? || action.update_action? }
+ validate :ensure_same_file_path_and_previous_path, if: :update_action?
def initialize(action: nil, previous_path: nil, file_path: nil, content: nil)
@action = action
@@ -41,4 +42,10 @@ class SnippetInputAction
previous_path.presence || file_path
end
+
+ def ensure_same_file_path_and_previous_path
+ return if previous_path == file_path
+
+ errors.add(:file_path, "can't be different from the previous_path attribute")
+ end
end
diff --git a/app/models/snippet_repository.rb b/app/models/snippet_repository.rb
index 2276851b7a1..8151308125a 100644
--- a/app/models/snippet_repository.rb
+++ b/app/models/snippet_repository.rb
@@ -53,10 +53,21 @@ class SnippetRepository < ApplicationRecord
def transform_file_entries(files)
next_index = get_last_empty_file_index + 1
- files.each do |file_entry|
+ files.map do |file_entry|
file_entry[:file_path] = file_path_for(file_entry, next_index) { next_index += 1 }
file_entry[:action] = infer_action(file_entry) unless file_entry[:action]
- end
+ file_entry[:action] = file_entry[:action].to_sym
+
+ if only_rename_action?(file_entry)
+ file_entry[:infer_content] = true
+ elsif empty_update_action?(file_entry)
+ # There is no need to perform a repository operation
+ # When the update action has no content
+ file_entry = nil
+ end
+
+ file_entry
+ end.compact
end
def file_path_for(file_entry, next_index)
@@ -111,4 +122,12 @@ class SnippetRepository < ApplicationRecord
err.is_a?(ArgumentError) &&
err.message.downcase.match?(/failed to parse signature/)
end
+
+ def only_rename_action?(action)
+ action[:action] == :move && action[:content].nil?
+ end
+
+ def empty_update_action?(action)
+ action[:action] == :update && action[:content].nil?
+ end
end
diff --git a/app/services/snippets/update_service.rb b/app/services/snippets/update_service.rb
index 211ebb836cb..9b61559295b 100644
--- a/app/services/snippets/update_service.rb
+++ b/app/services/snippets/update_service.rb
@@ -112,8 +112,10 @@ module Snippets
end
def build_actions_from_params(snippet)
- [{ previous_path: snippet.file_name_on_repo,
- file_path: params[:file_name],
+ file_name_on_repo = snippet.file_name_on_repo
+
+ [{ previous_path: file_name_on_repo,
+ file_path: params[:file_name] || file_name_on_repo,
content: params[:content] }]
end
end
diff --git a/app/views/projects/_find_file_link.html.haml b/app/views/projects/_find_file_link.html.haml
index da1b2d7f9b6..74cdb0f7409 100644
--- a/app/views/projects/_find_file_link.html.haml
+++ b/app/views/projects/_find_file_link.html.haml
@@ -1,3 +1,2 @@
= link_to project_find_file_path(@project, @ref), class: 'btn shortcuts-find-file', rel: 'nofollow' do
- = icon('search')
- %span= _('Find file')
+ = _('Find file')
diff --git a/app/views/projects/_import_project_pane.html.haml b/app/views/projects/_import_project_pane.html.haml
index 28d4f8eb201..3ae37254e39 100644
--- a/app/views/projects/_import_project_pane.html.haml
+++ b/app/views/projects/_import_project_pane.html.haml
@@ -22,7 +22,7 @@
**tracking_attrs(track_label, 'click_button', 'bitbucket_cloud') do
= icon('bitbucket', text: 'Bitbucket Cloud')
- unless bitbucket_import_configured?
- = render 'bitbucket_import_modal'
+ = render 'projects/bitbucket_import_modal'
- if bitbucket_server_import_enabled?
%div
= link_to status_import_bitbucket_server_path, class: "btn import_bitbucket", **tracking_attrs(track_label, 'click_button', 'bitbucket_server') do
@@ -34,7 +34,7 @@
**tracking_attrs(track_label, 'click_button', 'gitlab_com') do
= icon('gitlab', text: 'GitLab.com')
- unless gitlab_import_configured?
- = render 'gitlab_import_modal'
+ = render 'projects/gitlab_import_modal'
- if google_code_import_enabled?
%div
@@ -73,4 +73,4 @@
= form_for @project, html: { class: 'new_project' } do |f|
%hr
= render "shared/import_form", f: f
- = render 'new_project_fields', f: f, project_name_id: "import-url-name", hide_init_with_readme: true, track_label: track_label
+ = render 'projects/new_project_fields', f: f, project_name_id: "import-url-name", hide_init_with_readme: true, track_label: track_label