@trackunit/filters-asset-filter-definitions 1.5.108 → 1.5.115
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 +276 -90
- package/index.esm.js +252 -93
- package/package.json +18 -18
- package/src/defaultFilters/defaults/ActiveFilter.d.ts +10 -1
- package/src/defaultFilters/defaults/ActivityFilter.d.ts +10 -1
- package/src/defaultFilters/defaults/AssetIdsFilter.d.ts +10 -1
- package/src/defaultFilters/defaults/AssetTypeFilter.d.ts +11 -1
- package/src/defaultFilters/defaults/BrandFilter.d.ts +9 -1
- package/src/defaultFilters/defaults/CriticalityFilter.d.ts +9 -1
- package/src/defaultFilters/defaults/CustomerIdsFilter.d.ts +11 -1
- package/src/defaultFilters/defaults/FollowedFilter.d.ts +9 -1
- package/src/defaultFilters/defaults/GroupIdsFilter.d.ts +10 -1
- package/src/defaultFilters/defaults/HourIntervalFilter.d.ts +9 -1
- package/src/defaultFilters/defaults/LastSeenFilter.d.ts +9 -1
- package/src/defaultFilters/defaults/MetadataCompletenessFilter.d.ts +11 -1
- package/src/defaultFilters/defaults/ModelsFilter.d.ts +10 -1
- package/src/defaultFilters/defaults/OwnerAccountIdsFilter.d.ts +9 -1
- package/src/defaultFilters/defaults/PartnerFilter.d.ts +12 -1
- package/src/defaultFilters/defaults/PeriodFilter.d.ts +13 -1
- package/src/defaultFilters/defaults/ProductionYearFilter.d.ts +15 -1
- package/src/defaultFilters/defaults/ServicePlanStatusFilter.d.ts +11 -1
- package/src/defaultFilters/defaults/SiteDepotOwnershipIdsFilter.d.ts +9 -1
- package/src/defaultFilters/defaults/SiteIdsFilter.d.ts +12 -1
- package/src/defaultFilters/defaults/SiteStatusFilter.d.ts +9 -1
- package/src/defaultFilters/defaults/SiteTypeFilter.d.ts +9 -1
- package/src/defaultFilters/defaults/TelematicsConnectedFilter.d.ts +11 -1
- package/src/defaultFilters/defaults/area/AreaFilter.d.ts +12 -1
- package/src/defaultFilters/defaults/index.d.ts +2 -0
- package/src/defaultFilters/defaults/mock.d.ts +2 -0
package/index.cjs.js
CHANGED
|
@@ -304,6 +304,13 @@ const setupLibraryTranslations = () => {
|
|
|
304
304
|
i18nLibraryTranslation.registerTranslations(translations);
|
|
305
305
|
};
|
|
306
306
|
|
|
307
|
+
/**
|
|
308
|
+
* Renders the Active Filter view with the provided props.
|
|
309
|
+
*
|
|
310
|
+
* @param {FilterViewProps<BooleanValue>} props - The properties for the filter view, which include
|
|
311
|
+
* the filter definition, current state, and relevant actions.
|
|
312
|
+
* @returns {ReactElement} A React element rendering the Active Filter view.
|
|
313
|
+
*/
|
|
307
314
|
const ActiveFilterFiltersView = (props) => {
|
|
308
315
|
const [t] = useTranslation();
|
|
309
316
|
const { logEvent } = reactCoreHooks.useAnalytics(filtersFilterBar.FilterEvents);
|
|
@@ -1938,6 +1945,13 @@ const mapActivityToLabelId = (state) => {
|
|
|
1938
1945
|
return "assetFilters.activityFilter.unknown";
|
|
1939
1946
|
}
|
|
1940
1947
|
};
|
|
1948
|
+
/**
|
|
1949
|
+
* Renders the Activity Filters view with the provided filter properties.
|
|
1950
|
+
*
|
|
1951
|
+
* @param {FilterViewProps<string[]>} props - The properties for the filter view, including filter definition,
|
|
1952
|
+
* state, value, and actions.
|
|
1953
|
+
* @returns {ReactElement} A React element rendering the Activity Filters view.
|
|
1954
|
+
*/
|
|
1941
1955
|
const ActivityFiltersView = ({ filterBarActions, filterDefinition, filterState, value, setValue, }) => {
|
|
1942
1956
|
const [t] = useTranslation();
|
|
1943
1957
|
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(filterState.values);
|
|
@@ -2183,6 +2197,13 @@ const usePlacesSearch = ({ localStorageKey = SHARED_LOCATIONS_LOCAL_STORAGE_KEY,
|
|
|
2183
2197
|
};
|
|
2184
2198
|
};
|
|
2185
2199
|
|
|
2200
|
+
/**
|
|
2201
|
+
* Renders the AreaView component, which manages the UI and logic for an area filter
|
|
2202
|
+
* with optional search functionality.
|
|
2203
|
+
*
|
|
2204
|
+
* @param {FilterViewProps<AreaFilterGeoJsonGeometry> & { showWithSearch: boolean }} props - The props for the component.
|
|
2205
|
+
* @returns {ReactElement} The rendered AreaView component.
|
|
2206
|
+
*/
|
|
2186
2207
|
const AreaView = (props) => {
|
|
2187
2208
|
const [t] = useTranslation();
|
|
2188
2209
|
const { logEvent } = reactCoreHooks.useAnalytics(filtersFilterBar.FilterEvents);
|
|
@@ -2317,6 +2338,13 @@ const getSelectedOption = (value, options) => {
|
|
|
2317
2338
|
});
|
|
2318
2339
|
};
|
|
2319
2340
|
|
|
2341
|
+
/**
|
|
2342
|
+
* Renders a filter view component with a header and optional additional elements for Asset IDs.
|
|
2343
|
+
*
|
|
2344
|
+
* @param {FilterViewProps<string[]>} props - The properties for the filter view, including
|
|
2345
|
+
* filter definition, state, and actions.
|
|
2346
|
+
* @returns {ReactElement} A component rendering the Asset IDs filter view.
|
|
2347
|
+
*/
|
|
2320
2348
|
const AssetIdsFiltersView = (props) => {
|
|
2321
2349
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(filtersFilterBar.FilterHeader, { ...props.filterDefinition, ...props.filterBarActions, filterHasChanges: props.filterBarActions.appliedFilterKeys().includes(props.filterDefinition.filterKey) }), jsxRuntime.jsx("span", {})] }));
|
|
2322
2350
|
};
|
|
@@ -2352,6 +2380,12 @@ const assetTypeConst = {
|
|
|
2352
2380
|
VEHICLE: "VEHICLE",
|
|
2353
2381
|
};
|
|
2354
2382
|
const ALL_TYPES = sharedUtils.objectValues(assetTypeConst);
|
|
2383
|
+
/**
|
|
2384
|
+
* A filter view component for filtering asset types.
|
|
2385
|
+
*
|
|
2386
|
+
* @param {FilterViewProps<string[]> & { showTypes: AssetType[] }} props - Component props.
|
|
2387
|
+
* @returns {ReactElement} The rendered filter view component.
|
|
2388
|
+
*/
|
|
2355
2389
|
const AssetTypesFilterView = (props) => {
|
|
2356
2390
|
const [t] = useTranslation();
|
|
2357
2391
|
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(props.filterState.values);
|
|
@@ -2412,6 +2446,12 @@ const useAssetTypeFilter = ({ showTypes } = { showTypes: ALL_TYPES }) => {
|
|
|
2412
2446
|
};
|
|
2413
2447
|
|
|
2414
2448
|
const FETCH_LIMIT$8 = 1000;
|
|
2449
|
+
/**
|
|
2450
|
+
* React component for rendering the brand filter.
|
|
2451
|
+
*
|
|
2452
|
+
* @param {FilterViewProps<string[]>} props - The component's properties, including filter state and values.
|
|
2453
|
+
* @returns {ReactElement} The brand filter component.
|
|
2454
|
+
*/
|
|
2415
2455
|
const BrandFilterView = (props) => {
|
|
2416
2456
|
const { getMachineTypeTranslation } = translationsMachineType.useMachineTypeTranslations();
|
|
2417
2457
|
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(props.filterState.values);
|
|
@@ -2481,8 +2521,8 @@ const mapCriticalityToLabelId = (state) => {
|
|
|
2481
2521
|
/**
|
|
2482
2522
|
* Criticality filter definition
|
|
2483
2523
|
*
|
|
2484
|
-
* @param props FilterViewProps for the filter
|
|
2485
|
-
* @returns {
|
|
2524
|
+
* @param {FilterViewProps<string[]>} props FilterViewProps for the filter
|
|
2525
|
+
* @returns {ReactElement} The criticality filter component.
|
|
2486
2526
|
*/
|
|
2487
2527
|
const CriticalityFiltersView = (props) => {
|
|
2488
2528
|
const [t] = useTranslation();
|
|
@@ -2665,6 +2705,14 @@ const useCustomerHierarchy = (customerSummary) => {
|
|
|
2665
2705
|
}, [customerSummary]);
|
|
2666
2706
|
};
|
|
2667
2707
|
|
|
2708
|
+
/**
|
|
2709
|
+
* A filter view for customer IDs.
|
|
2710
|
+
*
|
|
2711
|
+
* This component renders a hierarchical checkbox filter for selecting customer IDs.
|
|
2712
|
+
*
|
|
2713
|
+
* @param {FilterViewProps<ValueName[]>} props - Filter properties including data, state, and actions.
|
|
2714
|
+
* @returns {ReactElement} A customer ID filter component for rendering in the UI.
|
|
2715
|
+
*/
|
|
2668
2716
|
const CustomerIdsFilterView = (props) => {
|
|
2669
2717
|
const { data, loading, searchText, setSearchText } = useCustomerData(props.filterState.values);
|
|
2670
2718
|
const hierarchicalOptions = useCustomerHierarchy(data?.assetSummary?.customers?.summary);
|
|
@@ -2698,6 +2746,12 @@ const useCustomerIdsFilter = ({ showInStarredMenu, showInFilterBar, defaultValue
|
|
|
2698
2746
|
return result;
|
|
2699
2747
|
};
|
|
2700
2748
|
|
|
2749
|
+
/**
|
|
2750
|
+
* The `FollowedFiltersView` component displays filter settings for "Followed" and allows the user to select between different values.
|
|
2751
|
+
*
|
|
2752
|
+
* @param {FilterViewProps<string>} props The component's props, including filter definition, filter bar actions, and the current value.
|
|
2753
|
+
* @returns {ReactElement} element that represents the "Followed" filters view.
|
|
2754
|
+
*/
|
|
2701
2755
|
const FollowedFiltersView = (props) => {
|
|
2702
2756
|
const [t] = useTranslation();
|
|
2703
2757
|
const { logEvent } = reactCoreHooks.useAnalytics(filtersFilterBar.FilterEvents);
|
|
@@ -2737,6 +2791,13 @@ const useFollowedFilter = () => {
|
|
|
2737
2791
|
};
|
|
2738
2792
|
|
|
2739
2793
|
const FETCH_LIMIT$6 = 1000;
|
|
2794
|
+
/**
|
|
2795
|
+
* The GroupIdsFilterView component is a filter view for group IDs.
|
|
2796
|
+
* It utilizes a checkbox filter with a search feature to display and manage group selections.
|
|
2797
|
+
*
|
|
2798
|
+
* @param {FilterViewProps<ValueName[]>} props - The properties for the filter view, including filter state and callbacks.
|
|
2799
|
+
* @returns {ReactElement} The GroupIdsFilterView component.
|
|
2800
|
+
*/
|
|
2740
2801
|
const GroupIdsFilterView = (props) => {
|
|
2741
2802
|
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(props.filterState.values);
|
|
2742
2803
|
const [showRequestMoreUseSearch, setShowRequestMoreUseSearch] = react.useState(false);
|
|
@@ -2793,6 +2854,12 @@ const useGroupIdsFilter = () => {
|
|
|
2793
2854
|
return result;
|
|
2794
2855
|
};
|
|
2795
2856
|
|
|
2857
|
+
/**
|
|
2858
|
+
* Component representing the view for the HourInterval filter with a checkbox list.
|
|
2859
|
+
*
|
|
2860
|
+
* @param {FilterViewProps<string[]>} props - Properties passed to the component.
|
|
2861
|
+
* @returns {ReactElement} Rendered checkbox filter.
|
|
2862
|
+
*/
|
|
2796
2863
|
const HourIntervalFilterView = (props) => {
|
|
2797
2864
|
return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, options: ["N/A", ...sharedUtils.hourIntervals].map(interval => ({
|
|
2798
2865
|
key: interval,
|
|
@@ -2828,6 +2895,12 @@ exports.AssetLastSeen = void 0;
|
|
|
2828
2895
|
AssetLastSeen["LastHour"] = "LAST_HOUR";
|
|
2829
2896
|
AssetLastSeen["OlderThan_30Days"] = "OLDER_THAN_30_DAYS";
|
|
2830
2897
|
})(exports.AssetLastSeen || (exports.AssetLastSeen = {}));
|
|
2898
|
+
/**
|
|
2899
|
+
* Represents the view component for the "Last Seen" filter.
|
|
2900
|
+
*
|
|
2901
|
+
* @param {FilterViewProps<string>} props - The properties required for the Last Seen filter view.
|
|
2902
|
+
* @returns {ReactElement} The rendered Last Seen filter view component.
|
|
2903
|
+
*/
|
|
2831
2904
|
const LastSeenFiltersView = (props) => {
|
|
2832
2905
|
const [t] = useTranslation();
|
|
2833
2906
|
const { logEvent } = reactCoreHooks.useAnalytics(filtersFilterBar.FilterEvents);
|
|
@@ -2901,6 +2974,13 @@ const mapMetadataCompletenessToLabelId = (type) => {
|
|
|
2901
2974
|
return "assetFilters.unknown";
|
|
2902
2975
|
}
|
|
2903
2976
|
};
|
|
2977
|
+
/**
|
|
2978
|
+
* The `MetadataCompletenessFilterView` component provides a filter
|
|
2979
|
+
* for selecting metadata completeness levels.
|
|
2980
|
+
*
|
|
2981
|
+
* @param {FilterViewProps<ValueName>} props - Props passed to the filter component
|
|
2982
|
+
* @returns {ReactElement} The JSX element representing the filter
|
|
2983
|
+
*/
|
|
2904
2984
|
const MetadataCompletenessFilterView = (props) => {
|
|
2905
2985
|
const [t] = useTranslation();
|
|
2906
2986
|
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(props.filterState.values);
|
|
@@ -2954,6 +3034,13 @@ const useMetadataCompletenessFilter = ({ isDefault } = {}) => {
|
|
|
2954
3034
|
};
|
|
2955
3035
|
|
|
2956
3036
|
const FETCH_LIMIT$5 = 1000;
|
|
3037
|
+
/**
|
|
3038
|
+
* Renders a custom model filter component, allowing filtering of active assets by models.
|
|
3039
|
+
* It also provides search functionality and controls for managing filtered results.
|
|
3040
|
+
*
|
|
3041
|
+
* @param {FilterViewProps<string[]>} props - The filter view properties, including filters and their state.
|
|
3042
|
+
* @returns {ReactElement} The rendered model filter component.
|
|
3043
|
+
*/
|
|
2957
3044
|
const ModelsFilterView = (props) => {
|
|
2958
3045
|
const { getMachineTypeTranslation } = translationsMachineType.useMachineTypeTranslations();
|
|
2959
3046
|
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(props.filterState.values);
|
|
@@ -3007,6 +3094,12 @@ const useModelsFilter = () => {
|
|
|
3007
3094
|
};
|
|
3008
3095
|
|
|
3009
3096
|
const FETCH_LIMIT$4 = 1000;
|
|
3097
|
+
/**
|
|
3098
|
+
* Component for rendering the Owner Account IDs filter view within the filter bar.
|
|
3099
|
+
*
|
|
3100
|
+
* @param {FilterViewProps<ValueName[]>} props - The props to render the filter view, including filter state and settings.
|
|
3101
|
+
* @returns {ReactElement} The rendered filter view component.
|
|
3102
|
+
*/
|
|
3010
3103
|
const OwnerAccountIdsFilterView = (props) => {
|
|
3011
3104
|
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(props.filterState.values);
|
|
3012
3105
|
const [showRequestMoreUseSearch, setShowRequestMoreUseSearch] = react.useState(false);
|
|
@@ -3057,6 +3150,38 @@ const useOwnerAccountIdsFilter = (defaultValue) => {
|
|
|
3057
3150
|
return result;
|
|
3058
3151
|
};
|
|
3059
3152
|
|
|
3153
|
+
/**
|
|
3154
|
+
* A React component that renders a filter header and body for the partner filter.
|
|
3155
|
+
*
|
|
3156
|
+
* @param {FilterViewProps<ValueName[]>} props - The props for the PartnerFilterView component.
|
|
3157
|
+
* @param {ValueNameArrayFilterDefinition} props.filterDefinition - The filter definition object.
|
|
3158
|
+
* @param {ValueName[]} props.value - The selected filter values.
|
|
3159
|
+
* @param {object} props.filterBarActions - Actions related to the filter bar API.
|
|
3160
|
+
* @returns {ReactElement} The rendered PartnerFilterView component.
|
|
3161
|
+
*/
|
|
3162
|
+
const PartnerFilterView = ({ filterDefinition, value, filterBarActions, }) => {
|
|
3163
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(filtersFilterBar.FilterHeader, { ...filterDefinition, ...filterBarActions, filterHasChanges: filterBarActions.appliedFilterKeys().includes(filterDefinition.filterKey) }), jsxRuntime.jsx(reactFilterComponents.FilterBody, { limitSize: true, children: value?.map(vn => vn.name).join(",") })] }));
|
|
3164
|
+
};
|
|
3165
|
+
/**
|
|
3166
|
+
* Partner filter definition
|
|
3167
|
+
*
|
|
3168
|
+
* @returns {ValueNameArrayFilterDefinition} Partner filter definition
|
|
3169
|
+
*/
|
|
3170
|
+
const usePartnerFilter = () => {
|
|
3171
|
+
const [t] = useTranslation();
|
|
3172
|
+
const result = react.useMemo(() => {
|
|
3173
|
+
return {
|
|
3174
|
+
filterKey: "partner",
|
|
3175
|
+
type: "valueNameArray",
|
|
3176
|
+
group: "OTHER",
|
|
3177
|
+
title: t("assetFilters.partnerFilter.label"),
|
|
3178
|
+
showInStarredMenu: () => false,
|
|
3179
|
+
component: props => jsxRuntime.jsx(PartnerFilterView, { ...props }),
|
|
3180
|
+
};
|
|
3181
|
+
}, [t]);
|
|
3182
|
+
return result;
|
|
3183
|
+
};
|
|
3184
|
+
|
|
3060
3185
|
exports.DayPeriod = void 0;
|
|
3061
3186
|
(function (DayPeriod) {
|
|
3062
3187
|
DayPeriod["LAST_24_HOURS"] = "LAST_24_HOURS";
|
|
@@ -3065,6 +3190,16 @@ exports.DayPeriod = void 0;
|
|
|
3065
3190
|
DayPeriod["LIFETIME"] = "LIFETIME";
|
|
3066
3191
|
DayPeriod["LAST_YEAR"] = "LAST_YEAR";
|
|
3067
3192
|
})(exports.DayPeriod || (exports.DayPeriod = {}));
|
|
3193
|
+
/**
|
|
3194
|
+
* Renders the Period Filter component, which allows users to select a time period for filtering data.
|
|
3195
|
+
*
|
|
3196
|
+
* @param {FilterViewProps<string>} props - The properties for the Period Filter component, including:
|
|
3197
|
+
* - filterDefinition (definition of the filter)
|
|
3198
|
+
* - filterBarActions (actions applicable to the filter bar)
|
|
3199
|
+
* - setValue (function to update the filter value)
|
|
3200
|
+
* - value (current value of the filter)
|
|
3201
|
+
* @returns {ReactElement} The rendered component.
|
|
3202
|
+
*/
|
|
3068
3203
|
const PeriodFilterView = (props) => {
|
|
3069
3204
|
const [t] = useTranslation();
|
|
3070
3205
|
const { logEvent } = reactCoreHooks.useAnalytics(filtersFilterBar.FilterEvents);
|
|
@@ -3109,6 +3244,18 @@ const usePeriodFilter = () => {
|
|
|
3109
3244
|
};
|
|
3110
3245
|
|
|
3111
3246
|
const FETCH_LIMIT$3 = 1000;
|
|
3247
|
+
/**
|
|
3248
|
+
* Production Year Filter View component.
|
|
3249
|
+
*
|
|
3250
|
+
* This component provides an interface to select production years.
|
|
3251
|
+
* It fetches data from a GraphQL query and integrates with the filter bar's filtering logic.
|
|
3252
|
+
*
|
|
3253
|
+
* @param {ValueNameArrayFilterDefinition} filterDefinition - The filter's definition.
|
|
3254
|
+
* @param {object} filterState - The current state of the filter, including selected values.
|
|
3255
|
+
* @param {object} filterBarActions - Actions for the filter's interaction with the filter bar.
|
|
3256
|
+
* @param {object} props - Additional props passed to the component.
|
|
3257
|
+
* @returns {JSX.Element} React component to render the production year filter.
|
|
3258
|
+
*/
|
|
3112
3259
|
const ProductionYearFilterView = ({ filterDefinition, filterState, filterBarActions, ...props }) => {
|
|
3113
3260
|
const [t] = useTranslation();
|
|
3114
3261
|
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(filterState.values);
|
|
@@ -3285,7 +3432,7 @@ const mapServicePlansStatusToLabelId = (servicePlan) => {
|
|
|
3285
3432
|
* Service plan status filter definition
|
|
3286
3433
|
*
|
|
3287
3434
|
* @param props FilterViewProps for the filter
|
|
3288
|
-
* @returns {
|
|
3435
|
+
* @returns {ReactElement} The rendered filter view component.
|
|
3289
3436
|
*/
|
|
3290
3437
|
const ServicePanStatusesFiltersView = (props) => {
|
|
3291
3438
|
const [t] = useTranslation();
|
|
@@ -3347,6 +3494,80 @@ const useServicePlanStatusFilter = ({ showInStarredMenu, showInFilterBar, servic
|
|
|
3347
3494
|
};
|
|
3348
3495
|
|
|
3349
3496
|
const FETCH_LIMIT$2 = 1000;
|
|
3497
|
+
/**
|
|
3498
|
+
* Component for rendering a filter view specific to site depot ownership.
|
|
3499
|
+
*
|
|
3500
|
+
* @param {FilterViewProps<ValueName[]>} props - The props required for the filter view.
|
|
3501
|
+
* @returns {ReactElement} The filter view component.
|
|
3502
|
+
*/
|
|
3503
|
+
const SiteDepotOwnershipIdsFilterView = (props) => {
|
|
3504
|
+
const [t] = useTranslation();
|
|
3505
|
+
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(props.filterState.values);
|
|
3506
|
+
const [showRequestMoreUseSearch, setShowRequestMoreUseSearch] = react.useState(false);
|
|
3507
|
+
const [searchText, setSearchText] = react.useState("");
|
|
3508
|
+
const debouncedSearch = reactComponents.useDebounce(searchText, 500);
|
|
3509
|
+
const { data, loading } = client.useQuery(GetSiteDepotOwnershipIdSummaryDocument, {
|
|
3510
|
+
fetchPolicy: "cache-first",
|
|
3511
|
+
variables: {
|
|
3512
|
+
limit: FETCH_LIMIT$2,
|
|
3513
|
+
search: debouncedSearch,
|
|
3514
|
+
filters: {
|
|
3515
|
+
...activeFilters,
|
|
3516
|
+
owningDepotSiteIds: null, // Omit the filters own values so list shows options correctly
|
|
3517
|
+
},
|
|
3518
|
+
},
|
|
3519
|
+
});
|
|
3520
|
+
const options = react.useMemo(() => {
|
|
3521
|
+
const result = data?.assetSummary?.owningDepots?.summary.map(owningDepotEdge => ({
|
|
3522
|
+
key: owningDepotEdge.site?.siteId ? owningDepotEdge.site.siteId || "unknown" : "UNDEFINED",
|
|
3523
|
+
count: owningDepotEdge.count || 0,
|
|
3524
|
+
label: owningDepotEdge.site?.name === "UNDEFINED"
|
|
3525
|
+
? t("siteOwningDepot.notOwned")
|
|
3526
|
+
: owningDepotEdge.site?.name || t("siteOwningDepot.unknown"),
|
|
3527
|
+
})) ?? [];
|
|
3528
|
+
return result;
|
|
3529
|
+
}, [data?.assetSummary?.owningDepots?.summary, t]);
|
|
3530
|
+
react.useEffect(() => {
|
|
3531
|
+
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$2);
|
|
3532
|
+
}, [options]);
|
|
3533
|
+
return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
|
|
3534
|
+
};
|
|
3535
|
+
/**
|
|
3536
|
+
* Site depot ownership filter definition
|
|
3537
|
+
*
|
|
3538
|
+
* @returns {ValueNameFilterDefinition} Site depot ownership filter definition
|
|
3539
|
+
*/
|
|
3540
|
+
const useSiteDepotOwnershipIdsFilter = ({ showInStarredMenu, showInFilterBar, defaultValue } = {
|
|
3541
|
+
showInStarredMenu: () => true,
|
|
3542
|
+
showInFilterBar: () => true,
|
|
3543
|
+
}) => {
|
|
3544
|
+
const [t] = useTranslation();
|
|
3545
|
+
const result = react.useMemo(() => {
|
|
3546
|
+
return {
|
|
3547
|
+
filterKey: "siteDepotOwnershipIds",
|
|
3548
|
+
type: "valueNameArray",
|
|
3549
|
+
default: true,
|
|
3550
|
+
defaultValue,
|
|
3551
|
+
group: "SITES",
|
|
3552
|
+
title: t("fleetlist.column.siteDepotOwnershipIds"),
|
|
3553
|
+
showInStarredMenu,
|
|
3554
|
+
showInFilterBar,
|
|
3555
|
+
component: props => jsxRuntime.jsx(SiteDepotOwnershipIdsFilterView, { ...props }),
|
|
3556
|
+
};
|
|
3557
|
+
}, [showInFilterBar, showInStarredMenu, defaultValue, t]);
|
|
3558
|
+
return result;
|
|
3559
|
+
};
|
|
3560
|
+
|
|
3561
|
+
const FETCH_LIMIT$1 = 1000;
|
|
3562
|
+
/**
|
|
3563
|
+
* Filter view component for selecting Site IDs.
|
|
3564
|
+
*
|
|
3565
|
+
* This component is responsible for rendering the Site IDs filter with search functionality
|
|
3566
|
+
* and displays the loading state when data is being fetched.
|
|
3567
|
+
*
|
|
3568
|
+
* @param {FilterViewProps<ValueName[]>} props - The properties passed to the component, including the current filter state and methods to manage it.
|
|
3569
|
+
* @returns {ReactElement} The rendered Site IDs filter view component.
|
|
3570
|
+
*/
|
|
3350
3571
|
const SiteIdsFilterView = (props) => {
|
|
3351
3572
|
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(props.filterState.values);
|
|
3352
3573
|
const [showRequestMoreUseSearch, setShowRequestMoreUseSearch] = react.useState(false);
|
|
@@ -3355,7 +3576,7 @@ const SiteIdsFilterView = (props) => {
|
|
|
3355
3576
|
const { data, loading } = client.useQuery(GetSiteIdSummaryDocument, {
|
|
3356
3577
|
fetchPolicy: "cache-first",
|
|
3357
3578
|
variables: {
|
|
3358
|
-
limit: FETCH_LIMIT$
|
|
3579
|
+
limit: FETCH_LIMIT$1,
|
|
3359
3580
|
search: debouncedSearch,
|
|
3360
3581
|
filters: {
|
|
3361
3582
|
...activeFilters,
|
|
@@ -3372,7 +3593,7 @@ const SiteIdsFilterView = (props) => {
|
|
|
3372
3593
|
return result;
|
|
3373
3594
|
}, [data?.assetSummary?.sites?.summary]);
|
|
3374
3595
|
react.useEffect(() => {
|
|
3375
|
-
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$
|
|
3596
|
+
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$1);
|
|
3376
3597
|
}, [options]);
|
|
3377
3598
|
return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
|
|
3378
3599
|
};
|
|
@@ -3410,6 +3631,12 @@ exports.SiteStatus = void 0;
|
|
|
3410
3631
|
SiteStatus["Finished"] = "FINISHED";
|
|
3411
3632
|
SiteStatus["Planned"] = "PLANNED";
|
|
3412
3633
|
})(exports.SiteStatus || (exports.SiteStatus = {}));
|
|
3634
|
+
/**
|
|
3635
|
+
* A component that renders a checkbox filter view with site statuses.
|
|
3636
|
+
*
|
|
3637
|
+
* @param {FilterViewProps<string[]>} props - The properties for the filter component.
|
|
3638
|
+
* @returns {ReactElement} The rendered SiteStatusFilterView component.
|
|
3639
|
+
*/
|
|
3413
3640
|
const SiteStatusFilterView = (props) => {
|
|
3414
3641
|
const [t] = useTranslation();
|
|
3415
3642
|
const shownStatus = [exports.SiteStatus.Active, exports.SiteStatus.Planned, exports.SiteStatus.Finished, exports.SiteStatus.Archived];
|
|
@@ -3490,6 +3717,12 @@ const sortSiteTypeSummary = (arr) => {
|
|
|
3490
3717
|
return typeA - typeB;
|
|
3491
3718
|
});
|
|
3492
3719
|
};
|
|
3720
|
+
/**
|
|
3721
|
+
* A filter view component for selecting site types.
|
|
3722
|
+
*
|
|
3723
|
+
* @param {FilterViewProps<string[]>} props - The filter view properties, including filter state and actions.
|
|
3724
|
+
* @returns {ReactElement} - The rendered filter view component.
|
|
3725
|
+
*/
|
|
3493
3726
|
const SiteTypesFilterView = (props) => {
|
|
3494
3727
|
const [t] = useTranslation();
|
|
3495
3728
|
const { assetQueryVariables } = filtersGraphqlHook.useAssetQueryFilters({ filters: props.filterState.values });
|
|
@@ -3571,6 +3804,14 @@ const mapSiteTypeToLabelId = (type) => {
|
|
|
3571
3804
|
}
|
|
3572
3805
|
};
|
|
3573
3806
|
|
|
3807
|
+
/**
|
|
3808
|
+
* The `TelematicsConnectedFiltersView` component serves as a filter view for telematics connection status
|
|
3809
|
+
* (connected or not connected). It integrates with the telemetry filter bar and displays options with counts
|
|
3810
|
+
* based on the current asset telematics connection summary.
|
|
3811
|
+
*
|
|
3812
|
+
* @param {FilterViewProps<BooleanValue>} props - Props containing filter state, filter actions, and definitions.
|
|
3813
|
+
* @returns {ReactElement} Rendered component for the telematics connection filter.
|
|
3814
|
+
*/
|
|
3574
3815
|
const TelematicsConnectedFiltersView = (props) => {
|
|
3575
3816
|
const [t] = useTranslation();
|
|
3576
3817
|
const { logEvent } = reactCoreHooks.useAnalytics(filtersFilterBar.FilterEvents);
|
|
@@ -3626,7 +3867,7 @@ const useTelematicsConnectedFilter = () => {
|
|
|
3626
3867
|
return result;
|
|
3627
3868
|
};
|
|
3628
3869
|
|
|
3629
|
-
const FETCH_LIMIT
|
|
3870
|
+
const FETCH_LIMIT = 1000;
|
|
3630
3871
|
/**
|
|
3631
3872
|
* Functional component for rendering a checkbox filter for types.
|
|
3632
3873
|
*
|
|
@@ -3642,7 +3883,7 @@ const TypesFilterView = (props) => {
|
|
|
3642
3883
|
const { data, loading } = client.useQuery(GetFleetTypesSummaryDocument, {
|
|
3643
3884
|
fetchPolicy: "cache-first",
|
|
3644
3885
|
variables: {
|
|
3645
|
-
limit: FETCH_LIMIT
|
|
3886
|
+
limit: FETCH_LIMIT,
|
|
3646
3887
|
search: debouncedSearch,
|
|
3647
3888
|
filters: {
|
|
3648
3889
|
...activeFilters,
|
|
@@ -3659,7 +3900,7 @@ const TypesFilterView = (props) => {
|
|
|
3659
3900
|
return result;
|
|
3660
3901
|
}, [data?.assetSummary?.types?.summary, getMachineTypeTranslation]);
|
|
3661
3902
|
react.useEffect(() => {
|
|
3662
|
-
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT
|
|
3903
|
+
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT);
|
|
3663
3904
|
}, [options]);
|
|
3664
3905
|
return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
|
|
3665
3906
|
};
|
|
@@ -4116,88 +4357,6 @@ const mockForGetPlaceDetailsQuery = (variables, data) => {
|
|
|
4116
4357
|
}, data || {}));
|
|
4117
4358
|
};
|
|
4118
4359
|
|
|
4119
|
-
const PartnerFilterView = ({ filterDefinition, value, filterBarActions }) => {
|
|
4120
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(filtersFilterBar.FilterHeader, { ...filterDefinition, ...filterBarActions, filterHasChanges: filterBarActions.appliedFilterKeys().includes(filterDefinition.filterKey) }), jsxRuntime.jsx(reactFilterComponents.FilterBody, { limitSize: true, children: value?.map(vn => vn.name).join(",") })] }));
|
|
4121
|
-
};
|
|
4122
|
-
/**
|
|
4123
|
-
* Partner filter definition
|
|
4124
|
-
*
|
|
4125
|
-
* @returns {ValueNameArrayFilterDefinition} Partner filter definition
|
|
4126
|
-
*/
|
|
4127
|
-
const usePartnerFilter = () => {
|
|
4128
|
-
const [t] = useTranslation();
|
|
4129
|
-
const result = react.useMemo(() => {
|
|
4130
|
-
return {
|
|
4131
|
-
filterKey: "partner",
|
|
4132
|
-
type: "valueNameArray",
|
|
4133
|
-
group: "OTHER",
|
|
4134
|
-
title: t("assetFilters.partnerFilter.label"),
|
|
4135
|
-
showInStarredMenu: () => false,
|
|
4136
|
-
component: props => jsxRuntime.jsx(PartnerFilterView, { ...props }),
|
|
4137
|
-
};
|
|
4138
|
-
}, [t]);
|
|
4139
|
-
return result;
|
|
4140
|
-
};
|
|
4141
|
-
|
|
4142
|
-
const FETCH_LIMIT = 1000;
|
|
4143
|
-
const SiteDepotOwnershipIdsFilterView = (props) => {
|
|
4144
|
-
const [t] = useTranslation();
|
|
4145
|
-
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(props.filterState.values);
|
|
4146
|
-
const [showRequestMoreUseSearch, setShowRequestMoreUseSearch] = react.useState(false);
|
|
4147
|
-
const [searchText, setSearchText] = react.useState("");
|
|
4148
|
-
const debouncedSearch = reactComponents.useDebounce(searchText, 500);
|
|
4149
|
-
const { data, loading } = client.useQuery(GetSiteDepotOwnershipIdSummaryDocument, {
|
|
4150
|
-
fetchPolicy: "cache-first",
|
|
4151
|
-
variables: {
|
|
4152
|
-
limit: FETCH_LIMIT,
|
|
4153
|
-
search: debouncedSearch,
|
|
4154
|
-
filters: {
|
|
4155
|
-
...activeFilters,
|
|
4156
|
-
owningDepotSiteIds: null, // Omit the filters own values so list shows options correctly
|
|
4157
|
-
},
|
|
4158
|
-
},
|
|
4159
|
-
});
|
|
4160
|
-
const options = react.useMemo(() => {
|
|
4161
|
-
const result = data?.assetSummary?.owningDepots?.summary.map(owningDepotEdge => ({
|
|
4162
|
-
key: owningDepotEdge.site?.siteId ? owningDepotEdge.site.siteId || "unknown" : "UNDEFINED",
|
|
4163
|
-
count: owningDepotEdge.count || 0,
|
|
4164
|
-
label: owningDepotEdge.site?.name === "UNDEFINED"
|
|
4165
|
-
? t("siteOwningDepot.notOwned")
|
|
4166
|
-
: owningDepotEdge.site?.name || t("siteOwningDepot.unknown"),
|
|
4167
|
-
})) ?? [];
|
|
4168
|
-
return result;
|
|
4169
|
-
}, [data?.assetSummary?.owningDepots?.summary, t]);
|
|
4170
|
-
react.useEffect(() => {
|
|
4171
|
-
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT);
|
|
4172
|
-
}, [options]);
|
|
4173
|
-
return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
|
|
4174
|
-
};
|
|
4175
|
-
/**
|
|
4176
|
-
* Site depot ownership filter definition
|
|
4177
|
-
*
|
|
4178
|
-
* @returns {ValueNameFilterDefinition} Site depot ownership filter definition
|
|
4179
|
-
*/
|
|
4180
|
-
const useSiteDepotOwnershipIdsFilter = ({ showInStarredMenu, showInFilterBar, defaultValue } = {
|
|
4181
|
-
showInStarredMenu: () => true,
|
|
4182
|
-
showInFilterBar: () => true,
|
|
4183
|
-
}) => {
|
|
4184
|
-
const [t] = useTranslation();
|
|
4185
|
-
const result = react.useMemo(() => {
|
|
4186
|
-
return {
|
|
4187
|
-
filterKey: "siteDepotOwnershipIds",
|
|
4188
|
-
type: "valueNameArray",
|
|
4189
|
-
default: true,
|
|
4190
|
-
defaultValue,
|
|
4191
|
-
group: "SITES",
|
|
4192
|
-
title: t("fleetlist.column.siteDepotOwnershipIds"),
|
|
4193
|
-
showInStarredMenu,
|
|
4194
|
-
showInFilterBar,
|
|
4195
|
-
component: props => jsxRuntime.jsx(SiteDepotOwnershipIdsFilterView, { ...props }),
|
|
4196
|
-
};
|
|
4197
|
-
}, [showInFilterBar, showInStarredMenu, defaultValue, t]);
|
|
4198
|
-
return result;
|
|
4199
|
-
};
|
|
4200
|
-
|
|
4201
4360
|
/**
|
|
4202
4361
|
* Default asset filter bar definition, used to define the default filters for the asset related filters.
|
|
4203
4362
|
*
|
|
@@ -4436,10 +4595,34 @@ const servicePlanSchema = zod.z.array(zod.z.union([
|
|
|
4436
4595
|
setupLibraryTranslations();
|
|
4437
4596
|
|
|
4438
4597
|
exports.ALL_TYPES = ALL_TYPES;
|
|
4598
|
+
exports.ActiveFilterFiltersView = ActiveFilterFiltersView;
|
|
4599
|
+
exports.ActivityFiltersView = ActivityFiltersView;
|
|
4600
|
+
exports.AreaView = AreaView;
|
|
4601
|
+
exports.AssetIdsFiltersView = AssetIdsFiltersView;
|
|
4602
|
+
exports.AssetTypesFilterView = AssetTypesFilterView;
|
|
4603
|
+
exports.BrandFilterView = BrandFilterView;
|
|
4439
4604
|
exports.ClearItemButton = ClearItemButton;
|
|
4605
|
+
exports.CriticalityFiltersView = CriticalityFiltersView;
|
|
4606
|
+
exports.CustomerIdsFilterView = CustomerIdsFilterView;
|
|
4607
|
+
exports.FollowedFiltersView = FollowedFiltersView;
|
|
4440
4608
|
exports.GetFleetGroupSummaryDocument = GetFleetGroupSummaryDocument;
|
|
4609
|
+
exports.GroupIdsFilterView = GroupIdsFilterView;
|
|
4610
|
+
exports.HourIntervalFilterView = HourIntervalFilterView;
|
|
4611
|
+
exports.LastSeenFiltersView = LastSeenFiltersView;
|
|
4612
|
+
exports.MetadataCompletenessFilterView = MetadataCompletenessFilterView;
|
|
4613
|
+
exports.ModelsFilterView = ModelsFilterView;
|
|
4614
|
+
exports.OwnerAccountIdsFilterView = OwnerAccountIdsFilterView;
|
|
4615
|
+
exports.PartnerFilterView = PartnerFilterView;
|
|
4616
|
+
exports.PeriodFilterView = PeriodFilterView;
|
|
4617
|
+
exports.ProductionYearFilterView = ProductionYearFilterView;
|
|
4441
4618
|
exports.SERVICE_PLAN_STATUSES_TO_SHOW = SERVICE_PLAN_STATUSES_TO_SHOW;
|
|
4442
4619
|
exports.SearchFilterInline = SearchFilterInline;
|
|
4620
|
+
exports.ServicePanStatusesFiltersView = ServicePanStatusesFiltersView;
|
|
4621
|
+
exports.SiteDepotOwnershipIdsFilterView = SiteDepotOwnershipIdsFilterView;
|
|
4622
|
+
exports.SiteIdsFilterView = SiteIdsFilterView;
|
|
4623
|
+
exports.SiteStatusFilterView = SiteStatusFilterView;
|
|
4624
|
+
exports.SiteTypesFilterView = SiteTypesFilterView;
|
|
4625
|
+
exports.TelematicsConnectedFiltersView = TelematicsConnectedFiltersView;
|
|
4443
4626
|
exports.TypesFilterView = TypesFilterView;
|
|
4444
4627
|
exports.areaFilterInternalGeoJsonGeometrySchema = areaFilterInternalGeoJsonGeometrySchema;
|
|
4445
4628
|
exports.areaFilterInternalSchema = areaFilterInternalSchema;
|
|
@@ -4447,6 +4630,7 @@ exports.assetTypeConst = assetTypeConst;
|
|
|
4447
4630
|
exports.mapActivityToLabelId = mapActivityToLabelId;
|
|
4448
4631
|
exports.mapMetadataCompletenessToLabelId = mapMetadataCompletenessToLabelId;
|
|
4449
4632
|
exports.metadataCompleteness = metadataCompleteness;
|
|
4633
|
+
exports.metadataCompletenessOptions = metadataCompletenessOptions;
|
|
4450
4634
|
exports.mockForGetAssetTelematicsDeviceConnectionSummaryQuery = mockForGetAssetTelematicsDeviceConnectionSummaryQuery;
|
|
4451
4635
|
exports.mockForGetCustomFieldSummaryQuery = mockForGetCustomFieldSummaryQuery;
|
|
4452
4636
|
exports.mockForGetCustomerIdSummaryQuery = mockForGetCustomerIdSummaryQuery;
|
|
@@ -4488,12 +4672,14 @@ exports.useLastSeenFilter = useLastSeenFilter;
|
|
|
4488
4672
|
exports.useMetadataCompletenessFilter = useMetadataCompletenessFilter;
|
|
4489
4673
|
exports.useModelsFilter = useModelsFilter;
|
|
4490
4674
|
exports.useOwnerAccountIdsFilter = useOwnerAccountIdsFilter;
|
|
4675
|
+
exports.usePartnerFilter = usePartnerFilter;
|
|
4491
4676
|
exports.usePeriodFilter = usePeriodFilter;
|
|
4492
4677
|
exports.usePlacesSearch = usePlacesSearch;
|
|
4493
4678
|
exports.useProductionYearFilter = useProductionYearFilter;
|
|
4494
4679
|
exports.useSearchFilter = useSearchFilter;
|
|
4495
4680
|
exports.useServicePlanStatusFilter = useServicePlanStatusFilter;
|
|
4496
4681
|
exports.useSetAssetFilterStateFromUrl = useSetAssetFilterStateFromUrl;
|
|
4682
|
+
exports.useSiteDepotOwnershipIdsFilter = useSiteDepotOwnershipIdsFilter;
|
|
4497
4683
|
exports.useSiteIdsFilter = useSiteIdsFilter;
|
|
4498
4684
|
exports.useSiteStatusFilter = useSiteStatusFilter;
|
|
4499
4685
|
exports.useSiteTypeFilter = useSiteTypeFilter;
|