mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-29 04:47:10 +08:00
Fix Actions dropdown options do not work
This commit is contained in:
parent
d4844c8987
commit
c642a86e04
4 changed files with 19 additions and 8 deletions
|
@ -130,11 +130,19 @@ export class RecordStore {
|
|||
*
|
||||
* @returns {object} Record
|
||||
*/
|
||||
getRecord(): Record {
|
||||
getBaseRecord(): Record {
|
||||
if (!this.internalState) {
|
||||
return null;
|
||||
}
|
||||
return deepClone(this.internalState);
|
||||
|
||||
const baseRecord = {
|
||||
id: this.internalState.id,
|
||||
type: this.internalState.type,
|
||||
module: this.internalState.module,
|
||||
attributes: this.internalState.attributes
|
||||
} as Record;
|
||||
|
||||
return deepClone(baseRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,6 +17,7 @@ export class RecordCreateAction extends RecordActionHandler {
|
|||
|
||||
run(data: RecordActionData): void {
|
||||
const store = data.store;
|
||||
const baseRecord = store.getBaseRecord();
|
||||
|
||||
const route = '/' + store.vm.appData.module.name + '/edit';
|
||||
const module = this.moduleNameMapper.toLegacy(store.vm.appData.module.name);
|
||||
|
@ -28,7 +29,7 @@ export class RecordCreateAction extends RecordActionHandler {
|
|||
// eslint-disable-next-line camelcase,@typescript-eslint/camelcase
|
||||
return_action: 'DetailView',
|
||||
// eslint-disable-next-line camelcase,@typescript-eslint/camelcase
|
||||
return_record: (store.getRecord() && store.getRecord().id) || ''
|
||||
return_record: (baseRecord && baseRecord.id) || ''
|
||||
}
|
||||
}).then();
|
||||
}
|
||||
|
|
|
@ -70,7 +70,8 @@ export class RecordActionsAdapter implements ActionDataSource {
|
|||
meta,
|
||||
mode,
|
||||
record,
|
||||
languages
|
||||
languages,
|
||||
widget
|
||||
]
|
||||
) => {
|
||||
if (!mode || !meta) {
|
||||
|
@ -135,13 +136,14 @@ export class RecordActionsAdapter implements ActionDataSource {
|
|||
|
||||
protected runAsyncAction(action: Action): void {
|
||||
const actionName = `record-${action.key}`;
|
||||
const baseRecord = this.store.getBaseRecord();
|
||||
|
||||
this.message.removeMessages();
|
||||
|
||||
const asyncData = {
|
||||
action: actionName,
|
||||
module: this.store.getRecord().module,
|
||||
id: this.store.getRecord().id,
|
||||
module: baseRecord.module,
|
||||
id: baseRecord.id,
|
||||
} as AsyncActionInput;
|
||||
|
||||
this.asyncActionService.run(actionName, asyncData).pipe(take(1)).subscribe((process: Process) => {
|
||||
|
|
|
@ -223,11 +223,11 @@ export class RecordViewStore extends ViewStore implements StateStore {
|
|||
*
|
||||
* @returns {string} ViewMode
|
||||
*/
|
||||
getRecord(): Record {
|
||||
getBaseRecord(): Record {
|
||||
if (!this.internalState) {
|
||||
return null;
|
||||
}
|
||||
return this.recordStore.getRecord();
|
||||
return this.recordStore.getBaseRecord();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue