mirror of https://github.com/rancher/ui.git
Stuff
This commit is contained in:
parent
295cfb14e6
commit
4069333ce1
|
|
@ -26,11 +26,7 @@ export default Ember.Route.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
goBack() {
|
goBack() {
|
||||||
if ( this.get('backTo') === 'waiting' ) {
|
this.send('goToPrevious','authenticated.clusters');
|
||||||
this.transitionTo('authenticated.project.waiting');
|
|
||||||
} else {
|
|
||||||
this.transitionTo('hosts');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,7 @@ export default Ember.Controller.extend({
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
newCluster() {
|
newCluster() {
|
||||||
let cluster = this.get('userStore').createRecord({
|
this.get('modalService').toggleModal('modal-edit-cluster');
|
||||||
type: 'cluster',
|
|
||||||
});
|
|
||||||
|
|
||||||
this.get('modalService').toggleModal('modal-edit-cluster', cluster);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,7 @@ export default Ember.Component.extend({
|
||||||
projects: Ember.inject.service(),
|
projects: Ember.inject.service(),
|
||||||
settings: Ember.inject.service(),
|
settings: Ember.inject.service(),
|
||||||
|
|
||||||
clusters: null,
|
cluster: Ember.computed.alias('projects.currentCluster'),
|
||||||
|
canCreate: Ember.computed.notEmpty('cluster.registrationToken.hostCommand'),
|
||||||
canCreate: true,
|
canImport: Ember.computed.notEmpty('cluster.registrationToken.clusterCommand'),
|
||||||
canImport: true,
|
|
||||||
canReuse: Ember.computed.gt('clusters.length', 0),
|
|
||||||
|
|
||||||
init() {
|
|
||||||
this._super(),
|
|
||||||
|
|
||||||
this.set('clusters', this.get('store').all('cluster'));
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,16 @@
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col span-4 offset-2 text-center option option-primary {{unless canCreate 'option-disabled'}}">
|
<div class="col span-4 offset-2 text-center option option-primary {{unless canCreate 'option-disabled'}}">
|
||||||
<h2>Add Host</h2>
|
<h2>Add Hosts</h2>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<p>Define and manage hosts inside {{settings.appName}}.</p>
|
<p>Define and manage hosts inside {{settings.appName}}.</p>
|
||||||
<p>Supports on-premise, bare-metal, and cloud infrastructure.</p>
|
<p>Supports on-premise, bare-metal, and cloud infrastructure.</p>
|
||||||
|
|
||||||
<div class="links" style="top: auto; bottom: 47px;">
|
{{#if canCreate}}
|
||||||
{{#link-to "authenticated.clusters.cluster.host-templates" projects.currentCluster.id class="btn bg-primary"}}Select{{/link-to}}
|
<div class="links" style="top: auto; bottom: 47px;">
|
||||||
</div>
|
{{#link-to "authenticated.clusters.cluster.host-templates" projects.currentCluster.id class="btn bg-primary"}}Select{{/link-to}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="bubble bg-body round"><img src="{{app.baseAssets}}assets/images/environment-advanced.svg" class="mt-5" /></div>
|
<div class="bubble bg-body round"><img src="{{app.baseAssets}}assets/images/environment-advanced.svg" class="mt-5" /></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -25,9 +27,11 @@
|
||||||
<p>Individual hosts are managed by cluster provider outside of {{settings.appName}}.</p>
|
<p>Individual hosts are managed by cluster provider outside of {{settings.appName}}.</p>
|
||||||
<p>Supports hosted services like Google Container Engine.</p>
|
<p>Supports hosted services like Google Container Engine.</p>
|
||||||
|
|
||||||
<div class="links" style="top: auto; bottom: 47px;">
|
{{#if canImport}}
|
||||||
{{#link-to "authenticated.clusters.cluster.import" projects.currentCluster.id class="btn bg-primary"}}Select{{/link-to}}
|
<div class="links" style="top: auto; bottom: 47px;">
|
||||||
</div>
|
{{#link-to "authenticated.clusters.cluster.import" projects.currentCluster.id class="btn bg-primary"}}Select{{/link-to}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="bubble bg-body round"><img src="{{app.baseAssets}}assets/images/environment-advanced.svg" class="mt-5" /></div>
|
<div class="bubble bg-body round"><img src="{{app.baseAssets}}assets/images/environment-advanced.svg" class="mt-5" /></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,37 @@ export default Ember.Component.extend(ModalBase, NewOrEdit, {
|
||||||
willInsertElement: function() {
|
willInsertElement: function() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
var orig = this.get('originalModel');
|
var orig = this.get('originalModel');
|
||||||
var clone = orig.clone();
|
if ( orig ) {
|
||||||
this.set('model', clone);
|
var clone = orig.clone();
|
||||||
this.set('editing', !!this.get('model.id'));
|
this.setProperties({
|
||||||
|
editing: true,
|
||||||
|
model: clone,
|
||||||
|
createProject: null,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.setProperties({
|
||||||
|
editing: false,
|
||||||
|
model: this.get('userStore').createRecord({
|
||||||
|
type: 'cluster',
|
||||||
|
}),
|
||||||
|
createProject: this.get('userStore').createRecord({
|
||||||
|
type: 'project',
|
||||||
|
name: 'Default',
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
didInsertElement() {
|
||||||
|
this.$('INPUT')[0].focus();
|
||||||
|
},
|
||||||
|
|
||||||
|
didSave() {
|
||||||
|
let project = this.get('createProject');
|
||||||
|
if ( project ) {
|
||||||
|
project.set('clusterId', this.get('model.id'));
|
||||||
|
return project.save();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
doneSaving: function() {
|
doneSaving: function() {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import PolledResource from 'ui/mixins/cattle-polled-resource';
|
||||||
|
|
||||||
var Cluster = Resource.extend(PolledResource, {
|
var Cluster = Resource.extend(PolledResource, {
|
||||||
modalService: Ember.inject.service('modal'),
|
modalService: Ember.inject.service('modal'),
|
||||||
|
userStore: Ember.inject.service('user-store'),
|
||||||
|
|
||||||
type: 'cluster',
|
type: 'cluster',
|
||||||
|
|
||||||
|
|
@ -13,6 +14,16 @@ var Cluster = Resource.extend(PolledResource, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_allProjects: null,
|
||||||
|
init() {
|
||||||
|
this._super(...arguments);
|
||||||
|
this.set('_allProjects', this.get('userStore').all('project'));
|
||||||
|
},
|
||||||
|
|
||||||
|
projects: function() {
|
||||||
|
return this.get('_allProjects').filterBy('clusterId', this.get('id'));
|
||||||
|
}.property('_allProjects.@each.clusterId'),
|
||||||
|
|
||||||
availableActions: function() {
|
availableActions: function() {
|
||||||
// let a = this.get('actionLinks');
|
// let a = this.get('actionLinks');
|
||||||
let l = this.get('links');
|
let l = this.get('links');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue