mirror of https://github.com/rancher/ui.git
Move volumes into host
This commit is contained in:
parent
74b0ac2473
commit
c123d85e10
|
|
@ -323,7 +323,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
if ( volume )
|
||||
{
|
||||
var mounts = volume.get('mounts');
|
||||
if ( !Ember.isArray('mounts') )
|
||||
if ( !Ember.isArray(mounts) )
|
||||
{
|
||||
mounts = [];
|
||||
volume.set('mounts',mounts);
|
||||
|
|
|
|||
|
|
@ -136,7 +136,6 @@
|
|||
{{#if isInfrastructure}}
|
||||
{{#link-to "hosts"}}<i class="ss-database"></i> Hosts{{/link-to}}
|
||||
{{#link-to "containers"}}<i class="ss-box"></i> Containers{{/link-to}}
|
||||
{{#link-to "volumes"}}<i class="ss-hdd"></i> Volumes{{/link-to}}
|
||||
{{#link-to "loadbalancers"}}<i class="ss-fork"></i> Load Balancers{{/link-to}}
|
||||
{{#link-to "loadbalancerconfigs"}}<i class="ss-file"></i> Balancer Configs{{/link-to}}
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ export default Ember.Component.extend({
|
|||
choices: null,
|
||||
|
||||
classNames: ['resource-actions'],
|
||||
classNameBindings: ['activeActions.length::hide'],
|
||||
|
||||
open: false,
|
||||
didInsertElement: function() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
import Cattle from 'ui/utils/cattle';
|
||||
|
||||
export default Cattle.CollectionController.extend({
|
||||
nonRootVolumes: function() {
|
||||
return this.get('arrangedContent').filter(function(volume) {
|
||||
return !volume.get('instanceId') && volume.get('state') !== 'purged';
|
||||
});
|
||||
}.property('arrangedContent.@each.{instanceId,state}')
|
||||
});
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
model: function() {
|
||||
var host = this.modelFor('host');
|
||||
var out = [];
|
||||
return host.followLink('storagePools').then((pools) => {
|
||||
var promises = pools.map((pool) => {
|
||||
return pool.followLink('volumes',{include: 'mounts'}).then((volumes) => {
|
||||
out.pushObjects((volumes||[]).toArray());
|
||||
});
|
||||
});
|
||||
|
||||
return Ember.RSVP.all(promises).then(() => {
|
||||
return out;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -1 +1,54 @@
|
|||
<h4>Coming soon, replacement for the Volumes tab...</h4>
|
||||
<section>
|
||||
<table class="grid fixed" style="margin-bottom: 0;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="90">State</th>
|
||||
<th>Host Path</th>
|
||||
<th>Mounts</th>
|
||||
<th class="actions" width="50"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each volume in nonRootVolumes itemController="volume"}}
|
||||
<tr>
|
||||
<td>
|
||||
<span {{bind-attr class=":badge :state volume.stateBackground"}}>
|
||||
{{volume.displayState}}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<div class="clip with-zeroclip">
|
||||
{{volume.displayUri}}
|
||||
</div>
|
||||
{{zero-clipboard text=volume.displayUri class="with-clip"}}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{#if volume.activeMounts.length}}
|
||||
{{#each mount in volume.activeMounts itemController="mount"}}
|
||||
<div>
|
||||
{{#link-to "container" mount.instanceId}}{{mount.instance.name}}{{/link-to}}:{{mount.path}}
|
||||
{{#if (eq mount.permissions "ro")}}
|
||||
<span class="text-muted">(read-only)</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/each}}
|
||||
{{else}}
|
||||
<span class="text-muted">None</span>
|
||||
{{/if}}
|
||||
</td>
|
||||
|
||||
<td class="actions">
|
||||
{{#if volume.availableActions.length}}
|
||||
{{resource-actions-menu model=volume choices=volume.availableActions}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<tr><td colspan="4" class="text-center text-muted">This host does not have any containers yet.</td></tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
export function initialize(/*container, application*/) {
|
||||
// Add 'touch' or 'no-touch' to the <body> so CSS can depend on the devicve type.
|
||||
// Add 'touch' or 'no-touch' to the <body> so CSS can depend on the device type.
|
||||
|
||||
var body = $('BODY');
|
||||
if ('ontouchstart' in document.documentElement)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ export default Ember.Controller.extend({
|
|||
},
|
||||
|
||||
save: function() {
|
||||
this.set('errors', null);
|
||||
this.set('saving',true);
|
||||
var promises = [];
|
||||
var balancer = this.get('model');
|
||||
|
|
|
|||
|
|
@ -25,6 +25,13 @@ export default OverlayRoute.extend({
|
|||
this.render({into: 'application', outlet: 'overlay'});
|
||||
},
|
||||
|
||||
resetController: function (controller, isExisting/*, transition*/) {
|
||||
if (isExisting)
|
||||
{
|
||||
controller.set('errors', null);
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
cancel: function() {
|
||||
this.transitionTo('loadbalancer.hosts');
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import TargetChoices from 'ui/mixins/target-choices';
|
|||
export default Ember.Controller.extend(TargetChoices, {
|
||||
error: null,
|
||||
editing: false,
|
||||
saving: false,
|
||||
|
||||
actions: {
|
||||
addTargetContainer: function() {
|
||||
|
|
@ -17,6 +18,8 @@ export default Ember.Controller.extend(TargetChoices, {
|
|||
},
|
||||
|
||||
save: function() {
|
||||
this.set('saving',true);
|
||||
this.set('errors', null);
|
||||
var promises = [];
|
||||
var balancer = this.get('model');
|
||||
|
||||
|
|
@ -34,6 +37,24 @@ export default Ember.Controller.extend(TargetChoices, {
|
|||
|
||||
return Ember.RSVP.all(promises,'Add multiple targets').then(() => {
|
||||
this.send('cancel');
|
||||
}).catch((err) => {
|
||||
if ( err.status === 422 && err.code === 'NotUnique' )
|
||||
{
|
||||
if ( this.get('targetsArray.length') > 1 )
|
||||
{
|
||||
this.set('errors',['This load balancer is already has one or more of the specified targets']);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.set('errors',['This load balancer already has the specified targets']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.set('errors', [err]);
|
||||
}
|
||||
}).finally(() => {
|
||||
this.set('saving', false);
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -25,6 +25,13 @@ export default OverlayRoute.extend({
|
|||
this.render({into: 'application', outlet: 'overlay'});
|
||||
},
|
||||
|
||||
resetController: function (controller, isExisting/*, transition*/) {
|
||||
if (isExisting)
|
||||
{
|
||||
controller.set('errors', null);
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
cancel: function() {
|
||||
this.goToPrevious();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<section class="horizontal-form container-fluid">
|
||||
<h2>Add Targets</h2>
|
||||
{{top-errors errors=errors}}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-md-8 col-md-offset-2">
|
||||
|
|
|
|||
|
|
@ -4,6 +4,15 @@ import Ember from 'ember';
|
|||
var MountController = Cattle.TransitioningResourceController.extend({
|
||||
isReadWrite: Ember.computed.equal('permissions','rw'),
|
||||
isReadOnly: Ember.computed.equal('permissions','ro'),
|
||||
|
||||
instance: function() {
|
||||
var proxy = Ember.ObjectProxy.create({content: {}});
|
||||
this.get('store').find('container', this.get('instanceId')).then((container) => {
|
||||
proxy.set('content', container);
|
||||
});
|
||||
|
||||
return proxy;
|
||||
}.property('instanceId'),
|
||||
});
|
||||
|
||||
MountController.reopenClass({
|
||||
|
|
|
|||
|
|
@ -29,3 +29,13 @@
|
|||
@extend .text-muted;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.zeroclip.with-clip {
|
||||
display: inline-block
|
||||
}
|
||||
|
||||
.clip.with-zeroclip {
|
||||
max-width: calc(100% - 20px);
|
||||
float: left;
|
||||
padding-right: 3px
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue