config-maps clone

This commit is contained in:
Westly Wright 2018-07-12 12:02:15 -07:00
parent b0db1b43ee
commit 0bb2d4e994
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
4 changed files with 22 additions and 3 deletions

View File

@ -1,6 +1,9 @@
import Controller from '@ember/controller';
export default Controller.extend({
queryParams: ['id'],
id: null,
actions: {
back() {

View File

@ -1,7 +1,14 @@
import Route from '@ember/routing/route';
import { get } from '@ember/object';
export default Route.extend({
model(/* params, transition*/) {
model(params/* , transition */) {
if (get(params, 'id')) {
const record = get(this, 'store').getById('configMap', get(params, 'id'));
return record.cloneForNew();
}
return this.get('store').createRecord({ type: 'configMap' });

View File

@ -17,7 +17,8 @@ export default Resource.extend({
router: service(),
clusterStore: service(),
state: 'active',
state: 'active',
canClone: true,
actions: {
edit() {
@ -25,6 +26,13 @@ export default Resource.extend({
get(this, 'router').transitionTo('authenticated.project.config-maps.detail.edit', get(this, 'id'));
},
clone() {
get(this, 'router').transitionTo('authenticated.project.config-maps.new', get(this, 'projectId'), { queryParams: { id: get(this, 'id') } });
}
},
});

View File

@ -622,9 +622,10 @@ export default Mixin.create({
var copy = this.clone();
delete copy.id;
delete copy.actionLinks;
delete copy.id;
delete copy.links;
delete copy.name;
delete copy.uuid;
return copy;