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() {
|
||||
if ( this.get('backTo') === 'waiting' ) {
|
||||
this.transitionTo('authenticated.project.waiting');
|
||||
} else {
|
||||
this.transitionTo('hosts');
|
||||
}
|
||||
this.send('goToPrevious','authenticated.clusters');
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@ export default Ember.Controller.extend({
|
|||
|
||||
actions: {
|
||||
newCluster() {
|
||||
let cluster = this.get('userStore').createRecord({
|
||||
type: 'cluster',
|
||||
});
|
||||
|
||||
this.get('modalService').toggleModal('modal-edit-cluster', cluster);
|
||||
this.get('modalService').toggleModal('modal-edit-cluster');
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -4,15 +4,7 @@ export default Ember.Component.extend({
|
|||
projects: Ember.inject.service(),
|
||||
settings: Ember.inject.service(),
|
||||
|
||||
clusters: null,
|
||||
|
||||
canCreate: true,
|
||||
canImport: true,
|
||||
canReuse: Ember.computed.gt('clusters.length', 0),
|
||||
|
||||
init() {
|
||||
this._super(),
|
||||
|
||||
this.set('clusters', this.get('store').all('cluster'));
|
||||
},
|
||||
cluster: Ember.computed.alias('projects.currentCluster'),
|
||||
canCreate: Ember.computed.notEmpty('cluster.registrationToken.hostCommand'),
|
||||
canImport: Ember.computed.notEmpty('cluster.registrationToken.clusterCommand'),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,14 +5,16 @@
|
|||
|
||||
<div class="row">
|
||||
<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">
|
||||
<p>Define and manage hosts inside {{settings.appName}}.</p>
|
||||
<p>Supports on-premise, bare-metal, and cloud infrastructure.</p>
|
||||
|
||||
<div class="links" style="top: auto; bottom: 47px;">
|
||||
{{#link-to "authenticated.clusters.cluster.host-templates" projects.currentCluster.id class="btn bg-primary"}}Select{{/link-to}}
|
||||
</div>
|
||||
{{#if canCreate}}
|
||||
<div class="links" style="top: auto; bottom: 47px;">
|
||||
{{#link-to "authenticated.clusters.cluster.host-templates" projects.currentCluster.id class="btn bg-primary"}}Select{{/link-to}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="bubble bg-body round"><img src="{{app.baseAssets}}assets/images/environment-advanced.svg" class="mt-5" /></div>
|
||||
</div>
|
||||
|
|
@ -25,9 +27,11 @@
|
|||
<p>Individual hosts are managed by cluster provider outside of {{settings.appName}}.</p>
|
||||
<p>Supports hosted services like Google Container Engine.</p>
|
||||
|
||||
<div class="links" style="top: auto; bottom: 47px;">
|
||||
{{#link-to "authenticated.clusters.cluster.import" projects.currentCluster.id class="btn bg-primary"}}Select{{/link-to}}
|
||||
</div>
|
||||
{{#if canImport}}
|
||||
<div class="links" style="top: auto; bottom: 47px;">
|
||||
{{#link-to "authenticated.clusters.cluster.import" projects.currentCluster.id class="btn bg-primary"}}Select{{/link-to}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="bubble bg-body round"><img src="{{app.baseAssets}}assets/images/environment-advanced.svg" class="mt-5" /></div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -11,9 +11,37 @@ export default Ember.Component.extend(ModalBase, NewOrEdit, {
|
|||
willInsertElement: function() {
|
||||
this._super(...arguments);
|
||||
var orig = this.get('originalModel');
|
||||
var clone = orig.clone();
|
||||
this.set('model', clone);
|
||||
this.set('editing', !!this.get('model.id'));
|
||||
if ( orig ) {
|
||||
var clone = orig.clone();
|
||||
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() {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import PolledResource from 'ui/mixins/cattle-polled-resource';
|
|||
|
||||
var Cluster = Resource.extend(PolledResource, {
|
||||
modalService: Ember.inject.service('modal'),
|
||||
userStore: Ember.inject.service('user-store'),
|
||||
|
||||
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() {
|
||||
// let a = this.get('actionLinks');
|
||||
let l = this.get('links');
|
||||
|
|
|
|||
Loading…
Reference in New Issue