diff --git a/app/balancers/new/template.hbs b/app/balancers/new/template.hbs index 6dd23cad6..a858f7c5b 100644 --- a/app/balancers/new/template.hbs +++ b/app/balancers/new/template.hbs @@ -1,4 +1,4 @@ -{{new-balancer +{{edit-balancer service=model.service existing=model.existing editing=upgrade diff --git a/app/components/container/form-networking/component.js b/app/components/container/form-networking/component.js index 8b1d197a6..1b491df06 100644 --- a/app/components/container/form-networking/component.js +++ b/app/components/container/form-networking/component.js @@ -70,6 +70,7 @@ export default Ember.Component.extend(ManageLabels, ContainerChoices,{ isContainerNetwork: Ember.computed.equal('instance.networkMode','container'), isManagedNetwork: Ember.computed.equal('instance.networkMode','managed'), isHostNetwork: Ember.computed.equal('instance.networkMode','host'), + isBridgeNetwork: Ember.computed.equal('instance.networkMode','bridge'), initNetwork: function() { var isService = this.get('isService')||false; diff --git a/app/components/container/form-networking/template.hbs b/app/components/container/form-networking/template.hbs index 3f1bf5b3d..551567868 100644 --- a/app/components/container/form-networking/template.hbs +++ b/app/components/container/form-networking/template.hbs @@ -7,7 +7,7 @@ expand=(action expandFn) }}
-
+
{{#input-or-display editable=editing value=instance.networkMode}} {{new-select @@ -20,7 +20,7 @@

{{t (concat-str 'formNetwork.networkMode' instance.networkMode 'detail' character='.')}}

- {{#if (or isContainerNetwork isHostNetwork)}} + {{#if (or isContainerNetwork isHostNetwork isBridgeNetwork)}}
{{#if isContainerNetwork}} @@ -34,7 +34,7 @@ value=instance.networkContainerId }} {{/input-or-display}} - {{else if isHostNetwork}} + {{else if (or isHostNetwork isBridgeNetwork)}}
{{#input-or-display editable=editing value=dnsDiscovery}} diff --git a/app/components/container/form-upgrade/component.js b/app/components/container/form-upgrade/component.js new file mode 100644 index 000000000..246b37788 --- /dev/null +++ b/app/components/container/form-upgrade/component.js @@ -0,0 +1,10 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + service: null, + editing: null, + isUpgrade: null, + choices: null, + + classNames: ['accordion-wrapper'], +}); diff --git a/app/components/container/form-upgrade/template.hbs b/app/components/container/form-upgrade/template.hbs new file mode 100644 index 000000000..c86e86c67 --- /dev/null +++ b/app/components/container/form-upgrade/template.hbs @@ -0,0 +1,65 @@ +{{#accordion-list-item + title=(t 'formUpgrade.title') + detail=(t 'formUpgrade.detail' appName=settings.appName) + status=status + statusClass=statusClass + expandAll=expandAll + expand=(action expandFn) +}} + + {{#input-or-display editable=editing value=service.startFirst}} +
+
+ +
+ +

{{t 'formUpgrade.stopFirst.detail'}}

+
+
+
+ +
+ +

{{t 'formUpgrade.startFirst.detail'}}

+
+
+
+ {{/input-or-display}} + +
+ +
+
+ + {{#input-or-display editable=editing value=service.batchSize}} +
+ {{input-integer min=1 step=100 classNames="form-control" value=service.batchSize}} + {{t 'generic.containers'}} +
+

{{t 'formUpgrade.batchSize.detail'}}

+ {{/input-or-display}} +
+ +
+ + {{#input-or-display editable=editing value=service.interval}} +
+ {{input-integer min=0 classNames="form-control" value=service.interval}} + {{t 'generic.millisecond'}} +
+ {{/input-or-display}} +

{{t 'formUpgrade.interval.detail'}}

+
+
+ +
+ +
+
+ +

{{t 'formUpgrade.force.detail'}}

+ + @TODO API for force-upgrade +
+
+{{/accordion-list-item}} diff --git a/app/components/container/new-edit/component.js b/app/components/container/new-edit/component.js index 94fdf2876..459a69435 100644 --- a/app/components/container/new-edit/component.js +++ b/app/components/container/new-edit/component.js @@ -145,6 +145,7 @@ export default Ember.Component.extend(NewOrEdit, SelectTab, { index: index, name: item.get('name') || intl.t('newContainer.emptySidekick', {num: index+1}), enabled: !isUpgrade + uiId: item.get('uiId'), }); }); diff --git a/app/components/container/new-edit/template.hbs b/app/components/container/new-edit/template.hbs index 1817f4812..14c81fa32 100644 --- a/app/components/container/new-edit/template.hbs +++ b/app/components/container/new-edit/template.hbs @@ -4,7 +4,7 @@

{{t headerToken name=configName}}

- +
{{else}} @@ -195,6 +195,17 @@ expandFn=expandFn }} + {{#if (and isService (not isSidekick))}} + {{container/form-upgrade + service=service + editing=true + isUpgrade=isUpgrade + choices=launchConfigChoices + expandAll=al.expandAll + expandFn=expandFn + }} + {{/if}} + {{container/form-volumes classNames="accordion-wrapper" instance=launchConfig @@ -228,7 +239,7 @@ {{top-errors errors=errors}} {{#save-cancel saveDisabled=noLaunchConfigsEnabled createLabel=(if isUpgrade 'newContainer.saveUpgrade' 'newContainer.saveNew') save="save" cancel="cancel"}} {{#if isService}} - + {{/if}} {{/save-cancel}} {{/unless}} diff --git a/app/components/new-balancer/component.js b/app/components/edit-balancer/component.js similarity index 99% rename from app/components/new-balancer/component.js rename to app/components/edit-balancer/component.js index 139e050be..8ad2ea5ac 100644 --- a/app/components/new-balancer/component.js +++ b/app/components/edit-balancer/component.js @@ -49,10 +49,6 @@ export default Ember.Component.extend(NewOrEdit, { setLabels(section,labels) { this.set(section+'Labels', labels); }, - - setUpgrade(upgrade) { - this.set('upgradeOptions', upgrade); - }, }, headerLabel: function() { diff --git a/app/components/new-balancer/template.hbs b/app/components/edit-balancer/template.hbs similarity index 71% rename from app/components/new-balancer/template.hbs rename to app/components/edit-balancer/template.hbs index b5317d1e0..d946647a1 100644 --- a/app/components/new-balancer/template.hbs +++ b/app/components/edit-balancer/template.hbs @@ -1,47 +1,80 @@
-

{{headerLabel}} {{help-btn link="/cattle/adding-load-balancers/"}}

+

{{headerLabel}}

-
- {{#liquid-if needsUpgrade}} - {{form-upgrade - optionsChanged=(action 'setUpgrade') +
+
+ {{form-name-description + model=service + namePlaceholder="servicePage.newBalancer.form.name.placeholder" + descriptionPlaceholder="servicePage.newBalancer.form.description.placeholder" + rowClass="" + colClass="" + bothColClass="" }} - {{/liquid-if}} +
-
+
{{container/form-scale initialLabels=launchConfig.labels initialScale=service.scale editing=editing isGlobal=isGlobal + isService=true errors=scaleErrors setLabels=(action 'setLabels' 'scale') setScale=(action 'setScale') }} + + {{form-stack + stack=stack + errors=stackErrors + }}
+
+ +
+ {{container/form-upgrade + optionsChanged=(action 'setUpgrade') + }}
- {{form-name-description - model=service - namePlaceholder="servicePage.newBalancer.form.name.placeholder" - descriptionPlaceholder="servicePage.newBalancer.form.description.placeholder" - }} - {{form-balancer-rules service=service }}
+{{container/form-scheduling + isService=true + isGlobal=isGlobal + canRequestHost=false + initialHostId=launchConfig.requestedHostId + initialLabels=launchConfig.labels + errors=schedulingErrors + allHosts=allHosts + setLabels=(action 'setLabels' 'scheduling') +}} + +{{#advanced-section advanced=false}} + {{#accordion-list as | al expandFn | }} + + {{form-user-labels + initialLabels=launchConfig.labels + setLabels=(action 'setLabels' 'user') + expandAll=al.expandAll + expandFn=expandFn + }} + + {{/accordion-list}} +{{/advanced-section}} + {{#select-tab initialTab='ssl' as |component|}}
@@ -71,23 +104,9 @@
- {{form-user-labels - initialLabels=launchConfig.labels - setLabels=(action 'setLabels' 'user') - }}
- {{container/form-scheduling - isService=true - isGlobal=isGlobal - canRequestHost=false - initialHostId=launchConfig.requestedHostId - initialLabels=launchConfig.labels - errors=schedulingErrors - allHosts=allHosts - setLabels=(action 'setLabels' 'scheduling') - }}
diff --git a/app/components/form-upgrade/component.js b/app/components/form-upgrade/component.js deleted file mode 100644 index a890da2a1..000000000 --- a/app/components/form-upgrade/component.js +++ /dev/null @@ -1,44 +0,0 @@ -import Ember from 'ember'; - -export default Ember.Component.extend({ - choices : null, - index : null, - - batchSize : 1, - interval : 2, - startFirst : false, - - init() { - this._super(...arguments); - - this.optionsDidChange(); - }, - - optionsDidChange: function() { - this.sendAction('optionsChanged', { - batchSize: parseInt(this.get('batchSize'),10), - intervalMillis: parseInt(this.get('interval'),10)*1000, - startFirst: this.get('startFirst'), - }); - }.observes('batchSize','interval','startFirst'), - - choicesDidChange: function() { - var index = this.get('index'); - var obj = this.get('choices').filterBy('index',index)[0]; - if ( !obj || !obj.enabled ) { - var first = this.get('choices').filterBy('enabled',true)[0]; - if ( first ) - { - this.sendAction('switch', first.index); - } - else - { - this.sendAction('switch', null); - } - } - }.observes('choices.@each.enabled'), - - hasSidekicks: function() { - return this.get('choices.length') > 1; - }.property('choices.length'), -}); diff --git a/app/components/form-upgrade/template.hbs b/app/components/form-upgrade/template.hbs deleted file mode 100644 index 175147ab2..000000000 --- a/app/components/form-upgrade/template.hbs +++ /dev/null @@ -1,33 +0,0 @@ -
-
- - {{input-integer min="1" class="form-control" value=batchSize}} -
-
- -
- {{input-integer class="form-control" value=interval}} - {{t 'formUpgrade.sec'}} -
- -
-
- -
- -
-
-
- -{{#if hasSidekicks}} -
-
- -
-
- {{#each choices as |choice|}} - - {{/each}} -
-
-{{/if}} diff --git a/app/components/modal-container-stop/template.hbs b/app/components/modal-container-stop/template.hbs index 37764dd1b..c42ee75f5 100644 --- a/app/components/modal-container-stop/template.hbs +++ b/app/components/modal-container-stop/template.hbs @@ -15,7 +15,7 @@
{{input-integer classNames="form-control" value=inputTimeout style="max-width:120px;"}} -
{{t 'modalContainerStop.uom'}}
+
{{t 'generic.seconds'}}
diff --git a/app/components/new-catalog/component.js b/app/components/new-catalog/component.js index c31d10fe1..1b2f8fb46 100644 --- a/app/components/new-catalog/component.js +++ b/app/components/new-catalog/component.js @@ -9,6 +9,7 @@ import { task } from 'ember-concurrency'; export default Ember.Component.extend(NewOrEdit, { intl: Ember.inject.service(), + catalog: Ember.inject.service(), projects: Ember.inject.service(), settings: Ember.inject.service(), @@ -140,9 +141,7 @@ export default Ember.Component.extend(NewOrEdit, { this.set('stackResource.environment', current); } - var selectedTemplateModel = yield this.get('store').request({ - url: url - }).then((response) => { + var selectedTemplateModel = yield this.get('catalog').fetchByUrl(url).then((response) => { if (response.questions) { response.questions.forEach((item) => { // This will be the component that is rendered to edit this answer diff --git a/app/components/save-cancel/component.js b/app/components/save-cancel/component.js index 9990344e2..abd13d2d9 100644 --- a/app/components/save-cancel/component.js +++ b/app/components/save-cancel/component.js @@ -10,7 +10,7 @@ export default Ember.Component.extend({ cancelDisabled: false, savedLabel: 'saveCancel.saved', forFooter: true, - classNames: ['text-center' , 'p-20'], + classNames: ['text-center', 'pt-20', 'pb-20'], classNamesBindings: ['forFooter:footer-actions'], saving: false, diff --git a/app/components/service-row/template.hbs b/app/components/service-row/template.hbs index 068d16cfd..21642b1c2 100644 --- a/app/components/service-row/template.hbs +++ b/app/components/service-row/template.hbs @@ -36,8 +36,6 @@ {{/if}}
- A: {{get subMatches model.id}}
- B: {{model.instances.length}}
{{#if showInstanceCount}} {{#if subMatches}} {{#if (lt (get subMatches model.id) model.instances.length)}} diff --git a/app/models/dnsservice.js b/app/models/dnsservice.js index 77932a114..ce454dc12 100644 --- a/app/models/dnsservice.js +++ b/app/models/dnsservice.js @@ -1,4 +1,3 @@ -import Ember from 'ember'; import Service from 'ui/models/service'; export default Service.extend({ diff --git a/app/models/template.js b/app/models/template.js index 25b39befd..aff6dce5f 100644 --- a/app/models/template.js +++ b/app/models/template.js @@ -7,6 +7,12 @@ export default Resource.extend({ settings: Ember.inject.service(), intl: Ember.inject.service(), + headers: function() { + return { + [C.HEADER.PROJECT_ID]: this.get('projects.current.id') + }; + }.property('project.current.id'), + cleanProjectUrl: Ember.computed('links.project', function() { let projectUrl = this.get('links.project'); let pattern = new RegExp('^([a-z]+://|//)', 'i'); diff --git a/app/models/templateversion.js b/app/models/templateversion.js index 7e9a172d6..0385d64f2 100644 --- a/app/models/templateversion.js +++ b/app/models/templateversion.js @@ -2,6 +2,14 @@ import Resource from 'ember-api-store/models/resource'; import C from 'ui/utils/constants'; export default Resource.extend({ + projects: Ember.inject.service(), + + headers: function() { + return { + [C.HEADER.PROJECT_ID]: this.get('projects.current.id') + }; + }.property('project.current.id'), + filesAsArray: function() { var obj = (this.get('files')||{}); var out = []; diff --git a/app/services/catalog.js b/app/services/catalog.js index 7b73203c4..f0e1487dd 100644 --- a/app/services/catalog.js +++ b/app/services/catalog.js @@ -95,7 +95,7 @@ export default Ember.Service.extend({ } let url = this._addLimits(`${this.get('app.catalogEndpoint')}/templates`, qp); - return this.get('store').request({url: url, headers: {[C.HEADER.PROJECT_ID]: this.get('projects.current.id')},}).then((res) => { + return this.get('store').request({url: url, headers: {[C.HEADER.PROJECT_ID]: this.get('projects.current.id')}}).then((res) => { res.catalogId = catalogId; this.set('templateCache', res); return this.filter(res, params.category, templateBase, plusInfra); @@ -108,6 +108,10 @@ export default Ember.Service.extend({ }); }, + fetchByUrl(url) { + return this.get('store').request({url: url, headers: {[C.HEADER.PROJECT_ID]: this.get('projects.current.id')}}); + }, + filter(data, category, templateBase, plusInfra) { let bases = []; diff --git a/app/services/endpoint.js b/app/services/endpoint.js index 84e8eaef8..d120b81d0 100644 --- a/app/services/endpoint.js +++ b/app/services/endpoint.js @@ -1,5 +1,6 @@ import Ember from 'ember'; import C from 'ui/utils/constants'; +import Util from 'ui/utils/util'; export default Ember.Service.extend({ cookies: Ember.inject.service(), diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 740b4e741..534682ed4 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -13,8 +13,9 @@ generic: cancel: Cancel closeModal: Close command: Command - confirm: Confirm collapseAll: Collapse All + confirm: Confirm + containers: Containers created: Created createdDate: "Created {date}" default: Default @@ -42,6 +43,7 @@ generic: loading: "Loading..." megabyte: 'MB' mibibyte: 'MiB' + millisecond: 'ms' missing: "*%MISSING%*" moreActions: More Actions na: 'n/a' @@ -55,6 +57,7 @@ generic: saved: Saved saving: Saving search: Search + seconds: seconds select: Select service: Service stack: Stack @@ -2469,12 +2472,24 @@ formUserLabels: protip: "ProTip: Paste one or more lines of key=value pairs into any key field for easy bulk entry." formUpgrade: - size: Batch Size - interval: Batch Interval - sec: sec - behavior: Start Behavior - startStop: Start before Stopping - whichServices: Which Services + title: Upgrade + detail: Configure how containers are replaced when performing an upgrade. + batchSize: + label: Batch Size + detail: Up to this many containers will be replaced at once. + interval: + label: Batch Interval + detail: After finishing a batch of containers, wait this long before starting the next batch + behavior: Replacement Behavior + startFirst: + label: Start new, then stop old + detail: Start new containers before stopping the old ones. If the service publishes a port, there must be enough eligible hosts availeblt to run Batch Size new containers, because the old containers are still actively using the ports. + stopFirst: + label: Stop old, then start new + detail: Stop the old containers (up to the Batch Size), then start new ones. This allows the reuse of published ports. Adjust Batch Size to ensure that you keep enough active capacity to run your application. + force: + label: Force Redeploy + detail: During an upgrade, containers are normally only replaced if part of their definition has changed. To force one to redeploy for this upgrade, select it here. formValueArray: addActionLabel: Add Value @@ -3190,7 +3205,6 @@ modalAuditlogInfo: response: "Response Object:" modalContainerStop: - uom: seconds header: "Are you sure you want to stop" helpText: "The container will be forcibly terminated if it does not stop itself before the timeout expires" protip: "ProTip: Hold the {key} key while clicking stop to bypass this confirmation." @@ -3415,7 +3429,7 @@ newContainer: keyPlaceholder: e.g. FOO valueLabel: Value valuePlaceholder: e.g. bar - emptyPrimaryService: "(Primary Service)" + emptyPrimaryService: "(Primary)" emptySidekick: "(Sidekick #{num})" addSidekickContainer: Add Sidekick Container addSidekickVm: Add Sidekick VM