@northern.tech/store 0.1.3 → 0.2.1
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/actions.js +251 -135
- package/dist/actions.js.map +1 -1
- package/dist/actions.mjs +13 -13
- package/dist/api/general-api.js +102 -51
- package/dist/api/general-api.js.map +1 -1
- package/dist/api/general-api.mjs +6 -6
- package/dist/api/users-api.js +104 -66
- package/dist/api/users-api.js.map +1 -1
- package/dist/api/users-api.mjs +7 -7
- package/dist/appSlice/constants.js +1 -39
- package/dist/appSlice/constants.js.map +1 -1
- package/dist/appSlice/constants.mjs +2 -2
- package/dist/appSlice/index.js +111 -64
- package/dist/appSlice/index.js.map +1 -1
- package/dist/appSlice/index.mjs +5 -5
- package/dist/appSlice/selectors.js +1 -43
- package/dist/appSlice/selectors.js.map +1 -1
- package/dist/appSlice/selectors.mjs +2 -2
- package/dist/appSlice/thunks.js +649 -552
- package/dist/appSlice/thunks.js.map +1 -1
- package/dist/appSlice/thunks.mjs +28 -28
- package/dist/auth.js +99 -51
- package/dist/auth.js.map +1 -1
- package/dist/auth.mjs +5 -5
- package/dist/{chunk-C2YZYTJ6.mjs → chunk-2Z3RFYW4.mjs} +2 -11
- package/dist/{chunk-C2YZYTJ6.mjs.map → chunk-2Z3RFYW4.mjs.map} +1 -1
- package/dist/{chunk-F37LUTBX.mjs → chunk-3ORTTLIB.mjs} +19 -16
- package/dist/{chunk-F37LUTBX.mjs.map → chunk-3ORTTLIB.mjs.map} +1 -1
- package/dist/{chunk-7E7KJHY3.mjs → chunk-4SDUITD4.mjs} +6 -12
- package/dist/{chunk-7E7KJHY3.mjs.map → chunk-4SDUITD4.mjs.map} +1 -1
- package/dist/{chunk-BOSBROA3.mjs → chunk-5VNQCCAQ.mjs} +2 -7
- package/dist/{chunk-BOSBROA3.mjs.map → chunk-5VNQCCAQ.mjs.map} +1 -1
- package/dist/{chunk-R2GBNXLV.mjs → chunk-65YIOCCD.mjs} +6 -11
- package/dist/{chunk-R2GBNXLV.mjs.map → chunk-65YIOCCD.mjs.map} +1 -1
- package/dist/{chunk-ZIYGEXSJ.mjs → chunk-6CSGHZ3E.mjs} +9 -21
- package/dist/{chunk-ZIYGEXSJ.mjs.map → chunk-6CSGHZ3E.mjs.map} +1 -1
- package/dist/{chunk-HRWZJQMH.mjs → chunk-AZRVRNXT.mjs} +40 -30
- package/dist/{chunk-HRWZJQMH.mjs.map → chunk-AZRVRNXT.mjs.map} +1 -1
- package/dist/{chunk-M4U5R7A4.mjs → chunk-B42NUKMZ.mjs} +2 -6
- package/dist/{chunk-M4U5R7A4.mjs.map → chunk-B42NUKMZ.mjs.map} +1 -1
- package/dist/{chunk-DZBVTSIX.mjs → chunk-CHUCIHMY.mjs} +3 -4
- package/dist/{chunk-DZBVTSIX.mjs.map → chunk-CHUCIHMY.mjs.map} +1 -1
- package/dist/{chunk-YNVSU3AA.mjs → chunk-DIZJVB6M.mjs} +307 -292
- package/dist/chunk-DIZJVB6M.mjs.map +1 -0
- package/dist/chunk-H5UCKQWK.mjs +41 -0
- package/dist/{chunk-IPPIKGIB.mjs.map → chunk-H5UCKQWK.mjs.map} +1 -1
- package/dist/{chunk-ZNST5R6O.mjs → chunk-IFWKT27G.mjs} +92 -29
- package/dist/chunk-IFWKT27G.mjs.map +1 -0
- package/dist/{chunk-6667TCAJ.mjs → chunk-JA27QXVB.mjs} +37 -28
- package/dist/{chunk-6667TCAJ.mjs.map → chunk-JA27QXVB.mjs.map} +1 -1
- package/dist/{chunk-HVHZG2H4.mjs → chunk-K2NZL5V4.mjs} +4 -7
- package/dist/chunk-K2NZL5V4.mjs.map +1 -0
- package/dist/{chunk-RQOE5OOT.mjs → chunk-KJAZNKV2.mjs} +66 -55
- package/dist/chunk-KJAZNKV2.mjs.map +1 -0
- package/dist/{chunk-G32LAKW4.mjs → chunk-KPPU6OWF.mjs} +27 -39
- package/dist/{chunk-G32LAKW4.mjs.map → chunk-KPPU6OWF.mjs.map} +1 -1
- package/dist/{chunk-BJSH2G7W.mjs → chunk-KZSTW27Q.mjs} +30 -18
- package/dist/{chunk-BJSH2G7W.mjs.map → chunk-KZSTW27Q.mjs.map} +1 -1
- package/dist/chunk-LZOMFHX3.mjs +38 -0
- package/dist/{chunk-XYVPYFSM.mjs → chunk-NJNSCJEY.mjs} +22 -26
- package/dist/{chunk-XYVPYFSM.mjs.map → chunk-NJNSCJEY.mjs.map} +1 -1
- package/dist/{chunk-N7G6QK2E.mjs → chunk-O6TYYKSD.mjs} +62 -60
- package/dist/chunk-O6TYYKSD.mjs.map +1 -0
- package/dist/{chunk-G3I53JGW.mjs → chunk-QQBUNZHA.mjs} +3 -6
- package/dist/{chunk-G3I53JGW.mjs.map → chunk-QQBUNZHA.mjs.map} +1 -1
- package/dist/{chunk-TD45YTYK.mjs → chunk-R7LXL3KJ.mjs} +22 -23
- package/dist/chunk-R7LXL3KJ.mjs.map +1 -0
- package/dist/{chunk-G7LATUT6.mjs → chunk-WCUGLHYM.mjs} +16 -20
- package/dist/{chunk-G7LATUT6.mjs.map → chunk-WCUGLHYM.mjs.map} +1 -1
- package/dist/chunk-WYHJFSMQ.mjs +25 -0
- package/dist/{chunk-IVSYYXTC.mjs.map → chunk-WYHJFSMQ.mjs.map} +1 -1
- package/dist/{chunk-O6O3D52B.mjs → chunk-XC5UXEIB.mjs} +4 -11
- package/dist/{chunk-O6O3D52B.mjs.map → chunk-XC5UXEIB.mjs.map} +1 -1
- package/dist/{chunk-BRHSKNFC.mjs → chunk-XD7INCM4.mjs} +11 -17
- package/dist/{chunk-BRHSKNFC.mjs.map → chunk-XD7INCM4.mjs.map} +1 -1
- package/dist/{chunk-RH6ONMG7.mjs → chunk-ZE7R2XXE.mjs} +10 -12
- package/dist/{chunk-RH6ONMG7.mjs.map → chunk-ZE7R2XXE.mjs.map} +1 -1
- package/dist/{chunk-HXPYJ6QN.mjs → chunk-ZK4W5T53.mjs} +7 -11
- package/dist/{chunk-HXPYJ6QN.mjs.map → chunk-ZK4W5T53.mjs.map} +1 -1
- package/dist/commonConstants.d.mts +18 -19
- package/dist/commonConstants.d.ts +18 -19
- package/dist/commonConstants.js +2 -35
- package/dist/commonConstants.js.map +1 -1
- package/dist/commonConstants.mjs +2 -2
- package/dist/commonSelectors.d.mts +42 -1
- package/dist/commonSelectors.d.ts +42 -1
- package/dist/commonSelectors.js +149 -129
- package/dist/commonSelectors.js.map +1 -1
- package/dist/commonSelectors.mjs +14 -12
- package/dist/constants.d.mts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants.js +92 -147
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +18 -14
- package/dist/deploymentsSlice/constants.js +94 -55
- package/dist/deploymentsSlice/constants.js.map +1 -1
- package/dist/deploymentsSlice/constants.mjs +4 -4
- package/dist/deploymentsSlice/index.js +128 -75
- package/dist/deploymentsSlice/index.js.map +1 -1
- package/dist/deploymentsSlice/index.mjs +5 -5
- package/dist/deploymentsSlice/selectors.js +95 -48
- package/dist/deploymentsSlice/selectors.js.map +1 -1
- package/dist/deploymentsSlice/selectors.mjs +5 -5
- package/dist/deploymentsSlice/thunks.js +649 -561
- package/dist/deploymentsSlice/thunks.js.map +1 -1
- package/dist/deploymentsSlice/thunks.mjs +28 -28
- package/dist/devicesSlice/constants.js +94 -54
- package/dist/devicesSlice/constants.js.map +1 -1
- package/dist/devicesSlice/constants.mjs +4 -4
- package/dist/devicesSlice/index.js +131 -77
- package/dist/devicesSlice/index.js.map +1 -1
- package/dist/devicesSlice/index.mjs +5 -5
- package/dist/devicesSlice/selectors.js +100 -85
- package/dist/devicesSlice/selectors.js.map +1 -1
- package/dist/devicesSlice/selectors.mjs +5 -5
- package/dist/devicesSlice/thunks.js +649 -597
- package/dist/devicesSlice/thunks.js.map +1 -1
- package/dist/devicesSlice/thunks.mjs +28 -28
- package/dist/monitorSlice/constants.js +94 -41
- package/dist/monitorSlice/constants.js.map +1 -1
- package/dist/monitorSlice/constants.mjs +4 -4
- package/dist/monitorSlice/index.js +101 -48
- package/dist/monitorSlice/index.js.map +1 -1
- package/dist/monitorSlice/index.mjs +5 -5
- package/dist/monitorSlice/selectors.js +0 -4
- package/dist/monitorSlice/selectors.mjs +1 -1
- package/dist/monitorSlice/thunks.js +333 -238
- package/dist/monitorSlice/thunks.js.map +1 -1
- package/dist/monitorSlice/thunks.mjs +25 -25
- package/dist/onboardingSlice/constants.js +0 -5
- package/dist/onboardingSlice/constants.mjs +1 -1
- package/dist/onboardingSlice/index.js +1 -22
- package/dist/onboardingSlice/index.js.map +1 -1
- package/dist/onboardingSlice/index.mjs +2 -2
- package/dist/onboardingSlice/selectors.js +0 -4
- package/dist/onboardingSlice/selectors.mjs +1 -1
- package/dist/onboardingSlice/thunks.js +649 -555
- package/dist/onboardingSlice/thunks.js.map +1 -1
- package/dist/onboardingSlice/thunks.mjs +28 -28
- package/dist/organizationSlice/constants.d.mts +6 -1
- package/dist/organizationSlice/constants.d.ts +6 -1
- package/dist/organizationSlice/constants.js +89 -51
- package/dist/organizationSlice/constants.js.map +1 -1
- package/dist/organizationSlice/constants.mjs +6 -4
- package/dist/organizationSlice/index.d.mts +224 -246
- package/dist/organizationSlice/index.d.ts +224 -246
- package/dist/organizationSlice/index.js +113 -59
- package/dist/organizationSlice/index.js.map +1 -1
- package/dist/organizationSlice/index.mjs +5 -5
- package/dist/organizationSlice/selectors.js +96 -58
- package/dist/organizationSlice/selectors.js.map +1 -1
- package/dist/organizationSlice/selectors.mjs +5 -5
- package/dist/organizationSlice/thunks.js +649 -580
- package/dist/organizationSlice/thunks.js.map +1 -1
- package/dist/organizationSlice/thunks.mjs +28 -28
- package/dist/releasesSlice/constants.js +0 -7
- package/dist/releasesSlice/constants.mjs +1 -1
- package/dist/releasesSlice/index.js +98 -60
- package/dist/releasesSlice/index.js.map +1 -1
- package/dist/releasesSlice/index.mjs +5 -5
- package/dist/releasesSlice/selectors.js +97 -53
- package/dist/releasesSlice/selectors.js.map +1 -1
- package/dist/releasesSlice/selectors.mjs +6 -6
- package/dist/releasesSlice/thunks.js +377 -287
- package/dist/releasesSlice/thunks.js.map +1 -1
- package/dist/releasesSlice/thunks.mjs +25 -25
- package/dist/selectors.d.mts +1 -1
- package/dist/selectors.d.ts +1 -1
- package/dist/selectors.js +150 -202
- package/dist/selectors.js.map +1 -1
- package/dist/selectors.mjs +45 -43
- package/dist/store.d.mts +235 -135
- package/dist/store.d.ts +235 -135
- package/dist/store.js +262 -157
- package/dist/store.js.map +1 -1
- package/dist/store.mjs +16 -16
- package/dist/storehooks.d.mts +3 -1
- package/dist/storehooks.d.ts +3 -1
- package/dist/storehooks.js +686 -569
- package/dist/storehooks.js.map +1 -1
- package/dist/storehooks.mjs +71 -54
- package/dist/storehooks.mjs.map +1 -1
- package/dist/thunks.js +649 -710
- package/dist/thunks.js.map +1 -1
- package/dist/thunks.mjs +28 -28
- package/dist/usersSlice/constants.d.mts +192 -17
- package/dist/usersSlice/constants.d.ts +192 -17
- package/dist/usersSlice/constants.js +97 -61
- package/dist/usersSlice/constants.js.map +1 -1
- package/dist/usersSlice/constants.mjs +6 -4
- package/dist/usersSlice/index.d.mts +1628 -704
- package/dist/usersSlice/index.d.ts +1628 -704
- package/dist/usersSlice/index.js +122 -67
- package/dist/usersSlice/index.js.map +1 -1
- package/dist/usersSlice/index.mjs +5 -5
- package/dist/usersSlice/selectors.js +101 -62
- package/dist/usersSlice/selectors.js.map +1 -1
- package/dist/usersSlice/selectors.mjs +6 -6
- package/dist/usersSlice/thunks.js +649 -584
- package/dist/usersSlice/thunks.js.map +1 -1
- package/dist/usersSlice/thunks.mjs +28 -28
- package/dist/utils.d.mts +6 -5
- package/dist/utils.d.ts +6 -5
- package/dist/utils.js +117 -89
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +5 -5
- package/package.json +66 -1
- package/dist/chunk-HVHZG2H4.mjs.map +0 -1
- package/dist/chunk-IPPIKGIB.mjs +0 -35
- package/dist/chunk-IVSYYXTC.mjs +0 -36
- package/dist/chunk-N7G6QK2E.mjs.map +0 -1
- package/dist/chunk-RQOE5OOT.mjs.map +0 -1
- package/dist/chunk-TD45YTYK.mjs.map +0 -1
- package/dist/chunk-XWBD7VOK.mjs +0 -93
- package/dist/chunk-YNVSU3AA.mjs.map +0 -1
- package/dist/chunk-ZNST5R6O.mjs.map +0 -1
- /package/dist/{chunk-XWBD7VOK.mjs.map → chunk-LZOMFHX3.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/releasesSlice/index.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport { DEVICE_LIST_DEFAULTS, SORTING_OPTIONS } from '@northern.tech/store/constants';\nimport { createSlice } from '@reduxjs/toolkit';\n\nexport const sliceName = 'releases';\n\nexport const initialState = {\n /*\n * Return list of saved artifacts objects\n */\n /*\n * return list of artifacts where duplicate names are collated with device compatibility lists combined\n */\n // artifacts: AppStore.getCollatedArtifacts(AppStore.getArtifactsRepo()),\n artifacts: [],\n /*\n * Return list of saved release objects\n */\n byId: {\n /*\n [releaseName]: {\n artifacts: [\n {\n id: '',\n name: '',\n description: '',\n device_types_compatible: [],\n ...\n updates: [{\n files: [\n { size: 123, name: '' }\n ],\n type_info: { type: '' }\n }],\n url: '' // optional\n }\n ],\n modified: ''\n device_types_compatible,\n name: '',\n tags: ['something'],\n notes: ''\n }\n */\n },\n releasesList: {\n ...DEVICE_LIST_DEFAULTS,\n searchedIds: [],\n releaseIds: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc,\n key: 'modified'\n },\n isLoading: undefined,\n searchTerm: '',\n searchTotal: 0,\n selectedTags: [],\n total: 0,\n type: ''\n },\n tags: [],\n updateTypes: [],\n /*\n * Return single release with corresponding Artifacts\n */\n selectedRelease: null\n};\n\nexport const releaseSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receiveRelease: (state, action) => {\n const { name } = action.payload;\n state.byId[name] = action.payload;\n },\n receiveReleases: (state, action) => {\n state.byId = action.payload;\n },\n receiveReleaseTags: (state, action) => {\n state.tags = action.payload;\n },\n receiveReleaseTypes: (state, action) => {\n state.updateTypes = action.payload;\n },\n removeRelease: (state, action) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: toBeRemoved, ...byId } = state.byId;\n state.byId = byId;\n state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;\n },\n selectedRelease: (state, action) => {\n state.selectedRelease = action.payload;\n },\n setReleaseListState: (state, action) => {\n state.releasesList = action.payload;\n }\n }\n});\n\nexport const actions = releaseSlice.actions;\nexport default releaseSlice.reducer;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/releasesSlice/index.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport { DEVICE_LIST_DEFAULTS, SORTING_OPTIONS } from '@northern.tech/store/constants';\nimport { createSlice } from '@reduxjs/toolkit';\n\nexport const sliceName = 'releases';\n\nexport const initialState = {\n /*\n * Return list of saved artifacts objects\n */\n /*\n * return list of artifacts where duplicate names are collated with device compatibility lists combined\n */\n // artifacts: AppStore.getCollatedArtifacts(AppStore.getArtifactsRepo()),\n artifacts: [],\n /*\n * Return list of saved release objects\n */\n byId: {\n /*\n [releaseName]: {\n artifacts: [\n {\n id: '',\n name: '',\n description: '',\n device_types_compatible: [],\n ...\n updates: [{\n files: [\n { size: 123, name: '' }\n ],\n type_info: { type: '' }\n }],\n url: '' // optional\n }\n ],\n modified: ''\n device_types_compatible,\n name: '',\n tags: ['something'],\n notes: ''\n }\n */\n },\n releasesList: {\n ...DEVICE_LIST_DEFAULTS,\n searchedIds: [],\n releaseIds: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc,\n key: 'modified'\n },\n isLoading: undefined,\n searchTerm: '',\n searchTotal: 0,\n selectedTags: [],\n total: 0,\n type: ''\n },\n tags: [],\n updateTypes: [],\n /*\n * Return single release with corresponding Artifacts\n */\n selectedRelease: null\n};\n\nexport const releaseSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receiveRelease: (state, action) => {\n const { name } = action.payload;\n state.byId[name] = action.payload;\n },\n receiveReleases: (state, action) => {\n state.byId = action.payload;\n },\n receiveReleaseTags: (state, action) => {\n state.tags = action.payload;\n },\n receiveReleaseTypes: (state, action) => {\n state.updateTypes = action.payload;\n },\n removeRelease: (state, action) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: toBeRemoved, ...byId } = state.byId;\n state.byId = byId;\n state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;\n },\n selectedRelease: (state, action) => {\n state.selectedRelease = action.payload;\n },\n setReleaseListState: (state, action) => {\n state.releasesList = action.payload;\n }\n }\n});\n\nexport const actions = releaseSlice.actions;\nexport default releaseSlice.reducer;\n"],"mappings":";;;;;;AAeA,SAAS,mBAAmB;AAErB,IAAM,YAAY;AAElB,IAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ1B,WAAW,CAAC;AAAA;AAAA;AAAA;AAAA,EAIZ,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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C,YAAM,eAAe,OAAO;AAAA,IAC9B;AAAA,EACF;AACF,CAAC;AAEM,IAAM,UAAU,aAAa;AACpC,IAAO,wBAAQ,aAAa;","names":[]}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__spreadProps,
|
|
3
|
-
__spreadValues
|
|
4
|
-
} from "./chunk-XWBD7VOK.mjs";
|
|
5
|
-
|
|
6
1
|
// src/appSlice/constants.ts
|
|
7
2
|
import { BarChart as BarChartIcon, PieChartOutline as PieChartIcon } from "@mui/icons-material";
|
|
8
3
|
var startingDeviceCount = {
|
|
@@ -25,7 +20,7 @@ var chartTypes = {
|
|
|
25
20
|
};
|
|
26
21
|
var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
|
|
27
22
|
var defaultReportType = "distribution";
|
|
28
|
-
var defaultReports = [
|
|
23
|
+
var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
|
|
29
24
|
var BEGINNING_OF_TIME = "2016-01-01T00:00:00.000Z";
|
|
30
25
|
var locations = {};
|
|
31
26
|
var PLANS = {
|
|
@@ -165,4 +160,4 @@ export {
|
|
|
165
160
|
APPLICATION_JSON_CONTENT_TYPE,
|
|
166
161
|
APPLICATION_JWT_CONTENT_TYPE
|
|
167
162
|
};
|
|
168
|
-
//# sourceMappingURL=chunk-
|
|
163
|
+
//# sourceMappingURL=chunk-5VNQCCAQ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/appSlice/constants.ts"],"sourcesContent":["// Copyright 2019 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { BarChart as BarChartIcon, PieChartOutline as PieChartIcon } from '@mui/icons-material';\n\nconst startingDeviceCount = {\n os: 'for first 50 devices',\n professional: 'for first 250 devices'\n};\n\nexport const apiRoot = '/api/management';\nexport const apiUrl = {\n v1: `${apiRoot}/v1`,\n v2: `${apiRoot}/v2`\n};\n\nexport const headerNames = {\n link: 'link',\n location: 'location',\n total: 'x-total-count'\n};\n\nexport const chartTypes = {\n bar: { key: 'bar', Icon: BarChartIcon },\n pie: { key: 'pie', Icon: PieChartIcon }\n};\nexport const emptyChartSelection = { software: '', group: '', chartType: chartTypes.bar.key, attribute: 'artifact_name' };\nexport const defaultReportType = 'distribution';\nexport const defaultReports = [{ ...emptyChartSelection, group: null, attribute: 'artifact_name', type: defaultReportType }];\n\nexport const BEGINNING_OF_TIME = '2016-01-01T00:00:00.000Z';\n\nexport const locations = {};\n\nexport const PLANS = {\n os: {\n id: 'os',\n name: 'Basic',\n offer: true,\n price: '$32/month',\n deviceCount: startingDeviceCount.os,\n offerprice: '$23/month for first 50 devices',\n price2: 'for first 6 months;\\n$29/month thereafter',\n features: ['Basic OTA features']\n },\n professional: {\n id: 'professional',\n name: 'Professional',\n offer: true,\n price: '$269/month',\n deviceCount: startingDeviceCount.professional,\n offerprice: '$200/month for first 50 devices',\n price2: 'for first 6 months;\\n$249/month thereafter',\n features: ['+ Advanced OTA features', '+ Standard support']\n },\n enterprise: {\n id: 'enterprise',\n name: 'Enterprise',\n price: 'Custom pricing',\n deviceCount: 'unlimited devices',\n features: ['+ Enterprise-grade OTA features', '+ Premium support']\n }\n};\n// the needs names need to be aligned with the name of the features in the appReducer, as they will be checked in the addonselection\nexport const ADDONS = {\n configure: {\n id: 'configure',\n title: 'Configure',\n description: 'Expand your plan with device configuration features',\n needs: ['hasDeviceConfig'],\n os: {\n price: '$11/month',\n deviceCount: startingDeviceCount.os\n },\n professional: {\n price: '$65/month',\n deviceCount: startingDeviceCount.professional\n },\n eligible: ['os', 'professional', 'enterprise']\n },\n troubleshoot: {\n id: 'troubleshoot',\n title: 'Troubleshoot',\n description: 'Expand your plan with device troubleshooting features',\n needs: ['hasDeviceConnect'],\n os: {\n price: '$27/month',\n deviceCount: startingDeviceCount.os\n },\n professional: {\n price: '$72/month',\n deviceCount: startingDeviceCount.professional\n },\n eligible: ['os', 'professional', 'enterprise']\n },\n monitor: {\n id: 'monitor',\n title: 'Monitor',\n description: 'Expand your plan with device monitoring features',\n needs: ['hasMonitor'],\n os: {\n price: '-',\n deviceCount: '-'\n },\n professional: {\n price: '$86/month',\n deviceCount: startingDeviceCount.professional\n },\n eligible: ['professional', 'enterprise']\n }\n};\n\nexport const BENEFITS = {\n auditlog: { id: 'auditlog', benefit: 'trace change across your devices and access troubleshooting session replay', requiredPlan: PLANS.professional.id },\n dashboard: { id: 'dashboard', benefit: 'actionable insights into the devices you are updating with Mender', requiredPlan: PLANS.enterprise.id },\n deltaGeneration: {\n id: 'deltaGeneration',\n benefit: 'automatic delta artifacts generation to minimize data transfer and improve the update delivery',\n requiredPlan: PLANS.enterprise.id\n },\n deviceConfiguration: { id: 'deviceConfiguration', benefit: 'device configuration features', requiredAddon: ADDONS.configure.id },\n deviceMonitor: { id: 'deviceMonitor', benefit: 'device monitoring features', requiredAddon: ADDONS.monitor.id, requiredPlan: PLANS.professional.id },\n deviceTroubleshoot: { id: 'deviceTroubleshoot', benefit: 'device troubleshooting features', requiredAddon: ADDONS.troubleshoot.id },\n dynamicGroups: { id: 'dynamicGroups', benefit: 'create dynamic groups to ease device management', requiredPlan: PLANS.enterprise.id },\n fullFiltering: { id: 'fullFiltering', benefit: 'filtering by multiple attributes to improve the device overview', requiredPlan: PLANS.professional.id },\n gateway: { id: 'gateway', benefit: 'see devices connected to your gateway device for easy access', requiredPlans: PLANS.professional.id },\n pausedDeployments: {\n id: 'pausedDeployments',\n benefit: 'granular control about update rollout to allow synchronization across your fleet',\n requiredPlan: PLANS.enterprise.id\n },\n phasedDeployments: { id: 'phasedDeployments', benefit: 'choose to roll out deployments in multiple phases', requiredPlan: PLANS.enterprise.id },\n rbac: { id: 'rbac', benefit: 'granular role based access control', requiredPlan: PLANS.enterprise.id },\n retryDeployments: { id: 'retryDeployments', benefit: 'optional retries for failed rollout attempts', requiredPlan: PLANS.professional.id },\n scheduledDeployments: {\n id: 'scheduledDeployments',\n benefit: 'scheduled deployments to steer the distribution of your updates.',\n requiredPlan: PLANS.professional.id\n },\n webhookEvents: {\n id: 'webhookEvents',\n benefit: 'receive inventory events and select which type(s) of events the webhook will receive',\n requiredPlan: PLANS.professional.id\n },\n\n default: { id: 'default', benefit: 'gain access to this feature', requiredPlan: PLANS.enterprise.id }\n};\n\nexport const yes = () => true;\nexport const canAccess = yes;\n\nexport const DARK_MODE = 'dark';\nexport const LIGHT_MODE = 'light';\n\nexport const APPLICATION_JSON_CONTENT_TYPE = 'application/json';\nexport const APPLICATION_JWT_CONTENT_TYPE = 'application/jwt';\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/appSlice/constants.ts"],"sourcesContent":["// Copyright 2019 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { BarChart as BarChartIcon, PieChartOutline as PieChartIcon } from '@mui/icons-material';\n\nconst startingDeviceCount = {\n os: 'for first 50 devices',\n professional: 'for first 250 devices'\n};\n\nexport const apiRoot = '/api/management';\nexport const apiUrl = {\n v1: `${apiRoot}/v1`,\n v2: `${apiRoot}/v2`\n};\n\nexport const headerNames = {\n link: 'link',\n location: 'location',\n total: 'x-total-count'\n};\n\nexport const chartTypes = {\n bar: { key: 'bar', Icon: BarChartIcon },\n pie: { key: 'pie', Icon: PieChartIcon }\n};\nexport const emptyChartSelection = { software: '', group: '', chartType: chartTypes.bar.key, attribute: 'artifact_name' };\nexport const defaultReportType = 'distribution';\nexport const defaultReports = [{ ...emptyChartSelection, group: null, attribute: 'artifact_name', type: defaultReportType }];\n\nexport const BEGINNING_OF_TIME = '2016-01-01T00:00:00.000Z';\n\nexport const locations = {};\n\nexport const PLANS = {\n os: {\n id: 'os',\n name: 'Basic',\n offer: true,\n price: '$32/month',\n deviceCount: startingDeviceCount.os,\n offerprice: '$23/month for first 50 devices',\n price2: 'for first 6 months;\\n$29/month thereafter',\n features: ['Basic OTA features']\n },\n professional: {\n id: 'professional',\n name: 'Professional',\n offer: true,\n price: '$269/month',\n deviceCount: startingDeviceCount.professional,\n offerprice: '$200/month for first 50 devices',\n price2: 'for first 6 months;\\n$249/month thereafter',\n features: ['+ Advanced OTA features', '+ Standard support']\n },\n enterprise: {\n id: 'enterprise',\n name: 'Enterprise',\n price: 'Custom pricing',\n deviceCount: 'unlimited devices',\n features: ['+ Enterprise-grade OTA features', '+ Premium support']\n }\n};\n// the needs names need to be aligned with the name of the features in the appReducer, as they will be checked in the addonselection\nexport const ADDONS = {\n configure: {\n id: 'configure',\n title: 'Configure',\n description: 'Expand your plan with device configuration features',\n needs: ['hasDeviceConfig'],\n os: {\n price: '$11/month',\n deviceCount: startingDeviceCount.os\n },\n professional: {\n price: '$65/month',\n deviceCount: startingDeviceCount.professional\n },\n eligible: ['os', 'professional', 'enterprise']\n },\n troubleshoot: {\n id: 'troubleshoot',\n title: 'Troubleshoot',\n description: 'Expand your plan with device troubleshooting features',\n needs: ['hasDeviceConnect'],\n os: {\n price: '$27/month',\n deviceCount: startingDeviceCount.os\n },\n professional: {\n price: '$72/month',\n deviceCount: startingDeviceCount.professional\n },\n eligible: ['os', 'professional', 'enterprise']\n },\n monitor: {\n id: 'monitor',\n title: 'Monitor',\n description: 'Expand your plan with device monitoring features',\n needs: ['hasMonitor'],\n os: {\n price: '-',\n deviceCount: '-'\n },\n professional: {\n price: '$86/month',\n deviceCount: startingDeviceCount.professional\n },\n eligible: ['professional', 'enterprise']\n }\n};\n\nexport const BENEFITS = {\n auditlog: { id: 'auditlog', benefit: 'trace change across your devices and access troubleshooting session replay', requiredPlan: PLANS.professional.id },\n dashboard: { id: 'dashboard', benefit: 'actionable insights into the devices you are updating with Mender', requiredPlan: PLANS.enterprise.id },\n deltaGeneration: {\n id: 'deltaGeneration',\n benefit: 'automatic delta artifacts generation to minimize data transfer and improve the update delivery',\n requiredPlan: PLANS.enterprise.id\n },\n deviceConfiguration: { id: 'deviceConfiguration', benefit: 'device configuration features', requiredAddon: ADDONS.configure.id },\n deviceMonitor: { id: 'deviceMonitor', benefit: 'device monitoring features', requiredAddon: ADDONS.monitor.id, requiredPlan: PLANS.professional.id },\n deviceTroubleshoot: { id: 'deviceTroubleshoot', benefit: 'device troubleshooting features', requiredAddon: ADDONS.troubleshoot.id },\n dynamicGroups: { id: 'dynamicGroups', benefit: 'create dynamic groups to ease device management', requiredPlan: PLANS.enterprise.id },\n fullFiltering: { id: 'fullFiltering', benefit: 'filtering by multiple attributes to improve the device overview', requiredPlan: PLANS.professional.id },\n gateway: { id: 'gateway', benefit: 'see devices connected to your gateway device for easy access', requiredPlans: PLANS.professional.id },\n pausedDeployments: {\n id: 'pausedDeployments',\n benefit: 'granular control about update rollout to allow synchronization across your fleet',\n requiredPlan: PLANS.enterprise.id\n },\n phasedDeployments: { id: 'phasedDeployments', benefit: 'choose to roll out deployments in multiple phases', requiredPlan: PLANS.enterprise.id },\n rbac: { id: 'rbac', benefit: 'granular role based access control', requiredPlan: PLANS.enterprise.id },\n retryDeployments: { id: 'retryDeployments', benefit: 'optional retries for failed rollout attempts', requiredPlan: PLANS.professional.id },\n scheduledDeployments: {\n id: 'scheduledDeployments',\n benefit: 'scheduled deployments to steer the distribution of your updates.',\n requiredPlan: PLANS.professional.id\n },\n webhookEvents: {\n id: 'webhookEvents',\n benefit: 'receive inventory events and select which type(s) of events the webhook will receive',\n requiredPlan: PLANS.professional.id\n },\n\n default: { id: 'default', benefit: 'gain access to this feature', requiredPlan: PLANS.enterprise.id }\n};\n\nexport const yes = () => true;\nexport const canAccess = yes;\n\nexport const DARK_MODE = 'dark';\nexport const LIGHT_MODE = 'light';\n\nexport const APPLICATION_JSON_CONTENT_TYPE = 'application/json';\nexport const APPLICATION_JWT_CONTENT_TYPE = 'application/jwt';\n"],"mappings":";AAaA,SAAS,YAAY,cAAc,mBAAmB,oBAAoB;AAE1E,IAAM,sBAAsB;AAAA,EAC1B,IAAI;AAAA,EACJ,cAAc;AAChB;AAEO,IAAM,UAAU;AAChB,IAAM,SAAS;AAAA,EACpB,IAAI,GAAG,OAAO;AAAA,EACd,IAAI,GAAG,OAAO;AAChB;AAEO,IAAM,cAAc;AAAA,EACzB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO;AACT;AAEO,IAAM,aAAa;AAAA,EACxB,KAAK,EAAE,KAAK,OAAO,MAAM,aAAa;AAAA,EACtC,KAAK,EAAE,KAAK,OAAO,MAAM,aAAa;AACxC;AACO,IAAM,sBAAsB,EAAE,UAAU,IAAI,OAAO,IAAI,WAAW,WAAW,IAAI,KAAK,WAAW,gBAAgB;AACjH,IAAM,oBAAoB;AAC1B,IAAM,iBAAiB,CAAC,EAAE,GAAG,qBAAqB,OAAO,MAAM,WAAW,iBAAiB,MAAM,kBAAkB,CAAC;AAEpH,IAAM,oBAAoB;AAE1B,IAAM,YAAY,CAAC;AAEnB,IAAM,QAAQ;AAAA,EACnB,IAAI;AAAA,IACF,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO;AAAA,IACP,aAAa,oBAAoB;AAAA,IACjC,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,UAAU,CAAC,oBAAoB;AAAA,EACjC;AAAA,EACA,cAAc;AAAA,IACZ,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAA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AS,EAAE,IAAI,WAAW,SAAS,+BAA+B,cAAc,MAAM,WAAW,GAAG;AACtG;AAEO,IAAM,MAAM,MAAM;AAClB,IAAM,YAAY;AAElB,IAAM,YAAY;AAClB,IAAM,aAAa;AAEnB,IAAM,gCAAgC;AACtC,IAAM,+BAA+B;","names":[]}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
cleanUp,
|
|
3
3
|
getToken
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZK4W5T53.mjs";
|
|
5
5
|
import {
|
|
6
6
|
TIMEOUTS
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
__spreadProps,
|
|
10
|
-
__spreadValues
|
|
11
|
-
} from "./chunk-XWBD7VOK.mjs";
|
|
7
|
+
} from "./chunk-QQBUNZHA.mjs";
|
|
12
8
|
|
|
13
9
|
// src/api/general-api.ts
|
|
14
10
|
import axios, { isCancel } from "axios";
|
|
15
11
|
var unauthorizedRedirect = (error) => {
|
|
16
|
-
|
|
17
|
-
if (!isCancel(error) && ((_a = error.response) == null ? void 0 : _a.status) === 401 && getToken()) {
|
|
12
|
+
if (!isCancel(error) && error.response?.status === 401 && getToken()) {
|
|
18
13
|
cleanUp();
|
|
19
14
|
window.location.replace("/ui/");
|
|
20
15
|
}
|
|
@@ -24,7 +19,7 @@ var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Conten
|
|
|
24
19
|
var authenticatedRequest = axios.create(commonRequestConfig);
|
|
25
20
|
authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
|
|
26
21
|
authenticatedRequest.interceptors.request.use(
|
|
27
|
-
(config) =>
|
|
22
|
+
(config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
|
|
28
23
|
(error) => Promise.reject(error)
|
|
29
24
|
);
|
|
30
25
|
var Api = {
|
|
@@ -32,7 +27,7 @@ var Api = {
|
|
|
32
27
|
delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
|
|
33
28
|
patch: authenticatedRequest.patch,
|
|
34
29
|
post: authenticatedRequest.post,
|
|
35
|
-
postUnauthorized: (url, data, config = {}) => axios.post(url, data,
|
|
30
|
+
postUnauthorized: (url, data, config = {}) => axios.post(url, data, { ...commonRequestConfig, ...config }),
|
|
36
31
|
put: authenticatedRequest.put,
|
|
37
32
|
upload: (url, formData, progress, cancelSignal) => authenticatedRequest.post(url, formData, {
|
|
38
33
|
headers: { "Content-Type": "multipart/form-data" },
|
|
@@ -54,4 +49,4 @@ export {
|
|
|
54
49
|
authenticatedRequest,
|
|
55
50
|
general_api_default
|
|
56
51
|
};
|
|
57
|
-
//# sourceMappingURL=chunk-
|
|
52
|
+
//# sourceMappingURL=chunk-65YIOCCD.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/general-api.ts"],"sourcesContent":["// Copyright 2017 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport axios, { isCancel } from 'axios';\n\nimport { cleanUp, getToken } from '../auth';\nimport { TIMEOUTS } from '../constants';\n\nconst unauthorizedRedirect = error => {\n if (!isCancel(error) && error.response?.status === 401 && getToken()) {\n cleanUp();\n window.location.replace('/ui/');\n }\n return Promise.reject(error);\n};\n\nexport const commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { 'Content-Type': 'application/json' } };\n\nexport const authenticatedRequest = axios.create(commonRequestConfig);\nauthenticatedRequest.interceptors.response.use(res => res, unauthorizedRedirect);\nauthenticatedRequest.interceptors.request.use(\n config => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),\n error => Promise.reject(error)\n);\n\nconst Api = {\n get: authenticatedRequest.get,\n delete: (url, data) => authenticatedRequest.request({ method: 'delete', url, data }),\n patch: authenticatedRequest.patch,\n post: authenticatedRequest.post,\n postUnauthorized: (url, data, config = {}) => axios.post(url, data, { ...commonRequestConfig, ...config }),\n put: authenticatedRequest.put,\n upload: (url, formData, progress, cancelSignal) =>\n authenticatedRequest.post(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data' },\n onUploadProgress: progress,\n timeout: 0,\n signal: cancelSignal\n }),\n uploadPut: (url, formData, progress, cancelSignal) =>\n authenticatedRequest.put(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data' },\n onUploadProgress: progress,\n timeout: 0,\n signal: cancelSignal\n })\n};\n\nexport default Api;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/api/general-api.ts"],"sourcesContent":["// Copyright 2017 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport axios, { isCancel } from 'axios';\n\nimport { cleanUp, getToken } from '../auth';\nimport { TIMEOUTS } from '../constants';\n\nconst unauthorizedRedirect = error => {\n if (!isCancel(error) && error.response?.status === 401 && getToken()) {\n cleanUp();\n window.location.replace('/ui/');\n }\n return Promise.reject(error);\n};\n\nexport const commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { 'Content-Type': 'application/json' } };\n\nexport const authenticatedRequest = axios.create(commonRequestConfig);\nauthenticatedRequest.interceptors.response.use(res => res, unauthorizedRedirect);\nauthenticatedRequest.interceptors.request.use(\n config => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),\n error => Promise.reject(error)\n);\n\nconst Api = {\n get: authenticatedRequest.get,\n delete: (url, data) => authenticatedRequest.request({ method: 'delete', url, data }),\n patch: authenticatedRequest.patch,\n post: authenticatedRequest.post,\n postUnauthorized: (url, data, config = {}) => axios.post(url, data, { ...commonRequestConfig, ...config }),\n put: authenticatedRequest.put,\n upload: (url, formData, progress, cancelSignal) =>\n authenticatedRequest.post(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data' },\n onUploadProgress: progress,\n timeout: 0,\n signal: cancelSignal\n }),\n uploadPut: (url, formData, progress, cancelSignal) =>\n authenticatedRequest.put(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data' },\n onUploadProgress: progress,\n timeout: 0,\n signal: cancelSignal\n })\n};\n\nexport default Api;\n"],"mappings":";;;;;;;;;AAcA,OAAO,SAAS,gBAAgB;AAKhC,IAAM,uBAAuB,WAAS;AACpC,MAAI,CAAC,SAAS,KAAK,KAAK,MAAM,UAAU,WAAW,OAAO,SAAS,GAAG;AACpE,YAAQ;AACR,WAAO,SAAS,QAAQ,MAAM;AAAA,EAChC;AACA,SAAO,QAAQ,OAAO,KAAK;AAC7B;AAEO,IAAM,sBAAsB,EAAE,SAAS,SAAS,gBAAgB,SAAS,EAAE,gBAAgB,mBAAmB,EAAE;AAEhH,IAAM,uBAAuB,MAAM,OAAO,mBAAmB;AACpE,qBAAqB,aAAa,SAAS,IAAI,SAAO,KAAK,oBAAoB;AAC/E,qBAAqB,aAAa,QAAQ;AAAA,EACxC,aAAW,EAAE,GAAG,QAAQ,SAAS,EAAE,GAAG,OAAO,SAAS,eAAe,UAAU,SAAS,CAAC,GAAG,EAAE;AAAA,EAC9F,WAAS,QAAQ,OAAO,KAAK;AAC/B;AAEA,IAAM,MAAM;AAAA,EACV,KAAK,qBAAqB;AAAA,EAC1B,QAAQ,CAAC,KAAK,SAAS,qBAAqB,QAAQ,EAAE,QAAQ,UAAU,KAAK,KAAK,CAAC;AAAA,EACnF,OAAO,qBAAqB;AAAA,EAC5B,MAAM,qBAAqB;AAAA,EAC3B,kBAAkB,CAAC,KAAK,MAAM,SAAS,CAAC,MAAM,MAAM,KAAK,KAAK,MAAM,EAAE,GAAG,qBAAqB,GAAG,OAAO,CAAC;AAAA,EACzG,KAAK,qBAAqB;AAAA,EAC1B,QAAQ,CAAC,KAAK,UAAU,UAAU,iBAChC,qBAAqB,KAAK,KAAK,UAAU;AAAA,IACvC,SAAS,EAAE,gBAAgB,sBAAsB;AAAA,IACjD,kBAAkB;AAAA,IAClB,SAAS;AAAA,IACT,QAAQ;AAAA,EACV,CAAC;AAAA,EACH,WAAW,CAAC,KAAK,UAAU,UAAU,iBACnC,qBAAqB,IAAI,KAAK,UAAU;AAAA,IACtC,SAAS,EAAE,gBAAgB,sBAAsB;AAAA,IACjD,kBAAkB;AAAA,IAClB,SAAS;AAAA,IACT,QAAQ;AAAA,EACV,CAAC;AACL;AAEA,IAAO,sBAAQ;","names":[]}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEVICE_STATES
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IFWKT27G.mjs";
|
|
4
4
|
import {
|
|
5
5
|
UNGROUPED_GROUP
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
__objRest,
|
|
9
|
-
__restKey,
|
|
10
|
-
__spreadProps,
|
|
11
|
-
__spreadValues
|
|
12
|
-
} from "./chunk-XWBD7VOK.mjs";
|
|
6
|
+
} from "./chunk-QQBUNZHA.mjs";
|
|
13
7
|
|
|
14
8
|
// src/devicesSlice/selectors.ts
|
|
15
9
|
import { duplicateFilter } from "@northern.tech/utils/helpers";
|
|
@@ -25,7 +19,8 @@ var getListedDevices = (state) => state.devices.deviceList.deviceIds;
|
|
|
25
19
|
var getFilteringAttributes = (state) => state.devices.filteringAttributes;
|
|
26
20
|
var getDeviceFilters = (state) => state.devices.filters || [];
|
|
27
21
|
var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
|
|
28
|
-
var getSortedFilteringAttributes = createSelector([getFilteringAttributes], (filteringAttributes) =>
|
|
22
|
+
var getSortedFilteringAttributes = createSelector([getFilteringAttributes], (filteringAttributes) => ({
|
|
23
|
+
...filteringAttributes,
|
|
29
24
|
identityAttributes: [...filteringAttributes.identityAttributes, "id"]
|
|
30
25
|
}));
|
|
31
26
|
var getDeviceLimit = (state) => state.devices.limit;
|
|
@@ -53,10 +48,7 @@ var getDeviceCountsByStatus = createSelector(
|
|
|
53
48
|
return accu;
|
|
54
49
|
}, {})
|
|
55
50
|
);
|
|
56
|
-
var getDeviceById = createSelector([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => {
|
|
57
|
-
var _a;
|
|
58
|
-
return (_a = devicesById[deviceId]) != null ? _a : {};
|
|
59
|
-
});
|
|
51
|
+
var getDeviceById = createSelector([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
|
|
60
52
|
var getSelectedGroupInfo = createSelector(
|
|
61
53
|
[getAcceptedDevices, getGroupsById, getSelectedGroup],
|
|
62
54
|
({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
|
|
@@ -73,17 +65,13 @@ var getLimitMaxed = createSelector(
|
|
|
73
65
|
[getAcceptedDevices, getDeviceLimit],
|
|
74
66
|
({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
|
|
75
67
|
);
|
|
76
|
-
var
|
|
77
|
-
var getGroupsByIdWithoutUngrouped = createSelector([getGroupsById], (_a) => {
|
|
78
|
-
var _c = _a, { [_b = UNGROUPED_GROUP.id]: ungrouped } = _c, groups = __objRest(_c, [__restKey(_b)]);
|
|
79
|
-
return groups;
|
|
80
|
-
});
|
|
68
|
+
var getGroupsByIdWithoutUngrouped = createSelector([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
|
|
81
69
|
var getGroups = createSelector([getGroupsById], (groupsById) => {
|
|
82
70
|
const groupNames = Object.keys(groupsById).sort();
|
|
83
71
|
const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
|
|
84
72
|
(accu, [groupname, group]) => {
|
|
85
73
|
const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
|
|
86
|
-
const groupItem =
|
|
74
|
+
const groupItem = { ...group, groupId: name, name: groupname };
|
|
87
75
|
if (group.filters.length > 0) {
|
|
88
76
|
if (groupname !== UNGROUPED_GROUP.id) {
|
|
89
77
|
accu.dynamic.push(groupItem);
|
|
@@ -97,7 +85,7 @@ var getGroups = createSelector([getGroupsById], (groupsById) => {
|
|
|
97
85
|
},
|
|
98
86
|
{ dynamic: [], static: [], ungrouped: [] }
|
|
99
87
|
);
|
|
100
|
-
return
|
|
88
|
+
return { groupNames, ...groupedGroups };
|
|
101
89
|
});
|
|
102
90
|
var getAttributesList = createSelector(
|
|
103
91
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
@@ -142,4 +130,4 @@ export {
|
|
|
142
130
|
getAttributesList,
|
|
143
131
|
getDeviceTypes
|
|
144
132
|
};
|
|
145
|
-
//# sourceMappingURL=chunk-
|
|
133
|
+
//# sourceMappingURL=chunk-6CSGHZ3E.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/devicesSlice/selectors.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport { DEVICE_STATES, UNGROUPED_GROUP } from '@northern.tech/store/constants';\nimport { duplicateFilter } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\n\nexport const getAcceptedDevices = state => state.devices.byStatus.accepted;\nexport const getDevicesByStatus = state => state.devices.byStatus;\nexport const getDevicesById = state => state.devices.byId;\nexport const getDeviceReports = state => state.devices.reports;\nexport const getGroupsById = state => state.devices.groups.byId;\nexport const getSelectedGroup = state => state.devices.groups.selectedGroup;\n\nexport const getDeviceListState = state => state.devices.deviceList;\nexport const getListedDevices = state => state.devices.deviceList.deviceIds;\nexport const getFilteringAttributes = state => state.devices.filteringAttributes;\nexport const getDeviceFilters = state => state.devices.filters || [];\nconst getFilteringAttributesFromConfig = state => state.devices.filteringAttributesConfig.attributes;\nexport const getSortedFilteringAttributes = createSelector([getFilteringAttributes], filteringAttributes => ({\n ...filteringAttributes,\n identityAttributes: [...filteringAttributes.identityAttributes, 'id']\n}));\nexport const getDeviceLimit = state => state.devices.limit;\nconst getFilteringAttributesLimit = state => state.devices.filteringAttributesLimit;\n\nexport const getDeviceIdentityAttributes = createSelector(\n [getFilteringAttributes, getFilteringAttributesLimit],\n ({ identityAttributes }, filteringAttributesLimit) => {\n // limit the selection of the available attribute to AVAILABLE_ATTRIBUTE_LIMIT\n const attributes = identityAttributes.slice(0, filteringAttributesLimit);\n return attributes.reduce(\n (accu, value) => {\n accu.push({ value, label: value, scope: 'identity' });\n return accu;\n },\n [\n { value: 'name', label: 'Name', scope: 'tags' },\n { value: 'id', label: 'Device ID', scope: 'identity' }\n ]\n );\n }\n);\n\nexport const getDeviceCountsByStatus = createSelector([getDevicesByStatus], byStatus =>\n Object.values(DEVICE_STATES).reduce((accu, state) => {\n accu[state] = byStatus[state].total || 0;\n return accu;\n }, {})\n);\n\nexport const getDeviceById = createSelector([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = '') => devicesById[deviceId] ?? {});\n\nexport const getSelectedGroupInfo = createSelector(\n [getAcceptedDevices, getGroupsById, getSelectedGroup],\n ({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {\n let groupCount = acceptedDeviceTotal;\n let groupFilters = [];\n if (selectedGroup && groupsById[selectedGroup]) {\n groupCount = groupsById[selectedGroup].total;\n groupFilters = groupsById[selectedGroup].filters || [];\n }\n return { groupCount, selectedGroup, groupFilters };\n }\n);\n\nexport const getLimitMaxed = createSelector([getAcceptedDevices, getDeviceLimit], ({ total: acceptedDevices = 0 }, deviceLimit) =>\n Boolean(deviceLimit && deviceLimit <= acceptedDevices)\n);\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const getGroupsByIdWithoutUngrouped = createSelector([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);\n\nexport const getGroups = createSelector([getGroupsById], groupsById => {\n const groupNames = Object.keys(groupsById).sort();\n const groupedGroups = Object.entries(groupsById)\n .sort((a, b) => a[0].localeCompare(b[0]))\n .reduce(\n (accu, [groupname, group]) => {\n const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;\n const groupItem = { ...group, groupId: name, name: groupname };\n if (group.filters.length > 0) {\n if (groupname !== UNGROUPED_GROUP.id) {\n accu.dynamic.push(groupItem);\n } else {\n accu.ungrouped.push(groupItem);\n }\n } else {\n accu.static.push(groupItem);\n }\n return accu;\n },\n { dynamic: [], static: [], ungrouped: [] }\n );\n return { groupNames, ...groupedGroups };\n});\nexport const getAttributesList = createSelector(\n [getFilteringAttributes, getFilteringAttributesFromConfig],\n ({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) =>\n [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(duplicateFilter)\n);\n\nexport const getDeviceTypes = createSelector([getAcceptedDevices, getDevicesById], ({ deviceIds = [] }, devicesById) =>\n Object.keys(\n deviceIds.slice(0, 200).reduce((accu, item) => {\n const { device_type: deviceTypes = [] } = devicesById[item] ? devicesById[item].attributes : {};\n accu = deviceTypes.reduce((deviceTypeAccu, deviceType) => {\n if (deviceType.length > 1) {\n deviceTypeAccu[deviceType] = deviceTypeAccu[deviceType] ? deviceTypeAccu[deviceType] + 1 : 1;\n }\n return deviceTypeAccu;\n }, accu);\n return accu;\n }, {})\n )\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/devicesSlice/selectors.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport { DEVICE_STATES, UNGROUPED_GROUP } from '@northern.tech/store/constants';\nimport { duplicateFilter } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\n\nexport const getAcceptedDevices = state => state.devices.byStatus.accepted;\nexport const getDevicesByStatus = state => state.devices.byStatus;\nexport const getDevicesById = state => state.devices.byId;\nexport const getDeviceReports = state => state.devices.reports;\nexport const getGroupsById = state => state.devices.groups.byId;\nexport const getSelectedGroup = state => state.devices.groups.selectedGroup;\n\nexport const getDeviceListState = state => state.devices.deviceList;\nexport const getListedDevices = state => state.devices.deviceList.deviceIds;\nexport const getFilteringAttributes = state => state.devices.filteringAttributes;\nexport const getDeviceFilters = state => state.devices.filters || [];\nconst getFilteringAttributesFromConfig = state => state.devices.filteringAttributesConfig.attributes;\nexport const getSortedFilteringAttributes = createSelector([getFilteringAttributes], filteringAttributes => ({\n ...filteringAttributes,\n identityAttributes: [...filteringAttributes.identityAttributes, 'id']\n}));\nexport const getDeviceLimit = state => state.devices.limit;\nconst getFilteringAttributesLimit = state => state.devices.filteringAttributesLimit;\n\nexport const getDeviceIdentityAttributes = createSelector(\n [getFilteringAttributes, getFilteringAttributesLimit],\n ({ identityAttributes }, filteringAttributesLimit) => {\n // limit the selection of the available attribute to AVAILABLE_ATTRIBUTE_LIMIT\n const attributes = identityAttributes.slice(0, filteringAttributesLimit);\n return attributes.reduce(\n (accu, value) => {\n accu.push({ value, label: value, scope: 'identity' });\n return accu;\n },\n [\n { value: 'name', label: 'Name', scope: 'tags' },\n { value: 'id', label: 'Device ID', scope: 'identity' }\n ]\n );\n }\n);\n\nexport const getDeviceCountsByStatus = createSelector([getDevicesByStatus], byStatus =>\n Object.values(DEVICE_STATES).reduce((accu, state) => {\n accu[state] = byStatus[state].total || 0;\n return accu;\n }, {})\n);\n\nexport const getDeviceById = createSelector([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = '') => devicesById[deviceId] ?? {});\n\nexport const getSelectedGroupInfo = createSelector(\n [getAcceptedDevices, getGroupsById, getSelectedGroup],\n ({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {\n let groupCount = acceptedDeviceTotal;\n let groupFilters = [];\n if (selectedGroup && groupsById[selectedGroup]) {\n groupCount = groupsById[selectedGroup].total;\n groupFilters = groupsById[selectedGroup].filters || [];\n }\n return { groupCount, selectedGroup, groupFilters };\n }\n);\n\nexport const getLimitMaxed = createSelector([getAcceptedDevices, getDeviceLimit], ({ total: acceptedDevices = 0 }, deviceLimit) =>\n Boolean(deviceLimit && deviceLimit <= acceptedDevices)\n);\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const getGroupsByIdWithoutUngrouped = createSelector([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);\n\nexport const getGroups = createSelector([getGroupsById], groupsById => {\n const groupNames = Object.keys(groupsById).sort();\n const groupedGroups = Object.entries(groupsById)\n .sort((a, b) => a[0].localeCompare(b[0]))\n .reduce(\n (accu, [groupname, group]) => {\n const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;\n const groupItem = { ...group, groupId: name, name: groupname };\n if (group.filters.length > 0) {\n if (groupname !== UNGROUPED_GROUP.id) {\n accu.dynamic.push(groupItem);\n } else {\n accu.ungrouped.push(groupItem);\n }\n } else {\n accu.static.push(groupItem);\n }\n return accu;\n },\n { dynamic: [], static: [], ungrouped: [] }\n );\n return { groupNames, ...groupedGroups };\n});\nexport const getAttributesList = createSelector(\n [getFilteringAttributes, getFilteringAttributesFromConfig],\n ({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) =>\n [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(duplicateFilter)\n);\n\nexport const getDeviceTypes = createSelector([getAcceptedDevices, getDevicesById], ({ deviceIds = [] }, devicesById) =>\n Object.keys(\n deviceIds.slice(0, 200).reduce((accu, item) => {\n const { device_type: deviceTypes = [] } = devicesById[item] ? devicesById[item].attributes : {};\n accu = deviceTypes.reduce((deviceTypeAccu, deviceType) => {\n if (deviceType.length > 1) {\n deviceTypeAccu[deviceType] = deviceTypeAccu[deviceType] ? deviceTypeAccu[deviceType] + 1 : 1;\n }\n return deviceTypeAccu;\n }, accu);\n return accu;\n }, {})\n )\n);\n"],"mappings":";;;;;;;;AAeA,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAExB,IAAM,qBAAqB,WAAS,MAAM,QAAQ,SAAS;AAC3D,IAAM,qBAAqB,WAAS,MAAM,QAAQ;AAClD,IAAM,iBAAiB,WAAS,MAAM,QAAQ;AAC9C,IAAM,mBAAmB,WAAS,MAAM,QAAQ;AAChD,IAAM,gBAAgB,WAAS,MAAM,QAAQ,OAAO;AACpD,IAAM,mBAAmB,WAAS,MAAM,QAAQ,OAAO;AAEvD,IAAM,qBAAqB,WAAS,MAAM,QAAQ;AAClD,IAAM,mBAAmB,WAAS,MAAM,QAAQ,WAAW;AAC3D,IAAM,yBAAyB,WAAS,MAAM,QAAQ;AACtD,IAAM,mBAAmB,WAAS,MAAM,QAAQ,WAAW,CAAC;AACnE,IAAM,mCAAmC,WAAS,MAAM,QAAQ,0BAA0B;AACnF,IAA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AG,EAAE,WAAW,CAAC,GAAG,YAAY,CAAC,EAAE,MACtF,CAAC,GAAG,oBAAoB,GAAG,qBAAqB,GAAG,UAAU,GAAG,SAAS,EAAE,OAAO,eAAe;AACrG;AAEO,IAAM,iBAAiB;AAAA,EAAe,CAAC,oBAAoB,cAAc;AAAA,EAAG,CAAC,EAAE,YAAY,CAAC,EAAE,GAAG,gBACtG,OAAO;AAAA,IACL,UAAU,MAAM,GAAG,GAAG,EAAE,OAAO,CAAC,MAAM,SAAS;AAC7C,YAAM,EAAE,aAAa,cAAc,CAAC,EAAE,IAAI,YAAY,IAAI,IAAI,YAAY,IAAI,EAAE,aAAa,CAAC;AAC9F,aAAO,YAAY,OAAO,CAAC,gBAAgB,eAAe;AACxD,YAAI,WAAW,SAAS,GAAG;AACzB,yBAAe,UAAU,IAAI,eAAe,UAAU,IAAI,eAAe,UAAU,IAAI,IAAI;AAAA,QAC7F;AACA,eAAO;AAAA,MACT,GAAG,IAAI;AACP,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,EACP;AACF;","names":[]}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEVICE_STATES
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IFWKT27G.mjs";
|
|
4
4
|
import {
|
|
5
5
|
DEVICE_LIST_DEFAULTS,
|
|
6
6
|
SORTING_OPTIONS
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
__objRest,
|
|
10
|
-
__restKey,
|
|
11
|
-
__spreadProps,
|
|
12
|
-
__spreadValues
|
|
13
|
-
} from "./chunk-XWBD7VOK.mjs";
|
|
7
|
+
} from "./chunk-QQBUNZHA.mjs";
|
|
14
8
|
|
|
15
9
|
// src/devicesSlice/index.ts
|
|
16
10
|
import { deepCompare, duplicateFilter } from "@northern.tech/utils/helpers";
|
|
@@ -31,9 +25,9 @@ var initialState = {
|
|
|
31
25
|
[DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
|
|
32
26
|
[DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
|
|
33
27
|
},
|
|
34
|
-
deviceList:
|
|
35
|
-
deviceIds: []
|
|
36
|
-
|
|
28
|
+
deviceList: {
|
|
29
|
+
deviceIds: [],
|
|
30
|
+
...DEVICE_LIST_DEFAULTS,
|
|
37
31
|
selectedAttributes: [],
|
|
38
32
|
selectedIssues: [],
|
|
39
33
|
selection: [],
|
|
@@ -44,7 +38,7 @@ var initialState = {
|
|
|
44
38
|
},
|
|
45
39
|
state: DEVICE_STATES.accepted,
|
|
46
40
|
total: 0
|
|
47
|
-
}
|
|
41
|
+
},
|
|
48
42
|
filters: [
|
|
49
43
|
// { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
|
|
50
44
|
],
|
|
@@ -79,49 +73,59 @@ var devicesSlice = createSlice({
|
|
|
79
73
|
},
|
|
80
74
|
addToGroup: (state, action) => {
|
|
81
75
|
const { group, deviceIds } = action.payload;
|
|
82
|
-
const maybeExistingGroup =
|
|
76
|
+
const maybeExistingGroup = {
|
|
83
77
|
filters: [],
|
|
84
|
-
deviceIds: []
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
deviceIds: [],
|
|
79
|
+
...state.groups.byId[group]
|
|
80
|
+
};
|
|
81
|
+
state.groups.byId[group] = {
|
|
82
|
+
...maybeExistingGroup,
|
|
87
83
|
deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),
|
|
88
84
|
total: (maybeExistingGroup.total || 0) + 1
|
|
89
|
-
}
|
|
85
|
+
};
|
|
90
86
|
},
|
|
91
87
|
removeFromGroup: (state, action) => {
|
|
92
88
|
const { group, deviceIds: removedIds } = action.payload;
|
|
93
|
-
const
|
|
94
|
-
const changedGroup =
|
|
89
|
+
const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
|
|
90
|
+
const changedGroup = {
|
|
91
|
+
...maybeExistingGroup,
|
|
95
92
|
deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
|
|
96
93
|
total: Math.max(total - removedIds.length, 0)
|
|
97
|
-
}
|
|
94
|
+
};
|
|
98
95
|
if (changedGroup.total || changedGroup.deviceIds.length) {
|
|
99
96
|
state.groups.byId[group] = changedGroup;
|
|
100
97
|
return;
|
|
101
98
|
} else if (state.groups.selectedGroup === group) {
|
|
102
99
|
state.groups.selectedGroup = void 0;
|
|
103
100
|
}
|
|
104
|
-
const
|
|
101
|
+
const { [group]: removal, ...remainingById } = state.groups.byId;
|
|
105
102
|
state.groups.byId = remainingById;
|
|
106
103
|
},
|
|
107
104
|
addGroup: (state, action) => {
|
|
108
105
|
const { groupName, group } = action.payload;
|
|
109
|
-
state.groups.byId[groupName] =
|
|
106
|
+
state.groups.byId[groupName] = {
|
|
107
|
+
...state.groups.byId[groupName],
|
|
108
|
+
...group
|
|
109
|
+
};
|
|
110
110
|
},
|
|
111
111
|
selectGroup: (state, { payload: group }) => {
|
|
112
112
|
state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
|
|
113
113
|
state.groups.selectedGroup = group;
|
|
114
114
|
},
|
|
115
115
|
removeGroup: (state, action) => {
|
|
116
|
-
|
|
117
|
-
const _b = state.groups.byId, { [_a = action.payload]: removal } = _b, remainingById = __objRest(_b, [__restKey(_a)]);
|
|
116
|
+
const { [action.payload]: removal, ...remainingById } = state.groups.byId;
|
|
118
117
|
state.groups.byId = remainingById;
|
|
119
118
|
state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
|
|
120
119
|
},
|
|
121
120
|
setDeviceListState: (state, action) => {
|
|
122
|
-
state.deviceList =
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
state.deviceList = {
|
|
122
|
+
...state.deviceList,
|
|
123
|
+
...action.payload,
|
|
124
|
+
sort: {
|
|
125
|
+
...state.deviceList.sort,
|
|
126
|
+
...action.payload.sort
|
|
127
|
+
}
|
|
128
|
+
};
|
|
125
129
|
},
|
|
126
130
|
setFilterAttributes: (state, action) => {
|
|
127
131
|
state.filteringAttributes = action.payload;
|
|
@@ -130,7 +134,10 @@ var devicesSlice = createSlice({
|
|
|
130
134
|
state.filteringAttributesConfig = action.payload;
|
|
131
135
|
},
|
|
132
136
|
receivedDevices: (state, action) => {
|
|
133
|
-
state.byId =
|
|
137
|
+
state.byId = {
|
|
138
|
+
...state.byId,
|
|
139
|
+
...action.payload
|
|
140
|
+
};
|
|
134
141
|
},
|
|
135
142
|
setDeviceFilters: (state, action) => {
|
|
136
143
|
if (deepCompare(action.payload, state.filters)) {
|
|
@@ -161,7 +168,10 @@ var devicesSlice = createSlice({
|
|
|
161
168
|
state.limit = action.payload;
|
|
162
169
|
},
|
|
163
170
|
receivedDevice: (state, action) => {
|
|
164
|
-
state.byId[action.payload.id] =
|
|
171
|
+
state.byId[action.payload.id] = {
|
|
172
|
+
...state.byId[action.payload.id],
|
|
173
|
+
...action.payload
|
|
174
|
+
};
|
|
165
175
|
},
|
|
166
176
|
maybeUpdateDevicesByStatus: (state, action) => {
|
|
167
177
|
const { deviceId, authId } = action.payload;
|
|
@@ -184,4 +194,4 @@ export {
|
|
|
184
194
|
actions,
|
|
185
195
|
devicesSlice_default
|
|
186
196
|
};
|
|
187
|
-
//# sourceMappingURL=chunk-
|
|
197
|
+
//# sourceMappingURL=chunk-AZRVRNXT.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/devicesSlice/index.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport { DEVICE_LIST_DEFAULTS, SORTING_OPTIONS } from '@northern.tech/store/commonConstants';\nimport { deepCompare, duplicateFilter } from '@northern.tech/utils/helpers';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport { DEVICE_STATES } from './constants';\n\nexport const sliceName = 'devices';\n\nexport const initialState = {\n byId: {\n // [deviceId]: {\n // ...,\n // twinsByIntegration: { [external.provider.id]: twinData }\n // }\n },\n byStatus: {\n [DEVICE_STATES.accepted]: { deviceIds: [], total: 0 },\n active: { deviceIds: [], total: 0 },\n inactive: { deviceIds: [], total: 0 },\n [DEVICE_STATES.pending]: { deviceIds: [], total: 0 },\n [DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },\n [DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }\n },\n deviceList: {\n deviceIds: [],\n ...DEVICE_LIST_DEFAULTS,\n selectedAttributes: [],\n selectedIssues: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n },\n state: DEVICE_STATES.accepted,\n total: 0\n },\n filters: [\n // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }\n ],\n filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },\n filteringAttributesLimit: 10,\n filteringAttributesConfig: {\n attributes: {\n // inventory: ['some_attribute']\n },\n count: 0,\n limit: 100\n },\n reports: [\n // { items: [{ key: \"someKey\", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }\n ],\n total: 0,\n limit: 0,\n groups: {\n byId: {\n // groupName: { deviceIds: [], total: 0, filters: [] },\n // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }\n },\n selectedGroup: undefined\n }\n};\n\nexport const devicesSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedGroups: (state, action) => {\n state.groups.byId = action.payload;\n },\n addToGroup: (state, action) => {\n const { group, deviceIds } = action.payload;\n const maybeExistingGroup = {\n filters: [],\n deviceIds: [],\n ...state.groups.byId[group]\n };\n state.groups.byId[group] = {\n ...maybeExistingGroup,\n deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),\n total: (maybeExistingGroup.total || 0) + 1\n };\n },\n removeFromGroup: (state, action) => {\n const { group, deviceIds: removedIds } = action.payload;\n const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};\n const changedGroup = {\n ...maybeExistingGroup,\n deviceIds: deviceIds.filter(id => !removedIds.includes(id)),\n total: Math.max(total - removedIds.length, 0)\n };\n if (changedGroup.total || changedGroup.deviceIds.length) {\n state.groups.byId[group] = changedGroup;\n return;\n } else if (state.groups.selectedGroup === group) {\n state.groups.selectedGroup = undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [group]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n },\n addGroup: (state, action) => {\n const { groupName, group } = action.payload;\n state.groups.byId[groupName] = {\n ...state.groups.byId[groupName],\n ...group\n };\n },\n selectGroup: (state, { payload: group }) => {\n state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];\n state.groups.selectedGroup = group;\n },\n removeGroup: (state, action) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? undefined : state.groups.selectedGroup;\n },\n setDeviceListState: (state, action) => {\n state.deviceList = {\n ...state.deviceList,\n ...action.payload,\n sort: {\n ...state.deviceList.sort,\n ...action.payload.sort\n }\n };\n },\n setFilterAttributes: (state, action) => {\n state.filteringAttributes = action.payload;\n },\n setFilterablesConfig: (state, action) => {\n state.filteringAttributesConfig = action.payload;\n },\n receivedDevices: (state, action) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n setDeviceFilters: (state, action) => {\n if (deepCompare(action.payload, state.filters)) {\n return;\n }\n state.filters = action.payload.filter(filter => filter.key && filter.operator && filter.scope && typeof filter.value !== 'undefined');\n },\n setInactiveDevices: (state, action) => {\n const { activeDeviceTotal, inactiveDeviceTotal } = action.payload;\n state.byStatus.active.total = activeDeviceTotal;\n state.byStatus.inactive.total = inactiveDeviceTotal;\n },\n setDeviceReports: (state, action) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action) => {\n const { forceUpdate, status, total, deviceIds } = action.payload;\n state.byStatus[status] = total || forceUpdate ? { deviceIds, total } : state.byStatus[status];\n },\n setDevicesCountByStatus: (state, action) => {\n const { count, status } = action.payload;\n state.byStatus[status].total = count;\n },\n setTotalDevices: (state, action) => {\n state.total = action.payload;\n },\n setDeviceLimit: (state, action) => {\n state.limit = action.payload;\n },\n receivedDevice: (state, action) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n maybeUpdateDevicesByStatus: (state, action) => {\n const { deviceId, authId } = action.payload;\n const device = state.byId[deviceId];\n const hasMultipleAuthSets = authId ? device.auth_sets.filter(authset => authset.id !== authId).length > 0 : false;\n if (!hasMultipleAuthSets && Object.values(DEVICE_STATES).includes(device.status)) {\n const deviceIds = state.byStatus[device.status].deviceIds.filter(id => id !== deviceId);\n state.byStatus[device.status] = { deviceIds, total: Math.max(0, state.byStatus[device.status].total - 1) };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,aAAa,uBAAuB;AAC7C,SAAS,mBAAmB;AAIrB,IAAM,YAAY;AAElB,IAAM,eAAe;AAAA,EAC1B,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,EAKN;AAAA,EACA,UAAU;AAAA,IACR,CAAC,cAAc,QAAQ,GAAG,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,IACpD,QAAQ,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,IA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../src/devicesSlice/index.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport { DEVICE_LIST_DEFAULTS, SORTING_OPTIONS } from '@northern.tech/store/commonConstants';\nimport { deepCompare, duplicateFilter } from '@northern.tech/utils/helpers';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport { DEVICE_STATES } from './constants';\n\nexport const sliceName = 'devices';\n\nexport const initialState = {\n byId: {\n // [deviceId]: {\n // ...,\n // twinsByIntegration: { [external.provider.id]: twinData }\n // }\n },\n byStatus: {\n [DEVICE_STATES.accepted]: { deviceIds: [], total: 0 },\n active: { deviceIds: [], total: 0 },\n inactive: { deviceIds: [], total: 0 },\n [DEVICE_STATES.pending]: { deviceIds: [], total: 0 },\n [DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },\n [DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }\n },\n deviceList: {\n deviceIds: [],\n ...DEVICE_LIST_DEFAULTS,\n selectedAttributes: [],\n selectedIssues: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n },\n state: DEVICE_STATES.accepted,\n total: 0\n },\n filters: [\n // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }\n ],\n filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },\n filteringAttributesLimit: 10,\n filteringAttributesConfig: {\n attributes: {\n // inventory: ['some_attribute']\n },\n count: 0,\n limit: 100\n },\n reports: [\n // { items: [{ key: \"someKey\", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }\n ],\n total: 0,\n limit: 0,\n groups: {\n byId: {\n // groupName: { deviceIds: [], total: 0, filters: [] },\n // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }\n },\n selectedGroup: undefined\n }\n};\n\nexport const devicesSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedGroups: (state, action) => {\n state.groups.byId = action.payload;\n },\n addToGroup: (state, action) => {\n const { group, deviceIds } = action.payload;\n const maybeExistingGroup = {\n filters: [],\n deviceIds: [],\n ...state.groups.byId[group]\n };\n state.groups.byId[group] = {\n ...maybeExistingGroup,\n deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),\n total: (maybeExistingGroup.total || 0) + 1\n };\n },\n removeFromGroup: (state, action) => {\n const { group, deviceIds: removedIds } = action.payload;\n const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};\n const changedGroup = {\n ...maybeExistingGroup,\n deviceIds: deviceIds.filter(id => !removedIds.includes(id)),\n total: Math.max(total - removedIds.length, 0)\n };\n if (changedGroup.total || changedGroup.deviceIds.length) {\n state.groups.byId[group] = changedGroup;\n return;\n } else if (state.groups.selectedGroup === group) {\n state.groups.selectedGroup = undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [group]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n },\n addGroup: (state, action) => {\n const { groupName, group } = action.payload;\n state.groups.byId[groupName] = {\n ...state.groups.byId[groupName],\n ...group\n };\n },\n selectGroup: (state, { payload: group }) => {\n state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];\n state.groups.selectedGroup = group;\n },\n removeGroup: (state, action) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? undefined : state.groups.selectedGroup;\n },\n setDeviceListState: (state, action) => {\n state.deviceList = {\n ...state.deviceList,\n ...action.payload,\n sort: {\n ...state.deviceList.sort,\n ...action.payload.sort\n }\n };\n },\n setFilterAttributes: (state, action) => {\n state.filteringAttributes = action.payload;\n },\n setFilterablesConfig: (state, action) => {\n state.filteringAttributesConfig = action.payload;\n },\n receivedDevices: (state, action) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n setDeviceFilters: (state, action) => {\n if (deepCompare(action.payload, state.filters)) {\n return;\n }\n state.filters = action.payload.filter(filter => filter.key && filter.operator && filter.scope && typeof filter.value !== 'undefined');\n },\n setInactiveDevices: (state, action) => {\n const { activeDeviceTotal, inactiveDeviceTotal } = action.payload;\n state.byStatus.active.total = activeDeviceTotal;\n state.byStatus.inactive.total = inactiveDeviceTotal;\n },\n setDeviceReports: (state, action) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action) => {\n const { forceUpdate, status, total, deviceIds } = action.payload;\n state.byStatus[status] = total || forceUpdate ? { deviceIds, total } : state.byStatus[status];\n },\n setDevicesCountByStatus: (state, action) => {\n const { count, status } = action.payload;\n state.byStatus[status].total = count;\n },\n setTotalDevices: (state, action) => {\n state.total = action.payload;\n },\n setDeviceLimit: (state, action) => {\n state.limit = action.payload;\n },\n receivedDevice: (state, action) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n maybeUpdateDevicesByStatus: (state, action) => {\n const { deviceId, authId } = action.payload;\n const device = state.byId[deviceId];\n const hasMultipleAuthSets = authId ? device.auth_sets.filter(authset => authset.id !== authId).length > 0 : false;\n if (!hasMultipleAuthSets && Object.values(DEVICE_STATES).includes(device.status)) {\n const deviceIds = state.byStatus[device.status].deviceIds.filter(id => id !== deviceId);\n state.byStatus[device.status] = { deviceIds, total: Math.max(0, state.byStatus[device.status].total - 1) };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n"],"mappings":";;;;;;;;;AAeA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,aAAa,EAAE,SAAS,OAAO,MAAM,GAAG;AAChF,cAAM,YAAY,MAAM,SAAS,OAAO,MAAM,EAAE,UAAU,OAAO,QAAM,OAAO,QAAQ;AACtF,cAAM,SAAS,OAAO,MAAM,IAAI,EAAE,WAAW,OAAO,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,MAAM,EAAE,QAAQ,CAAC,EAAE;AAAA,MAC3G;AAAA,IACF;AAAA,EACF;AACF,CAAC;AAEM,IAAM,UAAU,aAAa;AACpC,IAAO,uBAAQ,aAAa;","names":[]}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__spreadValues
|
|
3
|
-
} from "./chunk-XWBD7VOK.mjs";
|
|
4
|
-
|
|
5
1
|
// src/onboardingSlice/index.ts
|
|
6
2
|
import { createSlice } from "@reduxjs/toolkit";
|
|
7
3
|
var sliceName = "onboarding";
|
|
@@ -19,7 +15,7 @@ var onboardingSlice = createSlice({
|
|
|
19
15
|
initialState,
|
|
20
16
|
reducers: {
|
|
21
17
|
setOnboardingState: (state, action) => {
|
|
22
|
-
return
|
|
18
|
+
return { ...state, ...action.payload };
|
|
23
19
|
},
|
|
24
20
|
setDemoArtifactPort: (state, action) => {
|
|
25
21
|
state.demoArtifactPort = action.payload;
|
|
@@ -54,4 +50,4 @@ export {
|
|
|
54
50
|
actions,
|
|
55
51
|
onboardingSlice_default
|
|
56
52
|
};
|
|
57
|
-
//# sourceMappingURL=chunk-
|
|
53
|
+
//# sourceMappingURL=chunk-B42NUKMZ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/onboardingSlice/index.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { createSlice } from '@reduxjs/toolkit';\n\nexport const sliceName = 'onboarding';\n\nexport const initialState = {\n approach: null,\n complete: false,\n deviceType: null,\n demoArtifactPort: 85,\n progress: null,\n showTips: null,\n showTipsDialog: false\n};\n\nexport const onboardingSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n setOnboardingState: (state, action) => {\n return { ...state, ...action.payload };\n },\n setDemoArtifactPort: (state, action) => {\n state.demoArtifactPort = action.payload;\n },\n setShowOnboardingHelp: (state, action) => {\n state.showTips = action.payload;\n },\n setShowDismissOnboardingTipsDialog: (state, action) => {\n state.showTipsDialog = action.payload;\n },\n setOnboardingComplete: (state, action) => {\n state.complete = action.payload;\n },\n setOnboardingProgress: (state, action) => {\n state.progress = action.payload;\n },\n setOnboardingDeviceType: (state, action) => {\n state.deviceType = action.payload;\n },\n setOnboardingApproach: (state, action) => {\n state.approach = action.payload;\n }\n }\n});\n\nexport const actions = onboardingSlice.actions;\nexport default onboardingSlice.reducer;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/onboardingSlice/index.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { createSlice } from '@reduxjs/toolkit';\n\nexport const sliceName = 'onboarding';\n\nexport const initialState = {\n approach: null,\n complete: false,\n deviceType: null,\n demoArtifactPort: 85,\n progress: null,\n showTips: null,\n showTipsDialog: false\n};\n\nexport const onboardingSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n setOnboardingState: (state, action) => {\n return { ...state, ...action.payload };\n },\n setDemoArtifactPort: (state, action) => {\n state.demoArtifactPort = action.payload;\n },\n setShowOnboardingHelp: (state, action) => {\n state.showTips = action.payload;\n },\n setShowDismissOnboardingTipsDialog: (state, action) => {\n state.showTipsDialog = action.payload;\n },\n setOnboardingComplete: (state, action) => {\n state.complete = action.payload;\n },\n setOnboardingProgress: (state, action) => {\n state.progress = action.payload;\n },\n setOnboardingDeviceType: (state, action) => {\n state.deviceType = action.payload;\n },\n setOnboardingApproach: (state, action) => {\n state.approach = action.payload;\n }\n }\n});\n\nexport const actions = onboardingSlice.actions;\nexport default onboardingSlice.reducer;\n"],"mappings":";AAaA,SAAS,mBAAmB;AAErB,IAAM,YAAY;AAElB,IAAM,eAAe;AAAA,EAC1B,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,gBAAgB;AAClB;AAEO,IAAM,kBAAkB,YAAY;AAAA,EACzC,MAAM;AAAA,EACN;AAAA,EACA,UAAU;AAAA,IACR,oBAAoB,CAAC,OAAO,WAAW;AACrC,aAAO,EAAE,GAAG,OAAO,GAAG,OAAO,QAAQ;AAAA,IACvC;AAAA,IACA,qBAAqB,CAAC,OAAO,WAAW;AACtC,YAAM,mBAAmB,OAAO;AAAA,IAClC;AAAA,IACA,uBAAuB,CAAC,OAAO,WAAW;AACxC,YAAM,WAAW,OAAO;AAAA,IAC1B;AAAA,IACA,oCAAoC,CAAC,OAAO,WAAW;AACrD,YAAM,iBAAiB,OAAO;AAAA,IAChC;AAAA,IACA,uBAAuB,CAAC,OAAO,WAAW;AACxC,YAAM,WAAW,OAAO;AAAA,IAC1B;AAAA,IACA,uBAAuB,CAAC,OAAO,WAAW;AACxC,YAAM,WAAW,OAAO;AAAA,IAC1B;AAAA,IACA,yBAAyB,CAAC,OAAO,WAAW;AAC1C,YAAM,aAAa,OAAO;AAAA,IAC5B;AAAA,IACA,uBAAuB,CAAC,OAAO,WAAW;AACxC,YAAM,WAAW,OAAO;AAAA,IAC1B;AAAA,EACF;AACF,CAAC;AAEM,IAAM,UAAU,gBAAgB;AACvC,IAAO,0BAAQ,gBAAgB;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEPLOYMENT_STATES
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IFWKT27G.mjs";
|
|
4
4
|
|
|
5
5
|
// src/deploymentsSlice/selectors.ts
|
|
6
6
|
import { createSelector } from "@reduxjs/toolkit";
|
|
@@ -11,8 +11,7 @@ var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
|
|
|
11
11
|
var getMappedDeploymentSelection = createSelector(
|
|
12
12
|
[getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
|
|
13
13
|
(selectionState, deploymentsState, deploymentsById) => {
|
|
14
|
-
|
|
15
|
-
const { selection = [] } = (_a = selectionState[deploymentsState]) != null ? _a : {};
|
|
14
|
+
const { selection = [] } = selectionState[deploymentsState] ?? {};
|
|
16
15
|
return selection.reduce((accu, id) => {
|
|
17
16
|
if (deploymentsById[id]) {
|
|
18
17
|
accu.push(deploymentsById[id]);
|
|
@@ -52,4 +51,4 @@ export {
|
|
|
52
51
|
DEPLOYMENT_CUTOFF,
|
|
53
52
|
getRecentDeployments
|
|
54
53
|
};
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
//# sourceMappingURL=chunk-CHUCIHMY.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/deploymentsSlice/selectors.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport { createSelector } from '@reduxjs/toolkit';\n\nimport { DEPLOYMENT_STATES } from './constants';\n\nexport const getDeploymentsById = state => state.deployments.byId;\nexport const getDeploymentsByStatus = state => state.deployments.byStatus;\nexport const getSelectedDeploymentDeviceIds = state => state.deployments.selectedDeviceIds;\nexport const getDeploymentsSelectionState = state => state.deployments.selectionState;\n\nexport const getMappedDeploymentSelection = createSelector(\n [getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],\n (selectionState, deploymentsState, deploymentsById) => {\n const { selection = [] } = selectionState[deploymentsState] ?? {};\n return selection.reduce((accu, id) => {\n if (deploymentsById[id]) {\n accu.push(deploymentsById[id]);\n }\n return accu;\n }, []);\n }\n);\n\nconst relevantDeploymentStates = [DEPLOYMENT_STATES.pending, DEPLOYMENT_STATES.inprogress, DEPLOYMENT_STATES.finished];\nexport const DEPLOYMENT_CUTOFF = 3;\nexport const getRecentDeployments = createSelector([getDeploymentsById, getDeploymentsByStatus], (deploymentsById, deploymentsByStatus) =>\n Object.entries(deploymentsByStatus).reduce(\n (accu, [state, byStatus]) => {\n if (!relevantDeploymentStates.includes(state) || !byStatus.deploymentIds.length) {\n return accu;\n }\n accu[state] = byStatus.deploymentIds\n .reduce((accu, id) => {\n if (deploymentsById[id]) {\n accu.push(deploymentsById[id]);\n }\n return accu;\n }, [])\n .slice(0, DEPLOYMENT_CUTOFF);\n accu.total += byStatus.total;\n return accu;\n },\n { total: 0 }\n )\n);\n"],"mappings":";;;;;AAcA,SAAS,sBAAsB;AAIxB,IAAM,qBAAqB,WAAS,MAAM,YAAY;AACtD,IAAM,yBAAyB,WAAS,MAAM,YAAY;AAC1D,IAAM,iCAAiC,WAAS,MAAM,YAAY;AAClE,IAAM,+BAA+B,WAAS,MAAM,YAAY;AAEhE,IAAM,+BAA+B;AAAA,EAC1C,CAAC,8BAA8B,CAAC,GAAG,qBAAqB,kBAAkB,kBAAkB;AAAA,EAC5F,CAAC,gBAAgB,kBAAkB,oBAAoB;
|
|
1
|
+
{"version":3,"sources":["../src/deploymentsSlice/selectors.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport { createSelector } from '@reduxjs/toolkit';\n\nimport { DEPLOYMENT_STATES } from './constants';\n\nexport const getDeploymentsById = state => state.deployments.byId;\nexport const getDeploymentsByStatus = state => state.deployments.byStatus;\nexport const getSelectedDeploymentDeviceIds = state => state.deployments.selectedDeviceIds;\nexport const getDeploymentsSelectionState = state => state.deployments.selectionState;\n\nexport const getMappedDeploymentSelection = createSelector(\n [getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],\n (selectionState, deploymentsState, deploymentsById) => {\n const { selection = [] } = selectionState[deploymentsState] ?? {};\n return selection.reduce((accu, id) => {\n if (deploymentsById[id]) {\n accu.push(deploymentsById[id]);\n }\n return accu;\n }, []);\n }\n);\n\nconst relevantDeploymentStates = [DEPLOYMENT_STATES.pending, DEPLOYMENT_STATES.inprogress, DEPLOYMENT_STATES.finished];\nexport const DEPLOYMENT_CUTOFF = 3;\nexport const getRecentDeployments = createSelector([getDeploymentsById, getDeploymentsByStatus], (deploymentsById, deploymentsByStatus) =>\n Object.entries(deploymentsByStatus).reduce(\n (accu, [state, byStatus]) => {\n if (!relevantDeploymentStates.includes(state) || !byStatus.deploymentIds.length) {\n return accu;\n }\n accu[state] = byStatus.deploymentIds\n .reduce((accu, id) => {\n if (deploymentsById[id]) {\n accu.push(deploymentsById[id]);\n }\n return accu;\n }, [])\n .slice(0, DEPLOYMENT_CUTOFF);\n accu.total += byStatus.total;\n return accu;\n },\n { total: 0 }\n )\n);\n"],"mappings":";;;;;AAcA,SAAS,sBAAsB;AAIxB,IAAM,qBAAqB,WAAS,MAAM,YAAY;AACtD,IAAM,yBAAyB,WAAS,MAAM,YAAY;AAC1D,IAAM,iCAAiC,WAAS,MAAM,YAAY;AAClE,IAAM,+BAA+B,WAAS,MAAM,YAAY;AAEhE,IAAM,+BAA+B;AAAA,EAC1C,CAAC,8BAA8B,CAAC,GAAG,qBAAqB,kBAAkB,kBAAkB;AAAA,EAC5F,CAAC,gBAAgB,kBAAkB,oBAAoB;AACrD,UAAM,EAAE,YAAY,CAAC,EAAE,IAAI,eAAe,gBAAgB,KAAK,CAAC;AAChE,WAAO,UAAU,OAAO,CAAC,MAAM,OAAO;AACpC,UAAI,gBAAgB,EAAE,GAAG;AACvB,aAAK,KAAK,gBAAgB,EAAE,CAAC;AAAA,MAC/B;AACA,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,EACP;AACF;AAEA,IAAM,2BAA2B,CAAC,kBAAkB,SAAS,kBAAkB,YAAY,kBAAkB,QAAQ;AAC9G,IAAM,oBAAoB;AAC1B,IAAM,uBAAuB;AAAA,EAAe,CAAC,oBAAoB,sBAAsB;AAAA,EAAG,CAAC,iBAAiB,wBACjH,OAAO,QAAQ,mBAAmB,EAAE;AAAA,IAClC,CAAC,MAAM,CAAC,OAAO,QAAQ,MAAM;AAC3B,UAAI,CAAC,yBAAyB,SAAS,KAAK,KAAK,CAAC,SAAS,cAAc,QAAQ;AAC/E,eAAO;AAAA,MACT;AACA,WAAK,KAAK,IAAI,SAAS,cACpB,OAAO,CAACA,OAAM,OAAO;AACpB,YAAI,gBAAgB,EAAE,GAAG;AACvB,UAAAA,MAAK,KAAK,gBAAgB,EAAE,CAAC;AAAA,QAC/B;AACA,eAAOA;AAAA,MACT,GA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