Skip to content
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

FIX: Record info was not displayed for new rows #2238

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/Origam.Server/Controller/AbstractController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ protected IActionResult RunWithErrorHandler(Func<IActionResult> func)
FindEntity(input.DataStructureEntityId)
.Bind(dataStructureEntity =>
sessionObjects.UIService.GetRow(
input.SessionFormIdentifier, input.Entity,
input.SessionFormIdentifier, dataStructureEntity.Entity.Name,
dataStructureEntity, input.RowId));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,21 @@ import { getMenuItemId } from "model/selectors/getMenuItemId";
import { getSelectedRowId } from "model/selectors/TablePanelView/getSelectedRowId";
import { getDataStructureEntityId } from "model/selectors/DataView/getDataStructureEntityId";
import { getRecordInfo } from "model/selectors/RecordInfo/getRecordInfo";
import { getSessionId } from "model/selectors/getSessionId";

export function onRecordInfoClick(ctx: any) {
return flow(function*onRecordInfoClick(event: any) {
const menuId = getMenuItemId(ctx);
const dataStructureEntityId = getDataStructureEntityId(ctx);
const rowId = getSelectedRowId(ctx);
const sessionId = getSessionId(ctx);
if (rowId) {
yield*getRecordInfo(ctx).onOpenRecordInfoClick(
event,
menuId,
dataStructureEntityId,
rowId
rowId,
sessionId,
);
}
});
Expand Down
5 changes: 4 additions & 1 deletion frontend-html/src/model/actions-ui/onSelectedRowChange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@ along with ORIGAM. If not, see <http://www.gnu.org/licenses/>.

import { flow } from "mobx";
import { getRecordInfo } from "model/selectors/RecordInfo/getRecordInfo";
import { getSessionId } from "model/selectors/getSessionId";

export function onSelectedRowChange(ctx: any) {
return flow(function*onPossibleSelectedRowChange(
menuId: string,
dataStructureEntityId: string,
rowId: string | undefined
) {
const sessionId = getSessionId(ctx);
yield*getRecordInfo(ctx).onSelectedRowMaybeChanged(
menuId,
dataStructureEntityId,
rowId
rowId,
sessionId
);
});
}
34 changes: 22 additions & 12 deletions frontend-html/src/model/entities/RecordInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class RecordInfo implements IRecordInfo {
menuId?: string;
dataStructureEntityId?: string;
rowId?: string;
sessionId?: string;
} = {};

idgen = 0;
Expand Down Expand Up @@ -67,20 +68,23 @@ export class RecordInfo implements IRecordInfo {
willLoadNewInfo(
menuId: string | undefined,
dataStructureEntityId: string | undefined,
rowId: string | undefined
rowId: string | undefined,
sessionId: string | undefined
) {
return (
menuId !== this.displayedFor.menuId ||
dataStructureEntityId !== this.displayedFor.dataStructureEntityId ||
rowId !== this.displayedFor.rowId
rowId !== this.displayedFor.rowId ||
sessionId !== this.displayedFor.sessionId
);
}

hasValidLoadedFor() {
return (
this.displayedFor.menuId &&
this.displayedFor.dataStructureEntityId &&
this.displayedFor.rowId
this.displayedFor.rowId &&
this.displayedFor.sessionId
);
}

Expand All @@ -95,31 +99,34 @@ export class RecordInfo implements IRecordInfo {
event: any,
menuId: string,
dataStructureEntityId: string,
rowId: string
rowId: string,
sessionId: string,
) {
if(this.recordInfoExpanded){
return;
}
this.recordInfoExpanded = true;
this.recordAuditExpanded = false;
this.triggerInfoSectionExpand();
yield*this.loadRecordInfo(menuId, dataStructureEntityId, rowId);
yield*this.loadRecordInfo(menuId, dataStructureEntityId, rowId, sessionId);
}

*onSelectedRowMaybeChanged(
menuId: string,
dataStructureEntityId: string,
rowId: string
rowId: string,
sessionId: string
) {
if (this.willLoadNewInfo(menuId, dataStructureEntityId, rowId)) {
if (this.willLoadNewInfo(menuId, dataStructureEntityId, rowId, sessionId)) {
if (this.recordInfoExpanded) {
yield*this.loadRecordInfo(menuId, dataStructureEntityId, rowId);
yield*this.loadRecordInfo(menuId, dataStructureEntityId, rowId, sessionId);
}
}
this.displayedFor = {
menuId,
dataStructureEntityId,
rowId
rowId,
sessionId
};
}

Expand All @@ -144,7 +151,8 @@ export class RecordInfo implements IRecordInfo {
yield*this.loadRecordInfo(
this.displayedFor.menuId!,
this.displayedFor.dataStructureEntityId!,
this.displayedFor.rowId!
this.displayedFor.rowId!,
this.displayedFor.sessionId!
);
}
}
Expand All @@ -159,14 +167,16 @@ export class RecordInfo implements IRecordInfo {
*loadRecordInfo(
menuId: string,
dataStructureEntityId: string,
rowId: string
rowId: string,
sessionId: string
): any {
const api = getApi(this);
this.info = [];
const rawInfo = yield api.getRecordInfo({
MenuId: menuId,
DataStructureEntityId: dataStructureEntityId,
RowId: rowId
RowId: rowId,
SessionFormIdentifier: sessionId,
});
if(rawInfo.cell.map){
this.info = rawInfo.cell.map(
Expand Down
1 change: 1 addition & 0 deletions frontend-html/src/model/entities/types/IApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ export interface IApi {
MenuId: string;
DataStructureEntityId: string;
RowId: string;
SessionFormIdentifier: string;
}): Promise<any>;

getRecordAudit(data: {
Expand Down
6 changes: 4 additions & 2 deletions frontend-html/src/model/entities/types/IRecordInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export interface IRecordInfo extends IRecordInfoData {
event: any,
menuId: string,
dataStructureEntityId: string,
rowId: string
rowId: string,
sessionId: string,
): Generator;

onOpenRecordAuditClick(
Expand All @@ -54,7 +55,8 @@ export interface IRecordInfo extends IRecordInfoData {
onSelectedRowMaybeChanged(
menuId: string,
dataStructureEntityId: string,
rowId: string | undefined
rowId: string | undefined,
sessionId: string
): Generator;

onSidebarInfoSectionCollapsed(): Generator;
Expand Down