This commit is contained in:
Vincent Fiduccia 2016-11-09 14:43:10 -07:00
parent 0853752cf0
commit cc6d95056f
11 changed files with 55 additions and 9 deletions

View File

@ -41,7 +41,9 @@
<div class="btn-group r-ml10"> <div class="btn-group r-ml10">
{{#link-to "stack.index" classNames="btn btn-sm btn-default"}}{{tooltip-link icon="icon-tasks" text=(t 'tooltipLink.list') options=listLinkOptions}}{{/link-to}} {{#link-to "stack.index" classNames="btn btn-sm btn-default"}}{{tooltip-link icon="icon-tasks" text=(t 'tooltipLink.list') options=listLinkOptions}}{{/link-to}}
{{#link-to "stack.graph" classNames="btn btn-sm btn-default"}}{{tooltip-link icon="icon-share" text=(t 'tooltipLink.linkGraph') options=graphLinkOptions}}{{/link-to}} {{#if model.canViewConfig}}
{{#link-to "stack.graph" classNames="btn btn-sm btn-default"}}{{tooltip-link icon="icon-share" text=(t 'tooltipLink.linkGraph') options=graphLinkOptions}}{{/link-to}}
{{/if}}
{{#link-to "stack.code" classNames="btn btn-sm btn-default"}}{{tooltip-link icon="icon-file" text=(t 'tooltipLink.composeYaml') options=yamlLinkOptions}}{{/link-to}} {{#link-to "stack.code" classNames="btn btn-sm btn-default"}}{{tooltip-link icon="icon-file" text=(t 'tooltipLink.composeYaml') options=yamlLinkOptions}}{{/link-to}}
</div> </div>

View File

@ -1,5 +1,6 @@
import Ember from 'ember'; import Ember from 'ember';
import Util from 'ui/utils/util'; import Util from 'ui/utils/util';
import C from 'ui/utils/constants';
export default Ember.Mixin.create({ export default Ember.Mixin.create({
reservedKeys: ['delayTimer','pollTimer'], reservedKeys: ['delayTimer','pollTimer'],
@ -113,4 +114,16 @@ export default Ember.Mixin.create({
// but leave delay set so that it doesn't restart, (don't clearDelay()) // but leave delay set so that it doesn't restart, (don't clearDelay())
}); });
}, },
stateChanged: function() {
// Get rid of things that are removed
if ( C.REMOVEDISH_STATES.includes(this.state) ) {
try {
this.clearPoll();
this.clearDelay();
this.get('store')._remove(this.get('type'), this);
} catch (e) {
}
}
}.observes('state'),
}); });

View File

@ -2,8 +2,6 @@ import Ember from 'ember';
import Socket from 'ui/utils/socket'; import Socket from 'ui/utils/socket';
import C from 'ui/utils/constants'; import C from 'ui/utils/constants';
let DEADTOME = ['removed','purging','purged'];
const ORCHESTRATION_STACKS = [ const ORCHESTRATION_STACKS = [
'k8s', 'k8s',
'swarm', 'swarm',
@ -56,7 +54,7 @@ export default Ember.Mixin.create({
this[key](d); this[key](d);
} }
if ( resource && DEADTOME.includes(resource.state) ) { if ( resource && C.REMOVEDISH_STATES.includes(resource.state) ) {
store._remove(resource.type, resource); store._remove(resource.type, resource);
} }
} }

View File

@ -1,7 +1,14 @@
import Resource from 'ember-api-store/models/resource'; import Resource from 'ember-api-store/models/resource';
import PolledResource from 'ui/mixins/cattle-polled-resource';
var Password = Resource.extend({ var Password = Resource.extend(PolledResource, {
type: 'password', type: 'password',
}); });
// Passwords don't get pushed by /subscribe WS, so refresh more often
Password.reopenClass({
pollTransitioningDelay: 1000,
pollTransitioningInterval: 5000,
});
export default Password; export default Password;

View File

@ -152,6 +152,10 @@ var Stack = Resource.extend({
return out; return out;
}.property('actionLinks.{remove,purge,exportconfig,finishupgrade,cancelupgrade,rollback,cancelrollback,update}','canActivate','canDeactivate','externalIdInfo.kind'), }.property('actionLinks.{remove,purge,exportconfig,finishupgrade,cancelupgrade,rollback,cancelrollback,update}','canActivate','canDeactivate','externalIdInfo.kind'),
canViewConfig: function() {
return !!this.get('actionLinks.exportconfig');
}.property('actionLinks.exportconfig'),
combinedState: function() { combinedState: function() {
var stack = this.get('state'); var stack = this.get('state');
var health = this.get('healthState'); var health = this.get('healthState');

View File

@ -18,6 +18,13 @@ export default Ember.Service.extend({
return this.get('projects.current.orchestration') || 'cattle'; return this.get('projects.current.orchestration') || 'cattle';
}), }),
reset() {
this.setProperties({
cache: null,
catalogs: null,
});
},
refresh() { refresh() {
const store = this.get('store'); const store = this.get('store');

View File

@ -186,14 +186,19 @@ export default Ember.Service.extend(Ember.Evented, {
let version = this.get('rancherVersion'); let version = this.get('rancherVersion');
if ( !version ) if ( !version )
{ {
return 'latest'; return null;
} }
return minorVersion(version); return minorVersion(version);
}.property('rancherVersion'), }.property('rancherVersion'),
docsBase: function() { docsBase: function() {
let version = this.get('minorVersion'); let full = this.get('rancherVersion');
let version = 'latest';
if ( full ) {
version = minorVersion(full);
}
let lang = ((this.get('intl._locale')||[])[0]||'').replace(/-.*$/,''); let lang = ((this.get('intl._locale')||[])[0]||'').replace(/-.*$/,'');
if ( !lang || lang === 'none' || C.LANGUAGE.DOCS.indexOf(lang) === -1 ) { if ( !lang || lang === 'none' || C.LANGUAGE.DOCS.indexOf(lang) === -1 ) {
lang = 'en'; lang = 'en';

View File

@ -7,12 +7,14 @@ import Volume from 'ui/models/volume';
export default Ember.Service.extend({ export default Ember.Service.extend({
store: Ember.inject.service(), store: Ember.inject.service(),
userStore: Ember.inject.service('user-store'), userStore: Ember.inject.service('user-store'),
catalog: Ember.inject.service(),
reset: function() { reset: function() {
// Forget all the things // Forget all the things
console.log('Store Reset'); console.log('Store Reset');
this.get('userStore').reset(); this.get('userStore').reset();
this.get('store').reset(); this.get('store').reset();
this.get('catalog').reset();
// Some classes have extra special hackery to cache relationships // Some classes have extra special hackery to cache relationships
Backup.reset(); Backup.reset();

View File

@ -7,7 +7,7 @@ export default Ember.Route.extend({
model() { model() {
return Ember.RSVP.hash({ return Ember.RSVP.hash({
catalogInfo: this.get('catalog').fetchTemplates({templateBase: 'infra', category: 'all'}), catalogInfo: this.get('catalog').fetchTemplates({templateBase: C.EXTERNAL_ID.KIND_INFRA, category: C.EXTERNAL_ID.KIND_ALL}),
serviceChoices: this.get('allServices').choices(), serviceChoices: this.get('allServices').choices(),
}).then((hash) => { }).then((hash) => {
let existing = this.modelFor('settings.projects').projectTemplates; let existing = this.modelFor('settings.projects').projectTemplates;

View File

@ -10,7 +10,7 @@ export default Ember.Route.extend({
return Ember.RSVP.hash({ return Ember.RSVP.hash({
all: userStore.findAllUnremoved('project'), all: userStore.findAllUnremoved('project'),
projectTemplates: userStore.findAll('projectTemplate'), projectTemplates: userStore.findAll('projectTemplate'),
catalogTemplates: this.get('catalog').fetchTemplates({templateBase: C.EXTERNAL_ID.KIND_INFRA}), catalogTemplates: this.get('catalog').fetchTemplates({templateBase: C.EXTERNAL_ID.KIND_INFRA, category: C.EXTERNAL_ID.KIND_ALL}),
}).then((hash) => { }).then((hash) => {
let tplId = null; let tplId = null;
let tpl = hash.projectTemplates.objectAt(0); let tpl = hash.projectTemplates.objectAt(0);

View File

@ -35,6 +35,14 @@ function comparePart(in1, in2) {
} }
export function compare(in1, in2) { export function compare(in1, in2) {
if ( !in1 ) {
return 1;
}
if ( !in2 ) {
return -1;
}
let p1 = parse(in1); let p1 = parse(in1);
let p2 = parse(in2); let p2 = parse(in2);