mirror of https://github.com/rancher/ui.git
commit
c8b045222b
|
|
@ -3,16 +3,17 @@ import ManageLabels from 'ui/mixins/manage-labels';
|
|||
import Util from 'ui/utils/util';
|
||||
|
||||
export default Ember.Component.extend(ManageLabels, {
|
||||
settings: Ember.inject.service(),
|
||||
projects: Ember.inject.service(),
|
||||
cattleAgentIp : null,
|
||||
model: null,
|
||||
settings: Ember.inject.service(),
|
||||
projects: Ember.inject.service(),
|
||||
cattleAgentIp : null,
|
||||
model: null,
|
||||
|
||||
cluster: null,
|
||||
loading: Ember.computed.alias('cluster.isTransitioning'),
|
||||
cluster: null,
|
||||
loading: Ember.computed.alias('cluster.isTransitioning'),
|
||||
registrationCommandWindows: Ember.computed.alias('cluster.registrationToken.windowsCommand'),
|
||||
|
||||
_allHosts: null,
|
||||
hostsAtLoad: null,
|
||||
_allHosts: null,
|
||||
hostsAtLoad: null,
|
||||
|
||||
actions: {
|
||||
cancel() {
|
||||
|
|
@ -20,14 +21,12 @@ export default Ember.Component.extend(ManageLabels, {
|
|||
},
|
||||
|
||||
setLabels(labels) {
|
||||
if ( this.get('model') ) {
|
||||
var out = {};
|
||||
labels.forEach((row) => {
|
||||
out[row.key] = row.value;
|
||||
});
|
||||
var out = {};
|
||||
labels.forEach((row) => {
|
||||
out[row.key] = row.value;
|
||||
});
|
||||
|
||||
this.set('model.labels', out);
|
||||
}
|
||||
this.set('labels', out);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -37,10 +36,11 @@ export default Ember.Component.extend(ManageLabels, {
|
|||
this.setProperties({
|
||||
_allHosts: hosts,
|
||||
hostsAtLoad: hosts.get('length'),
|
||||
labels: []
|
||||
});
|
||||
},
|
||||
|
||||
registrationCommand: function() {
|
||||
registrationCommand: Ember.computed('registrationCommand','labels', 'cattleAgentIp', function() {
|
||||
let cmd = this.get('cluster.registrationToken.hostCommand');
|
||||
let cattleIp = this.get('cattleAgentIp');
|
||||
let lookFor = 'docker run';
|
||||
|
|
@ -50,7 +50,7 @@ export default Ember.Component.extend(ManageLabels, {
|
|||
}
|
||||
|
||||
let idx = cmd.indexOf(lookFor);
|
||||
let env = Util.addQueryParams('', this.get('model.labels')||{});
|
||||
let env = Util.addQueryParams('', this.get('labels')||{});
|
||||
|
||||
if ( env ) {
|
||||
lookFor = 'docker run';
|
||||
|
|
@ -68,11 +68,8 @@ export default Ember.Component.extend(ManageLabels, {
|
|||
}
|
||||
|
||||
return cmd;
|
||||
}.property('model.command','model.labels', 'cattleAgentIp'),
|
||||
|
||||
registrationCommandWindows: Ember.computed.alias('cluster.registrationToken.windowsCommand'),
|
||||
|
||||
newHosts: function() {
|
||||
}),
|
||||
newHosts: Ember.computed('hostsAtLoad','_allHosts.length', function() {
|
||||
let atLoad = this.get('hostsAtLoad')
|
||||
let now = this.get('_allHosts.length');
|
||||
|
||||
|
|
@ -81,6 +78,6 @@ export default Ember.Component.extend(ManageLabels, {
|
|||
}
|
||||
|
||||
return Math.max(0, now-atLoad);
|
||||
}.property('hostsAtLoad','_allHosts.length'),
|
||||
}),
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,9 +9,19 @@ export default Ember.Component.extend({
|
|||
projects : Ember.inject.service(),
|
||||
project : Ember.computed.alias('projects.current'),
|
||||
|
||||
clusters: Ember.computed(function() {
|
||||
return this.get('userStore').all('cluster', null, {url: 'clusters', forceReload: true, removeMissing: true});
|
||||
}),
|
||||
|
||||
projectChoices: function() {
|
||||
return this.get('projects.active').sortBy('name','id');
|
||||
}.property('projects.active.@each.{id,displayName,state}'),
|
||||
return this.get('projects.active').filter((project) => {
|
||||
let removedish = ['removing', 'removed'];
|
||||
let cluster = this.get('clusters').findBy('id', project.get('clusterId'));
|
||||
if ( cluster && !removedish.includes( cluster.get('state'))) {
|
||||
return project;
|
||||
}
|
||||
}).sortBy('name','id');
|
||||
}.property('projects.active.@each.{id,displayName,state}', 'clusters.@each.{state,transition}'),
|
||||
|
||||
byCluster: function() {
|
||||
let out = [];
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export default Ember.Component.extend({
|
|||
init() {
|
||||
this._super(...arguments);
|
||||
|
||||
const def = C.CATALOG.DEFAULT_BRANCH;
|
||||
// const def = C.CATALOG.DEFAULT_BRANCH;
|
||||
let parsed = parseCatalogSetting(this.get('initialValue'));
|
||||
let map = parsed.catalogs || {};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import PolledResource from 'ui/mixins/cattle-polled-resource';
|
|||
|
||||
var Cluster = Resource.extend(PolledResource, {
|
||||
userStore: Ember.inject.service('user-store'),
|
||||
projectsService: Ember.inject.service('projects'),
|
||||
|
||||
type: 'cluster',
|
||||
|
||||
|
|
@ -13,6 +14,14 @@ var Cluster = Resource.extend(PolledResource, {
|
|||
}
|
||||
},
|
||||
|
||||
delete: function(/*arguments*/) {
|
||||
var promise = this._super.apply(this, arguments);
|
||||
return promise.then((/* resp */) => {
|
||||
this.get('projectsService').refreshAll();
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
_allProjects: null,
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ export default Ember.Route.extend({
|
|||
githubRepo: null,
|
||||
githubBranch: null,
|
||||
composeFiles: null,
|
||||
compose: null,
|
||||
system: false,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,10 @@ export default Ember.Service.extend({
|
|||
projects: Ember.inject.service(),
|
||||
|
||||
kubernetesDashboard: function() {
|
||||
return this.get('app.kubernetesDashboard')
|
||||
.replace(this.get('app.projectToken'), this.get('projects.current.id'))
|
||||
.replace(this.get('app.clusterToken'), this.get('projects.currentCluster.id'));
|
||||
let kbd = this.get('app.kubernetesDashboard')
|
||||
.replace(this.get('app.projectToken'), this.get('projects.current.id'))
|
||||
.replace(this.get('app.clusterToken'), this.get('projects.currentCluster.id'));
|
||||
return `${kbd}#!/overview?namespace=default`; // im not 100% sure if '#!/overview?namespace=' is the final route, maybe we can do this better, but denise wanted this
|
||||
}.property('projects.current.id','projects.currentCluster.id'),
|
||||
|
||||
isReady() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ui",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.6",
|
||||
"private": true,
|
||||
"directories": {
|
||||
"doc": "doc",
|
||||
|
|
|
|||
Loading…
Reference in New Issue