mirror of https://github.com/rancher/ui.git
Bugs
This commit is contained in:
parent
773ca36666
commit
aaa792efdf
|
|
@ -18,7 +18,7 @@ export function activeIcon(stack)
|
|||
}
|
||||
|
||||
export function normalizeTag(name) {
|
||||
return (name||'').replace(/[^a-z0-9_ -]/ig,'');
|
||||
return (name||'').trim().toLowerCase();
|
||||
}
|
||||
|
||||
export function tagsToArray(str) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
import NewOrEdit from 'ui/mixins/new-or-edit';
|
||||
import C from 'ui/utils/constants';
|
||||
import {tagChoices} from 'ui/models/stack';
|
||||
import {tagChoices, tagsToArray} from 'ui/models/stack';
|
||||
|
||||
export default Ember.Controller.extend(NewOrEdit, {
|
||||
queryParams: ['githubRepo','githubBranch','composeFiles','system'],
|
||||
|
|
@ -19,6 +19,14 @@ export default Ember.Controller.extend(NewOrEdit, {
|
|||
this.set('allStacks', this.get('store').all('stack'));
|
||||
},
|
||||
|
||||
actions: {
|
||||
addTag(tag) {
|
||||
let neu = tagsToArray(this.get('model.group'));
|
||||
neu.addObject(tag);
|
||||
this.set('model.group', neu.join(', '));
|
||||
},
|
||||
},
|
||||
|
||||
groupChoices: function() {
|
||||
return tagChoices(this.get('allStacks'));
|
||||
}.property('allStacks.@each.grouping'),
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="icon icon-chevron-down"></i></button>
|
||||
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
||||
{{#each groupChoices as |key|}}
|
||||
<li><a {{action (mut primaryResource.group) key}}>{{key}}</a></li>
|
||||
<li><a {{action "addTag" key}}>{{key}}</a></li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue