@trackunit/filters-asset-filter-definitions 2.1.101 → 2.2.0
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 +401 -5
- package/index.esm.js +400 -6
- package/package.json +2 -2
- package/src/defaultFilters/defaults/CanProfileFilter/Can1ProfileFilter.d.ts +17 -0
- package/src/defaultFilters/defaults/CanProfileFilter/Can2ProfileFilter.d.ts +17 -0
- package/src/defaultFilters/defaults/CanProfileFilter/useCan1ProfileFilter.d.ts +7 -0
- package/src/defaultFilters/defaults/CanProfileFilter/useCan2ProfileFilter.d.ts +7 -0
- package/src/generated/graphql-api/gql.d.ts +32 -0
- package/src/generated/graphql-api/graphql.d.ts +78 -0
- package/src/generated/graphql-api/mock.d.ts +12 -0
- package/src/index.d.ts +2 -0
- package/src/translation.d.ts +2 -2
package/index.esm.js
CHANGED
|
@@ -60,6 +60,8 @@ var defaultTranslations = {
|
|
|
60
60
|
"assetFilters.assetType.TOOL": "Tools",
|
|
61
61
|
"assetFilters.assetType.VEHICLE": "Vehicle",
|
|
62
62
|
"assetFilters.boundingBoxFilter.value": "Within map area",
|
|
63
|
+
"assetFilters.can1Profile.label": "CAN1 profile",
|
|
64
|
+
"assetFilters.can2Profile.label": "CAN2 profile",
|
|
63
65
|
"assetFilters.criticality.CRITICAL": "Critical",
|
|
64
66
|
"assetFilters.criticality.LOW": "Low",
|
|
65
67
|
"assetFilters.criticality.NONE": "Good",
|
|
@@ -362,7 +364,7 @@ const GET_ACCESS_MANAGEMENT_MODE_DESIRED_SUMMARY = gql `
|
|
|
362
364
|
}
|
|
363
365
|
}
|
|
364
366
|
`;
|
|
365
|
-
const FETCH_LIMIT$
|
|
367
|
+
const FETCH_LIMIT$h = 1000;
|
|
366
368
|
/**
|
|
367
369
|
Renders the Access Management Mode Filter view with the provided props.
|
|
368
370
|
|
|
@@ -376,7 +378,7 @@ const AccessManagementModeFilterView = ({ filterDefinition, filterState, filterB
|
|
|
376
378
|
const { data, loading } = useQuery(GET_ACCESS_MANAGEMENT_MODE_DESIRED_SUMMARY, {
|
|
377
379
|
fetchPolicy: "cache-first",
|
|
378
380
|
variables: {
|
|
379
|
-
limit: FETCH_LIMIT$
|
|
381
|
+
limit: FETCH_LIMIT$h,
|
|
380
382
|
filters: {
|
|
381
383
|
...activeFilters,
|
|
382
384
|
accessManagementDesiredModes: null, // Omit the filters own values so list shows options correctly
|
|
@@ -517,6 +519,256 @@ const servicePlanStatus = {
|
|
|
517
519
|
PLANNED: "PLANNED",
|
|
518
520
|
UPCOMING: "UPCOMING",
|
|
519
521
|
};
|
|
522
|
+
const TelematicsDeviceCan1ProfileNamesDocument = {
|
|
523
|
+
kind: "Document",
|
|
524
|
+
definitions: [
|
|
525
|
+
{
|
|
526
|
+
kind: "OperationDefinition",
|
|
527
|
+
operation: "query",
|
|
528
|
+
name: { kind: "Name", value: "TelematicsDeviceCan1ProfileNames" },
|
|
529
|
+
selectionSet: {
|
|
530
|
+
kind: "SelectionSet",
|
|
531
|
+
selections: [
|
|
532
|
+
{
|
|
533
|
+
kind: "Field",
|
|
534
|
+
name: { kind: "Name", value: "telematicsDeviceSummary" },
|
|
535
|
+
selectionSet: {
|
|
536
|
+
kind: "SelectionSet",
|
|
537
|
+
selections: [
|
|
538
|
+
{
|
|
539
|
+
kind: "Field",
|
|
540
|
+
name: { kind: "Name", value: "can1Profiles" },
|
|
541
|
+
selectionSet: {
|
|
542
|
+
kind: "SelectionSet",
|
|
543
|
+
selections: [
|
|
544
|
+
{
|
|
545
|
+
kind: "Field",
|
|
546
|
+
name: { kind: "Name", value: "summary" },
|
|
547
|
+
selectionSet: {
|
|
548
|
+
kind: "SelectionSet",
|
|
549
|
+
selections: [
|
|
550
|
+
{ kind: "Field", name: { kind: "Name", value: "key" } },
|
|
551
|
+
{ kind: "Field", name: { kind: "Name", value: "name" } },
|
|
552
|
+
],
|
|
553
|
+
},
|
|
554
|
+
},
|
|
555
|
+
],
|
|
556
|
+
},
|
|
557
|
+
},
|
|
558
|
+
],
|
|
559
|
+
},
|
|
560
|
+
},
|
|
561
|
+
],
|
|
562
|
+
},
|
|
563
|
+
},
|
|
564
|
+
],
|
|
565
|
+
};
|
|
566
|
+
const GetFleetCan1ProfileSummaryDocument = {
|
|
567
|
+
kind: "Document",
|
|
568
|
+
definitions: [
|
|
569
|
+
{
|
|
570
|
+
kind: "OperationDefinition",
|
|
571
|
+
operation: "query",
|
|
572
|
+
name: { kind: "Name", value: "GetFleetCan1ProfileSummary" },
|
|
573
|
+
variableDefinitions: [
|
|
574
|
+
{
|
|
575
|
+
kind: "VariableDefinition",
|
|
576
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
577
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "AssetFiltersInput" } },
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
kind: "VariableDefinition",
|
|
581
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "search" } },
|
|
582
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "String" } },
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
kind: "VariableDefinition",
|
|
586
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "limit" } },
|
|
587
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "Int" } },
|
|
588
|
+
},
|
|
589
|
+
],
|
|
590
|
+
selectionSet: {
|
|
591
|
+
kind: "SelectionSet",
|
|
592
|
+
selections: [
|
|
593
|
+
{
|
|
594
|
+
kind: "Field",
|
|
595
|
+
name: { kind: "Name", value: "assetSummary" },
|
|
596
|
+
arguments: [
|
|
597
|
+
{
|
|
598
|
+
kind: "Argument",
|
|
599
|
+
name: { kind: "Name", value: "filters" },
|
|
600
|
+
value: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
601
|
+
},
|
|
602
|
+
],
|
|
603
|
+
selectionSet: {
|
|
604
|
+
kind: "SelectionSet",
|
|
605
|
+
selections: [
|
|
606
|
+
{
|
|
607
|
+
kind: "Field",
|
|
608
|
+
name: { kind: "Name", value: "can1ProfileSummary" },
|
|
609
|
+
arguments: [
|
|
610
|
+
{
|
|
611
|
+
kind: "Argument",
|
|
612
|
+
name: { kind: "Name", value: "filter" },
|
|
613
|
+
value: { kind: "Variable", name: { kind: "Name", value: "search" } },
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
kind: "Argument",
|
|
617
|
+
name: { kind: "Name", value: "limit" },
|
|
618
|
+
value: { kind: "Variable", name: { kind: "Name", value: "limit" } },
|
|
619
|
+
},
|
|
620
|
+
],
|
|
621
|
+
selectionSet: {
|
|
622
|
+
kind: "SelectionSet",
|
|
623
|
+
selections: [
|
|
624
|
+
{ kind: "Field", name: { kind: "Name", value: "total" } },
|
|
625
|
+
{
|
|
626
|
+
kind: "Field",
|
|
627
|
+
name: { kind: "Name", value: "summary" },
|
|
628
|
+
selectionSet: {
|
|
629
|
+
kind: "SelectionSet",
|
|
630
|
+
selections: [
|
|
631
|
+
{ kind: "Field", name: { kind: "Name", value: "key" } },
|
|
632
|
+
{ kind: "Field", name: { kind: "Name", value: "count" } },
|
|
633
|
+
],
|
|
634
|
+
},
|
|
635
|
+
},
|
|
636
|
+
],
|
|
637
|
+
},
|
|
638
|
+
},
|
|
639
|
+
],
|
|
640
|
+
},
|
|
641
|
+
},
|
|
642
|
+
],
|
|
643
|
+
},
|
|
644
|
+
},
|
|
645
|
+
],
|
|
646
|
+
};
|
|
647
|
+
const TelematicsDeviceCan2ProfileNamesDocument = {
|
|
648
|
+
kind: "Document",
|
|
649
|
+
definitions: [
|
|
650
|
+
{
|
|
651
|
+
kind: "OperationDefinition",
|
|
652
|
+
operation: "query",
|
|
653
|
+
name: { kind: "Name", value: "TelematicsDeviceCan2ProfileNames" },
|
|
654
|
+
selectionSet: {
|
|
655
|
+
kind: "SelectionSet",
|
|
656
|
+
selections: [
|
|
657
|
+
{
|
|
658
|
+
kind: "Field",
|
|
659
|
+
name: { kind: "Name", value: "telematicsDeviceSummary" },
|
|
660
|
+
selectionSet: {
|
|
661
|
+
kind: "SelectionSet",
|
|
662
|
+
selections: [
|
|
663
|
+
{
|
|
664
|
+
kind: "Field",
|
|
665
|
+
name: { kind: "Name", value: "can2Profiles" },
|
|
666
|
+
selectionSet: {
|
|
667
|
+
kind: "SelectionSet",
|
|
668
|
+
selections: [
|
|
669
|
+
{
|
|
670
|
+
kind: "Field",
|
|
671
|
+
name: { kind: "Name", value: "summary" },
|
|
672
|
+
selectionSet: {
|
|
673
|
+
kind: "SelectionSet",
|
|
674
|
+
selections: [
|
|
675
|
+
{ kind: "Field", name: { kind: "Name", value: "key" } },
|
|
676
|
+
{ kind: "Field", name: { kind: "Name", value: "name" } },
|
|
677
|
+
],
|
|
678
|
+
},
|
|
679
|
+
},
|
|
680
|
+
],
|
|
681
|
+
},
|
|
682
|
+
},
|
|
683
|
+
],
|
|
684
|
+
},
|
|
685
|
+
},
|
|
686
|
+
],
|
|
687
|
+
},
|
|
688
|
+
},
|
|
689
|
+
],
|
|
690
|
+
};
|
|
691
|
+
const GetFleetCan2ProfileSummaryDocument = {
|
|
692
|
+
kind: "Document",
|
|
693
|
+
definitions: [
|
|
694
|
+
{
|
|
695
|
+
kind: "OperationDefinition",
|
|
696
|
+
operation: "query",
|
|
697
|
+
name: { kind: "Name", value: "GetFleetCan2ProfileSummary" },
|
|
698
|
+
variableDefinitions: [
|
|
699
|
+
{
|
|
700
|
+
kind: "VariableDefinition",
|
|
701
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
702
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "AssetFiltersInput" } },
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
kind: "VariableDefinition",
|
|
706
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "search" } },
|
|
707
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "String" } },
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
kind: "VariableDefinition",
|
|
711
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "limit" } },
|
|
712
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "Int" } },
|
|
713
|
+
},
|
|
714
|
+
],
|
|
715
|
+
selectionSet: {
|
|
716
|
+
kind: "SelectionSet",
|
|
717
|
+
selections: [
|
|
718
|
+
{
|
|
719
|
+
kind: "Field",
|
|
720
|
+
name: { kind: "Name", value: "assetSummary" },
|
|
721
|
+
arguments: [
|
|
722
|
+
{
|
|
723
|
+
kind: "Argument",
|
|
724
|
+
name: { kind: "Name", value: "filters" },
|
|
725
|
+
value: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
726
|
+
},
|
|
727
|
+
],
|
|
728
|
+
selectionSet: {
|
|
729
|
+
kind: "SelectionSet",
|
|
730
|
+
selections: [
|
|
731
|
+
{
|
|
732
|
+
kind: "Field",
|
|
733
|
+
name: { kind: "Name", value: "can2ProfileSummary" },
|
|
734
|
+
arguments: [
|
|
735
|
+
{
|
|
736
|
+
kind: "Argument",
|
|
737
|
+
name: { kind: "Name", value: "filter" },
|
|
738
|
+
value: { kind: "Variable", name: { kind: "Name", value: "search" } },
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
kind: "Argument",
|
|
742
|
+
name: { kind: "Name", value: "limit" },
|
|
743
|
+
value: { kind: "Variable", name: { kind: "Name", value: "limit" } },
|
|
744
|
+
},
|
|
745
|
+
],
|
|
746
|
+
selectionSet: {
|
|
747
|
+
kind: "SelectionSet",
|
|
748
|
+
selections: [
|
|
749
|
+
{ kind: "Field", name: { kind: "Name", value: "total" } },
|
|
750
|
+
{
|
|
751
|
+
kind: "Field",
|
|
752
|
+
name: { kind: "Name", value: "summary" },
|
|
753
|
+
selectionSet: {
|
|
754
|
+
kind: "SelectionSet",
|
|
755
|
+
selections: [
|
|
756
|
+
{ kind: "Field", name: { kind: "Name", value: "key" } },
|
|
757
|
+
{ kind: "Field", name: { kind: "Name", value: "count" } },
|
|
758
|
+
],
|
|
759
|
+
},
|
|
760
|
+
},
|
|
761
|
+
],
|
|
762
|
+
},
|
|
763
|
+
},
|
|
764
|
+
],
|
|
765
|
+
},
|
|
766
|
+
},
|
|
767
|
+
],
|
|
768
|
+
},
|
|
769
|
+
},
|
|
770
|
+
],
|
|
771
|
+
};
|
|
520
772
|
const GetFleetCountriesSummaryDocument = {
|
|
521
773
|
kind: "Document",
|
|
522
774
|
definitions: [
|
|
@@ -3131,7 +3383,7 @@ const useAssetTypeFilter = ({ showTypes } = { showTypes: ALL_TYPES }) => {
|
|
|
3131
3383
|
return result;
|
|
3132
3384
|
};
|
|
3133
3385
|
|
|
3134
|
-
const FETCH_LIMIT$
|
|
3386
|
+
const FETCH_LIMIT$g = 1000;
|
|
3135
3387
|
/**
|
|
3136
3388
|
* React component for rendering the brand filter.
|
|
3137
3389
|
*
|
|
@@ -3147,7 +3399,7 @@ const BrandFilterView = (props) => {
|
|
|
3147
3399
|
const { data, loading } = useQuery(GetFleetBrandsSummaryDocument, {
|
|
3148
3400
|
fetchPolicy: "cache-first",
|
|
3149
3401
|
variables: {
|
|
3150
|
-
limit: FETCH_LIMIT$
|
|
3402
|
+
limit: FETCH_LIMIT$g,
|
|
3151
3403
|
search: debouncedSearch.trim(),
|
|
3152
3404
|
filters: {
|
|
3153
3405
|
...activeFilters,
|
|
@@ -3164,7 +3416,7 @@ const BrandFilterView = (props) => {
|
|
|
3164
3416
|
return result;
|
|
3165
3417
|
}, [data?.assetSummary?.brands?.summary, getMachineTypeTranslation]);
|
|
3166
3418
|
useEffect(() => {
|
|
3167
|
-
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$
|
|
3419
|
+
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$g);
|
|
3168
3420
|
}, [options]);
|
|
3169
3421
|
return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
|
|
3170
3422
|
};
|
|
@@ -3191,6 +3443,148 @@ const useBrandFilter = () => {
|
|
|
3191
3443
|
return result;
|
|
3192
3444
|
};
|
|
3193
3445
|
|
|
3446
|
+
const FETCH_LIMIT$f = 1000;
|
|
3447
|
+
/**
|
|
3448
|
+
* The CAN 1 Profile Filter component.
|
|
3449
|
+
*
|
|
3450
|
+
* Provides an interface to select CAN profiles reported on the CAN1 port. Options are
|
|
3451
|
+
* fetched from a GraphQL query keyed by the profile key, but only the resolved profile
|
|
3452
|
+
* name is displayed. Searching is delegated to the backend, which matches against the
|
|
3453
|
+
* profile key.
|
|
3454
|
+
*
|
|
3455
|
+
* @param props - The filter view props.
|
|
3456
|
+
* @param props.filterDefinition - The filter's definition.
|
|
3457
|
+
* @param props.filterState - The current state of the filter, including selected values.
|
|
3458
|
+
* @param props.filterBarActions - Actions for the filter's interaction with the filter bar.
|
|
3459
|
+
* @returns {ReactElement} React component to render the CAN1 profile filter.
|
|
3460
|
+
*/
|
|
3461
|
+
const Can1ProfileFilter = ({ filterDefinition, filterState, filterBarActions, ...props }) => {
|
|
3462
|
+
const [t] = useTranslation();
|
|
3463
|
+
const activeFilters = useActiveAssetFilters(filterState.values);
|
|
3464
|
+
const [showRequestMoreUseSearch, setShowRequestMoreUseSearch] = useState(false);
|
|
3465
|
+
const [searchText, setSearchText] = useState("");
|
|
3466
|
+
const debouncedSearch = useDebounce(searchText, { delay: 500 });
|
|
3467
|
+
const { data, loading } = useQuery(GetFleetCan1ProfileSummaryDocument, {
|
|
3468
|
+
variables: {
|
|
3469
|
+
limit: FETCH_LIMIT$f,
|
|
3470
|
+
search: debouncedSearch,
|
|
3471
|
+
filters: {
|
|
3472
|
+
...activeFilters,
|
|
3473
|
+
can1Profile: null, // Omit the filters own values so list shows options correctly
|
|
3474
|
+
},
|
|
3475
|
+
},
|
|
3476
|
+
fetchPolicy: "cache-first",
|
|
3477
|
+
});
|
|
3478
|
+
const { data: profileNamesData } = useQuery(TelematicsDeviceCan1ProfileNamesDocument, {
|
|
3479
|
+
context: { headers: { "TU-PREVIEW": "TELEMATICS_DEVICE_PREVIEW" } },
|
|
3480
|
+
fetchPolicy: "cache-first",
|
|
3481
|
+
});
|
|
3482
|
+
const profileNameByKey = useMemo(() => new Map(profileNamesData?.telematicsDeviceSummary?.can1Profiles?.summary?.map(profile => [profile.key, profile.name]) ??
|
|
3483
|
+
[]), [profileNamesData?.telematicsDeviceSummary?.can1Profiles?.summary]);
|
|
3484
|
+
const options = useMemo(() => {
|
|
3485
|
+
const result = data?.assetSummary?.can1ProfileSummary?.summary.map(canProfile => {
|
|
3486
|
+
if (canProfile.key.toUpperCase() === "UNDEFINED") {
|
|
3487
|
+
return { ...canProfile, label: t(`machine.types.Unknown`) };
|
|
3488
|
+
}
|
|
3489
|
+
return { ...canProfile, label: profileNameByKey.get(canProfile.key) ?? canProfile.key };
|
|
3490
|
+
}) ?? [];
|
|
3491
|
+
return result;
|
|
3492
|
+
}, [data?.assetSummary?.can1ProfileSummary?.summary, profileNameByKey, t]);
|
|
3493
|
+
useEffect(() => {
|
|
3494
|
+
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$f);
|
|
3495
|
+
}, [options]);
|
|
3496
|
+
return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, filterBarActions: filterBarActions, filterDefinition: filterDefinition, filterState: filterState, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
|
|
3497
|
+
};
|
|
3498
|
+
|
|
3499
|
+
/**
|
|
3500
|
+
* Get the CAN 1 Profile filter definition
|
|
3501
|
+
*
|
|
3502
|
+
* @returns {ValueNameArrayFilterDefinition} The CAN 1 Profile filter definition
|
|
3503
|
+
*/
|
|
3504
|
+
const useCan1ProfileFilter = () => {
|
|
3505
|
+
const [t] = useTranslation();
|
|
3506
|
+
return useMemo(() => {
|
|
3507
|
+
return {
|
|
3508
|
+
filterKey: "can1Profile",
|
|
3509
|
+
type: "valueNameArray",
|
|
3510
|
+
group: "DEVICE",
|
|
3511
|
+
title: t("assetFilters.can1Profile.label"),
|
|
3512
|
+
component: props => jsx(Can1ProfileFilter, { ...props }),
|
|
3513
|
+
};
|
|
3514
|
+
}, [t]);
|
|
3515
|
+
};
|
|
3516
|
+
|
|
3517
|
+
const FETCH_LIMIT$e = 1000;
|
|
3518
|
+
/**
|
|
3519
|
+
* The CAN 2 Profile Filter component.
|
|
3520
|
+
*
|
|
3521
|
+
* Provides an interface to select CAN profiles reported on the CAN2 port. Options are
|
|
3522
|
+
* fetched from a GraphQL query keyed by the profile key, but only the resolved profile
|
|
3523
|
+
* name is displayed. Searching is delegated to the backend, which matches against the
|
|
3524
|
+
* profile key.
|
|
3525
|
+
*
|
|
3526
|
+
* @param props - The filter view props.
|
|
3527
|
+
* @param props.filterDefinition - The filter's definition.
|
|
3528
|
+
* @param props.filterState - The current state of the filter, including selected values.
|
|
3529
|
+
* @param props.filterBarActions - Actions for the filter's interaction with the filter bar.
|
|
3530
|
+
* @returns {ReactElement} React component to render the CAN2 profile filter.
|
|
3531
|
+
*/
|
|
3532
|
+
const Can2ProfileFilter = ({ filterDefinition, filterState, filterBarActions, ...props }) => {
|
|
3533
|
+
const [t] = useTranslation();
|
|
3534
|
+
const activeFilters = useActiveAssetFilters(filterState.values);
|
|
3535
|
+
const [showRequestMoreUseSearch, setShowRequestMoreUseSearch] = useState(false);
|
|
3536
|
+
const [searchText, setSearchText] = useState("");
|
|
3537
|
+
const debouncedSearch = useDebounce(searchText, { delay: 500 });
|
|
3538
|
+
const { data, loading } = useQuery(GetFleetCan2ProfileSummaryDocument, {
|
|
3539
|
+
variables: {
|
|
3540
|
+
limit: FETCH_LIMIT$e,
|
|
3541
|
+
search: debouncedSearch,
|
|
3542
|
+
filters: {
|
|
3543
|
+
...activeFilters,
|
|
3544
|
+
can2Profile: null, // Omit the filters own values so list shows options correctly
|
|
3545
|
+
},
|
|
3546
|
+
},
|
|
3547
|
+
fetchPolicy: "cache-first",
|
|
3548
|
+
});
|
|
3549
|
+
const { data: profileNamesData } = useQuery(TelematicsDeviceCan2ProfileNamesDocument, {
|
|
3550
|
+
context: { headers: { "TU-PREVIEW": "TELEMATICS_DEVICE_PREVIEW" } },
|
|
3551
|
+
fetchPolicy: "cache-first",
|
|
3552
|
+
});
|
|
3553
|
+
const profileNameByKey = useMemo(() => new Map(profileNamesData?.telematicsDeviceSummary?.can2Profiles?.summary?.map(profile => [profile.key, profile.name]) ??
|
|
3554
|
+
[]), [profileNamesData?.telematicsDeviceSummary?.can2Profiles?.summary]);
|
|
3555
|
+
const options = useMemo(() => {
|
|
3556
|
+
const result = data?.assetSummary?.can2ProfileSummary?.summary.map(canProfile => {
|
|
3557
|
+
if (canProfile.key.toUpperCase() === "UNDEFINED") {
|
|
3558
|
+
return { ...canProfile, label: t(`machine.types.Unknown`) };
|
|
3559
|
+
}
|
|
3560
|
+
return { ...canProfile, label: profileNameByKey.get(canProfile.key) ?? canProfile.key };
|
|
3561
|
+
}) ?? [];
|
|
3562
|
+
return result;
|
|
3563
|
+
}, [data?.assetSummary?.can2ProfileSummary?.summary, profileNameByKey, t]);
|
|
3564
|
+
useEffect(() => {
|
|
3565
|
+
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$e);
|
|
3566
|
+
}, [options]);
|
|
3567
|
+
return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, filterBarActions: filterBarActions, filterDefinition: filterDefinition, filterState: filterState, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
|
|
3568
|
+
};
|
|
3569
|
+
|
|
3570
|
+
/**
|
|
3571
|
+
* Get the CAN 2 Profile filter definition
|
|
3572
|
+
*
|
|
3573
|
+
* @returns {ValueNameArrayFilterDefinition} The CAN 2 Profile filter definition
|
|
3574
|
+
*/
|
|
3575
|
+
const useCan2ProfileFilter = () => {
|
|
3576
|
+
const [t] = useTranslation();
|
|
3577
|
+
return useMemo(() => {
|
|
3578
|
+
return {
|
|
3579
|
+
filterKey: "can2Profile",
|
|
3580
|
+
type: "valueNameArray",
|
|
3581
|
+
group: "DEVICE",
|
|
3582
|
+
title: t("assetFilters.can2Profile.label"),
|
|
3583
|
+
component: props => jsx(Can2ProfileFilter, { ...props }),
|
|
3584
|
+
};
|
|
3585
|
+
}, [t]);
|
|
3586
|
+
};
|
|
3587
|
+
|
|
3194
3588
|
/**
|
|
3195
3589
|
* Build the country filter options from the SFS country summary, translating each
|
|
3196
3590
|
* code to its localized name and ordering the list alphabetically by that name.
|
|
@@ -6088,4 +6482,4 @@ const useDefaultAssetFilterBarDefinition = () => {
|
|
|
6088
6482
|
*/
|
|
6089
6483
|
setupLibraryTranslations();
|
|
6090
6484
|
|
|
6091
|
-
export { ALL_TYPES, AccessManagementMode, ActiveFilterFiltersView, ActivityFiltersView, AreaView, AssetActivityState, AssetIdsFiltersView, AssetLastSeen, AssetTypesFilterView, BrandFilterView, ClearItemButton, CriticalityFiltersView, CustomerIdsFilterView, DayPeriod, FollowedFiltersView, GetFleetGroupSummaryDocument, GroupIdsFilterView, HourIntervalFilterView, InsightsAfterTreatmentDieselExhaustFluidTankLevelFilterView, InsightsBatteryChargerStateFilterView, InsightsBatteryPotentialFilterView, InsightsBatteryStateOfChargePercentFilterView, InsightsFuelLevelFilterView, LastSeenFiltersView, MetadataCompletenessFilterView, ModelsFilterView, 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, useCountryFilter, useCriticalityFilter, useCustomerIdsFilter, useDefaultAssetFilterBarDefinition, useDeviceHealthIssueCategoryFilter, useDeviceHealthIssueStatusFilter, useDeviceHealthIssueTypeFilter, useDeviceTypesFilter, useFirmwareVersionFilter, useFollowedFilter, useGroupIdsFilter, useHourIntervalFilter, useInsightsAfterTreatmentDieselExhaustFluidTankLevelFilter, useInsightsBatteryChargerStateFilter, useInsightsBatteryPotentialFilter, useInsightsBatteryStateOfChargePercentFilter, useInsightsFuelLevelFilter, useLastSeenFilter, useMetadataCompletenessFilter, useModbusProfileFilter, useModelsFilter, useOwnerAccountIdsFilter, usePartnerFilter, usePeriodFilter, usePlacesSearch, useProductionYearFilter, useRentalActiveContractItemOffRentDatesDateRangeFilter, useRentalActiveContractItemOnRentDatesDateRangeFilter, useRentalContractCustomerParentExternalReferenceFilter, useRentalContractCustomerParentNameFilter, useRentalContractOrderNumberFilter, useRentalContractReferenceCodeDescriptionFilter, useRentalContractReferenceCodeFilter, useSearchFilter, useServicePlanStatusFilter, useSiteDepotOwnershipIdsFilter, useSiteIdsFilter, useSiteStatusFilter, useSiteTypeFilter, useTelematicsConnectedFilter, useTypesFilter };
|
|
6485
|
+
export { ALL_TYPES, AccessManagementMode, ActiveFilterFiltersView, ActivityFiltersView, AreaView, AssetActivityState, AssetIdsFiltersView, AssetLastSeen, AssetTypesFilterView, BrandFilterView, ClearItemButton, CriticalityFiltersView, CustomerIdsFilterView, DayPeriod, FollowedFiltersView, GetFleetGroupSummaryDocument, GroupIdsFilterView, HourIntervalFilterView, InsightsAfterTreatmentDieselExhaustFluidTankLevelFilterView, InsightsBatteryChargerStateFilterView, InsightsBatteryPotentialFilterView, InsightsBatteryStateOfChargePercentFilterView, InsightsFuelLevelFilterView, LastSeenFiltersView, MetadataCompletenessFilterView, ModelsFilterView, 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, useGroupIdsFilter, useHourIntervalFilter, useInsightsAfterTreatmentDieselExhaustFluidTankLevelFilter, useInsightsBatteryChargerStateFilter, useInsightsBatteryPotentialFilter, useInsightsBatteryStateOfChargePercentFilter, useInsightsFuelLevelFilter, useLastSeenFilter, useMetadataCompletenessFilter, useModbusProfileFilter, useModelsFilter, 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.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@trackunit/react-core-hooks": "1.17.71",
|
|
18
18
|
"@trackunit/react-filter-components": "2.1.66",
|
|
19
19
|
"@trackunit/react-form-components": "2.1.65",
|
|
20
|
-
"@trackunit/filters-graphql-hook": "2.1.
|
|
20
|
+
"@trackunit/filters-graphql-hook": "2.1.92",
|
|
21
21
|
"@trackunit/utilization-indicator": "2.1.62",
|
|
22
22
|
"@trackunit/geo-json-utils": "1.14.60",
|
|
23
23
|
"@trackunit/react-components": "2.1.62",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FilterViewProps, ValueName } from "@trackunit/filters-filter-bar";
|
|
2
|
+
import { ReactElement } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* The CAN 1 Profile Filter component.
|
|
5
|
+
*
|
|
6
|
+
* Provides an interface to select CAN profiles reported on the CAN1 port. Options are
|
|
7
|
+
* fetched from a GraphQL query keyed by the profile key, but only the resolved profile
|
|
8
|
+
* name is displayed. Searching is delegated to the backend, which matches against the
|
|
9
|
+
* profile key.
|
|
10
|
+
*
|
|
11
|
+
* @param props - The filter view props.
|
|
12
|
+
* @param props.filterDefinition - The filter's definition.
|
|
13
|
+
* @param props.filterState - The current state of the filter, including selected values.
|
|
14
|
+
* @param props.filterBarActions - Actions for the filter's interaction with the filter bar.
|
|
15
|
+
* @returns {ReactElement} React component to render the CAN1 profile filter.
|
|
16
|
+
*/
|
|
17
|
+
export declare const Can1ProfileFilter: ({ filterDefinition, filterState, filterBarActions, ...props }: FilterViewProps<Array<ValueName>>) => ReactElement;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FilterViewProps, ValueName } from "@trackunit/filters-filter-bar";
|
|
2
|
+
import { ReactElement } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* The CAN 2 Profile Filter component.
|
|
5
|
+
*
|
|
6
|
+
* Provides an interface to select CAN profiles reported on the CAN2 port. Options are
|
|
7
|
+
* fetched from a GraphQL query keyed by the profile key, but only the resolved profile
|
|
8
|
+
* name is displayed. Searching is delegated to the backend, which matches against the
|
|
9
|
+
* profile key.
|
|
10
|
+
*
|
|
11
|
+
* @param props - The filter view props.
|
|
12
|
+
* @param props.filterDefinition - The filter's definition.
|
|
13
|
+
* @param props.filterState - The current state of the filter, including selected values.
|
|
14
|
+
* @param props.filterBarActions - Actions for the filter's interaction with the filter bar.
|
|
15
|
+
* @returns {ReactElement} React component to render the CAN2 profile filter.
|
|
16
|
+
*/
|
|
17
|
+
export declare const Can2ProfileFilter: ({ filterDefinition, filterState, filterBarActions, ...props }: FilterViewProps<Array<ValueName>>) => ReactElement;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ValueNameArrayFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
|
+
/**
|
|
3
|
+
* Get the CAN 1 Profile filter definition
|
|
4
|
+
*
|
|
5
|
+
* @returns {ValueNameArrayFilterDefinition} The CAN 1 Profile filter definition
|
|
6
|
+
*/
|
|
7
|
+
export declare const useCan1ProfileFilter: () => ValueNameArrayFilterDefinition;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ValueNameArrayFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
|
+
/**
|
|
3
|
+
* Get the CAN 2 Profile filter definition
|
|
4
|
+
*
|
|
5
|
+
* @returns {ValueNameArrayFilterDefinition} The CAN 2 Profile filter definition
|
|
6
|
+
*/
|
|
7
|
+
export declare const useCan2ProfileFilter: () => ValueNameArrayFilterDefinition;
|
|
@@ -12,6 +12,22 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
|
|
|
12
12
|
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
|
|
13
13
|
*/
|
|
14
14
|
declare const documents: {
|
|
15
|
+
"query TelematicsDeviceCan1ProfileNames {\n telematicsDeviceSummary {\n can1Profiles {\n summary {\n key\n name\n }\n }\n }\n}": DocumentNode<types.TelematicsDeviceCan1ProfileNamesQuery, types.Exact<{
|
|
16
|
+
[key: string]: never;
|
|
17
|
+
}>>;
|
|
18
|
+
"query GetFleetCan1ProfileSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n can1ProfileSummary(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}": DocumentNode<types.GetFleetCan1ProfileSummaryQuery, types.Exact<{
|
|
19
|
+
filters: types.InputMaybe<types.AssetFiltersInput>;
|
|
20
|
+
search: types.InputMaybe<types.Scalars["String"]["input"]>;
|
|
21
|
+
limit: types.InputMaybe<types.Scalars["Int"]["input"]>;
|
|
22
|
+
}>>;
|
|
23
|
+
"query TelematicsDeviceCan2ProfileNames {\n telematicsDeviceSummary {\n can2Profiles {\n summary {\n key\n name\n }\n }\n }\n}": DocumentNode<types.TelematicsDeviceCan2ProfileNamesQuery, types.Exact<{
|
|
24
|
+
[key: string]: never;
|
|
25
|
+
}>>;
|
|
26
|
+
"query GetFleetCan2ProfileSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n can2ProfileSummary(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}": DocumentNode<types.GetFleetCan2ProfileSummaryQuery, types.Exact<{
|
|
27
|
+
filters: types.InputMaybe<types.AssetFiltersInput>;
|
|
28
|
+
search: types.InputMaybe<types.Scalars["String"]["input"]>;
|
|
29
|
+
limit: types.InputMaybe<types.Scalars["Int"]["input"]>;
|
|
30
|
+
}>>;
|
|
15
31
|
"query GetFleetCountriesSummary($filters: AssetFiltersInput, $limit: Int) {\n assetSummary(filters: $filters) {\n countries(limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}": DocumentNode<types.GetFleetCountriesSummaryQuery, types.Exact<{
|
|
16
32
|
filters: types.InputMaybe<types.AssetFiltersInput>;
|
|
17
33
|
limit: types.InputMaybe<types.Scalars["Int"]["input"]>;
|
|
@@ -55,6 +71,22 @@ declare const documents: {
|
|
|
55
71
|
* Please regenerate the types.
|
|
56
72
|
*/
|
|
57
73
|
export declare function graphql(source: string): unknown;
|
|
74
|
+
/**
|
|
75
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
76
|
+
*/
|
|
77
|
+
export declare function graphql(source: "query TelematicsDeviceCan1ProfileNames {\n telematicsDeviceSummary {\n can1Profiles {\n summary {\n key\n name\n }\n }\n }\n}"): (typeof documents)["query TelematicsDeviceCan1ProfileNames {\n telematicsDeviceSummary {\n can1Profiles {\n summary {\n key\n name\n }\n }\n }\n}"];
|
|
78
|
+
/**
|
|
79
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
80
|
+
*/
|
|
81
|
+
export declare function graphql(source: "query GetFleetCan1ProfileSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n can1ProfileSummary(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}"): (typeof documents)["query GetFleetCan1ProfileSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n can1ProfileSummary(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}"];
|
|
82
|
+
/**
|
|
83
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
84
|
+
*/
|
|
85
|
+
export declare function graphql(source: "query TelematicsDeviceCan2ProfileNames {\n telematicsDeviceSummary {\n can2Profiles {\n summary {\n key\n name\n }\n }\n }\n}"): (typeof documents)["query TelematicsDeviceCan2ProfileNames {\n telematicsDeviceSummary {\n can2Profiles {\n summary {\n key\n name\n }\n }\n }\n}"];
|
|
86
|
+
/**
|
|
87
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
88
|
+
*/
|
|
89
|
+
export declare function graphql(source: "query GetFleetCan2ProfileSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n can2ProfileSummary(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}"): (typeof documents)["query GetFleetCan2ProfileSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n can2ProfileSummary(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}"];
|
|
58
90
|
/**
|
|
59
91
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
60
92
|
*/
|