summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-11-06 15:48:44 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2017-11-06 15:48:44 +0100
commitac927462dc1b9578de3a716e9e4ff551f424663b (patch)
tree86aa6259222f1a1074bdf301b071ad2bc1480e8e
parentdc55abaa504b270a8ba89f475513364486ed91a4 (diff)
downloadgitlab-ce-ac927462dc1b9578de3a716e9e4ff551f424663b.tar.gz
Add support for not_installable/scheduled and to not show created banner
-rw-r--r--app/assets/javascripts/clusters/clusters_bundle.js5
-rw-r--r--app/assets/javascripts/clusters/components/application_row.vue7
-rw-r--r--app/assets/javascripts/clusters/constants.js2
-rw-r--r--app/models/clusters/applications/helm.rb6
-rw-r--r--app/models/clusters/applications/ingress.rb6
-rw-r--r--app/models/clusters/cluster.rb5
-rw-r--r--app/models/clusters/concerns/application_status.rb1
7 files changed, 27 insertions, 5 deletions
diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js
index 9f92d49f576..8d0610b23a3 100644
--- a/app/assets/javascripts/clusters/clusters_bundle.js
+++ b/app/assets/javascripts/clusters/clusters_bundle.js
@@ -134,9 +134,12 @@ export default class Clusters {
handleSuccess(data) {
const prevApplicationMap = Object.assign({}, this.store.state.applications);
+ const prevStatus = this.store.state.status;
this.store.updateStateFromServer(data.data);
this.checkForNewInstalls(prevApplicationMap, this.store.state.applications);
- this.updateContainer(this.store.state.status, this.store.state.statusReason);
+ if (prevStatus.length == 0 || prevStatus !== this.store.state.status) {
+ this.updateContainer(this.store.state.status, this.store.state.statusReason);
+ }
}
toggle() {
diff --git a/app/assets/javascripts/clusters/components/application_row.vue b/app/assets/javascripts/clusters/components/application_row.vue
index f8d53fcc4b7..9c5ff39534f 100644
--- a/app/assets/javascripts/clusters/components/application_row.vue
+++ b/app/assets/javascripts/clusters/components/application_row.vue
@@ -3,6 +3,8 @@ import { s__ } from '../../locale';
import eventHub from '../event_hub';
import loadingButton from '../../vue_shared/components/loading_button.vue';
import {
+ APPLICATION_NOT_INSTALLABLE,
+ APPLICATION_SCHEDULED,
APPLICATION_INSTALLABLE,
APPLICATION_INSTALLING,
APPLICATION_INSTALLED,
@@ -59,6 +61,7 @@ export default {
},
installButtonLoading() {
return !this.status ||
+ this.status === APPLICATION_SCHEDULED ||
this.status === APPLICATION_INSTALLING ||
this.requestStatus === REQUEST_LOADING;
},
@@ -72,9 +75,9 @@ export default {
},
installButtonLabel() {
let label;
- if (this.status === APPLICATION_INSTALLABLE || this.status === APPLICATION_ERROR) {
+ if (this.status === APPLICATION_INSTALLABLE || this.status === APPLICATION_ERROR || this.status === APPLICATION_NOT_INSTALLABLE) {
label = s__('ClusterIntegration|Install');
- } else if (this.status === APPLICATION_INSTALLING) {
+ } else if (this.status === APPLICATION_SCHEDULED || this.status === APPLICATION_INSTALLING) {
label = s__('ClusterIntegration|Installing');
} else if (this.status === APPLICATION_INSTALLED) {
label = s__('ClusterIntegration|Installed');
diff --git a/app/assets/javascripts/clusters/constants.js b/app/assets/javascripts/clusters/constants.js
index 3f202435716..f1894b173b9 100644
--- a/app/assets/javascripts/clusters/constants.js
+++ b/app/assets/javascripts/clusters/constants.js
@@ -1,5 +1,7 @@
// These need to match what is returned from the server
+export const APPLICATION_NOT_INSTALLABLE = 'not_installable';
export const APPLICATION_INSTALLABLE = 'installable';
+export const APPLICATION_SCHEDULED = 'scheduled';
export const APPLICATION_INSTALLING = 'installing';
export const APPLICATION_INSTALLED = 'installed';
export const APPLICATION_ERROR = 'error';
diff --git a/app/models/clusters/applications/helm.rb b/app/models/clusters/applications/helm.rb
index 42626a50175..9bc5c026645 100644
--- a/app/models/clusters/applications/helm.rb
+++ b/app/models/clusters/applications/helm.rb
@@ -11,10 +11,16 @@ module Clusters
validates :cluster, presence: true
+ after_initialize :set_initial_status
+
def self.application_name
self.to_s.demodulize.underscore
end
+ def set_initial_status
+ self.status = 0 unless cluster.platform_kubernetes_active?
+ end
+
def name
self.class.application_name
end
diff --git a/app/models/clusters/applications/ingress.rb b/app/models/clusters/applications/ingress.rb
index 0554cf84ed7..8cb1ed68de9 100644
--- a/app/models/clusters/applications/ingress.rb
+++ b/app/models/clusters/applications/ingress.rb
@@ -9,6 +9,8 @@ module Clusters
validates :cluster, presence: true
+ after_initialize :set_initial_status
+
default_value_for :ingress_type, :nginx
default_value_for :version, :nginx
@@ -20,6 +22,10 @@ module Clusters
self.to_s.demodulize.underscore
end
+ def set_initial_status
+ self.status = 0 unless cluster.application_helm_installed?
+ end
+
def name
self.class.application_name
end
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb
index 90508e31e93..185d9473aab 100644
--- a/app/models/clusters/cluster.rb
+++ b/app/models/clusters/cluster.rb
@@ -39,6 +39,9 @@ module Clusters
delegate :on_creation?, to: :provider, allow_nil: true
delegate :update_kubernetes_integration!, to: :platform, allow_nil: true
+ delegate :active?, to: :platform_kubernetes, prefix: true, allow_nil: true
+ delegate :installed?, to: :application_helm, prefix: true, allow_nil: true
+
enum platform_type: {
kubernetes: 1
}
@@ -60,8 +63,6 @@ module Clusters
end
def applications
- return [] unless kubernetes?
-
[
application_helm || build_application_helm,
application_ingress || build_application_ingress
diff --git a/app/models/clusters/concerns/application_status.rb b/app/models/clusters/concerns/application_status.rb
index 7bb68d75224..7592dd55689 100644
--- a/app/models/clusters/concerns/application_status.rb
+++ b/app/models/clusters/concerns/application_status.rb
@@ -5,6 +5,7 @@ module Clusters
included do
state_machine :status, initial: :installable do
+ state :not_installable, value: -2
state :errored, value: -1
state :installable, value: 0
state :scheduled, value: 1