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: Row state fetching fix 2022 4 #1797

Merged
merged 4 commits into from Aug 11, 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
1 change: 1 addition & 0 deletions backend/Origam.Server/Common/PortalResult.cs
Expand Up @@ -144,5 +144,6 @@ public int MaxRequestLength
public IFilteringConfig FilteringConfig { get; set; }

public string InitialScreenId { get; set; }
public int RowStatesDebouncingDelayMilliSeconds { get; set; }
}
}
1 change: 1 addition & 0 deletions backend/Origam.Server/Configuration/HtmlClientConfig.cs
Expand Up @@ -3,5 +3,6 @@
public class HtmlClientConfig
{
public bool ShowToolTipsForMemoFieldsOnly { get; set; }
public int RowStatesDebouncingDelayMilliSeconds { get; set; } = 200;
}
}
1 change: 1 addition & 0 deletions backend/Origam.Server/Controller/UIServiceController.cs
Expand Up @@ -1217,6 +1217,7 @@ private void AddConfigData(PortalResult result)
: chatConfig.ChatRefreshInterval;
result.CustomAssetsRoute = customAssetsConfig.RouteToCustomAssetsFolder;
result.ShowToolTipsForMemoFieldsOnly = htmlClientConfig.ShowToolTipsForMemoFieldsOnly;
result.RowStatesDebouncingDelayMilliSeconds = htmlClientConfig.RowStatesDebouncingDelayMilliSeconds;
result.FilteringConfig = clientFilteringConfig;
}
}
Expand Down
3 changes: 2 additions & 1 deletion backend/Origam.Server/TemplateFiles/_appsettings.json
Expand Up @@ -141,7 +141,8 @@
]
},
"HtmlClientConfig":{
"ShowToolTipsForMemoFieldsOnly" : "false"
"ShowToolTipsForMemoFieldsOnly" : "false",
"RowStatesDebouncingDelayMilliSeconds": 200
},
"Logging": {
"LogLevel": {
Expand Down
13 changes: 9 additions & 4 deletions frontend-html/src/model/entities/RowState.ts
Expand Up @@ -28,6 +28,7 @@ import { FlowBusyMonitor } from "utils/flow";
import { handleError } from "model/actions/handleError";
import { visibleRowsChanged } from "gui/Components/ScreenElements/Table/TableRendering/renderTable";
import { getDataSource } from "model/selectors/DataSources/getDataSource";
import { CancellablePromise } from "mobx/lib/api/flow";

const defaultRowStatesToFetch = 100;

Expand All @@ -41,8 +42,10 @@ export class RowState implements IRowState {
suppressWorkingStatus: boolean = false;
visibleRowIds: string[] = [];

constructor(data: IRowStateData) {
Object.assign(this, data);
constructor(debouncingDelayMilliSeconds?: number) {
this.triggerLoadDebounced = _.debounce(
this.triggerLoadImm,
debouncingDelayMilliSeconds == undefined ? 200 : debouncingDelayMilliSeconds);
visibleRowsChanged.subscribe((visibleRows) => {
const dataSource = getDataSource(this);
if (!visibleRows || dataSource.identifier !== visibleRows.dataSourceId) {
Expand Down Expand Up @@ -77,7 +80,9 @@ export class RowState implements IRowState {
}
return this.visibleRowIds.length === 0
? Array.from(this.requests.values()).slice(-defaultRowStatesToFetch)
: this.visibleRowIds.map(rowId => this.requests.get(rowId)!);
: this.visibleRowIds
.map(rowId => this.requests.get(rowId))
.filter(x => x !== undefined) as unknown as IterableIterator<RowStateRequest>;
}

*triggerLoad(loadAll: boolean): any {
Expand Down Expand Up @@ -139,7 +144,7 @@ export class RowState implements IRowState {
this.temporaryRequestsValues = undefined;
}
}
triggerLoadDebounced = _.debounce(this.triggerLoadImm, 200);
triggerLoadDebounced: any;

getValue(rowId: string) {
if (!this.requests.has(rowId)) {
Expand Down
Expand Up @@ -550,6 +550,7 @@ export class WorkbenchLifecycle implements IWorkbenchLifecycle {
showWorkQueues: portalInfo.workQueueListRefreshInterval > 0,
helpUrl: portalInfo.helpUrl,
showToolTipsForMemoFieldsOnly: portalInfo.showToolTipsForMemoFieldsOnly,
rowStatesDebouncingDelayMilliSeconds: portalInfo.rowStatesDebouncingDelayMilliSeconds,
filterConfig: {
caseSensitive: portalInfo.filteringConfig.caseSensitive,
accentSensitive: portalInfo.filteringConfig.accentSensitive
Expand Down
Expand Up @@ -24,5 +24,6 @@ export interface IPortalSettings {
showWorkQueues: boolean;
helpUrl: string;
showToolTipsForMemoFieldsOnly: boolean;
rowStatesDebouncingDelayMilliSeconds: number;
filterConfig: IFilterConfig;
}
4 changes: 3 additions & 1 deletion frontend-html/src/xmlInterpreters/screenXml.ts
Expand Up @@ -95,6 +95,7 @@ import { getMomentFormat, replaceDefaultDateFormats } from "./getMomentFormat";
import { getTablePanelView } from "../model/selectors/TablePanelView/getTablePanelView";
import { isMobileLayoutActive } from "model/selectors/isMobileLayoutActive";
import { ScreenFocusManager } from "model/entities/ScreenFocusManager";
import { getWorkbenchLifecycle } from "model/selectors/getWorkbenchLifecycle";


function getPropertyParameters(node: any) {
Expand Down Expand Up @@ -223,6 +224,7 @@ export function*interpretScreenXml(
isLazyLoading: boolean
) {
const workbench = getWorkbench(formScreenLifecycle);
const workbenchLifeCycle = getWorkbenchLifecycle(formScreenLifecycle);
const $workbench = scopeFor(workbench);
const panelConfigurations = new Map<string, IPanelConfiguration>(
panelConfigurationsRaw.map((pcr: any) => [
Expand Down Expand Up @@ -331,7 +333,7 @@ export function*interpretScreenXml(
// isSessioned: windowXml.attributes.UseSession,
dataSources: dataSourcesXml.elements.map((dataSource: any) => {
return new DataSource({
rowState: new RowState({}),
rowState: new RowState(workbenchLifeCycle.portalSettings?.rowStatesDebouncingDelayMilliSeconds),
entity: dataSource.attributes.Entity,
dataStructureEntityId: dataSource.attributes.DataStructureEntityId,
identifier: dataSource.attributes.Identifier,
Expand Down