[BugFix] Properly display and assign modal and tables on event manager (#1996)

This commit is contained in:
Sherfin Shamsudeen 2022-01-28 20:23:28 +05:30 committed by GitHub
parent cd71755c03
commit be3100e63f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View file

@ -65,7 +65,7 @@ export const EventManager = ({
if (components[key].component.component === componentType) {
componentOptions.push({
name: components[key].component.name,
value: { name: components[key].component.name, id: key },
value: key,
});
}
});
@ -207,7 +207,7 @@ export const EventManager = ({
<div className="col-9">
<SelectSearch
options={getComponentOptions('Modal')}
value={event.model}
value={event.modal?.id ?? event.modal}
search={true}
onChange={(value) => {
handlerChanged(index, 'modal', value);
@ -225,7 +225,7 @@ export const EventManager = ({
<div className="col-9">
<SelectSearch
options={getComponentOptions('Modal')}
value={event.model}
value={event.modal?.id ?? event.modal}
search={true}
onChange={(value) => {
handlerChanged(index, 'modal', value);

View file

@ -114,7 +114,7 @@ async function copyToClipboard(text) {
}
function showModal(_ref, modal, show) {
const modalId = modal.id;
const modalId = modal?.id ?? modal;
if (_.isEmpty(modalId)) {
console.log('No modal is associated with this event.');
return Promise.resolve();
@ -683,15 +683,15 @@ export function runQuery(_ref, queryId, queryName, confirmed = undefined, mode)
});
}
function setTablePageIndex(_ref, table, index) {
if (_.isEmpty(table.id)) {
function setTablePageIndex(_ref, tableId, index) {
if (_.isEmpty(tableId)) {
console.log('No table is associated with this event.');
return Promise.resolve();
}
const tableMeta = _ref.state.currentState.components[table.name];
const table = Object.entries(_ref.state.currentState.components).filter((entry) => entry[1].id === tableId)[0][1];
const newPageIndex = resolveReferences(index, _ref.state.currentState);
tableMeta.setPage(newPageIndex ?? 1);
table.setPage(newPageIndex ?? 1);
return Promise.resolve();
}