Skip to content

Commit

Permalink
feat(asset): add resolved due date filter for list assets (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
Catalin-web authored Oct 24, 2024
1 parent 36e981e commit d4ad953
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ export const AssetQueryBuilder: React.FC<AssetCalibrationQueryBuilderProps> = ({
},
QueryBuilderOperations.CONTAINS,
QueryBuilderOperations.DOES_NOT_CONTAIN,
QueryBuilderOperations.LESS_THAN,
QueryBuilderOperations.LESS_THAN_OR_EQUAL_TO,
QueryBuilderOperations.GREATER_THAN,
QueryBuilderOperations.GREATER_THAN_OR_EQUAL_TO
]);
}, [workspaceField, locationField, areDependenciesLoaded, globalVariableOptions]);

Expand Down
19 changes: 17 additions & 2 deletions src/datasources/asset/constants/ListAssets.constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { QueryBuilderOperations } from "../../../core/query-builder.constants";
import { QBField } from "../types/CalibrationForecastQuery.types";
import { AssetTypeOptions, BusTypeOptions } from "../types/types";
import { AssetTypeOptions, BusTypeOptions, ResolvedDueDateOptions } from "../types/types";

export enum ListAssetsFieldNames {
LOCATION = 'Location',
Expand All @@ -9,6 +9,7 @@ export enum ListAssetsFieldNames {
VENDOR_NAME = 'VendorName',
BUS_TYPE = 'BusType',
ASSET_TYPE = 'AssetType',
CALIBRATION_DUE_DATE = 'ExternalCalibration.NextRecommendedDate'
}

export const ListAssetsFields: Record<string, QBField> = {
Expand Down Expand Up @@ -72,11 +73,25 @@ export const ListAssetsFields: Record<string, QBField> = {
dataSource: AssetTypeOptions,
},
},
CALIBRATION_DUE_DATE: {
label: 'Calibration Due Date',
dataField: ListAssetsFieldNames.CALIBRATION_DUE_DATE,
filterOperations: [
QueryBuilderOperations.LESS_THAN.name,
QueryBuilderOperations.LESS_THAN_OR_EQUAL_TO.name,
QueryBuilderOperations.GREATER_THAN.name,
QueryBuilderOperations.GREATER_THAN_OR_EQUAL_TO.name
],
lookup: {
dataSource: ResolvedDueDateOptions
}
}
};

export const ListAssetsStaticFields = [
ListAssetsFields.MODEL_NAME,
ListAssetsFields.VENDOR_NAME,
ListAssetsFields.ASSET_TYPE,
ListAssetsFields.BUS_TYPE
ListAssetsFields.BUS_TYPE,
ListAssetsFields.CALIBRATION_DUE_DATE
];
5 changes: 5 additions & 0 deletions src/datasources/asset/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,8 @@ export const AssetTypeOptions = [
{ label: 'Fixture', value: AssetType.FIXTURE },
{ label: 'System', value: AssetType.SYSTEM },
];

export const ResolvedDueDateOptions = [
{ label: '${__from:date}', value: '${__from:date}' },
{ label: '${__to:date}', value: '${__to:date}' }
];

0 comments on commit d4ad953

Please sign in to comment.