@flightctl/ui-components 0.0.5 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsPage.d.ts +3 -1
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsPage.d.ts.map +1 -1
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsPage.js +2 -2
- package/dist/src/components/Device/DeviceDetails/DeviceDetailsPage.js.map +1 -1
- package/dist/src/components/Device/DevicesPage/DeviceTableToolbar.d.ts +2 -2
- package/dist/src/components/Device/DevicesPage/DeviceTableToolbar.d.ts.map +1 -1
- package/dist/src/components/Device/DevicesPage/DeviceTableToolbar.js +8 -8
- package/dist/src/components/Device/DevicesPage/DeviceTableToolbar.js.map +1 -1
- package/dist/src/components/Device/DevicesPage/DeviceToolbarFilters.d.ts +3 -3
- package/dist/src/components/Device/DevicesPage/DeviceToolbarFilters.d.ts.map +1 -1
- package/dist/src/components/Device/DevicesPage/DeviceToolbarFilters.js +23 -3
- package/dist/src/components/Device/DevicesPage/DeviceToolbarFilters.js.map +1 -1
- package/dist/src/components/Device/DevicesPage/DevicesPage.d.ts +7 -1
- package/dist/src/components/Device/DevicesPage/DevicesPage.d.ts.map +1 -1
- package/dist/src/components/Device/DevicesPage/DevicesPage.js +23 -23
- package/dist/src/components/Device/DevicesPage/DevicesPage.js.map +1 -1
- package/dist/src/components/Device/DevicesPage/EnrollmentRequestList.d.ts +0 -7
- package/dist/src/components/Device/DevicesPage/EnrollmentRequestList.d.ts.map +1 -1
- package/dist/src/components/Device/DevicesPage/EnrollmentRequestList.js +42 -51
- package/dist/src/components/Device/DevicesPage/EnrollmentRequestList.js.map +1 -1
- package/dist/src/components/Device/DevicesPage/useDeviceBackendFilters.d.ts +2 -0
- package/dist/src/components/Device/DevicesPage/useDeviceBackendFilters.d.ts.map +1 -1
- package/dist/src/components/Device/DevicesPage/useDeviceBackendFilters.js +10 -3
- package/dist/src/components/Device/DevicesPage/useDeviceBackendFilters.js.map +1 -1
- package/dist/src/components/Device/DevicesPage/useDevices.d.ts +10 -4
- package/dist/src/components/Device/DevicesPage/useDevices.d.ts.map +1 -1
- package/dist/src/components/Device/DevicesPage/useDevices.js +25 -26
- package/dist/src/components/Device/DevicesPage/useDevices.js.map +1 -1
- package/dist/src/components/EnrollmentRequest/PendingEnrollmentRequestsBadge.css +10 -0
- package/dist/src/components/EnrollmentRequest/PendingEnrollmentRequestsBadge.d.ts +5 -0
- package/dist/src/components/EnrollmentRequest/PendingEnrollmentRequestsBadge.d.ts.map +1 -0
- package/dist/src/components/EnrollmentRequest/PendingEnrollmentRequestsBadge.js +22 -0
- package/dist/src/components/EnrollmentRequest/PendingEnrollmentRequestsBadge.js.map +1 -0
- package/dist/src/components/Fleet/FleetDetails/FleetDevices.d.ts.map +1 -1
- package/dist/src/components/Fleet/FleetDetails/FleetDevices.js +7 -7
- package/dist/src/components/Fleet/FleetDetails/FleetDevices.js.map +1 -1
- package/dist/src/components/Fleet/FleetsPage.d.ts.map +1 -1
- package/dist/src/components/Fleet/FleetsPage.js +17 -23
- package/dist/src/components/Fleet/FleetsPage.js.map +1 -1
- package/dist/src/components/Fleet/useFleets.d.ts +18 -0
- package/dist/src/components/Fleet/useFleets.d.ts.map +1 -0
- package/dist/src/components/Fleet/useFleets.js +61 -0
- package/dist/src/components/Fleet/useFleets.js.map +1 -0
- package/dist/src/components/OverviewPage/Cards/Status/StatusCard.d.ts.map +1 -1
- package/dist/src/components/OverviewPage/Cards/Status/StatusCard.js +4 -3
- package/dist/src/components/OverviewPage/Cards/Status/StatusCard.js.map +1 -1
- package/dist/src/components/OverviewPage/Cards/ToDo/ToDoCard.d.ts.map +1 -1
- package/dist/src/components/OverviewPage/Cards/ToDo/ToDoCard.js +5 -9
- package/dist/src/components/OverviewPage/Cards/ToDo/ToDoCard.js.map +1 -1
- package/dist/src/components/OverviewPage/Overview.js +1 -1
- package/dist/src/components/OverviewPage/Overview.js.map +1 -1
- package/dist/src/components/Repository/CreateRepository/CreateRepository.js +2 -2
- package/dist/src/components/Repository/CreateRepository/CreateRepository.js.map +1 -1
- package/dist/src/components/Repository/RepositoryDetails/DeleteRepositoryModal.js +1 -1
- package/dist/src/components/Repository/RepositoryDetails/DeleteRepositoryModal.js.map +1 -1
- package/dist/src/components/Repository/RepositoryList.d.ts.map +1 -1
- package/dist/src/components/Repository/RepositoryList.js +1 -1
- package/dist/src/components/Repository/RepositoryList.js.map +1 -1
- package/dist/src/components/ResourceSync/RepositoryResourceSyncList.d.ts.map +1 -1
- package/dist/src/components/ResourceSync/RepositoryResourceSyncList.js +2 -2
- package/dist/src/components/ResourceSync/RepositoryResourceSyncList.js.map +1 -1
- package/dist/src/components/Table/Table.d.ts +12 -2
- package/dist/src/components/Table/Table.d.ts.map +1 -1
- package/dist/src/components/Table/Table.js +3 -3
- package/dist/src/components/Table/Table.js.map +1 -1
- package/dist/src/components/charts/DonutChart.css +5 -0
- package/dist/src/components/charts/DonutChart.js +1 -1
- package/dist/src/components/charts/DonutChart.js.map +1 -1
- package/dist/src/components/common/LeaveFormConfirmation.js +1 -1
- package/dist/src/components/common/LeaveFormConfirmation.js.map +1 -1
- package/dist/src/components/modals/massModals/MassDeleteRepositoryModal/MassDeleteRepositoryModal.d.ts.map +1 -1
- package/dist/src/components/modals/massModals/MassDeleteRepositoryModal/MassDeleteRepositoryModal.js +2 -2
- package/dist/src/components/modals/massModals/MassDeleteRepositoryModal/MassDeleteRepositoryModal.js.map +1 -1
- package/dist/src/hooks/useApiTableSort.d.ts +8 -0
- package/dist/src/hooks/useApiTableSort.d.ts.map +1 -0
- package/dist/src/hooks/useApiTableSort.js +44 -0
- package/dist/src/hooks/useApiTableSort.js.map +1 -0
- package/dist/src/hooks/useAppContext.d.ts +4 -4
- package/dist/src/hooks/useAppContext.d.ts.map +1 -1
- package/dist/src/hooks/useNavigate.d.ts +3 -3
- package/dist/src/hooks/useNavigate.d.ts.map +1 -1
- package/dist/src/hooks/useNavigate.js +3 -3
- package/dist/src/hooks/useNavigate.js.map +1 -1
- package/dist/src/hooks/usePendingEnrollmentRequestsCount.d.ts +2 -0
- package/dist/src/hooks/usePendingEnrollmentRequestsCount.d.ts.map +1 -0
- package/dist/src/hooks/usePendingEnrollmentRequestsCount.js +13 -0
- package/dist/src/hooks/usePendingEnrollmentRequestsCount.js.map +1 -0
- package/dist/src/utils/query.d.ts +6 -0
- package/dist/src/utils/query.d.ts.map +1 -0
- package/dist/src/utils/query.js +32 -0
- package/dist/src/utils/query.js.map +1 -0
- package/dist/src/utils/sort/generic.d.ts +1 -4
- package/dist/src/utils/sort/generic.d.ts.map +1 -1
- package/dist/src/utils/sort/generic.js +1 -28
- package/dist/src/utils/sort/generic.js.map +1 -1
- package/dist/src/utils/status/devices.d.ts +2 -1
- package/dist/src/utils/status/devices.d.ts.map +1 -1
- package/dist/src/utils/status/devices.js +1 -0
- package/dist/src/utils/status/devices.js.map +1 -1
- package/package.json +6 -6
- package/src/components/Device/DeviceDetails/DeviceDetailsPage.tsx +2 -2
- package/src/components/Device/DevicesPage/DeviceTableToolbar.tsx +13 -13
- package/src/components/Device/DevicesPage/DeviceToolbarFilters.tsx +35 -8
- package/src/components/Device/DevicesPage/DevicesPage.tsx +41 -27
- package/src/components/Device/DevicesPage/EnrollmentRequestList.tsx +91 -116
- package/src/components/Device/DevicesPage/useDeviceBackendFilters.ts +14 -3
- package/src/components/Device/DevicesPage/useDevices.ts +43 -32
- package/src/components/EnrollmentRequest/PendingEnrollmentRequestsBadge.css +10 -0
- package/src/components/EnrollmentRequest/PendingEnrollmentRequestsBadge.tsx +27 -0
- package/src/components/Fleet/FleetDetails/FleetDevices.tsx +12 -18
- package/src/components/Fleet/FleetsPage.tsx +39 -28
- package/src/components/Fleet/useFleets.ts +86 -0
- package/src/components/OverviewPage/Cards/Status/StatusCard.tsx +4 -3
- package/src/components/OverviewPage/Cards/ToDo/ToDoCard.tsx +6 -10
- package/src/components/OverviewPage/Overview.tsx +1 -1
- package/src/components/Repository/CreateRepository/CreateRepository.tsx +2 -2
- package/src/components/Repository/RepositoryDetails/DeleteRepositoryModal.tsx +1 -1
- package/src/components/Repository/RepositoryList.tsx +1 -0
- package/src/components/ResourceSync/RepositoryResourceSyncList.tsx +2 -1
- package/src/components/Table/Table.tsx +19 -5
- package/src/components/charts/DonutChart.css +5 -0
- package/src/components/charts/DonutChart.tsx +1 -1
- package/src/components/modals/massModals/MassDeleteRepositoryModal/MassDeleteRepositoryModal.tsx +4 -2
- package/src/hooks/useApiTableSort.ts +49 -0
- package/src/hooks/useNavigate.tsx +3 -3
- package/src/hooks/usePendingEnrollmentRequestsCount.ts +12 -0
- package/src/utils/query.ts +29 -0
- package/src/utils/sort/generic.ts +1 -30
- package/src/utils/status/devices.ts +1 -0
- package/dist/src/components/Device/DevicesPage/useDeviceFilters.d.ts +0 -8
- package/dist/src/components/Device/DevicesPage/useDeviceFilters.d.ts.map +0 -1
- package/dist/src/components/Device/DevicesPage/useDeviceFilters.js +0 -16
- package/dist/src/components/Device/DevicesPage/useDeviceFilters.js.map +0 -1
- package/dist/src/utils/sort/device.d.ts +0 -4
- package/dist/src/utils/sort/device.d.ts.map +0 -1
- package/dist/src/utils/sort/device.js +0 -49
- package/dist/src/utils/sort/device.js.map +0 -1
- package/dist/src/utils/sort/fleet.d.ts +0 -4
- package/dist/src/utils/sort/fleet.d.ts.map +0 -1
- package/dist/src/utils/sort/fleet.js +0 -18
- package/dist/src/utils/sort/fleet.js.map +0 -1
- package/src/components/Device/DevicesPage/useDeviceFilters.ts +0 -15
- package/src/utils/sort/device.ts +0 -60
- package/src/utils/sort/fleet.ts +0 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ObjectMeta } from '@flightctl/types';
|
|
2
2
|
|
|
3
3
|
export const sortByName = <R extends { metadata: ObjectMeta }>(resources: R[]) =>
|
|
4
4
|
resources.sort((a, b) => {
|
|
@@ -6,32 +6,3 @@ export const sortByName = <R extends { metadata: ObjectMeta }>(resources: R[]) =
|
|
|
6
6
|
const bName = b.metadata.name || '-';
|
|
7
7
|
return aName.localeCompare(bName);
|
|
8
8
|
});
|
|
9
|
-
|
|
10
|
-
export const sortByLastSeenDate = (devices: Device[]) =>
|
|
11
|
-
devices.sort((a, b) => {
|
|
12
|
-
const getDate = (device: Device) => {
|
|
13
|
-
const lastSeen = device.status?.lastSeen;
|
|
14
|
-
if (lastSeen) {
|
|
15
|
-
return lastSeen;
|
|
16
|
-
}
|
|
17
|
-
return device.metadata.creationTimestamp || 0;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const aDate = getDate(a);
|
|
21
|
-
const bDate = getDate(b);
|
|
22
|
-
return new Date(aDate).getTime() - new Date(bDate).getTime();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export const sortByCreationDate = (enrollments: EnrollmentRequest[]) =>
|
|
26
|
-
enrollments.sort((a, b) => {
|
|
27
|
-
const aDate = a.metadata.creationTimestamp || 0;
|
|
28
|
-
const bDate = b.metadata.creationTimestamp || 0;
|
|
29
|
-
return new Date(aDate).getTime() - new Date(bDate).getTime();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export const sortByAlias = (devices: Device[]) =>
|
|
33
|
-
devices.sort((a, b) => {
|
|
34
|
-
const aAlias = a.metadata.labels?.alias || '-';
|
|
35
|
-
const bAlias = b.metadata.labels?.alias || '-';
|
|
36
|
-
return aAlias.localeCompare(bAlias);
|
|
37
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Device } from '@flightctl/types';
|
|
2
|
-
export declare const useDeviceFilters: (devices: Array<Device>) => {
|
|
3
|
-
filteredData: Device[];
|
|
4
|
-
search: string;
|
|
5
|
-
setSearch: (value: string) => void;
|
|
6
|
-
hasFiltersEnabled: boolean;
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=useDeviceFilters.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDeviceFilters.d.ts","sourceRoot":"","sources":["../../../../../src/components/Device/DevicesPage/useDeviceFilters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAK1C,eAAO,MAAM,gBAAgB,YAAa,MAAM,MAAM,CAAC;;;;;CAStD,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useDeviceFilters = void 0;
|
|
4
|
-
const useTableTextSearch_1 = require("../../../hooks/useTableTextSearch");
|
|
5
|
-
const getSearchText = (device) => { var _a; return [device.metadata.name, (_a = device.metadata.labels) === null || _a === void 0 ? void 0 : _a.alias]; };
|
|
6
|
-
const useDeviceFilters = (devices) => {
|
|
7
|
-
const { search, setSearch, filteredData } = (0, useTableTextSearch_1.useTableTextSearch)(devices, getSearchText);
|
|
8
|
-
return {
|
|
9
|
-
filteredData,
|
|
10
|
-
search,
|
|
11
|
-
setSearch,
|
|
12
|
-
hasFiltersEnabled: !!search,
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
exports.useDeviceFilters = useDeviceFilters;
|
|
16
|
-
//# sourceMappingURL=useDeviceFilters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDeviceFilters.js","sourceRoot":"","sources":["../../../../../src/components/Device/DevicesPage/useDeviceFilters.ts"],"names":[],"mappings":";;;AACA,0EAAuE;AAEvE,MAAM,aAAa,GAAG,CAAC,MAAc,EAAE,EAAE,WAAC,OAAA,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAA,MAAM,CAAC,QAAQ,CAAC,MAAM,0CAAE,KAAK,CAAC,CAAA,EAAA,CAAC;AAEzF,MAAM,gBAAgB,GAAG,CAAC,OAAsB,EAAE,EAAE;IACzD,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,IAAA,uCAAkB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAEvF,OAAO;QACL,YAAY;QACZ,MAAM;QACN,SAAS;QACT,iBAAiB,EAAE,CAAC,CAAC,MAAM;KAC5B,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,gBAAgB,oBAS3B"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Device } from '@flightctl/types';
|
|
2
|
-
export declare const sortDeviceStatus: (devices: Array<Device>, status: 'DeviceStatus' | 'ApplicationStatus' | 'SystemUpdateStatus') => Device[];
|
|
3
|
-
export declare const sortDevicesByFleet: (resources: Array<Device>) => Device[];
|
|
4
|
-
//# sourceMappingURL=device.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../../src/utils/sort/device.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAuC1C,eAAO,MAAM,gBAAgB,YAClB,MAAM,MAAM,CAAC,UACd,cAAc,GAAG,mBAAmB,GAAG,oBAAoB,aAWjE,CAAC;AAEL,eAAO,MAAM,kBAAkB,cAAe,MAAM,MAAM,CAAC,aAKvD,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sortDevicesByFleet = exports.sortDeviceStatus = void 0;
|
|
4
|
-
const devices_1 = require("../devices");
|
|
5
|
-
const devices_2 = require("../status/devices");
|
|
6
|
-
const applications_1 = require("../status/applications");
|
|
7
|
-
const system_1 = require("../status/system");
|
|
8
|
-
const sortByApplicationStatus = (a, b) => {
|
|
9
|
-
var _a, _b;
|
|
10
|
-
const aStatus = (0, devices_2.getApplicationSummaryStatus)((_a = a.status) === null || _a === void 0 ? void 0 : _a.applicationsSummary);
|
|
11
|
-
const bStatus = (0, devices_2.getApplicationSummaryStatus)((_b = b.status) === null || _b === void 0 ? void 0 : _b.applicationsSummary);
|
|
12
|
-
const aIndex = applications_1.applicationSummaryStatusOrder.indexOf(aStatus);
|
|
13
|
-
const bIndex = applications_1.applicationSummaryStatusOrder.indexOf(bStatus);
|
|
14
|
-
return aIndex - bIndex;
|
|
15
|
-
};
|
|
16
|
-
const sortByDeviceStatus = (a, b) => {
|
|
17
|
-
var _a, _b;
|
|
18
|
-
const aStatus = (0, devices_2.getDeviceSummaryStatus)((_a = a.status) === null || _a === void 0 ? void 0 : _a.summary);
|
|
19
|
-
const bStatus = (0, devices_2.getDeviceSummaryStatus)((_b = b.status) === null || _b === void 0 ? void 0 : _b.summary);
|
|
20
|
-
const aIndex = devices_2.deviceStatusOrder.indexOf(aStatus);
|
|
21
|
-
const bIndex = devices_2.deviceStatusOrder.indexOf(bStatus);
|
|
22
|
-
return aIndex - bIndex;
|
|
23
|
-
};
|
|
24
|
-
const sortBySystemUpdateStatus = (a, b) => {
|
|
25
|
-
var _a, _b;
|
|
26
|
-
const aStatus = (0, devices_2.getSystemUpdateStatus)((_a = a.status) === null || _a === void 0 ? void 0 : _a.updated);
|
|
27
|
-
const bStatus = (0, devices_2.getSystemUpdateStatus)((_b = b.status) === null || _b === void 0 ? void 0 : _b.updated);
|
|
28
|
-
const aIndex = system_1.systemUpdateStatusOrder.indexOf(aStatus);
|
|
29
|
-
const bIndex = system_1.systemUpdateStatusOrder.indexOf(bStatus);
|
|
30
|
-
return aIndex - bIndex;
|
|
31
|
-
};
|
|
32
|
-
const sortDeviceStatus = (devices, status) => devices.sort((a, b) => {
|
|
33
|
-
switch (status) {
|
|
34
|
-
case 'ApplicationStatus':
|
|
35
|
-
return sortByApplicationStatus(a, b);
|
|
36
|
-
case 'DeviceStatus':
|
|
37
|
-
return sortByDeviceStatus(a, b);
|
|
38
|
-
case 'SystemUpdateStatus':
|
|
39
|
-
return sortBySystemUpdateStatus(a, b);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
exports.sortDeviceStatus = sortDeviceStatus;
|
|
43
|
-
const sortDevicesByFleet = (resources) => resources.sort((a, b) => {
|
|
44
|
-
const aFleet = (0, devices_1.getDeviceFleet)(a.metadata);
|
|
45
|
-
const bFleet = (0, devices_1.getDeviceFleet)(b.metadata);
|
|
46
|
-
return (aFleet || '-').localeCompare(bFleet || '-');
|
|
47
|
-
});
|
|
48
|
-
exports.sortDevicesByFleet = sortDevicesByFleet;
|
|
49
|
-
//# sourceMappingURL=device.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../../../src/utils/sort/device.ts"],"names":[],"mappings":";;;AACA,wCAA4C;AAE5C,+CAK2B;AAC3B,yDAAuE;AACvE,6CAA2D;AAE3D,MAAM,uBAAuB,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE;;IACvD,MAAM,OAAO,GAAG,IAAA,qCAA2B,EAAC,MAAA,CAAC,CAAC,MAAM,0CAAE,mBAAmB,CAAC,CAAC;IAC3E,MAAM,OAAO,GAAG,IAAA,qCAA2B,EAAC,MAAA,CAAC,CAAC,MAAM,0CAAE,mBAAmB,CAAC,CAAC;IAE3E,MAAM,MAAM,GAAG,4CAA6B,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,4CAA6B,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9D,OAAO,MAAM,GAAG,MAAM,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE;;IAClD,MAAM,OAAO,GAAG,IAAA,gCAAsB,EAAC,MAAA,CAAC,CAAC,MAAM,0CAAE,OAAO,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAG,IAAA,gCAAsB,EAAC,MAAA,CAAC,CAAC,MAAM,0CAAE,OAAO,CAAC,CAAC;IAE1D,MAAM,MAAM,GAAG,2BAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,2BAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,OAAO,MAAM,GAAG,MAAM,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE;;IACxD,MAAM,OAAO,GAAG,IAAA,+BAAqB,EAAC,MAAA,CAAC,CAAC,MAAM,0CAAE,OAAO,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,IAAA,+BAAqB,EAAC,MAAA,CAAC,CAAC,MAAM,0CAAE,OAAO,CAAC,CAAC;IAEzD,MAAM,MAAM,GAAG,gCAAuB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,gCAAuB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACxD,OAAO,MAAM,GAAG,MAAM,CAAC;AACzB,CAAC,CAAC;AAEK,MAAM,gBAAgB,GAAG,CAC9B,OAAsB,EACtB,MAAmE,EACnE,EAAE,CACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;IACpB,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,mBAAmB;YACtB,OAAO,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvC,KAAK,cAAc;YACjB,OAAO,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClC,KAAK,oBAAoB;YACvB,OAAO,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC,CAAC,CAAC;AAbQ,QAAA,gBAAgB,oBAaxB;AAEE,MAAM,kBAAkB,GAAG,CAAC,SAAwB,EAAE,EAAE,CAC7D,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;IACtB,MAAM,MAAM,GAAG,IAAA,wBAAc,EAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAA,wBAAc,EAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC1C,OAAO,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,aAAa,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC;AACtD,CAAC,CAAC,CAAC;AALQ,QAAA,kBAAkB,sBAK1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fleet.d.ts","sourceRoot":"","sources":["../../../../src/utils/sort/fleet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,eAAO,MAAM,iBAAiB,WAAY,MAAM,KAAK,CAAC,YAKlD,CAAC;AAEL,eAAO,MAAM,YAAY,WAAY,MAAM,KAAK,CAAC,YAK7C,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sortByStatus = exports.sortFleetsByOSImg = void 0;
|
|
4
|
-
const fleet_1 = require("../status/fleet");
|
|
5
|
-
const sortFleetsByOSImg = (fleets) => fleets.sort((a, b) => {
|
|
6
|
-
var _a, _b;
|
|
7
|
-
const aOS = ((_a = a.spec.template.spec.os) === null || _a === void 0 ? void 0 : _a.image) || '-';
|
|
8
|
-
const bOS = ((_b = b.spec.template.spec.os) === null || _b === void 0 ? void 0 : _b.image) || '-';
|
|
9
|
-
return aOS.localeCompare(bOS);
|
|
10
|
-
});
|
|
11
|
-
exports.sortFleetsByOSImg = sortFleetsByOSImg;
|
|
12
|
-
const sortByStatus = (fleets) => fleets.sort((a, b) => {
|
|
13
|
-
const aStatus = (0, fleet_1.getFleetSyncStatus)(a).status;
|
|
14
|
-
const bStatus = (0, fleet_1.getFleetSyncStatus)(b).status;
|
|
15
|
-
return aStatus.localeCompare(bStatus);
|
|
16
|
-
});
|
|
17
|
-
exports.sortByStatus = sortByStatus;
|
|
18
|
-
//# sourceMappingURL=fleet.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fleet.js","sourceRoot":"","sources":["../../../../src/utils/sort/fleet.ts"],"names":[],"mappings":";;;AACA,2CAAqD;AAE9C,MAAM,iBAAiB,GAAG,CAAC,MAAoB,EAAE,EAAE,CACxD,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;;IACnB,MAAM,GAAG,GAAG,CAAA,MAAA,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,0CAAE,KAAK,KAAI,GAAG,CAAC;IAClD,MAAM,GAAG,GAAG,CAAA,MAAA,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,0CAAE,KAAK,KAAI,GAAG,CAAC;IAClD,OAAO,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;AAChC,CAAC,CAAC,CAAC;AALQ,QAAA,iBAAiB,qBAKzB;AAEE,MAAM,YAAY,GAAG,CAAC,MAAoB,EAAE,EAAE,CACnD,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;IACnB,MAAM,OAAO,GAAG,IAAA,0BAAkB,EAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC7C,MAAM,OAAO,GAAG,IAAA,0BAAkB,EAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC7C,OAAO,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC,CAAC,CAAC;AALQ,QAAA,YAAY,gBAKpB"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Device } from '@flightctl/types';
|
|
2
|
-
import { useTableTextSearch } from '../../../hooks/useTableTextSearch';
|
|
3
|
-
|
|
4
|
-
const getSearchText = (device: Device) => [device.metadata.name, device.metadata.labels?.alias];
|
|
5
|
-
|
|
6
|
-
export const useDeviceFilters = (devices: Array<Device>) => {
|
|
7
|
-
const { search, setSearch, filteredData } = useTableTextSearch(devices, getSearchText);
|
|
8
|
-
|
|
9
|
-
return {
|
|
10
|
-
filteredData,
|
|
11
|
-
search,
|
|
12
|
-
setSearch,
|
|
13
|
-
hasFiltersEnabled: !!search,
|
|
14
|
-
};
|
|
15
|
-
};
|
package/src/utils/sort/device.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Device } from '@flightctl/types';
|
|
2
|
-
import { getDeviceFleet } from '../devices';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
deviceStatusOrder,
|
|
6
|
-
getApplicationSummaryStatus,
|
|
7
|
-
getDeviceSummaryStatus,
|
|
8
|
-
getSystemUpdateStatus,
|
|
9
|
-
} from '../status/devices';
|
|
10
|
-
import { applicationSummaryStatusOrder } from '../status/applications';
|
|
11
|
-
import { systemUpdateStatusOrder } from '../status/system';
|
|
12
|
-
|
|
13
|
-
const sortByApplicationStatus = (a: Device, b: Device) => {
|
|
14
|
-
const aStatus = getApplicationSummaryStatus(a.status?.applicationsSummary);
|
|
15
|
-
const bStatus = getApplicationSummaryStatus(b.status?.applicationsSummary);
|
|
16
|
-
|
|
17
|
-
const aIndex = applicationSummaryStatusOrder.indexOf(aStatus);
|
|
18
|
-
const bIndex = applicationSummaryStatusOrder.indexOf(bStatus);
|
|
19
|
-
return aIndex - bIndex;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const sortByDeviceStatus = (a: Device, b: Device) => {
|
|
23
|
-
const aStatus = getDeviceSummaryStatus(a.status?.summary);
|
|
24
|
-
const bStatus = getDeviceSummaryStatus(b.status?.summary);
|
|
25
|
-
|
|
26
|
-
const aIndex = deviceStatusOrder.indexOf(aStatus);
|
|
27
|
-
const bIndex = deviceStatusOrder.indexOf(bStatus);
|
|
28
|
-
return aIndex - bIndex;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const sortBySystemUpdateStatus = (a: Device, b: Device) => {
|
|
32
|
-
const aStatus = getSystemUpdateStatus(a.status?.updated);
|
|
33
|
-
const bStatus = getSystemUpdateStatus(b.status?.updated);
|
|
34
|
-
|
|
35
|
-
const aIndex = systemUpdateStatusOrder.indexOf(aStatus);
|
|
36
|
-
const bIndex = systemUpdateStatusOrder.indexOf(bStatus);
|
|
37
|
-
return aIndex - bIndex;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const sortDeviceStatus = (
|
|
41
|
-
devices: Array<Device>,
|
|
42
|
-
status: 'DeviceStatus' | 'ApplicationStatus' | 'SystemUpdateStatus',
|
|
43
|
-
) =>
|
|
44
|
-
devices.sort((a, b) => {
|
|
45
|
-
switch (status) {
|
|
46
|
-
case 'ApplicationStatus':
|
|
47
|
-
return sortByApplicationStatus(a, b);
|
|
48
|
-
case 'DeviceStatus':
|
|
49
|
-
return sortByDeviceStatus(a, b);
|
|
50
|
-
case 'SystemUpdateStatus':
|
|
51
|
-
return sortBySystemUpdateStatus(a, b);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
export const sortDevicesByFleet = (resources: Array<Device>) =>
|
|
56
|
-
resources.sort((a, b) => {
|
|
57
|
-
const aFleet = getDeviceFleet(a.metadata);
|
|
58
|
-
const bFleet = getDeviceFleet(b.metadata);
|
|
59
|
-
return (aFleet || '-').localeCompare(bFleet || '-');
|
|
60
|
-
});
|
package/src/utils/sort/fleet.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Fleet } from '@flightctl/types';
|
|
2
|
-
import { getFleetSyncStatus } from '../status/fleet';
|
|
3
|
-
|
|
4
|
-
export const sortFleetsByOSImg = (fleets: Array<Fleet>) =>
|
|
5
|
-
fleets.sort((a, b) => {
|
|
6
|
-
const aOS = a.spec.template.spec.os?.image || '-';
|
|
7
|
-
const bOS = b.spec.template.spec.os?.image || '-';
|
|
8
|
-
return aOS.localeCompare(bOS);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export const sortByStatus = (fleets: Array<Fleet>) =>
|
|
12
|
-
fleets.sort((a, b) => {
|
|
13
|
-
const aStatus = getFleetSyncStatus(a).status;
|
|
14
|
-
const bStatus = getFleetSyncStatus(b).status;
|
|
15
|
-
return aStatus.localeCompare(bStatus);
|
|
16
|
-
});
|