-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add save as copy to module and chart resources #1468
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should create the new resource and redirect to edit screen.
Also some notifications could be helpful (success, error)
@@ -527,7 +528,9 @@ export default { | |||
const { namespaceID } = this.namespace | |||
|
|||
if (chartID === NoID) { | |||
let c = new compose.Chart({ namespaceID: this.namespace.namespaceID }) | |||
const chartClone = this.$attrs.chart || {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need this anymore
{ fields: [new compose.ModuleFieldString({ fieldID: NoID, name: this.$t('general.placeholder.sample') })] }, | ||
this.namespace, | ||
) | ||
if (this.$attrs.module) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dont think you need this anymore
chart.name = `${this.chart.name} (copy)` | ||
chart.handle = `${this.chart.handle}_copy` | ||
|
||
const resourceTranslationLanguage = this.currentLanguage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of copying the code, make handleSave accept a chart, and work with that. Then just call handleSave(chart) inside handleClone()
module.name = `${this.module.name} (copy)` | ||
module.handle = `${this.module.handle}_copy` | ||
|
||
const resourceTranslationLanguage = this.currentLanguage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, instead of copying the code just call handleSave(module) and make it accept a module.
Also make sure it doesn't check for isEdit, but instead it check if ID is equal NoID, like chart does.
@@ -616,16 +615,18 @@ export default { | |||
this.processing = false | |||
}, | |||
|
|||
handleSave ({ closeOnSuccess = false } = {}) { | |||
handleSave ({ closeOnSuccess = false, chart } = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just chart = this.chart
? Saves you trouble of renaming everything
@@ -766,19 +762,21 @@ export default { | |||
this.module.config = { ...this.module.config, ...changes } | |||
}, | |||
|
|||
handleSave ({ closeOnSuccess = false } = {}) { | |||
handleSave ({ closeOnSuccess = false, module } = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here module = this.module
92b5125
to
caad998
Compare
caad998
to
9b07c10
Compare
Two questions, the rest is okay:
|
595c177
to
55fed4a
Compare
The following changes are implemented
TODO: Summary
Changes in the user interface:
TODO: Add screenshots, recordings or remove this section
Checklist when submitting a final (!draft) PR