@gisce/react-ooui 1.1.2-rc.3 → 1.1.2-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/useSearch.d.ts +5 -2
- package/dist/hooks/useSearch.d.ts.map +1 -1
- package/dist/react-ooui.es.js +3540 -3480
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +14 -14
- package/dist/react-ooui.umd.js.map +1 -1
- package/dist/views/actionViews/GraphActionView.d.ts.map +1 -1
- package/dist/views/actionViews/TreeActionView.d.ts.map +1 -1
- package/dist/widgets/views/Dashboard/DashboardTree.d.ts.map +1 -1
- package/dist/widgets/views/Graph/Graph.d.ts +1 -0
- package/dist/widgets/views/Graph/Graph.d.ts.map +1 -1
- package/dist/widgets/views/Graph/GraphChart.d.ts +1 -0
- package/dist/widgets/views/Graph/GraphChart.d.ts.map +1 -1
- package/dist/widgets/views/Graph/GraphIndicator.d.ts +1 -0
- package/dist/widgets/views/Graph/GraphIndicator.d.ts.map +1 -1
- package/dist/widgets/views/Graph/useGraphData.d.ts +2 -0
- package/dist/widgets/views/Graph/useGraphData.d.ts.map +1 -1
- package/dist/widgets/views/searchFilter/SearchFilter.d.ts +1 -0
- package/dist/widgets/views/searchFilter/SearchFilter.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/helpers/searchHelper.ts +1 -1
- package/src/hooks/useSearch.ts +107 -106
- package/src/views/actionViews/GraphActionView.tsx +63 -50
- package/src/views/actionViews/TreeActionView.tsx +0 -1
- package/src/widgets/views/Dashboard/DashboardTree.tsx +1 -27
- package/src/widgets/views/Graph/Graph.tsx +4 -1
- package/src/widgets/views/Graph/GraphChart.tsx +7 -2
- package/src/widgets/views/Graph/GraphIndicator.tsx +52 -6
- package/src/widgets/views/Graph/useGraphData.tsx +34 -2
- package/src/widgets/views/searchFilter/SearchFilter.tsx +5 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphActionView.d.ts","sourceRoot":"","sources":["GraphActionView.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAO7C,oBAAY,oBAAoB,GAAG;IACjC,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,GAAG,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;IACZ,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,eAAe,UAAW,oBAAoB,
|
|
1
|
+
{"version":3,"file":"GraphActionView.d.ts","sourceRoot":"","sources":["GraphActionView.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAO7C,oBAAY,oBAAoB,GAAG;IACjC,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,GAAG,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;IACZ,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,eAAe,UAAW,oBAAoB,uBA8H1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeActionView.d.ts","sourceRoot":"","sources":["TreeActionView.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAKnD,oBAAY,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,GAAG,CAAC;IACnB,KAAK,EAAE,MAAM,C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,MAAM,cAAc,UAAW,mBAAmB,uBAsDxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardTree.d.ts","sourceRoot":"","sources":["DashboardTree.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"DashboardTree.d.ts","sourceRoot":"","sources":["DashboardTree.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQnD,aAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,aAAK,KAAK,GAAG;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC/C,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,GAAG,CAAC;CACrB,CAAC;AAEF,iBAAS,aAAa,CAAC,KAAK,EAAE,KAAK,sBA6MlC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["Graph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAiBf,oBAAY,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["Graph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAiBf,oBAAY,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAkHF,eAAO,MAAM,KAAK,4EAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphChart.d.ts","sourceRoot":"","sources":["GraphChart.tsx"],"names":[],"mappings":";AAaA,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"GraphChart.d.ts","sourceRoot":"","sources":["GraphChart.tsx"],"names":[],"mappings":";AAaA,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,UAAU,UAAW,eAAe,gBAiDhD,CAAC"}
|
|
@@ -11,6 +11,7 @@ export declare type GraphInidicatorProps = {
|
|
|
11
11
|
suffix?: string;
|
|
12
12
|
field?: string;
|
|
13
13
|
operator?: Operator;
|
|
14
|
+
manualIds?: number[];
|
|
14
15
|
};
|
|
15
16
|
export declare const GraphIndicator: (props: GraphInidicatorProps) => JSX.Element;
|
|
16
17
|
//# sourceMappingURL=GraphIndicator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphIndicator.d.ts","sourceRoot":"","sources":["GraphIndicator.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQvC,oBAAY,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"GraphIndicator.d.ts","sourceRoot":"","sources":["GraphIndicator.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQvC,oBAAY,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,oBAAoB,gBAoNzD,CAAC"}
|
|
@@ -4,6 +4,7 @@ export declare type GraphDataQueryOpts = {
|
|
|
4
4
|
domain?: any;
|
|
5
5
|
context?: any;
|
|
6
6
|
limit?: number;
|
|
7
|
+
manualIds?: number[];
|
|
7
8
|
};
|
|
8
9
|
export declare type GraphDataOpts = GraphDataQueryOpts & {
|
|
9
10
|
xml: string;
|
|
@@ -14,5 +15,6 @@ export declare const useGraphData: (opts: GraphDataOpts) => {
|
|
|
14
15
|
error: any;
|
|
15
16
|
type: GraphType;
|
|
16
17
|
values: any;
|
|
18
|
+
evaluatedEntries: any[] | undefined;
|
|
17
19
|
};
|
|
18
20
|
//# sourceMappingURL=useGraphData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGraphData.d.ts","sourceRoot":"","sources":["useGraphData.tsx"],"names":[],"mappings":"AACA,OAAO,EAKL,SAAS,EACV,MAAM,aAAa,CAAC;AAOrB,oBAAY,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"useGraphData.d.ts","sourceRoot":"","sources":["useGraphData.tsx"],"names":[],"mappings":"AACA,OAAO,EAKL,SAAS,EACV,MAAM,aAAa,CAAC;AAOrB,oBAAY,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,oBAAY,aAAa,GAAG,kBAAkB,GAAG;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,aAAa;;;;;;CAgF/C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchFilter.d.ts","sourceRoot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AAG,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,iBAAS,YAAY,CAAC,KAAK,EAAE,KAAK,eAmHjC;AAED,eAAe,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -175,7 +175,7 @@ export const getUniqueFieldsForParams = (params: any[]) => {
|
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
export const mergeParams = (searchParams: any[], domainParams: any[]) => {
|
|
178
|
-
const finalParams = searchParams;
|
|
178
|
+
const finalParams = [...searchParams];
|
|
179
179
|
const uniqueParams = getUniqueFieldsForParams(searchParams);
|
|
180
180
|
|
|
181
181
|
domainParams.forEach((element) => {
|
package/src/hooks/useSearch.ts
CHANGED
|
@@ -75,7 +75,6 @@ export const useSearch = (opts: UseSearchOpts) => {
|
|
|
75
75
|
const internalLimit = useRef(limit || DEFAULT_SEARCH_LIMIT);
|
|
76
76
|
|
|
77
77
|
const originalResults = useRef<any[]>([]);
|
|
78
|
-
const actionDomain = useRef<any>([]);
|
|
79
78
|
|
|
80
79
|
const setResults = useCallback((results: any) => {
|
|
81
80
|
setResultsActionView?.([...results]);
|
|
@@ -94,7 +93,7 @@ export const useSearch = (opts: UseSearchOpts) => {
|
|
|
94
93
|
model,
|
|
95
94
|
payload: nameSearch,
|
|
96
95
|
limit: internalLimit.current,
|
|
97
|
-
attrs:
|
|
96
|
+
attrs: domain,
|
|
98
97
|
context,
|
|
99
98
|
});
|
|
100
99
|
|
|
@@ -163,117 +162,119 @@ export const useSearch = (opts: UseSearchOpts) => {
|
|
|
163
162
|
sorter,
|
|
164
163
|
setCurrentItemIndex,
|
|
165
164
|
setActionViewTotalItems,
|
|
166
|
-
actionDomain,
|
|
167
165
|
]);
|
|
168
166
|
|
|
169
|
-
const searchResults = useCallback(
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
const searchResults = useCallback(
|
|
168
|
+
async (opts?: { params: any; newOffset: number }) => {
|
|
169
|
+
const { params, newOffset } = opts || {};
|
|
172
170
|
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
const mergedParams = mergeParams(params || searchParams, domain);
|
|
172
|
+
const { colors } = getTree(treeView!);
|
|
175
173
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
174
|
+
const { totalItems, results, attrsEvaluated } =
|
|
175
|
+
await ConnectionProvider.getHandler().searchForTree({
|
|
176
|
+
params: mergedParams,
|
|
177
|
+
limit: internalLimit.current,
|
|
178
|
+
offset: newOffset || offset,
|
|
179
|
+
model,
|
|
180
|
+
fields: treeView!.field_parent
|
|
181
|
+
? { ...treeView!.fields, [treeView!.field_parent]: {} }
|
|
182
|
+
: treeView!.fields,
|
|
183
|
+
context,
|
|
184
|
+
attrs: colors && { colors },
|
|
185
|
+
});
|
|
186
|
+
setColorsForResults(getColorMap(attrsEvaluated));
|
|
189
187
|
|
|
190
|
-
|
|
188
|
+
originalResults.current = [...results];
|
|
191
189
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
190
|
+
const resultsSorted =
|
|
191
|
+
sorter !== undefined
|
|
192
|
+
? sortResults({
|
|
193
|
+
resultsToSort: results,
|
|
194
|
+
sorter: sorter,
|
|
195
|
+
fields: { ...treeView!.fields, ...formView!.fields },
|
|
196
|
+
})
|
|
197
|
+
: [...originalResults.current];
|
|
200
198
|
|
|
201
|
-
|
|
199
|
+
setResults(resultsSorted);
|
|
202
200
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
if (resultsActionView && resultsSorted.length > 0) {
|
|
202
|
+
const newCurrentItemIndex = resultsSorted.findIndex(
|
|
203
|
+
(item) => currentId === item.id
|
|
204
|
+
);
|
|
207
205
|
|
|
208
|
-
|
|
209
|
-
|
|
206
|
+
if (newCurrentItemIndex === -1) {
|
|
207
|
+
setCurrentItemIndex?.(0);
|
|
208
|
+
} else {
|
|
209
|
+
setCurrentItemIndex?.(newCurrentItemIndex);
|
|
210
|
+
}
|
|
210
211
|
} else {
|
|
211
|
-
setCurrentItemIndex?.(
|
|
212
|
+
setCurrentItemIndex?.(undefined);
|
|
212
213
|
}
|
|
213
|
-
} else {
|
|
214
|
-
setCurrentItemIndex?.(undefined);
|
|
215
|
-
}
|
|
216
214
|
|
|
217
|
-
|
|
215
|
+
const totalItemsValue = await totalItems;
|
|
218
216
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
217
|
+
setTotalItems(totalItemsValue);
|
|
218
|
+
setActionViewTotalItems?.(totalItemsValue);
|
|
219
|
+
},
|
|
220
|
+
[
|
|
221
|
+
setCurrentItemIndex,
|
|
222
|
+
resultsActionView,
|
|
223
|
+
setResults,
|
|
224
|
+
currentId,
|
|
225
|
+
model,
|
|
226
|
+
context,
|
|
227
|
+
domain,
|
|
228
|
+
treeView,
|
|
229
|
+
formView,
|
|
230
|
+
sorter,
|
|
231
|
+
setActionViewTotalItems,
|
|
232
|
+
limit,
|
|
233
|
+
offset,
|
|
234
|
+
searchParams,
|
|
235
|
+
]
|
|
236
|
+
);
|
|
238
237
|
|
|
239
|
-
const fetchResults = useCallback(
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
238
|
+
const fetchResults = useCallback(
|
|
239
|
+
async (opts?: { params: any; newOffset: number }) => {
|
|
240
|
+
try {
|
|
241
|
+
setTableRefreshing(true);
|
|
242
|
+
setTreeIsLoading?.(true);
|
|
243
|
+
if (nameSearch && !searchNameGetDoneRef.current) {
|
|
244
|
+
await searchByNameSearch();
|
|
245
|
+
} else {
|
|
246
|
+
await searchResults(opts);
|
|
247
|
+
}
|
|
248
|
+
} catch (error) {
|
|
249
|
+
setSearchError(error.message);
|
|
250
|
+
} finally {
|
|
251
|
+
setTableRefreshing(false);
|
|
252
|
+
setSearchFilterLoading(false);
|
|
253
|
+
setTreeIsLoading?.(false);
|
|
247
254
|
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
setSearchFilterLoading,
|
|
272
|
-
setTableRefreshing,
|
|
273
|
-
setTreeIsLoading,
|
|
274
|
-
sorter,
|
|
275
|
-
treeView,
|
|
276
|
-
]);
|
|
255
|
+
},
|
|
256
|
+
[
|
|
257
|
+
context,
|
|
258
|
+
currentId,
|
|
259
|
+
domain,
|
|
260
|
+
formView,
|
|
261
|
+
limit,
|
|
262
|
+
model,
|
|
263
|
+
nameSearch,
|
|
264
|
+
offset,
|
|
265
|
+
resultsActionView,
|
|
266
|
+
searchNameGetDoneRef,
|
|
267
|
+
setActionViewTotalItems,
|
|
268
|
+
setCurrentItemIndex,
|
|
269
|
+
setResults,
|
|
270
|
+
setSearchError,
|
|
271
|
+
setSearchFilterLoading,
|
|
272
|
+
setTableRefreshing,
|
|
273
|
+
setTreeIsLoading,
|
|
274
|
+
sorter,
|
|
275
|
+
treeView,
|
|
276
|
+
]
|
|
277
|
+
);
|
|
277
278
|
|
|
278
279
|
const changeSort = useCallback(
|
|
279
280
|
(newSorter: any) => {
|
|
@@ -292,22 +293,19 @@ export const useSearch = (opts: UseSearchOpts) => {
|
|
|
292
293
|
);
|
|
293
294
|
|
|
294
295
|
const submit = useCallback(
|
|
295
|
-
({
|
|
296
|
-
params: newParams,
|
|
297
|
-
limit: newLimit,
|
|
298
|
-
offset: newOffset,
|
|
299
|
-
searchValues,
|
|
300
|
-
}: {
|
|
296
|
+
(opts: {
|
|
301
297
|
params: any;
|
|
302
298
|
limit: number;
|
|
303
299
|
offset: number;
|
|
304
300
|
searchValues: any;
|
|
305
301
|
}) => {
|
|
302
|
+
const { params, searchValues, limit: newLimit, offset: newOffset } = opts;
|
|
303
|
+
|
|
306
304
|
if (tableRefreshing) return;
|
|
307
305
|
setSearchTreeNameSearch?.(undefined);
|
|
308
306
|
setSelectedRowItems?.([]);
|
|
309
307
|
setSearchValues?.(searchValues);
|
|
310
|
-
setSearchParams?.(
|
|
308
|
+
setSearchParams?.(params);
|
|
311
309
|
setSearchVisible?.(false);
|
|
312
310
|
setSearchFilterLoading(true);
|
|
313
311
|
setSearchError(undefined);
|
|
@@ -315,7 +313,10 @@ export const useSearch = (opts: UseSearchOpts) => {
|
|
|
315
313
|
internalLimit.current = newLimit;
|
|
316
314
|
if (newLimit) setLimit?.(newLimit);
|
|
317
315
|
if (newOffset) setOffset(newOffset);
|
|
318
|
-
fetchResults(
|
|
316
|
+
fetchResults({
|
|
317
|
+
params,
|
|
318
|
+
newOffset,
|
|
319
|
+
});
|
|
319
320
|
},
|
|
320
321
|
[
|
|
321
322
|
tableRefreshing,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import GraphActionBar from "@/actionbar/GraphActionBar";
|
|
2
2
|
import TitleHeader from "@/ui/TitleHeader";
|
|
3
3
|
import { Graph } from "@/widgets/views/Graph/Graph";
|
|
4
|
-
import React, { useContext, useRef } from "react";
|
|
4
|
+
import React, { useContext, useEffect, useRef, useState } from "react";
|
|
5
5
|
import {
|
|
6
6
|
ActionViewContext,
|
|
7
7
|
ActionViewContextType,
|
|
@@ -11,7 +11,7 @@ import { mergeSearchFields } from "@/helpers/formHelper";
|
|
|
11
11
|
import { useSearch } from "@/hooks/useSearch";
|
|
12
12
|
import SearchFilter from "@/widgets/views/searchFilter/SearchFilter";
|
|
13
13
|
import { Spin } from "antd";
|
|
14
|
-
import {
|
|
14
|
+
import { mergeParams } from "@/helpers/searchHelper";
|
|
15
15
|
|
|
16
16
|
export type GraphActionViewProps = {
|
|
17
17
|
viewData: any;
|
|
@@ -47,43 +47,48 @@ export const GraphActionView = (props: GraphActionViewProps) => {
|
|
|
47
47
|
setTreeIsLoading = undefined,
|
|
48
48
|
limit,
|
|
49
49
|
setLimit,
|
|
50
|
+
searchParams,
|
|
51
|
+
searchValues,
|
|
52
|
+
setSearchValues,
|
|
53
|
+
currentView,
|
|
50
54
|
} = actionViewContext || {};
|
|
51
55
|
|
|
52
|
-
const
|
|
53
|
-
ActionViewContext
|
|
54
|
-
) as ActionViewContextType;
|
|
55
|
-
const { t } = useContext(LocaleContext) as LocaleContextType;
|
|
56
|
+
const [applyLimit, setApplyLimit] = useState(true);
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
(graphRef.current as any)?.refresh();
|
|
60
|
+
}, [searchParams]);
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (viewData.view_id !== currentView.view_id) {
|
|
64
|
+
setApplyLimit(true);
|
|
65
|
+
}
|
|
66
|
+
}, [currentView]);
|
|
67
|
+
|
|
68
|
+
const { clear, searchFilterLoading, searchError, offset, tableRefreshing } =
|
|
69
|
+
useSearch({
|
|
70
|
+
model,
|
|
71
|
+
setSearchTreeNameSearch,
|
|
72
|
+
setSelectedRowItems,
|
|
73
|
+
searchParams,
|
|
74
|
+
setSearchValues,
|
|
75
|
+
setSearchParams,
|
|
76
|
+
setSearchVisible,
|
|
77
|
+
setTreeIsLoading,
|
|
78
|
+
context,
|
|
79
|
+
formView: formView!,
|
|
80
|
+
treeView: treeView!,
|
|
81
|
+
sorter,
|
|
82
|
+
setSorter,
|
|
83
|
+
setCurrentItemIndex,
|
|
84
|
+
setResultsActionView,
|
|
85
|
+
resultsActionView,
|
|
86
|
+
domain,
|
|
87
|
+
currentId,
|
|
88
|
+
setActionViewTotalItems,
|
|
89
|
+
limit,
|
|
90
|
+
setLimit,
|
|
91
|
+
});
|
|
87
92
|
|
|
88
93
|
if (!visible) {
|
|
89
94
|
return null;
|
|
@@ -112,27 +117,35 @@ export const GraphActionView = (props: GraphActionViewProps) => {
|
|
|
112
117
|
onClear={clear}
|
|
113
118
|
offset={offset}
|
|
114
119
|
isSearching={searchFilterLoading}
|
|
115
|
-
onSubmit={
|
|
120
|
+
onSubmit={(opts: {
|
|
121
|
+
params: any;
|
|
122
|
+
limit: number;
|
|
123
|
+
offset: number;
|
|
124
|
+
searchValues: any;
|
|
125
|
+
}) => {
|
|
126
|
+
setApplyLimit(false);
|
|
127
|
+
setSearchParams?.(opts.params);
|
|
128
|
+
setSearchVisible?.(false);
|
|
129
|
+
}}
|
|
116
130
|
searchError={searchError}
|
|
117
131
|
searchVisible={searchVisible}
|
|
118
132
|
searchValues={searchValues}
|
|
133
|
+
showLimitOptions={false}
|
|
119
134
|
/>
|
|
120
135
|
{tableRefreshing ? (
|
|
121
136
|
<Spin />
|
|
122
137
|
) : (
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/>
|
|
135
|
-
</>
|
|
138
|
+
<Graph
|
|
139
|
+
ref={graphRef}
|
|
140
|
+
view_id={viewData.view_id}
|
|
141
|
+
model={model}
|
|
142
|
+
context={context}
|
|
143
|
+
domain={mergeParams(searchParams || [], domain)}
|
|
144
|
+
limit={applyLimit ? limit : undefined}
|
|
145
|
+
manualIds={
|
|
146
|
+
applyLimit ? resultsActionView?.map((r) => r.id) : undefined
|
|
147
|
+
}
|
|
148
|
+
/>
|
|
136
149
|
)}
|
|
137
150
|
</>
|
|
138
151
|
);
|
|
@@ -6,6 +6,7 @@ import { FormView, TreeView } from "@/types/index";
|
|
|
6
6
|
import ConnectionProvider from "@/ConnectionProvider";
|
|
7
7
|
|
|
8
8
|
import { getColorMap, getTree, sortResults } from "@/helpers/treeHelper";
|
|
9
|
+
import { mergeParams } from "@/helpers/searchHelper";
|
|
9
10
|
|
|
10
11
|
const DEFAULT_SEARCH_LIMIT = 80;
|
|
11
12
|
|
|
@@ -67,33 +68,6 @@ function DashboardTree(props: Props) {
|
|
|
67
68
|
setOffset((page - 1) * limitRef.current!);
|
|
68
69
|
};
|
|
69
70
|
|
|
70
|
-
const getUniqueFieldsForParams = (params: any[]) => {
|
|
71
|
-
const uniqueFields: any = {};
|
|
72
|
-
|
|
73
|
-
params.forEach((param) => {
|
|
74
|
-
if (Array.isArray(param) && param[0]) {
|
|
75
|
-
uniqueFields[param[0]] = true;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
return Object.keys(uniqueFields);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const mergeParams = (searchParams: any[], domainParams: any[]) => {
|
|
83
|
-
const finalParams = searchParams;
|
|
84
|
-
const uniqueParams = getUniqueFieldsForParams(searchParams);
|
|
85
|
-
|
|
86
|
-
domainParams.forEach((element) => {
|
|
87
|
-
if (Array.isArray(element) && element[0]) {
|
|
88
|
-
if (!uniqueParams.includes(element[0])) {
|
|
89
|
-
finalParams.push(element);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
return finalParams;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
71
|
const searchResults = async () => {
|
|
98
72
|
const domainParams =
|
|
99
73
|
actionDomain.current.length > 0 ? actionDomain.current : domain;
|
|
@@ -27,10 +27,11 @@ export type GraphProps = {
|
|
|
27
27
|
domain: any;
|
|
28
28
|
context: any;
|
|
29
29
|
limit?: number;
|
|
30
|
+
manualIds?: number[];
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
const GraphComp = (props: GraphProps, ref: any) => {
|
|
33
|
-
const { view_id, model, context, domain, limit } = props;
|
|
34
|
+
const { view_id, model, context, domain, limit, manualIds } = props;
|
|
34
35
|
const [loading, setLoading] = useState(false);
|
|
35
36
|
const [graphOoui, setGraphOoui] = useState<GraphOoui>();
|
|
36
37
|
const [graphXml, setGraphXml] = useState<string>();
|
|
@@ -116,6 +117,7 @@ const GraphComp = (props: GraphProps, ref: any) => {
|
|
|
116
117
|
domain={domain}
|
|
117
118
|
icon={indicator.icon!}
|
|
118
119
|
suffix={indicator.suffix!}
|
|
120
|
+
manualIds={manualIds}
|
|
119
121
|
{...indicatorFieldopts}
|
|
120
122
|
/>
|
|
121
123
|
);
|
|
@@ -130,6 +132,7 @@ const GraphComp = (props: GraphProps, ref: any) => {
|
|
|
130
132
|
domain={domain}
|
|
131
133
|
xml={graphXml!}
|
|
132
134
|
limit={limit}
|
|
135
|
+
manualIds={manualIds}
|
|
133
136
|
/>
|
|
134
137
|
);
|
|
135
138
|
}
|
|
@@ -17,19 +17,21 @@ export type GraphChartProps = {
|
|
|
17
17
|
context: any;
|
|
18
18
|
xml: string;
|
|
19
19
|
limit?: number;
|
|
20
|
+
manualIds?: number[];
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
export const GraphChart = (props: GraphChartProps) => {
|
|
23
|
-
const { model, domain, context, xml, limit } = props;
|
|
24
|
+
const { model, domain, context, xml, limit, manualIds } = props;
|
|
24
25
|
const { t } = useContext(LocaleContext) as LocaleContextType;
|
|
25
26
|
|
|
26
|
-
const { error, loading, values, type } = useGraphData({
|
|
27
|
+
const { error, loading, values, type, evaluatedEntries } = useGraphData({
|
|
27
28
|
model,
|
|
28
29
|
xml,
|
|
29
30
|
limit,
|
|
30
31
|
domain,
|
|
31
32
|
context,
|
|
32
33
|
uninformedString: t("uninformed"),
|
|
34
|
+
manualIds,
|
|
33
35
|
});
|
|
34
36
|
|
|
35
37
|
if (error) {
|
|
@@ -54,6 +56,9 @@ export const GraphChart = (props: GraphChartProps) => {
|
|
|
54
56
|
|
|
55
57
|
return (
|
|
56
58
|
<div style={{ padding: "1rem" }}>
|
|
59
|
+
<p style={{ textAlign: "right" }}>
|
|
60
|
+
{`${t("totalRegisters")} ${evaluatedEntries?.length}`}
|
|
61
|
+
</p>
|
|
57
62
|
<Chart
|
|
58
63
|
{...getGraphProps({
|
|
59
64
|
type,
|