@trackunit/filters-asset-filter-definitions 2.7.17 → 2.7.19
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/index.cjs.js +458 -0
- package/index.esm.js +451 -2
- package/package.json +15 -15
- package/src/defaultFilters/defaults/InspectionTemplateAssignedFilter.d.ts +22 -0
- package/src/defaultFilters/defaults/LastInspectionResultFilter.d.ts +24 -0
- package/src/defaultFilters/defaults/LastPerformedInspectionFilter.d.ts +23 -0
- package/src/generated/graphql-api/gql.d.ts +2 -2
- package/src/generated/graphql-api/graphql.d.ts +39 -0
- package/src/generated/graphql-api/mock.d.ts +6 -0
- package/src/hooks/useDefaultAssetFilterBarDefinition.d.ts +3 -0
- package/src/index.d.ts +3 -0
- package/src/translation.d.ts +2 -2
package/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import { DefaultCheckboxFilter, FilterEvents, FilterHeader, HierarchicalCheckbox
|
|
|
5
5
|
import { useActiveAssetFilters, useAssetQueryFilters } from '@trackunit/filters-graphql-hook';
|
|
6
6
|
import { useQuery, useConnectionPageMerger, usePaginationQuery } from '@trackunit/react-graphql-hooks';
|
|
7
7
|
import { useMemo, useState, useCallback, useEffect } from 'react';
|
|
8
|
-
import { useAnalytics, useCurrentUser, useUserPermission, useHasAccessTo } from '@trackunit/react-core-hooks';
|
|
8
|
+
import { useAnalytics, useHostFeatureFlag, useCurrentUser, useUserPermission, useHasAccessTo } from '@trackunit/react-core-hooks';
|
|
9
9
|
import { FilterBody, RadioFilterItem } from '@trackunit/react-filter-components';
|
|
10
10
|
import { RadioGroup, RadioItem, Search } from '@trackunit/react-form-components';
|
|
11
11
|
import { ActivityIndicator } from '@trackunit/utilization-indicator';
|
|
@@ -71,6 +71,26 @@ var defaultTranslations = {
|
|
|
71
71
|
"assetFilters.followedFilter.label": "Followed",
|
|
72
72
|
"assetFilters.groupFilter.missingGroup": "Missing group",
|
|
73
73
|
"assetFilters.hourIntervalFilter.label": "Hour interval",
|
|
74
|
+
"assetFilters.inspectionTemplateAssigned.ALL": "All",
|
|
75
|
+
"assetFilters.inspectionTemplateAssigned.HAS_TEMPLATE": "Has template",
|
|
76
|
+
"assetFilters.inspectionTemplateAssigned.NO_TEMPLATE": "Does not have template",
|
|
77
|
+
"assetFilters.lastInspectionResult.FAILED_CRITICAL": "Failed",
|
|
78
|
+
"assetFilters.lastInspectionResult.FAILED_LOW": "Passed (with warning)",
|
|
79
|
+
"assetFilters.lastInspectionResult.NO_LAST_INSPECTION": "Unknown",
|
|
80
|
+
"assetFilters.lastInspectionResult.PASSED": "Passed",
|
|
81
|
+
"assetFilters.lastInspectionResult.SKIPPED": "Skipped",
|
|
82
|
+
"assetFilters.lastPerformedInspection.ALL": "All",
|
|
83
|
+
"assetFilters.lastPerformedInspection.MORE_THAN_12_HOURS_AGO": "More than 12 hours ago",
|
|
84
|
+
"assetFilters.lastPerformedInspection.MORE_THAN_2_HOURS_AGO": "More than 2 hours ago",
|
|
85
|
+
"assetFilters.lastPerformedInspection.MORE_THAN_24_HOURS_AGO": "More than 24 hours ago",
|
|
86
|
+
"assetFilters.lastPerformedInspection.MORE_THAN_7_DAYS_AGO": "More than 7 days ago",
|
|
87
|
+
"assetFilters.lastPerformedInspection.MORE_THAN_8_HOURS_AGO": "More than 8 hours ago",
|
|
88
|
+
"assetFilters.lastPerformedInspection.NEVER": "Never",
|
|
89
|
+
"assetFilters.lastPerformedInspection.WITHIN_12_HOURS": "Within 12 hours",
|
|
90
|
+
"assetFilters.lastPerformedInspection.WITHIN_2_HOURS": "Within 2 hours",
|
|
91
|
+
"assetFilters.lastPerformedInspection.WITHIN_24_HOURS": "Within 24 hours",
|
|
92
|
+
"assetFilters.lastPerformedInspection.WITHIN_7_DAYS": "Within 7 days",
|
|
93
|
+
"assetFilters.lastPerformedInspection.WITHIN_8_HOURS": "Within 8 hours",
|
|
74
94
|
"assetFilters.lastSeenFilter.anytime": "Any time",
|
|
75
95
|
"assetFilters.lastSeenFilter.last24Hours": "Last 24 hours",
|
|
76
96
|
"assetFilters.lastSeenFilter.last30Days": "Last 30 days",
|
|
@@ -151,6 +171,9 @@ var defaultTranslations = {
|
|
|
151
171
|
"fleetlist.column.insights.cumulativeIdleHours": "Total Idle Hours",
|
|
152
172
|
"fleetlist.column.insights.cumulativeOperatingHours": "Total Hours",
|
|
153
173
|
"fleetlist.column.insights.fuelLevel": "Fuel Level",
|
|
174
|
+
"fleetlist.column.inspectionTemplateAssigned": "Template assigned",
|
|
175
|
+
"fleetlist.column.lastInspectionResult": "Result of last inspection",
|
|
176
|
+
"fleetlist.column.lastPerformedInspection": "Last performed inspection",
|
|
154
177
|
"fleetlist.column.lastSeen": "Last Seen (GPS)",
|
|
155
178
|
"fleetlist.column.metadataCompleteness": "Metadata Completeness",
|
|
156
179
|
"fleetlist.column.model": "Model",
|
|
@@ -1860,6 +1883,125 @@ const GetMetadataCompletenessSummaryDocument = {
|
|
|
1860
1883
|
},
|
|
1861
1884
|
],
|
|
1862
1885
|
};
|
|
1886
|
+
const GetInspectionLastStatusesSummaryDocument = {
|
|
1887
|
+
kind: "Document",
|
|
1888
|
+
definitions: [
|
|
1889
|
+
{
|
|
1890
|
+
kind: "OperationDefinition",
|
|
1891
|
+
operation: "query",
|
|
1892
|
+
name: { kind: "Name", value: "GetInspectionLastStatusesSummary" },
|
|
1893
|
+
variableDefinitions: [
|
|
1894
|
+
{
|
|
1895
|
+
kind: "VariableDefinition",
|
|
1896
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
1897
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "AssetFiltersInput" } },
|
|
1898
|
+
},
|
|
1899
|
+
],
|
|
1900
|
+
selectionSet: {
|
|
1901
|
+
kind: "SelectionSet",
|
|
1902
|
+
selections: [
|
|
1903
|
+
{
|
|
1904
|
+
kind: "Field",
|
|
1905
|
+
name: { kind: "Name", value: "assetSummary" },
|
|
1906
|
+
arguments: [
|
|
1907
|
+
{
|
|
1908
|
+
kind: "Argument",
|
|
1909
|
+
name: { kind: "Name", value: "filters" },
|
|
1910
|
+
value: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
1911
|
+
},
|
|
1912
|
+
],
|
|
1913
|
+
selectionSet: {
|
|
1914
|
+
kind: "SelectionSet",
|
|
1915
|
+
selections: [
|
|
1916
|
+
{
|
|
1917
|
+
kind: "Field",
|
|
1918
|
+
name: { kind: "Name", value: "inspectionLastStatuses" },
|
|
1919
|
+
selectionSet: {
|
|
1920
|
+
kind: "SelectionSet",
|
|
1921
|
+
selections: [
|
|
1922
|
+
{ kind: "Field", name: { kind: "Name", value: "total" } },
|
|
1923
|
+
{ kind: "Field", name: { kind: "Name", value: "undefined" } },
|
|
1924
|
+
{
|
|
1925
|
+
kind: "Field",
|
|
1926
|
+
name: { kind: "Name", value: "summary" },
|
|
1927
|
+
selectionSet: {
|
|
1928
|
+
kind: "SelectionSet",
|
|
1929
|
+
selections: [
|
|
1930
|
+
{ kind: "Field", name: { kind: "Name", value: "status" } },
|
|
1931
|
+
{ kind: "Field", name: { kind: "Name", value: "count" } },
|
|
1932
|
+
],
|
|
1933
|
+
},
|
|
1934
|
+
},
|
|
1935
|
+
],
|
|
1936
|
+
},
|
|
1937
|
+
},
|
|
1938
|
+
],
|
|
1939
|
+
},
|
|
1940
|
+
},
|
|
1941
|
+
],
|
|
1942
|
+
},
|
|
1943
|
+
},
|
|
1944
|
+
],
|
|
1945
|
+
};
|
|
1946
|
+
const GetInspectionTemplateAssignedSummaryDocument = {
|
|
1947
|
+
kind: "Document",
|
|
1948
|
+
definitions: [
|
|
1949
|
+
{
|
|
1950
|
+
kind: "OperationDefinition",
|
|
1951
|
+
operation: "query",
|
|
1952
|
+
name: { kind: "Name", value: "GetInspectionTemplateAssignedSummary" },
|
|
1953
|
+
variableDefinitions: [
|
|
1954
|
+
{
|
|
1955
|
+
kind: "VariableDefinition",
|
|
1956
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
1957
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "AssetFiltersInput" } },
|
|
1958
|
+
},
|
|
1959
|
+
],
|
|
1960
|
+
selectionSet: {
|
|
1961
|
+
kind: "SelectionSet",
|
|
1962
|
+
selections: [
|
|
1963
|
+
{
|
|
1964
|
+
kind: "Field",
|
|
1965
|
+
name: { kind: "Name", value: "assetSummary" },
|
|
1966
|
+
arguments: [
|
|
1967
|
+
{
|
|
1968
|
+
kind: "Argument",
|
|
1969
|
+
name: { kind: "Name", value: "filters" },
|
|
1970
|
+
value: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
1971
|
+
},
|
|
1972
|
+
],
|
|
1973
|
+
selectionSet: {
|
|
1974
|
+
kind: "SelectionSet",
|
|
1975
|
+
selections: [
|
|
1976
|
+
{
|
|
1977
|
+
kind: "Field",
|
|
1978
|
+
name: { kind: "Name", value: "inspectionTemplateAssigned" },
|
|
1979
|
+
selectionSet: {
|
|
1980
|
+
kind: "SelectionSet",
|
|
1981
|
+
selections: [
|
|
1982
|
+
{ kind: "Field", name: { kind: "Name", value: "total" } },
|
|
1983
|
+
{
|
|
1984
|
+
kind: "Field",
|
|
1985
|
+
name: { kind: "Name", value: "summary" },
|
|
1986
|
+
selectionSet: {
|
|
1987
|
+
kind: "SelectionSet",
|
|
1988
|
+
selections: [
|
|
1989
|
+
{ kind: "Field", name: { kind: "Name", value: "status" } },
|
|
1990
|
+
{ kind: "Field", name: { kind: "Name", value: "count" } },
|
|
1991
|
+
],
|
|
1992
|
+
},
|
|
1993
|
+
},
|
|
1994
|
+
],
|
|
1995
|
+
},
|
|
1996
|
+
},
|
|
1997
|
+
],
|
|
1998
|
+
},
|
|
1999
|
+
},
|
|
2000
|
+
],
|
|
2001
|
+
},
|
|
2002
|
+
},
|
|
2003
|
+
],
|
|
2004
|
+
};
|
|
1863
2005
|
const GetFleetModelsSummaryConnectionDocument = {
|
|
1864
2006
|
kind: "Document",
|
|
1865
2007
|
definitions: [
|
|
@@ -6198,6 +6340,304 @@ const useInsightsFuelLevelFilter = (defaultValue) => {
|
|
|
6198
6340
|
return result;
|
|
6199
6341
|
};
|
|
6200
6342
|
|
|
6343
|
+
/**
|
|
6344
|
+
* Must stay aligned with `Flags.INSPECTIONS_FILTERS` in
|
|
6345
|
+
* `libs/react/core-contexts-internal/src/featureFlags/flag.ts` (ConfigCat key).
|
|
6346
|
+
*/
|
|
6347
|
+
const INSPECTIONS_FILTERS_FEATURE_FLAG_KEY$2 = "inspections_manager_inspectionFilters";
|
|
6348
|
+
const inspectionTemplateAssignedOptions = ["HAS_TEMPLATE", "NO_TEMPLATE", "ALL"];
|
|
6349
|
+
/**
|
|
6350
|
+
* Maps inspection template assigned filter value to a translation key id.
|
|
6351
|
+
*
|
|
6352
|
+
* @param type - Filter value
|
|
6353
|
+
* @returns {string} Translation key id for the option label
|
|
6354
|
+
*/
|
|
6355
|
+
const mapInspectionTemplateAssignedToLabelId = (type) => {
|
|
6356
|
+
switch (type) {
|
|
6357
|
+
case "HAS_TEMPLATE":
|
|
6358
|
+
case "NO_TEMPLATE":
|
|
6359
|
+
case "ALL":
|
|
6360
|
+
return `assetFilters.inspectionTemplateAssigned.${type}`;
|
|
6361
|
+
default:
|
|
6362
|
+
return "assetFilters.unknown";
|
|
6363
|
+
}
|
|
6364
|
+
};
|
|
6365
|
+
/**
|
|
6366
|
+
* Filter view for "template assigned" (inspections). Fetches per-option asset counts via
|
|
6367
|
+
* `GetInspectionTemplateAssignedSummary`, excluding this filter's own value so all options remain
|
|
6368
|
+
* selectable.
|
|
6369
|
+
*
|
|
6370
|
+
* @param {FilterViewProps<ValueName>} props - Props passed to the filter component
|
|
6371
|
+
* @returns {ReactElement} The filter radio UI
|
|
6372
|
+
*/
|
|
6373
|
+
const InspectionTemplateAssignedFilter = (props) => {
|
|
6374
|
+
const [t] = useTranslation();
|
|
6375
|
+
const activeFilters = useActiveAssetFilters(props.filterState.values);
|
|
6376
|
+
const { data, loading } = useQuery(GetInspectionTemplateAssignedSummaryDocument, {
|
|
6377
|
+
// `inspectionTemplateAssigned` is a preview field; the API requires this header to opt in.
|
|
6378
|
+
context: { headers: { "TU-PREVIEW": "ASSET-TEMPLATE-ASSIGNED" } },
|
|
6379
|
+
variables: {
|
|
6380
|
+
filters: {
|
|
6381
|
+
...activeFilters,
|
|
6382
|
+
inspectionTemplateAssigned: null, // Omit the filter's own value so all options show counts
|
|
6383
|
+
},
|
|
6384
|
+
},
|
|
6385
|
+
});
|
|
6386
|
+
const getCountForInspectionTemplateAssigned = useCallback((type) => {
|
|
6387
|
+
const summary = data?.assetSummary?.inspectionTemplateAssigned?.summary ?? [];
|
|
6388
|
+
switch (type) {
|
|
6389
|
+
case "HAS_TEMPLATE":
|
|
6390
|
+
case "NO_TEMPLATE":
|
|
6391
|
+
return summary.find(item => item.status === type)?.count ?? 0;
|
|
6392
|
+
case "ALL":
|
|
6393
|
+
return data?.assetSummary?.inspectionTemplateAssigned?.total;
|
|
6394
|
+
default:
|
|
6395
|
+
throw new Error("Unrecognized inspectionTemplateAssigned type");
|
|
6396
|
+
}
|
|
6397
|
+
}, [data?.assetSummary?.inspectionTemplateAssigned?.summary, data?.assetSummary?.inspectionTemplateAssigned?.total]);
|
|
6398
|
+
const options = useMemo(() => {
|
|
6399
|
+
return inspectionTemplateAssignedOptions.map(type => ({
|
|
6400
|
+
key: type,
|
|
6401
|
+
count: getCountForInspectionTemplateAssigned(type) ?? undefined,
|
|
6402
|
+
label: t(mapInspectionTemplateAssignedToLabelId(type)),
|
|
6403
|
+
}));
|
|
6404
|
+
}, [getCountForInspectionTemplateAssigned, t]);
|
|
6405
|
+
return jsx(DefaultRadioFilter, { ...props, loading: loading, options: options });
|
|
6406
|
+
};
|
|
6407
|
+
/**
|
|
6408
|
+
* Inspection template assigned filter definition. Applied to results via
|
|
6409
|
+
* `AssetFiltersInput.inspectionTemplateAssigned` (see `useActiveAssetFilters`).
|
|
6410
|
+
*/
|
|
6411
|
+
const useInspectionTemplateAssignedFilter = ({ isDefault } = {}) => {
|
|
6412
|
+
const [t] = useTranslation();
|
|
6413
|
+
const inspectionsFiltersEnabled = useHostFeatureFlag(INSPECTIONS_FILTERS_FEATURE_FLAG_KEY$2, {
|
|
6414
|
+
defaultValueWhenMissing: true, // if flag is deleted
|
|
6415
|
+
}) ?? false; // when loading
|
|
6416
|
+
const result = useMemo(() => {
|
|
6417
|
+
return {
|
|
6418
|
+
filterKey: "inspectionTemplateAssigned",
|
|
6419
|
+
type: "valueName",
|
|
6420
|
+
group: "INSPECTIONS",
|
|
6421
|
+
default: isDefault,
|
|
6422
|
+
defaultValue: { value: "ALL", name: t(mapInspectionTemplateAssignedToLabelId("ALL")) },
|
|
6423
|
+
title: t("fleetlist.column.inspectionTemplateAssigned"),
|
|
6424
|
+
showInFilterBar: () => inspectionsFiltersEnabled,
|
|
6425
|
+
component: filterProps => jsx(InspectionTemplateAssignedFilter, { ...filterProps }),
|
|
6426
|
+
};
|
|
6427
|
+
}, [inspectionsFiltersEnabled, isDefault, t]);
|
|
6428
|
+
return result;
|
|
6429
|
+
};
|
|
6430
|
+
|
|
6431
|
+
/**
|
|
6432
|
+
* Must stay aligned with `Flags.INSPECTIONS_FILTERS` in
|
|
6433
|
+
* `libs/react/core-contexts-internal/src/featureFlags/flag.ts` (ConfigCat key).
|
|
6434
|
+
*/
|
|
6435
|
+
const INSPECTIONS_FILTERS_FEATURE_FLAG_KEY$1 = "inspections_manager_inspectionFilters";
|
|
6436
|
+
const lastInspectionResultOptionKeys = [
|
|
6437
|
+
"PASSED",
|
|
6438
|
+
"FAILED_LOW",
|
|
6439
|
+
"FAILED_CRITICAL",
|
|
6440
|
+
"SKIPPED",
|
|
6441
|
+
"NO_LAST_INSPECTION",
|
|
6442
|
+
];
|
|
6443
|
+
const mapLastInspectionResultOptionToLabelId = (key) => {
|
|
6444
|
+
switch (key) {
|
|
6445
|
+
case "PASSED":
|
|
6446
|
+
return "assetFilters.lastInspectionResult.PASSED";
|
|
6447
|
+
case "FAILED_LOW":
|
|
6448
|
+
return "assetFilters.lastInspectionResult.FAILED_LOW";
|
|
6449
|
+
case "FAILED_CRITICAL":
|
|
6450
|
+
return "assetFilters.lastInspectionResult.FAILED_CRITICAL";
|
|
6451
|
+
case "SKIPPED":
|
|
6452
|
+
return "assetFilters.lastInspectionResult.SKIPPED";
|
|
6453
|
+
case "NO_LAST_INSPECTION":
|
|
6454
|
+
return "assetFilters.lastInspectionResult.NO_LAST_INSPECTION";
|
|
6455
|
+
default:
|
|
6456
|
+
return "assetFilters.unknown";
|
|
6457
|
+
}
|
|
6458
|
+
};
|
|
6459
|
+
const mapStoredFilterValueToLabelId = (value) => {
|
|
6460
|
+
switch (value) {
|
|
6461
|
+
case "PASSED":
|
|
6462
|
+
return "assetFilters.lastInspectionResult.PASSED";
|
|
6463
|
+
case "FAILED_LOW":
|
|
6464
|
+
return "assetFilters.lastInspectionResult.FAILED_LOW";
|
|
6465
|
+
case "FAILED_CRITICAL":
|
|
6466
|
+
return "assetFilters.lastInspectionResult.FAILED_CRITICAL";
|
|
6467
|
+
case "SKIPPED":
|
|
6468
|
+
return "assetFilters.lastInspectionResult.SKIPPED";
|
|
6469
|
+
case "NO_LAST_INSPECTION":
|
|
6470
|
+
return "assetFilters.lastInspectionResult.NO_LAST_INSPECTION";
|
|
6471
|
+
default:
|
|
6472
|
+
return "assetFilters.unknown";
|
|
6473
|
+
}
|
|
6474
|
+
};
|
|
6475
|
+
/**
|
|
6476
|
+
* Checkbox filter for last inspection result. Per-option counts come from the `inspectionLastStatuses`
|
|
6477
|
+
* summary; the `NO_LAST_INSPECTION` option maps to the summary's `undefined` bucket.
|
|
6478
|
+
*
|
|
6479
|
+
* @param props - Filter view props from the filter bar
|
|
6480
|
+
* @returns {ReactElement} Checkbox list for last inspection result values
|
|
6481
|
+
*/
|
|
6482
|
+
const LastInspectionResultFiltersView = (props) => {
|
|
6483
|
+
const [t] = useTranslation();
|
|
6484
|
+
const activeFilters = useActiveAssetFilters(props.filterState.values);
|
|
6485
|
+
const { data, loading } = useQuery(GetInspectionLastStatusesSummaryDocument, {
|
|
6486
|
+
// `inspectionLastStatuses` is a preview field; the API requires this header to opt in.
|
|
6487
|
+
context: { headers: { "TU-PREVIEW": "ASSET-LAST-INSPECTION" } },
|
|
6488
|
+
variables: {
|
|
6489
|
+
filters: {
|
|
6490
|
+
...activeFilters,
|
|
6491
|
+
// Omit this filter's own values so counts reflect every option.
|
|
6492
|
+
inspectionLastFilters: {
|
|
6493
|
+
...activeFilters.inspectionLastFilters,
|
|
6494
|
+
statuses: null,
|
|
6495
|
+
includeNeverInspected: null,
|
|
6496
|
+
},
|
|
6497
|
+
},
|
|
6498
|
+
},
|
|
6499
|
+
});
|
|
6500
|
+
const getCountForOption = useCallback((key) => {
|
|
6501
|
+
const inspectionLastStatuses = data?.assetSummary?.inspectionLastStatuses;
|
|
6502
|
+
if (key === "NO_LAST_INSPECTION") {
|
|
6503
|
+
return inspectionLastStatuses?.undefined ?? 0;
|
|
6504
|
+
}
|
|
6505
|
+
return inspectionLastStatuses?.summary.find(item => item.status === key)?.count ?? 0;
|
|
6506
|
+
}, [data?.assetSummary?.inspectionLastStatuses]);
|
|
6507
|
+
const options = useMemo(() => {
|
|
6508
|
+
return lastInspectionResultOptionKeys.map(key => ({
|
|
6509
|
+
key,
|
|
6510
|
+
count: getCountForOption(key),
|
|
6511
|
+
label: t(mapLastInspectionResultOptionToLabelId(key)),
|
|
6512
|
+
}));
|
|
6513
|
+
}, [getCountForOption, t]);
|
|
6514
|
+
return jsx(DefaultCheckboxFilter, { ...props, loading: loading, options: options });
|
|
6515
|
+
};
|
|
6516
|
+
/**
|
|
6517
|
+
* Last inspection result filter definition (INSPECTIONS group; gated by inspections filters feature flag).
|
|
6518
|
+
*
|
|
6519
|
+
* @param root0 - Hook options
|
|
6520
|
+
* @param root0.isDefault - When true, include in default filter bar configuration
|
|
6521
|
+
* @returns {StringArrayFilterDefinition} Filter definition for the asset filter bar
|
|
6522
|
+
*/
|
|
6523
|
+
const useLastInspectionResultFilter = ({ isDefault } = {}) => {
|
|
6524
|
+
const [t] = useTranslation();
|
|
6525
|
+
const inspectionsFiltersEnabled = useHostFeatureFlag(INSPECTIONS_FILTERS_FEATURE_FLAG_KEY$1, {
|
|
6526
|
+
defaultValueWhenMissing: true, // if flag is deleted
|
|
6527
|
+
}) ?? false; // when loading
|
|
6528
|
+
const result = useMemo(() => {
|
|
6529
|
+
return {
|
|
6530
|
+
filterKey: "lastInspectionResult",
|
|
6531
|
+
type: "stringArray",
|
|
6532
|
+
group: "INSPECTIONS",
|
|
6533
|
+
default: isDefault,
|
|
6534
|
+
title: t("fleetlist.column.lastInspectionResult"),
|
|
6535
|
+
showInFilterBar: () => inspectionsFiltersEnabled,
|
|
6536
|
+
valueAsText: values => values.map(value => t(mapStoredFilterValueToLabelId(value))),
|
|
6537
|
+
component: filterProps => jsx(LastInspectionResultFiltersView, { ...filterProps }),
|
|
6538
|
+
};
|
|
6539
|
+
}, [inspectionsFiltersEnabled, isDefault, t]);
|
|
6540
|
+
return result;
|
|
6541
|
+
};
|
|
6542
|
+
|
|
6543
|
+
/**
|
|
6544
|
+
* Must stay aligned with `Flags.INSPECTIONS_FILTERS` in
|
|
6545
|
+
* `libs/react/core-contexts-internal/src/featureFlags/flag.ts` (ConfigCat key).
|
|
6546
|
+
*/
|
|
6547
|
+
const INSPECTIONS_FILTERS_FEATURE_FLAG_KEY = "inspections_manager_inspectionFilters";
|
|
6548
|
+
const lastPerformedInspectionOptions = [
|
|
6549
|
+
"ALL",
|
|
6550
|
+
"WITHIN_2_HOURS",
|
|
6551
|
+
"WITHIN_8_HOURS",
|
|
6552
|
+
"WITHIN_12_HOURS",
|
|
6553
|
+
"WITHIN_24_HOURS",
|
|
6554
|
+
"WITHIN_7_DAYS",
|
|
6555
|
+
"MORE_THAN_2_HOURS_AGO",
|
|
6556
|
+
"MORE_THAN_8_HOURS_AGO",
|
|
6557
|
+
"MORE_THAN_12_HOURS_AGO",
|
|
6558
|
+
"MORE_THAN_24_HOURS_AGO",
|
|
6559
|
+
"MORE_THAN_7_DAYS_AGO",
|
|
6560
|
+
"NEVER",
|
|
6561
|
+
];
|
|
6562
|
+
/**
|
|
6563
|
+
* Maps last performed inspection filter value to a translation key id.
|
|
6564
|
+
*
|
|
6565
|
+
* @param type - Filter value
|
|
6566
|
+
* @returns {string} Translation key id for the option label
|
|
6567
|
+
*/
|
|
6568
|
+
const mapLastPerformedInspectionToLabelId = (type) => {
|
|
6569
|
+
switch (type) {
|
|
6570
|
+
case "ALL":
|
|
6571
|
+
return "assetFilters.lastPerformedInspection.ALL";
|
|
6572
|
+
case "WITHIN_2_HOURS":
|
|
6573
|
+
return "assetFilters.lastPerformedInspection.WITHIN_2_HOURS";
|
|
6574
|
+
case "WITHIN_8_HOURS":
|
|
6575
|
+
return "assetFilters.lastPerformedInspection.WITHIN_8_HOURS";
|
|
6576
|
+
case "WITHIN_12_HOURS":
|
|
6577
|
+
return "assetFilters.lastPerformedInspection.WITHIN_12_HOURS";
|
|
6578
|
+
case "WITHIN_24_HOURS":
|
|
6579
|
+
return "assetFilters.lastPerformedInspection.WITHIN_24_HOURS";
|
|
6580
|
+
case "WITHIN_7_DAYS":
|
|
6581
|
+
return "assetFilters.lastPerformedInspection.WITHIN_7_DAYS";
|
|
6582
|
+
case "MORE_THAN_2_HOURS_AGO":
|
|
6583
|
+
return "assetFilters.lastPerformedInspection.MORE_THAN_2_HOURS_AGO";
|
|
6584
|
+
case "MORE_THAN_8_HOURS_AGO":
|
|
6585
|
+
return "assetFilters.lastPerformedInspection.MORE_THAN_8_HOURS_AGO";
|
|
6586
|
+
case "MORE_THAN_12_HOURS_AGO":
|
|
6587
|
+
return "assetFilters.lastPerformedInspection.MORE_THAN_12_HOURS_AGO";
|
|
6588
|
+
case "MORE_THAN_24_HOURS_AGO":
|
|
6589
|
+
return "assetFilters.lastPerformedInspection.MORE_THAN_24_HOURS_AGO";
|
|
6590
|
+
case "MORE_THAN_7_DAYS_AGO":
|
|
6591
|
+
return "assetFilters.lastPerformedInspection.MORE_THAN_7_DAYS_AGO";
|
|
6592
|
+
case "NEVER":
|
|
6593
|
+
return "assetFilters.lastPerformedInspection.NEVER";
|
|
6594
|
+
default:
|
|
6595
|
+
return "assetFilters.unknown";
|
|
6596
|
+
}
|
|
6597
|
+
};
|
|
6598
|
+
/**
|
|
6599
|
+
* Filter view for "last performed inspection" (inspections). The selected time bucket is applied to
|
|
6600
|
+
* results via `inspectionLastFilters.performed` (see `useActiveAssetFilters`). The schema exposes no
|
|
6601
|
+
* per-time-bucket summary, so options render without per-option counts.
|
|
6602
|
+
*
|
|
6603
|
+
* @param {FilterViewProps<ValueName>} props - Props passed to the filter component
|
|
6604
|
+
* @returns {ReactElement} The filter radio UI
|
|
6605
|
+
*/
|
|
6606
|
+
const LastPerformedInspectionFilterView = (props) => {
|
|
6607
|
+
const [t] = useTranslation();
|
|
6608
|
+
const options = useMemo(() => {
|
|
6609
|
+
return lastPerformedInspectionOptions.map(type => ({
|
|
6610
|
+
key: type,
|
|
6611
|
+
label: t(mapLastPerformedInspectionToLabelId(type)),
|
|
6612
|
+
}));
|
|
6613
|
+
}, [t]);
|
|
6614
|
+
return jsx(DefaultRadioFilter, { ...props, loading: false, options: options });
|
|
6615
|
+
};
|
|
6616
|
+
/**
|
|
6617
|
+
* Last performed inspection filter definition. Applied to results via
|
|
6618
|
+
* `inspectionLastFilters.performed` (see `useActiveAssetFilters`); the schema exposes no
|
|
6619
|
+
* per-time-bucket summary, so options render without counts.
|
|
6620
|
+
*/
|
|
6621
|
+
const useLastPerformedInspectionFilter = ({ isDefault } = {}) => {
|
|
6622
|
+
const [t] = useTranslation();
|
|
6623
|
+
const inspectionsFiltersEnabled = useHostFeatureFlag(INSPECTIONS_FILTERS_FEATURE_FLAG_KEY, {
|
|
6624
|
+
defaultValueWhenMissing: true, // if flag is deleted
|
|
6625
|
+
}) ?? false; // when loading
|
|
6626
|
+
const result = useMemo(() => {
|
|
6627
|
+
return {
|
|
6628
|
+
filterKey: "lastPerformedInspection",
|
|
6629
|
+
type: "valueName",
|
|
6630
|
+
group: "INSPECTIONS",
|
|
6631
|
+
default: isDefault,
|
|
6632
|
+
defaultValue: { value: "ALL", name: t(mapLastPerformedInspectionToLabelId("ALL")) },
|
|
6633
|
+
title: t("fleetlist.column.lastPerformedInspection"),
|
|
6634
|
+
showInFilterBar: () => inspectionsFiltersEnabled,
|
|
6635
|
+
component: filterProps => jsx(LastPerformedInspectionFilterView, { ...filterProps }),
|
|
6636
|
+
};
|
|
6637
|
+
}, [inspectionsFiltersEnabled, isDefault, t]);
|
|
6638
|
+
return result;
|
|
6639
|
+
};
|
|
6640
|
+
|
|
6201
6641
|
/** The time the asset was last seen. */
|
|
6202
6642
|
var AssetLastSeen;
|
|
6203
6643
|
(function (AssetLastSeen) {
|
|
@@ -7926,6 +8366,9 @@ const useDefaultAssetFilterBarDefinition = () => {
|
|
|
7926
8366
|
const { hasAccess: hasDeviceHealthAppAccess } = useHasAccessTo({ irisAppId: "@trackunit/fleet-health" });
|
|
7927
8367
|
const assetType = useAssetTypeFilter();
|
|
7928
8368
|
const metadataCompleteness = useMetadataCompletenessFilter();
|
|
8369
|
+
const inspectionTemplateAssigned = useInspectionTemplateAssignedFilter();
|
|
8370
|
+
const lastInspectionResult = useLastInspectionResultFilter();
|
|
8371
|
+
const lastPerformedInspection = useLastPerformedInspectionFilter();
|
|
7929
8372
|
const groups = useGroupIdsFilter();
|
|
7930
8373
|
const siteEnabledProps = useMemo(() => {
|
|
7931
8374
|
return {
|
|
@@ -8007,6 +8450,9 @@ const useDefaultAssetFilterBarDefinition = () => {
|
|
|
8007
8450
|
pendingTelematicsDevices,
|
|
8008
8451
|
telematicsConnected,
|
|
8009
8452
|
activeFilter,
|
|
8453
|
+
inspectionTemplateAssigned,
|
|
8454
|
+
lastInspectionResult,
|
|
8455
|
+
lastPerformedInspection,
|
|
8010
8456
|
serviceStatus,
|
|
8011
8457
|
followed,
|
|
8012
8458
|
partner,
|
|
@@ -8030,6 +8476,9 @@ const useDefaultAssetFilterBarDefinition = () => {
|
|
|
8030
8476
|
groups,
|
|
8031
8477
|
assetType,
|
|
8032
8478
|
metadataCompleteness,
|
|
8479
|
+
inspectionTemplateAssigned,
|
|
8480
|
+
lastInspectionResult,
|
|
8481
|
+
lastPerformedInspection,
|
|
8033
8482
|
brands,
|
|
8034
8483
|
countries,
|
|
8035
8484
|
models,
|
|
@@ -8075,4 +8524,4 @@ const useDefaultAssetFilterBarDefinition = () => {
|
|
|
8075
8524
|
*/
|
|
8076
8525
|
setupLibraryTranslations();
|
|
8077
8526
|
|
|
8078
|
-
export { ALL_TYPES, AccessManagementMode, ActiveFilterFiltersView, ActivityFiltersView, AreaView, AssetActivityState, AssetIdsFiltersView, AssetLastSeen, AssetTypesFilterView, BrandFilterView, ClearItemButton, CriticalityFiltersView, CustomerIdsFilterView, DayPeriod, FollowedFiltersView, FreeTextRecentSearchesFilterView, GetFleetGroupSummaryConnectionDocument, GetFleetGroupSummaryMissingDocument, GroupIdsFilterView, HourIntervalFilterView, InsightsAfterTreatmentDieselExhaustFluidTankLevelFilterView, InsightsBatteryChargerStateFilterView, InsightsBatteryPotentialFilterView, InsightsBatteryStateOfChargePercentFilterView, InsightsFuelLevelFilterView, LastSeenFiltersView, MetadataCompletenessFilterView, ModelsFilterView, NameFilterView, OwnerAccountIdsFilterView, PartnerFilterView, PeriodFilterView, ProductionYearFilterView, RecentSearchesFooter, RentalContractCustomerParentExternalReferenceFilterView, RentalContractCustomerParentNameFilterView, RentalContractOrderNumberFilterView, RentalContractReferenceCodeDescriptionFilterView, RentalContractReferenceCodeFilterView, SERVICE_PLAN_STATUSES_TO_SHOW, SearchFilterInline, ServicePanStatusesFiltersView, SiteDepotOwnershipIdsFilterView, SiteIdsFilterView, SiteStatus, SiteStatusFilterView, SiteTypeSFS, SiteTypesFilterView, TelematicsConnectedFiltersView, TypesFilterView, areaFilterInternalGeoJsonGeometrySchema, areaFilterInternalSchema, assetTypeConst, mapActivityToLabelId, mapMetadataCompletenessToLabelId, metadataCompleteness, metadataCompletenessOptions, placePredictionSchema, placeSchema, sortSiteTypeSummary, useAccessManagementModeFilter, useActiveFilterFilter, useActivityFilter, useAreaFilter, useAssetIdsFilter, useAssetTypeFilter, useBrandFilter, useCan1ProfileFilter, useCan2ProfileFilter, useCountryFilter, useCriticalityFilter, useCustomerIdsFilter, useDefaultAssetFilterBarDefinition, useDeviceHealthIssueCategoryFilter, useDeviceHealthIssueStatusFilter, useDeviceHealthIssueTypeFilter, useDeviceTypesFilter, useFirmwareVersionFilter, useFollowedFilter, useFreeTextRecentSearches, useGroupIdsFilter, useHourIntervalFilter, useInsightsAfterTreatmentDieselExhaustFluidTankLevelFilter, useInsightsBatteryChargerStateFilter, useInsightsBatteryPotentialFilter, useInsightsBatteryStateOfChargePercentFilter, useInsightsFuelLevelFilter, useLastSeenFilter, useMetadataCompletenessFilter, useModbusProfileFilter, useModelsFilter, useNameFilter, useNetworkTechnologyFilter, useOwnerAccountIdsFilter, usePartnerFilter, usePeriodFilter, usePlacesSearch, useProductionYearFilter, useRentalActiveContractItemOffRentDatesDateRangeFilter, useRentalActiveContractItemOnRentDatesDateRangeFilter, useRentalContractCustomerParentExternalReferenceFilter, useRentalContractCustomerParentNameFilter, useRentalContractOrderNumberFilter, useRentalContractReferenceCodeDescriptionFilter, useRentalContractReferenceCodeFilter, useSearchFilter, useServicePlanStatusFilter, useSiteDepotOwnershipIdsFilter, useSiteIdsFilter, useSiteStatusFilter, useSiteTypeFilter, useTelematicsConnectedFilter, useTypesFilter };
|
|
8527
|
+
export { ALL_TYPES, AccessManagementMode, ActiveFilterFiltersView, ActivityFiltersView, AreaView, AssetActivityState, AssetIdsFiltersView, AssetLastSeen, AssetTypesFilterView, BrandFilterView, ClearItemButton, CriticalityFiltersView, CustomerIdsFilterView, DayPeriod, FollowedFiltersView, FreeTextRecentSearchesFilterView, GetFleetGroupSummaryConnectionDocument, GetFleetGroupSummaryMissingDocument, GroupIdsFilterView, HourIntervalFilterView, InsightsAfterTreatmentDieselExhaustFluidTankLevelFilterView, InsightsBatteryChargerStateFilterView, InsightsBatteryPotentialFilterView, InsightsBatteryStateOfChargePercentFilterView, InsightsFuelLevelFilterView, InspectionTemplateAssignedFilter, LastInspectionResultFiltersView, LastPerformedInspectionFilterView, LastSeenFiltersView, MetadataCompletenessFilterView, ModelsFilterView, NameFilterView, OwnerAccountIdsFilterView, PartnerFilterView, PeriodFilterView, ProductionYearFilterView, RecentSearchesFooter, RentalContractCustomerParentExternalReferenceFilterView, RentalContractCustomerParentNameFilterView, RentalContractOrderNumberFilterView, RentalContractReferenceCodeDescriptionFilterView, RentalContractReferenceCodeFilterView, SERVICE_PLAN_STATUSES_TO_SHOW, SearchFilterInline, ServicePanStatusesFiltersView, SiteDepotOwnershipIdsFilterView, SiteIdsFilterView, SiteStatus, SiteStatusFilterView, SiteTypeSFS, SiteTypesFilterView, TelematicsConnectedFiltersView, TypesFilterView, areaFilterInternalGeoJsonGeometrySchema, areaFilterInternalSchema, assetTypeConst, inspectionTemplateAssignedOptions, lastInspectionResultOptionKeys, lastPerformedInspectionOptions, mapActivityToLabelId, mapMetadataCompletenessToLabelId, metadataCompleteness, metadataCompletenessOptions, placePredictionSchema, placeSchema, sortSiteTypeSummary, useAccessManagementModeFilter, useActiveFilterFilter, useActivityFilter, useAreaFilter, useAssetIdsFilter, useAssetTypeFilter, useBrandFilter, useCan1ProfileFilter, useCan2ProfileFilter, useCountryFilter, useCriticalityFilter, useCustomerIdsFilter, useDefaultAssetFilterBarDefinition, useDeviceHealthIssueCategoryFilter, useDeviceHealthIssueStatusFilter, useDeviceHealthIssueTypeFilter, useDeviceTypesFilter, useFirmwareVersionFilter, useFollowedFilter, useFreeTextRecentSearches, useGroupIdsFilter, useHourIntervalFilter, useInsightsAfterTreatmentDieselExhaustFluidTankLevelFilter, useInsightsBatteryChargerStateFilter, useInsightsBatteryPotentialFilter, useInsightsBatteryStateOfChargePercentFilter, useInsightsFuelLevelFilter, useInspectionTemplateAssignedFilter, useLastInspectionResultFilter, useLastPerformedInspectionFilter, useLastSeenFilter, useMetadataCompletenessFilter, useModbusProfileFilter, useModelsFilter, useNameFilter, useNetworkTechnologyFilter, useOwnerAccountIdsFilter, usePartnerFilter, usePeriodFilter, usePlacesSearch, useProductionYearFilter, useRentalActiveContractItemOffRentDatesDateRangeFilter, useRentalActiveContractItemOnRentDatesDateRangeFilter, useRentalContractCustomerParentExternalReferenceFilter, useRentalContractCustomerParentNameFilter, useRentalContractOrderNumberFilter, useRentalContractReferenceCodeDescriptionFilter, useRentalContractReferenceCodeFilter, useSearchFilter, useServicePlanStatusFilter, useSiteDepotOwnershipIdsFilter, useSiteIdsFilter, useSiteStatusFilter, useSiteTypeFilter, useTelematicsConnectedFilter, useTypesFilter };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/filters-asset-filter-definitions",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.19",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -12,24 +12,24 @@
|
|
|
12
12
|
"zod": "^3.25.76",
|
|
13
13
|
"string-ts": "^2.0.0",
|
|
14
14
|
"tailwind-merge": "^2.0.0",
|
|
15
|
-
"@trackunit/iris-app-build-utilities": "2.3.
|
|
16
|
-
"@trackunit/filters-filter-bar": "2.4.
|
|
17
|
-
"@trackunit/react-core-hooks": "1.20.
|
|
18
|
-
"@trackunit/react-filter-components": "2.4.
|
|
19
|
-
"@trackunit/react-form-components": "2.4.
|
|
20
|
-
"@trackunit/filters-graphql-hook": "2.6.
|
|
21
|
-
"@trackunit/utilization-indicator": "2.4.
|
|
15
|
+
"@trackunit/iris-app-build-utilities": "2.3.6",
|
|
16
|
+
"@trackunit/filters-filter-bar": "2.4.11",
|
|
17
|
+
"@trackunit/react-core-hooks": "1.20.6",
|
|
18
|
+
"@trackunit/react-filter-components": "2.4.11",
|
|
19
|
+
"@trackunit/react-form-components": "2.4.10",
|
|
20
|
+
"@trackunit/filters-graphql-hook": "2.6.18",
|
|
21
|
+
"@trackunit/utilization-indicator": "2.4.10",
|
|
22
22
|
"@trackunit/geo-json-utils": "1.15.4",
|
|
23
|
-
"@trackunit/react-components": "2.6.
|
|
23
|
+
"@trackunit/react-components": "2.6.5",
|
|
24
24
|
"@trackunit/shared-utils": "1.16.4",
|
|
25
|
-
"@trackunit/translations-machine-type": "2.3.
|
|
26
|
-
"@trackunit/criticality-indicator": "2.4.
|
|
27
|
-
"@trackunit/iris-app-api": "2.3.
|
|
25
|
+
"@trackunit/translations-machine-type": "2.3.6",
|
|
26
|
+
"@trackunit/criticality-indicator": "2.4.10",
|
|
27
|
+
"@trackunit/iris-app-api": "2.3.6",
|
|
28
28
|
"@trackunit/react-core-contexts-test": "1.18.4",
|
|
29
|
-
"@trackunit/i18n-library-translation": "2.3.
|
|
29
|
+
"@trackunit/i18n-library-translation": "2.3.6",
|
|
30
30
|
"@trackunit/iris-app-runtime-core-api": "1.17.4",
|
|
31
|
-
"@trackunit/react-graphql-hooks": "2.4.
|
|
32
|
-
"@trackunit/translations-device": "1.6.
|
|
31
|
+
"@trackunit/react-graphql-hooks": "2.4.10",
|
|
32
|
+
"@trackunit/translations-device": "1.6.13"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@apollo/client": "^3.13.8",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FilterViewProps, ValueName, ValueNameFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
|
+
import { ReactElement } from "react";
|
|
3
|
+
export declare const inspectionTemplateAssignedOptions: readonly ["HAS_TEMPLATE", "NO_TEMPLATE", "ALL"];
|
|
4
|
+
export type InspectionTemplateAssigned = (typeof inspectionTemplateAssignedOptions)[number];
|
|
5
|
+
/**
|
|
6
|
+
* Filter view for "template assigned" (inspections). Fetches per-option asset counts via
|
|
7
|
+
* `GetInspectionTemplateAssignedSummary`, excluding this filter's own value so all options remain
|
|
8
|
+
* selectable.
|
|
9
|
+
*
|
|
10
|
+
* @param {FilterViewProps<ValueName>} props - Props passed to the filter component
|
|
11
|
+
* @returns {ReactElement} The filter radio UI
|
|
12
|
+
*/
|
|
13
|
+
export declare const InspectionTemplateAssignedFilter: (props: FilterViewProps<ValueName>) => ReactElement;
|
|
14
|
+
interface UseInspectionTemplateAssignedFilterProps {
|
|
15
|
+
isDefault?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Inspection template assigned filter definition. Applied to results via
|
|
19
|
+
* `AssetFiltersInput.inspectionTemplateAssigned` (see `useActiveAssetFilters`).
|
|
20
|
+
*/
|
|
21
|
+
export declare const useInspectionTemplateAssignedFilter: ({ isDefault }?: UseInspectionTemplateAssignedFilterProps) => ValueNameFilterDefinition;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FilterViewProps, StringArrayFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
|
+
import { ReactElement } from "react";
|
|
3
|
+
export declare const lastInspectionResultOptionKeys: readonly ["PASSED", "FAILED_LOW", "FAILED_CRITICAL", "SKIPPED", "NO_LAST_INSPECTION"];
|
|
4
|
+
export type LastInspectionResultOptionKey = (typeof lastInspectionResultOptionKeys)[number];
|
|
5
|
+
/**
|
|
6
|
+
* Checkbox filter for last inspection result. Per-option counts come from the `inspectionLastStatuses`
|
|
7
|
+
* summary; the `NO_LAST_INSPECTION` option maps to the summary's `undefined` bucket.
|
|
8
|
+
*
|
|
9
|
+
* @param props - Filter view props from the filter bar
|
|
10
|
+
* @returns {ReactElement} Checkbox list for last inspection result values
|
|
11
|
+
*/
|
|
12
|
+
export declare const LastInspectionResultFiltersView: (props: FilterViewProps<Array<string>>) => ReactElement;
|
|
13
|
+
interface UseLastInspectionResultFilterProps {
|
|
14
|
+
isDefault?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Last inspection result filter definition (INSPECTIONS group; gated by inspections filters feature flag).
|
|
18
|
+
*
|
|
19
|
+
* @param root0 - Hook options
|
|
20
|
+
* @param root0.isDefault - When true, include in default filter bar configuration
|
|
21
|
+
* @returns {StringArrayFilterDefinition} Filter definition for the asset filter bar
|
|
22
|
+
*/
|
|
23
|
+
export declare const useLastInspectionResultFilter: ({ isDefault }?: UseLastInspectionResultFilterProps) => StringArrayFilterDefinition;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FilterViewProps, ValueName, ValueNameFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
|
+
import { ReactElement } from "react";
|
|
3
|
+
export declare const lastPerformedInspectionOptions: readonly ["ALL", "WITHIN_2_HOURS", "WITHIN_8_HOURS", "WITHIN_12_HOURS", "WITHIN_24_HOURS", "WITHIN_7_DAYS", "MORE_THAN_2_HOURS_AGO", "MORE_THAN_8_HOURS_AGO", "MORE_THAN_12_HOURS_AGO", "MORE_THAN_24_HOURS_AGO", "MORE_THAN_7_DAYS_AGO", "NEVER"];
|
|
4
|
+
export type LastPerformedInspection = (typeof lastPerformedInspectionOptions)[number];
|
|
5
|
+
/**
|
|
6
|
+
* Filter view for "last performed inspection" (inspections). The selected time bucket is applied to
|
|
7
|
+
* results via `inspectionLastFilters.performed` (see `useActiveAssetFilters`). The schema exposes no
|
|
8
|
+
* per-time-bucket summary, so options render without per-option counts.
|
|
9
|
+
*
|
|
10
|
+
* @param {FilterViewProps<ValueName>} props - Props passed to the filter component
|
|
11
|
+
* @returns {ReactElement} The filter radio UI
|
|
12
|
+
*/
|
|
13
|
+
export declare const LastPerformedInspectionFilterView: (props: FilterViewProps<ValueName>) => ReactElement;
|
|
14
|
+
interface UseLastPerformedInspectionFilterProps {
|
|
15
|
+
isDefault?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Last performed inspection filter definition. Applied to results via
|
|
19
|
+
* `inspectionLastFilters.performed` (see `useActiveAssetFilters`); the schema exposes no
|
|
20
|
+
* per-time-bucket summary, so options render without counts.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useLastPerformedInspectionFilter: ({ isDefault }?: UseLastPerformedInspectionFilterProps) => ValueNameFilterDefinition;
|
|
23
|
+
export {};
|