mirror of https://github.com/rancher/ui.git
config-maps clone
This commit is contained in:
parent
b0db1b43ee
commit
0bb2d4e994
|
|
@ -1,6 +1,9 @@
|
||||||
import Controller from '@ember/controller';
|
import Controller from '@ember/controller';
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
|
queryParams: ['id'],
|
||||||
|
id: null,
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
back() {
|
back() {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
|
import { get } from '@ember/object';
|
||||||
|
|
||||||
export default Route.extend({
|
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' });
|
return this.get('store').createRecord({ type: 'configMap' });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@ export default Resource.extend({
|
||||||
router: service(),
|
router: service(),
|
||||||
clusterStore: service(),
|
clusterStore: service(),
|
||||||
|
|
||||||
state: 'active',
|
state: 'active',
|
||||||
|
canClone: true,
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
edit() {
|
edit() {
|
||||||
|
|
@ -25,6 +26,13 @@ export default Resource.extend({
|
||||||
get(this, 'router').transitionTo('authenticated.project.config-maps.detail.edit', get(this, 'id'));
|
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') } });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -622,9 +622,10 @@ export default Mixin.create({
|
||||||
|
|
||||||
var copy = this.clone();
|
var copy = this.clone();
|
||||||
|
|
||||||
delete copy.id;
|
|
||||||
delete copy.actionLinks;
|
delete copy.actionLinks;
|
||||||
|
delete copy.id;
|
||||||
delete copy.links;
|
delete copy.links;
|
||||||
|
delete copy.name;
|
||||||
delete copy.uuid;
|
delete copy.uuid;
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue