From c3238bafd0c2d43587b39b15d6dec2925294903f Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Mon, 21 Aug 2017 11:09:55 -0700 Subject: [PATCH 1/8] Add stack memory to balancer and dns launch --- app/components/new-edit-balancer/component.js | 5 +++- app/components/new-edit-dns/component.js | 6 +++-- app/mixins/stack-memory.js | 23 +++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 app/mixins/stack-memory.js diff --git a/app/components/new-edit-balancer/component.js b/app/components/new-edit-balancer/component.js index 714ee7644..af70b22d4 100644 --- a/app/components/new-edit-balancer/component.js +++ b/app/components/new-edit-balancer/component.js @@ -1,10 +1,12 @@ import Ember from 'ember'; import NewOrEdit from 'ui/mixins/new-or-edit'; import C from 'ui/utils/constants'; +import StackState from 'ui/mixins/stack-memory'; -export default Ember.Component.extend(NewOrEdit, { +export default Ember.Component.extend(NewOrEdit, StackState, { intl : Ember.inject.service(), settings : Ember.inject.service(), + prefs: Ember.inject.service(), service : null, editing : null, @@ -252,6 +254,7 @@ export default Ember.Component.extend(NewOrEdit, { }, doneSaving() { + this._super(...arguments); this.send('done'); }, }); diff --git a/app/components/new-edit-dns/component.js b/app/components/new-edit-dns/component.js index 52f425765..a4a479153 100644 --- a/app/components/new-edit-dns/component.js +++ b/app/components/new-edit-dns/component.js @@ -1,6 +1,7 @@ import Ember from 'ember'; import NewOrEdit from 'ui/mixins/new-or-edit'; import Errors from 'ui/utils/errors'; +import StackState from 'ui/mixins/stack-memory'; const HOSTNAME = 'externalhostname'; const IP = 'externalip'; @@ -15,7 +16,7 @@ function modeToType(mode) { } } -export default Ember.Component.extend(NewOrEdit, { +export default Ember.Component.extend(NewOrEdit, StackState, { intl: Ember.inject.service(), record: null, @@ -156,6 +157,7 @@ export default Ember.Component.extend(NewOrEdit, { }, doneSaving() { - this.send('cancel'); + this._super(...arguments); + this.send('done'); }, }); diff --git a/app/mixins/stack-memory.js b/app/mixins/stack-memory.js new file mode 100644 index 000000000..aa4730f25 --- /dev/null +++ b/app/mixins/stack-memory.js @@ -0,0 +1,23 @@ +import Ember from 'ember'; +import C from 'ui/utils/constants'; + +export default Ember.Mixin.create({ + prefs: Ember.inject.service(), + stack: null, + init() { + this._super(...arguments); + this.setStack(); + }, + setStack() { + let stackId = this.get(`prefs.${C.PREFS.LAST_STACK}`) || null; + if (stackId) { + this.set('stack', this.get('store').getById('stack', stackId)); + } + }, + doneSaving() { + if (this.get('stack')) { + this.set(`prefs.${C.PREFS.LAST_STACK}`, this.get('stack.id')); + } + this.send('done'); + }, +}); From a87e1e52186db221cf1cb49c4d1a5092be7c0a1e Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Mon, 21 Aug 2017 15:40:17 -0700 Subject: [PATCH 2/8] add stack name to service details --- app/service/route.js | 3 +++ app/service/template.hbs | 43 ++++++++++++++++++++++++---------------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/app/service/route.js b/app/service/route.js index 2e3f8140f..e958b08e1 100644 --- a/app/service/route.js +++ b/app/service/route.js @@ -17,6 +17,9 @@ export default Ember.Route.extend({ if (model.get('service.initPorts')) { model.get('service').initPorts(); } + if (model.get('service.stackId')) { + model.set('stack', this.get('store').getById('stack', model.get('service.stackId'))); + } }, getServiceLogs(serviceId) { diff --git a/app/service/template.hbs b/app/service/template.hbs index e009daa5f..77755ab3a 100644 --- a/app/service/template.hbs +++ b/app/service/template.hbs @@ -22,6 +22,28 @@
From c7cb38052b36e7f02e8989dfa5f54549b2cd46ed Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Wed, 23 Aug 2017 12:44:15 -0700 Subject: [PATCH 3/8] Combine services and containers on stack details --- app/stack/index/controller.js | 18 +++++++- app/stack/index/template.hbs | 77 ++++++++++++++++------------------- translations/en-us.yaml | 2 +- 3 files changed, 52 insertions(+), 45 deletions(-) diff --git a/app/stack/index/controller.js b/app/stack/index/controller.js index dea220607..e827617f3 100644 --- a/app/stack/index/controller.js +++ b/app/stack/index/controller.js @@ -1,5 +1,6 @@ import Ember from 'ember'; import { headersWithHost as containerHeaders } from 'ui/components/container-table/component'; +import { searchFields as containerSearchFields } from 'ui/components/container-dots/component'; export default Ember.Controller.extend({ prefs: Ember.inject.service(), @@ -99,12 +100,27 @@ export default Ember.Controller.extend({ name: 'scale', sort: ['scale:desc','isGlobalScale:desc','displayName'], searchField: null, - width: 100, translationKey: 'stacksPage.table.scale', classNames: 'text-center', + width: 100 }, ], + extraSearchFields: ['id:prefix','displayIp:ip'], + extraSearchSubFields: containerSearchFields, + rows: Ember.computed('instances.[]', 'scalingGroups.[]', function() { + let out = []; + let containers = this.get('instances'); + let scalinggroups = this.get('scalingGroups'); + return out.concat(containers, scalinggroups); + }), + + containerStats: Ember.computed('instances.[]', 'scalingGroups.[]', function() { + let containerLength = this.get('instances.length') || 0; + let scalingGroupsLength = this.get('scalingGroups.length') || 0; + return containerLength += scalingGroupsLength; + }), + getType(ownType, real=true) { return this.get('model.services').filter((service) => { if (real ? (service.get('isReal') && service.get('kind') === ownType) : (service.get('kind') === ownType)) { diff --git a/app/stack/index/template.hbs b/app/stack/index/template.hbs index 877945faf..2866fbc3e 100644 --- a/app/stack/index/template.hbs +++ b/app/stack/index/template.hbs @@ -6,62 +6,53 @@ title=(t 'stackPage.containers.header') detail=(t 'stackPage.containers.detail') status=(t 'stackPage.containers.status' count=instances.length) - statusClass=(if instances.length 'bg-success' 'text-muted') + statusClass=(if containerStats 'bg-success' 'text-muted') expandAll=al.expandAll expand=(action expandFn) componentName='container-table' as | parent | }} - {{component parent.intent - body=instances - search=true - sortBy=sortBy - stickyHeader=false - bulkActions=true - showHost=false - }} - {{/accordion-list-item}} - - {{#accordion-list-item - title=(t 'stackPage.scalingGroups.header') - detail=(t 'stackPage.scalingGroups.detail') - status=(t 'stackPage.scalingGroups.status' count=scalingGroups.length) - statusClass=(if scalingGroups.length 'bg-success' 'text-muted') - expandAll=al.expandAll - expand=(action expandFn) - componentName='sortable-table' - as | parent | - }} - {{#component parent.intent - body=scalingGroups - bulkActions=true + {{#sortable-table + tableClassNames="double-rows" classNames="grid sortable-table" - fullRows=true - headers=sgHeaders - pagingLabel="pagination.service" + body=rows searchText=searchText sortBy=sortBy - stickyHeader=false - subHeaders=containerHeaders + bulkActions=true subRows=true + fullRows=true + pagingLabel="pagination.containerService" subSearchField="instances" - as |sortable kind serv dt|}} + extraSearchFields=extraSearchFields + extraSearchSubFields=extraSearchSubFields + headers=sgHeaders as |sortable kind inst dt|}} {{#if (eq kind "row")}} - {{service-row - canExpand=true - expanded=(array-includes expandedInstances serv.id) - fullColspan=sortable.fullColspan - model=serv - searchText=searchText - showInstanceCount=false - subMatches=sortable.subMatches - toggle=(action "toggleExpand" serv.id) - dt=dt - }} + {{#if (eq inst.baseType "instance")}} + {{container-row + model=inst + dt=dt + showHost=true + expandPlaceholder=true + scalePlaceholder=true + fullColspan=sortable.fullColspan + }} + {{else}} + {{service-row + model=inst + toggle=(action "toggleExpand" inst.id) + expanded=(array-includes expandedInstances inst.id) + searchText=searchText + subMatches=sortable.subMatches + fullColspan=sortable.fullColspan + dt=dt + }} + {{/if}} {{else if (eq kind "nomatch")}} - {{t 'containersPage.table.noMatch'}} + {{t 'containersPage.table.noMatch'}} + {{else if (eq kind "norows")}} + {{t 'containersPage.table.noData'}} {{/if}} - {{/component}} + {{/sortable-table}} {{/accordion-list-item}} {{#accordion-list-item diff --git a/translations/en-us.yaml b/translations/en-us.yaml index ee1145ff6..30d7e14fb 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -922,7 +922,7 @@ stackPage: backLink: Back to all stacks containers: header: Containers - detail: Standalone Containers that are not part of a Service or Load Balancer + detail: Standalone Containers and Services contained in this stack status: | {count, plural, =0 {No containers} From 5e6f1833deea47a265a94cb943eb67dffbb8444b Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Thu, 24 Aug 2017 11:17:02 -0700 Subject: [PATCH 4/8] add stack details --- app/stack/index/controller.js | 42 ++++++++++++++++++++++++++++++ app/stack/index/route.js | 17 +++++++++++++ app/stack/index/template.hbs | 48 +++++++++++++++++++++++++++++++++++ translations/en-us.yaml | 9 +++++++ 4 files changed, 116 insertions(+) diff --git a/app/stack/index/controller.js b/app/stack/index/controller.js index e827617f3..99912bfdc 100644 --- a/app/stack/index/controller.js +++ b/app/stack/index/controller.js @@ -105,6 +105,48 @@ export default Ember.Controller.extend({ width: 100 }, ], + storageSortBy: 'state', + storageHeaders: [ + { + name: 'expand', + sort: false, + searchField: null, + width: 30 + }, + { + name: 'state', + sort: ['stateSort','displayName'], + searchField: 'displayState', + translationKey: 'generic.state', + width: 120 + }, + { + name: 'name', + sort: ['displayName','id'], + searchField: 'displayName', + translationKey: 'generic.name', + }, + { + name: 'mounts', + sort: ['mounts.length','displayName','id'], + translationKey: 'volumesPage.mounts.label', + searchField: null, + width: 100, + }, + { + name: 'scope', + sort: ['scope'], + translationKey: 'volumesPage.scope.label', + width: 120 + }, + { + name: 'driver', + sort: ['driver','displayName','id'], + searchField: 'displayType', + translationKey: 'volumesPage.driver.label', + width: 150 + }, + ], extraSearchFields: ['id:prefix','displayIp:ip'], extraSearchSubFields: containerSearchFields, diff --git a/app/stack/index/route.js b/app/stack/index/route.js index 28db886eb..d2b2403fa 100644 --- a/app/stack/index/route.js +++ b/app/stack/index/route.js @@ -1,10 +1,27 @@ import Ember from 'ember'; export default Ember.Route.extend({ + parentRoute: 'stack', + resetController: function (controller, isExisting/*, transition*/) { if (isExisting) { controller.set('showAddtlInfo', false); } }, + + model(/* params, transition */) { + let model = this.modelFor(this.get('parentRoute')); + + return this.get('store').findAll('volume').then((volumes) => { + return this.get('store').findAll('volumetemplate').then((volumeTemplates) => { + + let volOut = []; + + model.volumes = volOut.concat(volumes.filterBy('stackId', model.get('stack.id')), volumeTemplates.filterBy('stackId', model.get('stack.id'))); + + return model; + }); + }); + } }); diff --git a/app/stack/index/template.hbs b/app/stack/index/template.hbs index 2866fbc3e..44a6c7787 100644 --- a/app/stack/index/template.hbs +++ b/app/stack/index/template.hbs @@ -1,5 +1,9 @@ {{stack-header model=model.stack all=model.all.stacks}} +{{#if model.stack.description}} + {{banner-message color='bg-secondary mb-0 mt-10' message=model.stack.description}} +{{/if}} +
{{#accordion-list as |al expandFn| }} {{#accordion-list-item @@ -7,6 +11,7 @@ detail=(t 'stackPage.containers.detail') status=(t 'stackPage.containers.status' count=instances.length) statusClass=(if containerStats 'bg-success' 'text-muted') + expandOnInit=true expandAll=al.expandAll expand=(action expandFn) componentName='container-table' @@ -135,5 +140,48 @@ {{/if}} {{/component}} {{/accordion-list-item}} + + {{#accordion-list-item + title=(t 'stackPage.volumesTab.header') + detail=(t 'stackPage.volumesTab.detail') + status=(t 'pagination.volume' pages=1 count=(or model.volumes.length 0)) + statusClass=(if model.volumes.length 'bg-success' 'text-muted') + expandAll=al.expandAll + expand=(action expandFn) + componentName='sortable-table' + as | parent | + }} + {{#component parent.intent + body=model.volumes + bulkActions=true + classNames="grid sortable-table" + fullRows=true + isVisible=parent.expanded + pagingLabel="pagination.volume" + searchText=searchText + sortBy=sortBy + stickyHeader=false + subHeaders=containerHeaders + subRows=true + subSearchField="instances" + headers=storageHeaders as |sortable kind mount dt| + }} + {{#if (eq kind "row")}} + {{volume-row + model=mount + toggle=(action "toggleExpand" mount.id) + expanded=(array-includes expandedInstances mount.id) + searchText=searchText + subMatches=sortable.subMatches + fullColspan=sortable.fullColspan + dt=dt + }} + {{else if (eq kind "nomatch")}} + {{t 'stackPage.volumesTab.table.noMatch'}} + {{else if (eq kind "norows")}} + {{t 'stackPage.volumesTab.table.noData'}} + {{/if}} + {{/component}} + {{/accordion-list-item}} {{/accordion-list}}
diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 30d7e14fb..3f0455733 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -956,6 +956,15 @@ stackPage: =1 {# container} other {# containers} } + volumesTab: + header: Volumes + detail: 'These properties show the volumes attached to your container.' + table: + path: Mount Point + shared: Shared With + writable: Writable + noData: This stack has no volumes mounted + noMatch: No volumes match the current search newStack: header: Import Compose.yml From faac15c470dc5c318b4615bd186b828081858de2 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Thu, 24 Aug 2017 11:38:09 -0700 Subject: [PATCH 5/8] Fix regression and weird setting in route --- app/volume/route.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/volume/route.js b/app/volume/route.js index 53d5eb0b7..18e1a0e95 100644 --- a/app/volume/route.js +++ b/app/volume/route.js @@ -7,17 +7,19 @@ export default Ember.Route.extend({ }, }, model: function(params) { + let out = Ember.Object.create({ volume: this.get('store').getById(params.type, params.volume_id) }); if (out.volume.stackId) { - out.stack = this.controllerFor('volume').set('stack', this.get('store').getById('stack', out.volume.stackId)); + out.stack = this.get('store').getById('stack', out.volume.stackId); } if (out.volume.hostId) { - out.host = this.controllerFor('volume').set('host', this.get('store').getById('host', out.volume.hostId)); + out.host = this.get('store').getById('host', out.volume.hostId); } + return out; }, }); From 7d0ff2be810bb3860e99388c952aff332b1c5c17 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Thu, 24 Aug 2017 11:50:50 -0700 Subject: [PATCH 6/8] Fix broken stack link on service details --- app/service/controller.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/service/controller.js b/app/service/controller.js index 11c96f382..e2d70f496 100644 --- a/app/service/controller.js +++ b/app/service/controller.js @@ -2,6 +2,7 @@ import Ember from 'ember'; export default Ember.Controller.extend({ application: Ember.inject.controller(), + projects: Ember.inject.service(), service: Ember.computed.alias('model.service'), rules: Ember.computed.alias('service.lbConfig.portRules'), From 0be470d35c5afc4bbb64da3aaab58a9ded3d012a Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Fri, 25 Aug 2017 13:24:15 -0700 Subject: [PATCH 7/8] Fix dropdowns for actions menus, hover menues both desktop and mobile --- app/components/action-menu/component.js | 7 ++- .../page-header-environment/template.hbs | 46 ++++++++----------- app/components/page-header/component.js | 8 ++++ app/components/page-header/template.hbs | 2 +- app/mixins/hover-dropdowns.js | 43 ++++++++++------- app/services/resource-actions.js | 13 +++++- app/styles/components/_page-header.scss | 7 +++ app/styles/layout/_medium.scss | 14 ++++-- app/utils/position-dropdown.js | 19 ++++---- 9 files changed, 101 insertions(+), 58 deletions(-) diff --git a/app/components/action-menu/component.js b/app/components/action-menu/component.js index 5a67c1d65..de98d9515 100644 --- a/app/components/action-menu/component.js +++ b/app/components/action-menu/component.js @@ -21,6 +21,11 @@ export default Ember.Component.extend({ click(e) { var tgt = Ember.$(e.target); var more = tgt.closest('.more-actions'); + var offsets = { + y: -1, + x: 2, + mirror: true + }; if ( more && more.length ) { e.preventDefault(); e.stopPropagation(); @@ -31,7 +36,7 @@ export default Ember.Component.extend({ this.get('resourceActions').set('tooltipActions', false); } - this.get('resourceActions').show(this.get('model'), more, this.$()); + this.get('resourceActions').show(this.get('model'), more, this.$(), offsets); } }, diff --git a/app/components/page-header-environment/template.hbs b/app/components/page-header-environment/template.hbs index d48566908..bd0e98d7f 100644 --- a/app/components/page-header-environment/template.hbs +++ b/app/components/page-header-environment/template.hbs @@ -1,37 +1,31 @@ {{~#if project~}} -