Skip to content

Commit

Permalink
apply review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kelanik8 committed Oct 19, 2023
1 parent 7fbaaa4 commit 9b07c10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
8 changes: 3 additions & 5 deletions client/web/compose/src/views/Admin/Charts/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -615,18 +615,16 @@ export default {
this.processing = false
},
handleSave ({ closeOnSuccess = false, chart } = {}) {
handleSave ({ closeOnSuccess = false, chart = this.chart } = {}) {
/**
* Pass a special tag alongside payload that
* instructs store layer to add content-language header to the API request
*/
const resourceTranslationLanguage = this.currentLanguage
const selectedChart = chart || this.chart
const c = Object.assign({}, chart, resourceTranslationLanguage)
const c = Object.assign({}, selectedChart, resourceTranslationLanguage)
if (selectedChart.chartID === NoID) {
if (chart.chartID === NoID) {
this.createChart(c).then(({ chartID }) => {
this.toastSuccess(this.$t('notification:chart.saved'))
this.initialChartState = cloneDeep(chartConstructor(this.chart))
Expand Down
12 changes: 5 additions & 7 deletions client/web/compose/src/views/Admin/Modules/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -762,21 +762,19 @@ export default {
this.module.config = { ...this.module.config, ...changes }
},
handleSave ({ closeOnSuccess = false, module } = {}) {
handleSave ({ closeOnSuccess = false, module = this.module } = {}) {
/**
* Pass a special tag alongside payload that
* instructs store layer to add content-language header to the API request
*/
const resourceTranslationLanguage = this.currentLanguage
this.processing = true
const selectedModule = module || this.module
if (selectedModule.moduleID === NoID) {
if (module.moduleID === NoID) {
// Filter out record fields that reference this not yet created module
let fields = []
const toBeUpdatedFields = []
selectedModule.fields.forEach(f => {
module.fields.forEach(f => {
if (f.kind === 'Record' && f.options.moduleID === '-1') {
toBeUpdatedFields.push(f)
} else {
Expand All @@ -786,7 +784,7 @@ export default {
// If such fields exist , after module is created add fields, map moduleID and update module
// Unfortunately this ruins the initial field order, but we can improve this later
this.createModule({ ...selectedModule, fields, resourceTranslationLanguage }).then(async module => {
this.createModule({ ...module, fields, resourceTranslationLanguage }).then(async module => {
if (toBeUpdatedFields.length) {
fields = [
...module.fields,
Expand All @@ -813,7 +811,7 @@ export default {
this.processing = false
})
} else {
this.updateModule({ ...selectedModule, resourceTranslationLanguage }).then(module => {
this.updateModule({ ...module, resourceTranslationLanguage }).then(module => {
this.module = new compose.Module({ ...module }, this.namespace)
this.initialModuleState = this.module.clone()
Expand Down

0 comments on commit 9b07c10

Please sign in to comment.