@overmap-ai/core 1.0.63-org-projs-only.1 → 1.0.63-org-doc-improvements.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/overmap-core.js +451 -248
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +451 -248
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/DocumentService.d.ts +1 -1
- package/dist/sdk/services/FormService.d.ts +15 -11
- package/dist/sdk/services/FormSubmissionService.d.ts +8 -5
- package/dist/sdk/services/IssueAssociationService.d.ts +9 -0
- package/dist/sdk/services/index.d.ts +1 -0
- package/dist/store/slices/documentSlice.d.ts +3 -311
- package/dist/store/slices/index.d.ts +1 -0
- package/dist/store/slices/issueAssociationSlice.d.ts +49 -0
- package/dist/store/store.d.ts +3 -2
- package/dist/typings/models/assets.d.ts +2 -2
- package/dist/typings/models/attachments.d.ts +5 -8
- package/dist/typings/models/base.d.ts +8 -5
- package/dist/typings/models/documents.d.ts +6 -16
- package/dist/typings/models/forms.d.ts +3 -3
- package/dist/typings/models/issueTypes.d.ts +2 -2
- package/dist/typings/models/issues.d.ts +13 -9
- package/dist/typings/models/license.d.ts +2 -2
- package/dist/typings/models/projects.d.ts +4 -2
- package/dist/typings/models/store.d.ts +2 -1
- package/dist/typings/models/teams.d.ts +2 -2
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -379,15 +379,15 @@ const wrapMigration = (migrator) => (state) => {
|
|
|
379
379
|
};
|
|
380
380
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
381
381
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
382
|
-
const initialState$
|
|
382
|
+
const initialState$C = {
|
|
383
383
|
accessToken: "",
|
|
384
384
|
refreshToken: "",
|
|
385
385
|
isLoggedIn: false
|
|
386
386
|
};
|
|
387
387
|
const authSlice = createSlice({
|
|
388
388
|
name: "auth",
|
|
389
|
-
initialState: initialState$
|
|
390
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
389
|
+
initialState: initialState$C,
|
|
390
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$C)),
|
|
391
391
|
reducers: {
|
|
392
392
|
setTokens: (state, action) => {
|
|
393
393
|
state.accessToken = action.payload.accessToken;
|
|
@@ -857,11 +857,11 @@ function createModelAdapter(computeModelId) {
|
|
|
857
857
|
};
|
|
858
858
|
}
|
|
859
859
|
const categoryAdapter = createModelAdapter((category) => category.offline_id);
|
|
860
|
-
const initialState$
|
|
860
|
+
const initialState$B = categoryAdapter.getInitialState({});
|
|
861
861
|
const categorySlice = createSlice({
|
|
862
862
|
name: "categories",
|
|
863
|
-
initialState: initialState$
|
|
864
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
863
|
+
initialState: initialState$B,
|
|
864
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
|
|
865
865
|
reducers: {
|
|
866
866
|
initializeCategories: categoryAdapter.initialize,
|
|
867
867
|
addCategory: categoryAdapter.addOne,
|
|
@@ -891,11 +891,11 @@ const selectIssueCountOfCategory = (categoryId) => (state) => {
|
|
|
891
891
|
};
|
|
892
892
|
const categoryReducer = categorySlice.reducer;
|
|
893
893
|
const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
|
|
894
|
-
const initialState$
|
|
894
|
+
const initialState$A = assetTypeAdapter.getInitialState({});
|
|
895
895
|
const assetTypeSlice = createSlice({
|
|
896
896
|
name: "assetTypes",
|
|
897
|
-
initialState: initialState$
|
|
898
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
897
|
+
initialState: initialState$A,
|
|
898
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$A)),
|
|
899
899
|
reducers: {
|
|
900
900
|
initializeAssetTypes: assetTypeAdapter.initialize,
|
|
901
901
|
addAssetType: assetTypeAdapter.addOne,
|
|
@@ -940,11 +940,11 @@ const selectAssetTypesByName = restructureCreateSelectorWithArgs(
|
|
|
940
940
|
);
|
|
941
941
|
const assetTypeReducer = assetTypeSlice.reducer;
|
|
942
942
|
const assetAdapter = createModelAdapter((asset) => asset.offline_id);
|
|
943
|
-
const initialState$
|
|
943
|
+
const initialState$z = assetAdapter.getInitialState({});
|
|
944
944
|
const assetSlice = createSlice({
|
|
945
945
|
name: "assets",
|
|
946
|
-
initialState: initialState$
|
|
947
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
946
|
+
initialState: initialState$z,
|
|
947
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
|
|
948
948
|
reducers: {
|
|
949
949
|
initializeAssets: (state, action) => {
|
|
950
950
|
assetAdapter.initialize(state, action);
|
|
@@ -1047,11 +1047,11 @@ const selectAssetTypesFromIds = (assetTypeIds) => (state) => {
|
|
|
1047
1047
|
};
|
|
1048
1048
|
const assetReducer = assetSlice.reducer;
|
|
1049
1049
|
const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
1050
|
-
const initialState$
|
|
1050
|
+
const initialState$y = assetAttachmentAdapter.getInitialState({});
|
|
1051
1051
|
const assetAttachmentSlice = createSlice({
|
|
1052
1052
|
name: "assetAttachments",
|
|
1053
|
-
initialState: initialState$
|
|
1054
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1053
|
+
initialState: initialState$y,
|
|
1054
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
|
|
1055
1055
|
reducers: {
|
|
1056
1056
|
initializeAssetAttachments: assetAttachmentAdapter.initialize,
|
|
1057
1057
|
addAssetAttachment: assetAttachmentAdapter.addOne,
|
|
@@ -1109,13 +1109,13 @@ const selectAttachmentsOfAssetByType = restructureCreateSelectorWithArgs(
|
|
|
1109
1109
|
)
|
|
1110
1110
|
);
|
|
1111
1111
|
const assetAttachmentReducer = assetAttachmentSlice.reducer;
|
|
1112
|
-
const initialState$
|
|
1112
|
+
const initialState$x = {
|
|
1113
1113
|
completionsByAssetId: {}
|
|
1114
1114
|
};
|
|
1115
1115
|
const assetStageCompletionSlice = createSlice({
|
|
1116
1116
|
name: "assetStageCompletions",
|
|
1117
|
-
initialState: initialState$
|
|
1118
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1117
|
+
initialState: initialState$x,
|
|
1118
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
|
|
1119
1119
|
reducers: {
|
|
1120
1120
|
addStageCompletion: (state, action) => {
|
|
1121
1121
|
let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
|
|
@@ -1167,11 +1167,11 @@ const selectCompletedStageIdsForAsset = restructureCreateSelectorWithArgs(
|
|
|
1167
1167
|
);
|
|
1168
1168
|
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1169
1169
|
const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
|
|
1170
|
-
const initialState$
|
|
1170
|
+
const initialState$w = assetStageAdapter.getInitialState({});
|
|
1171
1171
|
const assetStageSlice = createSlice({
|
|
1172
1172
|
name: "assetStages",
|
|
1173
|
-
initialState: initialState$
|
|
1174
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1173
|
+
initialState: initialState$w,
|
|
1174
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
|
|
1175
1175
|
reducers: {
|
|
1176
1176
|
initializeStages: assetStageAdapter.initialize,
|
|
1177
1177
|
setStage: assetStageAdapter.setOne,
|
|
@@ -1252,11 +1252,11 @@ const assetStageReducer = assetStageSlice.reducer;
|
|
|
1252
1252
|
const assetTypeAttachmentAdapter = createModelAdapter(
|
|
1253
1253
|
(attachment) => attachment.offline_id
|
|
1254
1254
|
);
|
|
1255
|
-
const initialState$
|
|
1255
|
+
const initialState$v = assetTypeAttachmentAdapter.getInitialState({});
|
|
1256
1256
|
const assetTypeAttachmentSlice = createSlice({
|
|
1257
1257
|
name: "assetTypeAttachments",
|
|
1258
|
-
initialState: initialState$
|
|
1259
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1258
|
+
initialState: initialState$v,
|
|
1259
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
|
|
1260
1260
|
reducers: {
|
|
1261
1261
|
initializeAssetTypeAttachments: assetTypeAttachmentAdapter.initialize,
|
|
1262
1262
|
addAssetTypeAttachment: assetTypeAttachmentAdapter.addOne,
|
|
@@ -1315,10 +1315,10 @@ const selectAttachmentsOfAssetTypeByType = restructureCreateSelectorWithArgs(
|
|
|
1315
1315
|
);
|
|
1316
1316
|
const assetTypeAttachmentReducer = assetTypeAttachmentSlice.reducer;
|
|
1317
1317
|
const workspaceAdapter = createModelAdapter((workspace) => workspace.offline_id);
|
|
1318
|
-
const initialState$
|
|
1318
|
+
const initialState$u = workspaceAdapter.getInitialState({});
|
|
1319
1319
|
const workspaceSlice = createSlice({
|
|
1320
1320
|
name: "workspace",
|
|
1321
|
-
initialState: initialState$
|
|
1321
|
+
initialState: initialState$u,
|
|
1322
1322
|
reducers: {
|
|
1323
1323
|
initializeWorkspaces: workspaceAdapter.initialize,
|
|
1324
1324
|
setWorkspaces: workspaceAdapter.setMany,
|
|
@@ -1350,14 +1350,14 @@ const selectPermittedWorkspaceIds = createSelector(
|
|
|
1350
1350
|
const workspaceReducer = workspaceSlice.reducer;
|
|
1351
1351
|
const maxRecentIssues = 10;
|
|
1352
1352
|
const issueAdapter = createModelAdapter((issue) => issue.offline_id);
|
|
1353
|
-
const initialState$
|
|
1353
|
+
const initialState$t = issueAdapter.getInitialState({
|
|
1354
1354
|
recentIssueIds: []
|
|
1355
1355
|
});
|
|
1356
1356
|
const issueSlice = createSlice({
|
|
1357
1357
|
name: "issues",
|
|
1358
|
-
initialState: initialState$
|
|
1358
|
+
initialState: initialState$t,
|
|
1359
1359
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1360
|
-
Object.assign(state, initialState$
|
|
1360
|
+
Object.assign(state, initialState$t);
|
|
1361
1361
|
}),
|
|
1362
1362
|
reducers: {
|
|
1363
1363
|
initializeIssues: issueAdapter.initialize,
|
|
@@ -1501,12 +1501,12 @@ const selectRecentIssuesAsSearchResults = createSelector(
|
|
|
1501
1501
|
);
|
|
1502
1502
|
const issueReducer = issueSlice.reducer;
|
|
1503
1503
|
const issueTypeAdapter = createModelAdapter((issueType) => issueType.offline_id);
|
|
1504
|
-
const initialState$
|
|
1504
|
+
const initialState$s = issueTypeAdapter.getInitialState({});
|
|
1505
1505
|
const issueTypeSlice = createSlice({
|
|
1506
1506
|
name: "issueTypes",
|
|
1507
|
-
initialState: initialState$
|
|
1507
|
+
initialState: initialState$s,
|
|
1508
1508
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1509
|
-
Object.assign(state, initialState$
|
|
1509
|
+
Object.assign(state, initialState$s);
|
|
1510
1510
|
}),
|
|
1511
1511
|
reducers: {
|
|
1512
1512
|
initializeIssueTypes: issueTypeAdapter.initialize,
|
|
@@ -1555,15 +1555,15 @@ const selectIssuesOfIssueTypeCount = (issueTypeId) => (state) => {
|
|
|
1555
1555
|
return ((_a2 = selectIssuesOfIssueType(issueTypeId)(state)) == null ? void 0 : _a2.length) ?? 0;
|
|
1556
1556
|
};
|
|
1557
1557
|
const issueTypeReducer = issueTypeSlice.reducer;
|
|
1558
|
-
const initialState$
|
|
1558
|
+
const initialState$r = {
|
|
1559
1559
|
s3Urls: {}
|
|
1560
1560
|
};
|
|
1561
1561
|
const msPerHour = 1e3 * 60 * 60;
|
|
1562
1562
|
const msPerWeek = msPerHour * 24 * 7;
|
|
1563
1563
|
const fileSlice = createSlice({
|
|
1564
1564
|
name: "file",
|
|
1565
|
-
initialState: initialState$
|
|
1566
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1565
|
+
initialState: initialState$r,
|
|
1566
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
|
|
1567
1567
|
reducers: {
|
|
1568
1568
|
setUploadUrl: (state, action) => {
|
|
1569
1569
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -1644,7 +1644,7 @@ var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
|
1644
1644
|
LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
|
|
1645
1645
|
return LicenseStatus2;
|
|
1646
1646
|
})(LicenseStatus || {});
|
|
1647
|
-
const initialState$
|
|
1647
|
+
const initialState$q = {
|
|
1648
1648
|
users: {},
|
|
1649
1649
|
currentUser: {
|
|
1650
1650
|
id: 0,
|
|
@@ -1655,8 +1655,8 @@ const initialState$p = {
|
|
|
1655
1655
|
};
|
|
1656
1656
|
const userSlice = createSlice({
|
|
1657
1657
|
name: "users",
|
|
1658
|
-
initialState: initialState$
|
|
1659
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1658
|
+
initialState: initialState$q,
|
|
1659
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1660
1660
|
reducers: {
|
|
1661
1661
|
setUsers: (state, action) => {
|
|
1662
1662
|
const usersMapping = {};
|
|
@@ -1721,11 +1721,11 @@ const userReducer = userSlice.reducer;
|
|
|
1721
1721
|
const organizationAccessAdapter = createModelAdapter(
|
|
1722
1722
|
(organizationAccess) => organizationAccess.offline_id
|
|
1723
1723
|
);
|
|
1724
|
-
const initialState$
|
|
1724
|
+
const initialState$p = organizationAccessAdapter.getInitialState({});
|
|
1725
1725
|
const organizationAccessSlice = createSlice({
|
|
1726
1726
|
name: "organizationAccess",
|
|
1727
|
-
initialState: initialState$
|
|
1728
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1727
|
+
initialState: initialState$p,
|
|
1728
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
|
|
1729
1729
|
reducers: {
|
|
1730
1730
|
initializeOrganizationAccesses: organizationAccessAdapter.initialize,
|
|
1731
1731
|
updateOrganizationAccess: organizationAccessAdapter.updateOne,
|
|
@@ -1762,11 +1762,11 @@ const selectOrganizationAccessUserMapping = (state) => {
|
|
|
1762
1762
|
};
|
|
1763
1763
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
1764
1764
|
const licenseAdapter = createModelAdapter((license) => license.offline_id);
|
|
1765
|
-
const initialState$
|
|
1765
|
+
const initialState$o = licenseAdapter.getInitialState({});
|
|
1766
1766
|
const licenseSlice = createSlice({
|
|
1767
1767
|
name: "license",
|
|
1768
|
-
initialState: initialState$
|
|
1769
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1768
|
+
initialState: initialState$o,
|
|
1769
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1770
1770
|
reducers: {
|
|
1771
1771
|
initializeLicences: licenseAdapter.initialize,
|
|
1772
1772
|
addLicenses: licenseAdapter.addMany,
|
|
@@ -1792,11 +1792,11 @@ const selectLicensesForProjectsMapping = createSelector(
|
|
|
1792
1792
|
);
|
|
1793
1793
|
const licenseReducer = licenseSlice.reducer;
|
|
1794
1794
|
const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
|
|
1795
|
-
const initialState$
|
|
1795
|
+
const initialState$n = projectAccessAdapter.getInitialState({});
|
|
1796
1796
|
const projectAccessSlice = createSlice({
|
|
1797
1797
|
name: "projectAccess",
|
|
1798
|
-
initialState: initialState$
|
|
1799
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1798
|
+
initialState: initialState$n,
|
|
1799
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
1800
1800
|
reducers: {
|
|
1801
1801
|
initializeProjectAccesses: projectAccessAdapter.initialize,
|
|
1802
1802
|
updateProjectAccess: projectAccessAdapter.updateOne,
|
|
@@ -1842,14 +1842,14 @@ const selectProjectAccessUserMapping = (state) => {
|
|
|
1842
1842
|
return projectAccesses;
|
|
1843
1843
|
};
|
|
1844
1844
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
1845
|
-
const initialState$
|
|
1845
|
+
const initialState$m = {
|
|
1846
1846
|
projects: {},
|
|
1847
1847
|
activeProjectId: null
|
|
1848
1848
|
};
|
|
1849
1849
|
const projectSlice = createSlice({
|
|
1850
1850
|
name: "projects",
|
|
1851
|
-
initialState: initialState$
|
|
1852
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1851
|
+
initialState: initialState$m,
|
|
1852
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
|
|
1853
1853
|
reducers: {
|
|
1854
1854
|
setProjects: (state, action) => {
|
|
1855
1855
|
const projectsMap = {};
|
|
@@ -1963,13 +1963,13 @@ const selectSortedProjectUsers = createSelector(
|
|
|
1963
1963
|
});
|
|
1964
1964
|
}
|
|
1965
1965
|
);
|
|
1966
|
-
const initialState$
|
|
1966
|
+
const initialState$l = {
|
|
1967
1967
|
organizations: {}
|
|
1968
1968
|
};
|
|
1969
1969
|
const organizationSlice = createSlice({
|
|
1970
1970
|
name: "organizations",
|
|
1971
|
-
initialState: initialState$
|
|
1972
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1971
|
+
initialState: initialState$l,
|
|
1972
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
|
|
1973
1973
|
reducers: {
|
|
1974
1974
|
setOrganizations: (state, action) => {
|
|
1975
1975
|
for (const org of action.payload) {
|
|
@@ -2052,14 +2052,14 @@ const createOfflineAction = (request2, baseUrl, serviceName) => {
|
|
|
2052
2052
|
}
|
|
2053
2053
|
};
|
|
2054
2054
|
};
|
|
2055
|
-
const initialState$
|
|
2055
|
+
const initialState$k = {
|
|
2056
2056
|
deletedRequests: [],
|
|
2057
2057
|
latestRetryTime: 0
|
|
2058
2058
|
};
|
|
2059
2059
|
const outboxSlice = createSlice({
|
|
2060
2060
|
name: "outbox",
|
|
2061
|
-
initialState: initialState$
|
|
2062
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2061
|
+
initialState: initialState$k,
|
|
2062
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
|
|
2063
2063
|
reducers: {
|
|
2064
2064
|
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
2065
2065
|
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
@@ -2091,15 +2091,15 @@ const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
|
|
|
2091
2091
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
2092
2092
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
2093
2093
|
const outboxReducer = outboxSlice.reducer;
|
|
2094
|
-
const initialState$
|
|
2094
|
+
const initialState$j = {
|
|
2095
2095
|
projectFiles: {},
|
|
2096
2096
|
activeProjectFileId: null,
|
|
2097
2097
|
isImportingProjectFile: false
|
|
2098
2098
|
};
|
|
2099
2099
|
const projectFileSlice = createSlice({
|
|
2100
2100
|
name: "projectFiles",
|
|
2101
|
-
initialState: initialState$
|
|
2102
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2101
|
+
initialState: initialState$j,
|
|
2102
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
|
|
2103
2103
|
reducers: {
|
|
2104
2104
|
addOrReplaceProjectFiles: (state, action) => {
|
|
2105
2105
|
for (let fileObj of action.payload) {
|
|
@@ -2184,11 +2184,11 @@ const selectProjectFileById = (id) => (state) => {
|
|
|
2184
2184
|
};
|
|
2185
2185
|
const projectFileReducer = projectFileSlice.reducer;
|
|
2186
2186
|
const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2187
|
-
const initialState$
|
|
2187
|
+
const initialState$i = projectAttachmentAdapter.getInitialState({});
|
|
2188
2188
|
const projectAttachmentSlice = createSlice({
|
|
2189
2189
|
name: "projectAttachments",
|
|
2190
|
-
initialState: initialState$
|
|
2191
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2190
|
+
initialState: initialState$i,
|
|
2191
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
|
|
2192
2192
|
reducers: {
|
|
2193
2193
|
initializeProjectAttachments: projectAttachmentAdapter.initialize,
|
|
2194
2194
|
addProjectAttachment: projectAttachmentAdapter.addOne,
|
|
@@ -2246,12 +2246,12 @@ const selectAttachmentsOfProjectByType = restructureCreateSelectorWithArgs(
|
|
|
2246
2246
|
)
|
|
2247
2247
|
);
|
|
2248
2248
|
const projectAttachmentReducer = projectAttachmentSlice.reducer;
|
|
2249
|
-
const initialState$
|
|
2249
|
+
const initialState$h = {
|
|
2250
2250
|
isRehydrated: false
|
|
2251
2251
|
};
|
|
2252
2252
|
const rehydratedSlice = createSlice({
|
|
2253
2253
|
name: "rehydrated",
|
|
2254
|
-
initialState: initialState$
|
|
2254
|
+
initialState: initialState$h,
|
|
2255
2255
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
2256
2256
|
reducers: {
|
|
2257
2257
|
setRehydrated: (state, action) => {
|
|
@@ -2262,13 +2262,13 @@ const rehydratedSlice = createSlice({
|
|
|
2262
2262
|
const { setRehydrated } = rehydratedSlice.actions;
|
|
2263
2263
|
const selectRehydrated = (state) => state.rehydratedReducer.isRehydrated;
|
|
2264
2264
|
const rehydratedReducer = rehydratedSlice.reducer;
|
|
2265
|
-
const initialState$
|
|
2265
|
+
const initialState$g = {
|
|
2266
2266
|
isFetchingInitialData: false
|
|
2267
2267
|
};
|
|
2268
2268
|
const settingSlice = createSlice({
|
|
2269
2269
|
name: "settings",
|
|
2270
|
-
initialState: initialState$
|
|
2271
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2270
|
+
initialState: initialState$g,
|
|
2271
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
2272
2272
|
reducers: {
|
|
2273
2273
|
setIsFetchingInitialData: (state, action) => {
|
|
2274
2274
|
state.isFetchingInitialData = action.payload;
|
|
@@ -2292,11 +2292,11 @@ const formRevisionSortFn = (formRevisionA, formRevisionB) => {
|
|
|
2292
2292
|
}
|
|
2293
2293
|
};
|
|
2294
2294
|
const formRevisionAdapter = createModelAdapter((revision) => revision.offline_id);
|
|
2295
|
-
const initialState$
|
|
2295
|
+
const initialState$f = formRevisionAdapter.getInitialState({});
|
|
2296
2296
|
const formRevisionsSlice = createSlice({
|
|
2297
2297
|
name: "formRevisions",
|
|
2298
|
-
initialState: initialState$
|
|
2299
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2298
|
+
initialState: initialState$f,
|
|
2299
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
|
|
2300
2300
|
reducers: {
|
|
2301
2301
|
initializeFormRevisions: formRevisionAdapter.initialize,
|
|
2302
2302
|
setFormRevision: formRevisionAdapter.setOne,
|
|
@@ -2396,11 +2396,11 @@ const selectLatestFormRevisionByForm = createSelector([selectFormRevisionMapping
|
|
|
2396
2396
|
});
|
|
2397
2397
|
const formRevisionReducer = formRevisionsSlice.reducer;
|
|
2398
2398
|
const formAdapter = createModelAdapter((form) => form.offline_id);
|
|
2399
|
-
const initialState$
|
|
2399
|
+
const initialState$e = formAdapter.getInitialState({});
|
|
2400
2400
|
const formSlice = createSlice({
|
|
2401
2401
|
name: "forms",
|
|
2402
|
-
initialState: initialState$
|
|
2403
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2402
|
+
initialState: initialState$e,
|
|
2403
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
|
|
2404
2404
|
reducers: {
|
|
2405
2405
|
initializeForms: formAdapter.initialize,
|
|
2406
2406
|
setForm: formAdapter.setOne,
|
|
@@ -2480,11 +2480,11 @@ const selectGeneralFormCount = createSelector([selectFormMapping], (formsMapping
|
|
|
2480
2480
|
});
|
|
2481
2481
|
const formReducer = formSlice.reducer;
|
|
2482
2482
|
const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
|
|
2483
|
-
const initialState$
|
|
2483
|
+
const initialState$d = submissionAdapter.getInitialState({});
|
|
2484
2484
|
const formSubmissionSlice = createSlice({
|
|
2485
2485
|
name: "formSubmissions",
|
|
2486
|
-
initialState: initialState$
|
|
2487
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2486
|
+
initialState: initialState$d,
|
|
2487
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
|
|
2488
2488
|
reducers: {
|
|
2489
2489
|
initializeFormSubmissions: submissionAdapter.initialize,
|
|
2490
2490
|
setFormSubmission: submissionAdapter.setOne,
|
|
@@ -2594,8 +2594,10 @@ const selectAttachedFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
|
2594
2594
|
],
|
|
2595
2595
|
(issues, forms, formRevisions, submissions, issueId) => {
|
|
2596
2596
|
const issue = issues[issueId];
|
|
2597
|
-
if (!issue
|
|
2597
|
+
if (!issue)
|
|
2598
2598
|
return [];
|
|
2599
|
+
if (!issue.issue_type) {
|
|
2600
|
+
return Object.values(submissions).filter((submission) => submission.issue === issueId);
|
|
2599
2601
|
}
|
|
2600
2602
|
const issueTypeForms = new Set(
|
|
2601
2603
|
Object.keys(forms).filter((formId) => forms[formId].issue_type === issue.issue_type)
|
|
@@ -2650,8 +2652,10 @@ const selectAttachedFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
|
2650
2652
|
],
|
|
2651
2653
|
(assets, forms, formRevisions, submissions, assetId) => {
|
|
2652
2654
|
const asset = assets[assetId];
|
|
2653
|
-
if (!asset
|
|
2655
|
+
if (!asset)
|
|
2654
2656
|
return [];
|
|
2657
|
+
if (!asset.asset_type) {
|
|
2658
|
+
return Object.values(submissions).filter((submission) => submission.asset === assetId);
|
|
2655
2659
|
}
|
|
2656
2660
|
const issueTypeForms = new Set(
|
|
2657
2661
|
Object.keys(forms).filter((formId) => forms[formId].asset_type === asset.asset_type)
|
|
@@ -2688,11 +2692,11 @@ const formSubmissionReducer = formSubmissionSlice.reducer;
|
|
|
2688
2692
|
const formSubmissionAttachmentAdapter = createModelAdapter(
|
|
2689
2693
|
(attachment) => attachment.offline_id
|
|
2690
2694
|
);
|
|
2691
|
-
const initialState$
|
|
2695
|
+
const initialState$c = formSubmissionAttachmentAdapter.getInitialState({});
|
|
2692
2696
|
const formSubmissionAttachmentSlice = createSlice({
|
|
2693
2697
|
name: "formSubmissionAttachments",
|
|
2694
|
-
initialState: initialState$
|
|
2695
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2698
|
+
initialState: initialState$c,
|
|
2699
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
|
|
2696
2700
|
reducers: {
|
|
2697
2701
|
initializeFormSubmissionAttachments: formSubmissionAttachmentAdapter.initialize,
|
|
2698
2702
|
addFormSubmissionAttachment: formSubmissionAttachmentAdapter.addOne,
|
|
@@ -2731,11 +2735,11 @@ const formSubmissionAttachmentReducer = formSubmissionAttachmentSlice.reducer;
|
|
|
2731
2735
|
const formRevisionAttachmentAdapter = createModelAdapter(
|
|
2732
2736
|
(attachment) => attachment.offline_id
|
|
2733
2737
|
);
|
|
2734
|
-
const initialState$
|
|
2738
|
+
const initialState$b = formRevisionAttachmentAdapter.getInitialState({});
|
|
2735
2739
|
const formRevisionAttachmentSlice = createSlice({
|
|
2736
2740
|
name: "formRevisionAttachments",
|
|
2737
|
-
initialState: initialState$
|
|
2738
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2741
|
+
initialState: initialState$b,
|
|
2742
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
|
|
2739
2743
|
reducers: {
|
|
2740
2744
|
initializeFormRevisionAttachments: formRevisionAttachmentAdapter.initialize,
|
|
2741
2745
|
addFormRevisionAttachment: formRevisionAttachmentAdapter.addOne,
|
|
@@ -2772,10 +2776,10 @@ const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
|
|
|
2772
2776
|
);
|
|
2773
2777
|
const formRevisionAttachmentReducer = formRevisionAttachmentSlice.reducer;
|
|
2774
2778
|
const emailDomainAdapter = createModelAdapter((emailDomain) => emailDomain.offline_id);
|
|
2775
|
-
const initialState$
|
|
2779
|
+
const initialState$a = emailDomainAdapter.getInitialState({});
|
|
2776
2780
|
const emailDomainsSlice = createSlice({
|
|
2777
2781
|
name: "emailDomains",
|
|
2778
|
-
initialState: initialState$
|
|
2782
|
+
initialState: initialState$a,
|
|
2779
2783
|
reducers: {
|
|
2780
2784
|
initializeEmailDomains: emailDomainAdapter.initialize,
|
|
2781
2785
|
addEmailDomain: emailDomainAdapter.addOne,
|
|
@@ -2794,14 +2798,14 @@ const selectEmailDomainsOfOrganization = restructureCreateSelectorWithArgs(
|
|
|
2794
2798
|
)
|
|
2795
2799
|
);
|
|
2796
2800
|
const emailDomainsReducer = emailDomainsSlice.reducer;
|
|
2797
|
-
const initialState$
|
|
2801
|
+
const initialState$9 = {
|
|
2798
2802
|
documents: {}
|
|
2799
2803
|
};
|
|
2800
2804
|
const documentSlice = createSlice({
|
|
2801
2805
|
name: "documents",
|
|
2802
|
-
initialState: initialState$
|
|
2806
|
+
initialState: initialState$9,
|
|
2803
2807
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2804
|
-
Object.assign(state, initialState$
|
|
2808
|
+
Object.assign(state, initialState$9);
|
|
2805
2809
|
}),
|
|
2806
2810
|
reducers: {
|
|
2807
2811
|
setDocuments: (state, action) => {
|
|
@@ -2976,11 +2980,11 @@ const selectRootDocuments = createSelector(
|
|
|
2976
2980
|
);
|
|
2977
2981
|
const documentsReducer = documentSlice.reducer;
|
|
2978
2982
|
const documentAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2979
|
-
const initialState$
|
|
2983
|
+
const initialState$8 = documentAttachmentAdapter.getInitialState({});
|
|
2980
2984
|
const documentAttachmentSlice = createSlice({
|
|
2981
2985
|
name: "documentAttachments",
|
|
2982
|
-
initialState: initialState$
|
|
2983
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2986
|
+
initialState: initialState$8,
|
|
2987
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
2984
2988
|
reducers: {
|
|
2985
2989
|
initializeDocumentAttachments: documentAttachmentAdapter.initialize,
|
|
2986
2990
|
addDocumentAttachment: documentAttachmentAdapter.addOne,
|
|
@@ -3039,11 +3043,11 @@ const selectAttachmentsOfDocumentByType = restructureCreateSelectorWithArgs(
|
|
|
3039
3043
|
);
|
|
3040
3044
|
const documentAttachmentReducer = documentAttachmentSlice.reducer;
|
|
3041
3045
|
const teamAdapter = createModelAdapter((team) => team.offline_id);
|
|
3042
|
-
const initialState$
|
|
3046
|
+
const initialState$7 = teamAdapter.getInitialState({});
|
|
3043
3047
|
const teamSlice = createSlice({
|
|
3044
3048
|
name: "teams",
|
|
3045
|
-
initialState: initialState$
|
|
3046
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3049
|
+
initialState: initialState$7,
|
|
3050
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
3047
3051
|
reducers: {
|
|
3048
3052
|
setTeam: teamAdapter.setOne,
|
|
3049
3053
|
initializeTeams: teamAdapter.initialize,
|
|
@@ -3077,11 +3081,11 @@ const teamReducer = teamSlice.reducer;
|
|
|
3077
3081
|
const agentUserConversationAdapter = createModelAdapter(
|
|
3078
3082
|
(conversation) => conversation.offline_id
|
|
3079
3083
|
);
|
|
3080
|
-
const initialState$
|
|
3084
|
+
const initialState$6 = agentUserConversationAdapter.getInitialState({});
|
|
3081
3085
|
const agentsSlice = createSlice({
|
|
3082
3086
|
name: "agents",
|
|
3083
|
-
initialState: initialState$
|
|
3084
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3087
|
+
initialState: initialState$6,
|
|
3088
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
3085
3089
|
reducers: {
|
|
3086
3090
|
initializeConversations: agentUserConversationAdapter.initialize,
|
|
3087
3091
|
addConversation: agentUserConversationAdapter.addOne,
|
|
@@ -3103,11 +3107,11 @@ const selectConversation = restructureCreateSelectorWithArgs(
|
|
|
3103
3107
|
);
|
|
3104
3108
|
const agentsReducer = agentsSlice.reducer;
|
|
3105
3109
|
const issueCommentAdapter = createModelAdapter((comment) => comment.offline_id);
|
|
3106
|
-
const initialState$
|
|
3110
|
+
const initialState$5 = issueCommentAdapter.getInitialState({});
|
|
3107
3111
|
const issueCommentSlice = createSlice({
|
|
3108
3112
|
name: "issueComments",
|
|
3109
|
-
initialState: initialState$
|
|
3110
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3113
|
+
initialState: initialState$5,
|
|
3114
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
3111
3115
|
reducers: {
|
|
3112
3116
|
addIssueComment: issueCommentAdapter.addOne,
|
|
3113
3117
|
addIssueComments: issueCommentAdapter.addMany,
|
|
@@ -3136,11 +3140,11 @@ const selectCommentsOfIssue = restructureCreateSelectorWithArgs(
|
|
|
3136
3140
|
);
|
|
3137
3141
|
const issueCommentReducer = issueCommentSlice.reducer;
|
|
3138
3142
|
const issueUpdateAdapter = createModelAdapter((issueUpdate) => issueUpdate.offline_id);
|
|
3139
|
-
const initialState$
|
|
3143
|
+
const initialState$4 = issueUpdateAdapter.getInitialState({});
|
|
3140
3144
|
const issueUpdateSlice = createSlice({
|
|
3141
3145
|
name: "issueUpdates",
|
|
3142
|
-
initialState: initialState$
|
|
3143
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3146
|
+
initialState: initialState$4,
|
|
3147
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
|
|
3144
3148
|
reducers: {
|
|
3145
3149
|
initializeIssueUpdates: issueUpdateAdapter.setMany,
|
|
3146
3150
|
setIssueUpdate: issueUpdateAdapter.setOne,
|
|
@@ -3169,11 +3173,11 @@ const selectIssueUpdatesOfIssue = restructureCreateSelectorWithArgs(
|
|
|
3169
3173
|
);
|
|
3170
3174
|
const issueUpdateReducer = issueUpdateSlice.reducer;
|
|
3171
3175
|
const issueAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
3172
|
-
const initialState$
|
|
3176
|
+
const initialState$3 = issueAttachmentAdapter.getInitialState({});
|
|
3173
3177
|
const issueAttachmentSlice = createSlice({
|
|
3174
3178
|
name: "issueAttachments",
|
|
3175
|
-
initialState: initialState$
|
|
3176
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3179
|
+
initialState: initialState$3,
|
|
3180
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
|
|
3177
3181
|
reducers: {
|
|
3178
3182
|
initializeIssueAttachments: issueAttachmentAdapter.initialize,
|
|
3179
3183
|
addIssueAttachment: issueAttachmentAdapter.addOne,
|
|
@@ -3231,23 +3235,23 @@ const selectAttachmentsOfIssueByType = restructureCreateSelectorWithArgs(
|
|
|
3231
3235
|
)
|
|
3232
3236
|
);
|
|
3233
3237
|
const issueAttachmentReducer = issueAttachmentSlice.reducer;
|
|
3234
|
-
const initialState$
|
|
3238
|
+
const initialState$2 = {
|
|
3235
3239
|
version: 0
|
|
3236
3240
|
};
|
|
3237
3241
|
const versioningSlice = createSlice({
|
|
3238
3242
|
name: "versioning",
|
|
3239
|
-
initialState: initialState$
|
|
3243
|
+
initialState: initialState$2,
|
|
3240
3244
|
reducers: {}
|
|
3241
3245
|
});
|
|
3242
3246
|
const versioningReducer = versioningSlice.reducer;
|
|
3243
3247
|
const geoImageAdapter = createModelAdapter((model) => model.offline_id);
|
|
3244
|
-
const initialState = geoImageAdapter.getInitialState({});
|
|
3248
|
+
const initialState$1 = geoImageAdapter.getInitialState({});
|
|
3245
3249
|
const geoImageSlice = createSlice({
|
|
3246
3250
|
name: "geoImages",
|
|
3247
|
-
initialState,
|
|
3251
|
+
initialState: initialState$1,
|
|
3248
3252
|
extraReducers: (builder) => {
|
|
3249
3253
|
builder.addCase("RESET", (state) => {
|
|
3250
|
-
Object.assign(state, initialState);
|
|
3254
|
+
Object.assign(state, initialState$1);
|
|
3251
3255
|
});
|
|
3252
3256
|
},
|
|
3253
3257
|
reducers: {
|
|
@@ -3284,6 +3288,64 @@ const selectGeoImagesOfProject = restructureCreateSelectorWithArgs(
|
|
|
3284
3288
|
})
|
|
3285
3289
|
);
|
|
3286
3290
|
const geoImageReducer = geoImageSlice.reducer;
|
|
3291
|
+
const issueAssociationAdapter = createModelAdapter((assoc) => assoc.offline_id);
|
|
3292
|
+
const initialState = issueAssociationAdapter.getInitialState({});
|
|
3293
|
+
const issueAssociationSlice = createSlice({
|
|
3294
|
+
name: "issueAssociations",
|
|
3295
|
+
initialState,
|
|
3296
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
|
|
3297
|
+
reducers: {
|
|
3298
|
+
initializeIssueAssociations: issueAssociationAdapter.initialize,
|
|
3299
|
+
addIssueAssociation: issueAssociationAdapter.addOne,
|
|
3300
|
+
addIssueAssociations: issueAssociationAdapter.addMany,
|
|
3301
|
+
setIssueAssociation: issueAssociationAdapter.setOne,
|
|
3302
|
+
setIssueAssociations: issueAssociationAdapter.setMany,
|
|
3303
|
+
updateIssueAssociation: issueAssociationAdapter.updateOne,
|
|
3304
|
+
updateIssueAssociations: issueAssociationAdapter.updateMany,
|
|
3305
|
+
deleteIssueAssociation: issueAssociationAdapter.deleteOne,
|
|
3306
|
+
deleteIssueAssociations: issueAssociationAdapter.deleteMany
|
|
3307
|
+
}
|
|
3308
|
+
});
|
|
3309
|
+
const {
|
|
3310
|
+
initializeIssueAssociations,
|
|
3311
|
+
setIssueAssociations,
|
|
3312
|
+
setIssueAssociation,
|
|
3313
|
+
updateIssueAssociation,
|
|
3314
|
+
updateIssueAssociations,
|
|
3315
|
+
addIssueAssociation,
|
|
3316
|
+
addIssueAssociations,
|
|
3317
|
+
deleteIssueAssociation,
|
|
3318
|
+
deleteIssueAssociations
|
|
3319
|
+
} = issueAssociationSlice.actions;
|
|
3320
|
+
const selectIssueAssociationMapping = (state) => state.issueAssociationReducer.instances;
|
|
3321
|
+
const selectIssueAssociationById = (id) => (state) => {
|
|
3322
|
+
return state.issueAssociationReducer.instances[id];
|
|
3323
|
+
};
|
|
3324
|
+
const selectIssueAssociationsToIssue = restructureCreateSelectorWithArgs(
|
|
3325
|
+
createSelector(
|
|
3326
|
+
[selectIssueAssociationMapping, (_state, issueId) => issueId],
|
|
3327
|
+
(associationMapping, issueId) => {
|
|
3328
|
+
return Object.values(associationMapping).filter((assoc) => assoc.associated_issue === issueId);
|
|
3329
|
+
}
|
|
3330
|
+
)
|
|
3331
|
+
);
|
|
3332
|
+
const selectIssueAssociationsOfIssue = restructureCreateSelectorWithArgs(
|
|
3333
|
+
createSelector(
|
|
3334
|
+
[selectIssueAssociationMapping, (_state, issueId) => issueId],
|
|
3335
|
+
(associationMapping, issueId) => {
|
|
3336
|
+
return Object.values(associationMapping).filter((assoc) => assoc.issue === issueId);
|
|
3337
|
+
}
|
|
3338
|
+
)
|
|
3339
|
+
);
|
|
3340
|
+
const selectIssueAssociationsOfAsset = restructureCreateSelectorWithArgs(
|
|
3341
|
+
createSelector(
|
|
3342
|
+
[selectIssueAssociationMapping, (_state, assetId) => assetId],
|
|
3343
|
+
(associationMapping, assetId) => {
|
|
3344
|
+
return Object.values(associationMapping).filter((assoc) => assoc.asset === assetId);
|
|
3345
|
+
}
|
|
3346
|
+
)
|
|
3347
|
+
);
|
|
3348
|
+
const issueAssociationReducer = issueAssociationSlice.reducer;
|
|
3287
3349
|
const fullAssetMarkerSize = 45;
|
|
3288
3350
|
const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
|
|
3289
3351
|
const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
|
|
@@ -3356,7 +3418,8 @@ const overmapReducers = {
|
|
|
3356
3418
|
agentsReducer,
|
|
3357
3419
|
issueCommentReducer,
|
|
3358
3420
|
issueUpdateReducer,
|
|
3359
|
-
geoImageReducer
|
|
3421
|
+
geoImageReducer,
|
|
3422
|
+
issueAssociationReducer
|
|
3360
3423
|
};
|
|
3361
3424
|
const overmapReducer = combineReducers(overmapReducers);
|
|
3362
3425
|
const resetStore = "RESET";
|
|
@@ -4147,11 +4210,13 @@ class AssetService extends BaseApiService {
|
|
|
4147
4210
|
}
|
|
4148
4211
|
async remove(assetId) {
|
|
4149
4212
|
const { store } = this.client;
|
|
4150
|
-
const
|
|
4213
|
+
const state = store.getState();
|
|
4214
|
+
const assetToBeDeleted = selectAsset(assetId)(state);
|
|
4151
4215
|
if (!assetToBeDeleted)
|
|
4152
4216
|
throw new Error(`No asset with id ${assetId} found in the store`);
|
|
4153
|
-
const attachmentsOfAssets = selectAttachmentsOfAsset(assetId)(
|
|
4154
|
-
const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(assetId)(
|
|
4217
|
+
const attachmentsOfAssets = selectAttachmentsOfAsset(assetId)(state);
|
|
4218
|
+
const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(assetId)(state);
|
|
4219
|
+
const issueAssociations = selectIssueAssociationsOfAsset(assetId)(state);
|
|
4155
4220
|
this.dispatch(deleteAsset(assetId));
|
|
4156
4221
|
if (attachmentsOfAssets.length > 0) {
|
|
4157
4222
|
const attachmentsOfAssetIds = attachmentsOfAssets.map(({ offline_id }) => offline_id);
|
|
@@ -4161,6 +4226,10 @@ class AssetService extends BaseApiService {
|
|
|
4161
4226
|
const formSubmissionsOfAssetIds = formSubmissionsOfAssets.map(({ offline_id }) => offline_id);
|
|
4162
4227
|
this.dispatch(deleteFormSubmissions(formSubmissionsOfAssetIds));
|
|
4163
4228
|
}
|
|
4229
|
+
if (issueAssociations.length > 0) {
|
|
4230
|
+
const issueAssociationsIds = issueAssociations.map(({ offline_id }) => offline_id);
|
|
4231
|
+
this.dispatch(deleteIssueAssociations(issueAssociationsIds));
|
|
4232
|
+
}
|
|
4164
4233
|
return this.enqueueRequest({
|
|
4165
4234
|
description: "Delete asset",
|
|
4166
4235
|
method: HttpMethod.DELETE,
|
|
@@ -4171,6 +4240,7 @@ class AssetService extends BaseApiService {
|
|
|
4171
4240
|
this.dispatch(addAsset(assetToBeDeleted));
|
|
4172
4241
|
this.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
4173
4242
|
this.dispatch(addFormSubmissions(formSubmissionsOfAssets));
|
|
4243
|
+
this.dispatch(addIssueAssociations(issueAssociations));
|
|
4174
4244
|
throw err;
|
|
4175
4245
|
});
|
|
4176
4246
|
}
|
|
@@ -5046,6 +5116,12 @@ class IssueService extends BaseApiService {
|
|
|
5046
5116
|
const attachmentsOfIssue = selectAttachmentsOfIssue(id)(state);
|
|
5047
5117
|
const updatesOfIssue = selectIssueUpdatesOfIssue(id)(state);
|
|
5048
5118
|
const formSubmissionsOfIssue = selectFormSubmissionsOfIssue(id)(state);
|
|
5119
|
+
const issueAssociationsRecord = {};
|
|
5120
|
+
for (const issueAssociation of selectIssueAssociationsToIssue(id)(state))
|
|
5121
|
+
issueAssociationsRecord[issueAssociation.offline_id] = issueAssociation;
|
|
5122
|
+
for (const issueAssociation of selectIssueAssociationsOfIssue(id)(state))
|
|
5123
|
+
issueAssociationsRecord[issueAssociation.offline_id] = issueAssociation;
|
|
5124
|
+
const issueAssociations = Object.values(issueAssociationsRecord);
|
|
5049
5125
|
this.dispatch(deleteIssue(id));
|
|
5050
5126
|
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
5051
5127
|
if (attachmentsOfIssue.length > 0)
|
|
@@ -5054,6 +5130,8 @@ class IssueService extends BaseApiService {
|
|
|
5054
5130
|
this.dispatch(deleteIssueUpdates(updatesOfIssue.map(({ offline_id }) => offline_id)));
|
|
5055
5131
|
if (formSubmissionsOfIssue.length > 0)
|
|
5056
5132
|
this.dispatch(deleteFormSubmissions(formSubmissionsOfIssue.map(({ offline_id }) => offline_id)));
|
|
5133
|
+
if (issueAssociations.length > 0)
|
|
5134
|
+
this.dispatch(deleteIssueAssociations(issueAssociations.map(({ offline_id }) => offline_id)));
|
|
5057
5135
|
try {
|
|
5058
5136
|
return await this.enqueueRequest({
|
|
5059
5137
|
description: "Delete issue",
|
|
@@ -5068,6 +5146,7 @@ class IssueService extends BaseApiService {
|
|
|
5068
5146
|
this.dispatch(addIssueUpdates(updatesOfIssue));
|
|
5069
5147
|
this.dispatch(addActiveProjectIssuesCount(1));
|
|
5070
5148
|
this.dispatch(addFormSubmissions(formSubmissionsOfIssue));
|
|
5149
|
+
this.dispatch(addIssueAssociations(issueAssociations));
|
|
5071
5150
|
throw e;
|
|
5072
5151
|
}
|
|
5073
5152
|
}
|
|
@@ -5111,7 +5190,7 @@ class IssueTypeService extends BaseApiService {
|
|
|
5111
5190
|
offline_id: offlineIssueType.offline_id,
|
|
5112
5191
|
submitted_at: offlineIssueType.submitted_at,
|
|
5113
5192
|
icon: offlineIssueType.icon,
|
|
5114
|
-
icon_color: offlineIssueType.
|
|
5193
|
+
icon_color: offlineIssueType.color,
|
|
5115
5194
|
name: offlineIssueType.name,
|
|
5116
5195
|
description: offlineIssueType.description
|
|
5117
5196
|
},
|
|
@@ -5360,17 +5439,23 @@ class ProjectService extends BaseApiService {
|
|
|
5360
5439
|
* @throws An APIError if the server returns an error, or any other error that may occur.
|
|
5361
5440
|
*/
|
|
5362
5441
|
async add(project) {
|
|
5442
|
+
if (!project.organization_owner && !project.user_owner) {
|
|
5443
|
+
throw new Error("Project type was not chosen when trying to create a project");
|
|
5444
|
+
}
|
|
5363
5445
|
if (!project.bounds && !project.canvas_bounds) {
|
|
5364
5446
|
throw new Error("Project must either have bounds or canvas_bounds set");
|
|
5365
5447
|
}
|
|
5448
|
+
const isOrganizationProject = !!project.organization_owner;
|
|
5449
|
+
const url = isOrganizationProject ? `/organizations/${project.organization_owner}/projects/` : "/projects/";
|
|
5450
|
+
const projectType = isOrganizationProject ? { organization_owner: project.organization_owner } : { user_owner: project.user_owner };
|
|
5366
5451
|
return await this.enqueueRequest({
|
|
5367
5452
|
description: "Create project",
|
|
5368
5453
|
method: HttpMethod.POST,
|
|
5369
|
-
url
|
|
5454
|
+
url,
|
|
5370
5455
|
payload: {
|
|
5371
5456
|
name: project.name,
|
|
5372
5457
|
bounds: project.bounds,
|
|
5373
|
-
|
|
5458
|
+
...projectType
|
|
5374
5459
|
},
|
|
5375
5460
|
blockers: [],
|
|
5376
5461
|
blocks: []
|
|
@@ -5497,36 +5582,67 @@ const separateImageFromFields = async (fields) => {
|
|
|
5497
5582
|
}
|
|
5498
5583
|
return { fields: newFields, images };
|
|
5499
5584
|
};
|
|
5500
|
-
class FormService extends
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
description: "Attach image to form revision field",
|
|
5516
|
-
method: HttpMethod.POST,
|
|
5517
|
-
url: `/forms/revisions/${offlineRevisionId}/attachments/`,
|
|
5518
|
-
payload: revisionAttachmentPayload,
|
|
5519
|
-
blockers: [revisionAttachmentPayload.revision],
|
|
5520
|
-
blocks: [revisionAttachmentPayload.offline_id]
|
|
5521
|
-
});
|
|
5522
|
-
const offlinePayload = {
|
|
5523
|
-
...revisionAttachmentPayload,
|
|
5524
|
-
file: URL.createObjectURL(image)
|
|
5585
|
+
class FormService extends BaseUploadService {
|
|
5586
|
+
async bulkAddRevisionAttachments(revisionId, files) {
|
|
5587
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5588
|
+
const createdBy = this.client.store.getState().userReducer.currentUser.id;
|
|
5589
|
+
const filePayloads = {};
|
|
5590
|
+
const offlineFormRevisionAttachments = [];
|
|
5591
|
+
const attachmentPayloads = [];
|
|
5592
|
+
for (const [fieldIdentifier, file] of Object.entries(files)) {
|
|
5593
|
+
const sha1 = await hashFile(file);
|
|
5594
|
+
if (!(sha1 in filePayloads)) {
|
|
5595
|
+
filePayloads[sha1] = {
|
|
5596
|
+
sha1,
|
|
5597
|
+
file_type: file.type,
|
|
5598
|
+
extension: file.name.split(".").pop(),
|
|
5599
|
+
size: file.size
|
|
5525
5600
|
};
|
|
5526
|
-
this.
|
|
5527
|
-
|
|
5601
|
+
await this.client.files.addCache(file, sha1);
|
|
5602
|
+
}
|
|
5603
|
+
const offlineFormRevisionAttachment = offline({
|
|
5604
|
+
file: URL.createObjectURL(file),
|
|
5605
|
+
file_type: file.type,
|
|
5606
|
+
file_name: file.name,
|
|
5607
|
+
file_sha1: sha1,
|
|
5608
|
+
created_by: createdBy,
|
|
5609
|
+
revision: revisionId,
|
|
5610
|
+
submitted_at: submittedAt,
|
|
5611
|
+
field_identifier: fieldIdentifier
|
|
5528
5612
|
});
|
|
5613
|
+
offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
|
|
5614
|
+
const attachmentPayload = {
|
|
5615
|
+
offline_id: offlineFormRevisionAttachment.offline_id,
|
|
5616
|
+
name: file.name,
|
|
5617
|
+
field_identifier: fieldIdentifier,
|
|
5618
|
+
sha1
|
|
5619
|
+
};
|
|
5620
|
+
attachmentPayloads.push(attachmentPayload);
|
|
5621
|
+
}
|
|
5622
|
+
this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
|
|
5623
|
+
const promise = this.enqueueRequest({
|
|
5624
|
+
description: "Attach files to form revision",
|
|
5625
|
+
method: HttpMethod.POST,
|
|
5626
|
+
url: `/forms/revisions/${revisionId}/attachments/bulk/`,
|
|
5627
|
+
payload: {
|
|
5628
|
+
submitted_at: submittedAt,
|
|
5629
|
+
attachments: attachmentPayloads,
|
|
5630
|
+
files: Object.values(filePayloads)
|
|
5631
|
+
},
|
|
5632
|
+
blockers: [revisionId],
|
|
5633
|
+
blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
5529
5634
|
});
|
|
5635
|
+
promise.then((result) => {
|
|
5636
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
5637
|
+
this.dispatch(updateFormRevisionAttachments(result.attachments));
|
|
5638
|
+
}).catch(() => {
|
|
5639
|
+
this.dispatch(
|
|
5640
|
+
deleteFormRevisionAttachments(
|
|
5641
|
+
offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
5642
|
+
)
|
|
5643
|
+
);
|
|
5644
|
+
});
|
|
5645
|
+
return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5530
5646
|
}
|
|
5531
5647
|
async add(ownerId, form, initialRevision, urlPrefix) {
|
|
5532
5648
|
const { fields, images } = await separateImageFromFields(initialRevision.fields);
|
|
@@ -5559,14 +5675,16 @@ class FormService extends BaseApiService {
|
|
|
5559
5675
|
blockers: [ownerId],
|
|
5560
5676
|
blocks: [form.offline_id, offlineFormRevision.offline_id]
|
|
5561
5677
|
});
|
|
5562
|
-
const
|
|
5678
|
+
const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
|
|
5679
|
+
offlineFormRevision.offline_id,
|
|
5680
|
+
images
|
|
5681
|
+
);
|
|
5563
5682
|
void formPromise.catch((e) => {
|
|
5564
5683
|
this.dispatch(deleteForm(form.offline_id));
|
|
5565
5684
|
this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
|
|
5566
5685
|
throw e;
|
|
5567
5686
|
});
|
|
5568
|
-
|
|
5569
|
-
return [form, offlineFormRevision, formPromise, settledPromise];
|
|
5687
|
+
return [form, offlineFormRevision, offlineFormRevisionAttachments, formPromise, attachmentsPromise];
|
|
5570
5688
|
}
|
|
5571
5689
|
addForOrganization(organizationId, initialRevision) {
|
|
5572
5690
|
const state = this.client.store.getState();
|
|
@@ -5648,14 +5766,16 @@ class FormService extends BaseApiService {
|
|
|
5648
5766
|
blockers: [formId],
|
|
5649
5767
|
blocks: [offlineRevision.offline_id]
|
|
5650
5768
|
});
|
|
5651
|
-
const
|
|
5769
|
+
const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
|
|
5770
|
+
fullRevision.offline_id,
|
|
5771
|
+
images
|
|
5772
|
+
);
|
|
5652
5773
|
void promise.then((result) => {
|
|
5653
5774
|
this.dispatch(setFormRevision(result));
|
|
5654
5775
|
}).catch(() => {
|
|
5655
5776
|
this.dispatch(deleteFormRevision(fullRevision.offline_id));
|
|
5656
5777
|
});
|
|
5657
|
-
|
|
5658
|
-
return [fullRevision, settledPromise];
|
|
5778
|
+
return [fullRevision, offlineFormRevisionAttachments, promise, attachmentsPromise];
|
|
5659
5779
|
}
|
|
5660
5780
|
async favorite(formId) {
|
|
5661
5781
|
const { store } = this.client;
|
|
@@ -5818,46 +5938,71 @@ const separateFilesFromValues = (values) => {
|
|
|
5818
5938
|
return { values: newValues, files };
|
|
5819
5939
|
};
|
|
5820
5940
|
class FormSubmissionService extends BaseUploadService {
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
const attach = await this.enqueueRequest({
|
|
5837
|
-
description: "Attach file to form submission",
|
|
5838
|
-
method: HttpMethod.POST,
|
|
5839
|
-
url: `/forms/submission/${submission.offline_id}/attachments/`,
|
|
5840
|
-
payload: submissionAttachmentPayload,
|
|
5841
|
-
blockers: [
|
|
5842
|
-
submission.asset,
|
|
5843
|
-
submission.asset_stage,
|
|
5844
|
-
submission.issue,
|
|
5845
|
-
submission.form_revision
|
|
5846
|
-
].filter((x) => x !== void 0),
|
|
5847
|
-
blocks: [submissionAttachmentPayload.offline_id]
|
|
5848
|
-
});
|
|
5849
|
-
const offlinePayload = {
|
|
5850
|
-
...submissionAttachmentPayload,
|
|
5851
|
-
file: URL.createObjectURL(file)
|
|
5941
|
+
async bulkAddSubmissionAttachments(submissionId, files) {
|
|
5942
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5943
|
+
const createdBy = this.client.store.getState().userReducer.currentUser.id;
|
|
5944
|
+
const filePayloads = {};
|
|
5945
|
+
const offlineFormSubmissionAttachments = [];
|
|
5946
|
+
const attachmentPayloads = [];
|
|
5947
|
+
for (const [fieldIdentifier, filesArray] of Object.entries(files)) {
|
|
5948
|
+
for (const file of filesArray) {
|
|
5949
|
+
const sha1 = await hashFile(file);
|
|
5950
|
+
if (!(sha1 in filePayloads)) {
|
|
5951
|
+
filePayloads[sha1] = {
|
|
5952
|
+
sha1,
|
|
5953
|
+
file_type: file.type,
|
|
5954
|
+
extension: file.name.split(".").pop(),
|
|
5955
|
+
size: file.size
|
|
5852
5956
|
};
|
|
5853
|
-
this.
|
|
5854
|
-
attachResults.push(attach);
|
|
5957
|
+
await this.client.files.addCache(file, sha1);
|
|
5855
5958
|
}
|
|
5856
|
-
|
|
5857
|
-
|
|
5959
|
+
const offlineFormSubmissionAttachment = offline({
|
|
5960
|
+
file: URL.createObjectURL(file),
|
|
5961
|
+
file_type: file.type,
|
|
5962
|
+
file_name: file.name,
|
|
5963
|
+
file_sha1: sha1,
|
|
5964
|
+
created_by: createdBy,
|
|
5965
|
+
submission: submissionId,
|
|
5966
|
+
submitted_at: submittedAt,
|
|
5967
|
+
field_identifier: fieldIdentifier
|
|
5968
|
+
});
|
|
5969
|
+
offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
|
|
5970
|
+
const attachmentPayload = {
|
|
5971
|
+
offline_id: offlineFormSubmissionAttachment.offline_id,
|
|
5972
|
+
name: file.name,
|
|
5973
|
+
sha1,
|
|
5974
|
+
field_identifier: fieldIdentifier
|
|
5975
|
+
};
|
|
5976
|
+
attachmentPayloads.push(attachmentPayload);
|
|
5977
|
+
}
|
|
5978
|
+
}
|
|
5979
|
+
this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
|
|
5980
|
+
const promise = this.enqueueRequest({
|
|
5981
|
+
description: "Attach files to form submission",
|
|
5982
|
+
method: HttpMethod.POST,
|
|
5983
|
+
url: `/forms/submissions/${submissionId}/attachments/bulk/`,
|
|
5984
|
+
payload: {
|
|
5985
|
+
submitted_at: submittedAt,
|
|
5986
|
+
attachments: attachmentPayloads,
|
|
5987
|
+
files: Object.values(filePayloads)
|
|
5988
|
+
},
|
|
5989
|
+
blockers: [submissionId],
|
|
5990
|
+
blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
5991
|
+
});
|
|
5992
|
+
promise.then((result) => {
|
|
5993
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
5994
|
+
this.dispatch(updateFormSubmissionAttachments(result.attachments));
|
|
5995
|
+
}).catch(() => {
|
|
5996
|
+
this.dispatch(
|
|
5997
|
+
deleteFormSubmissionAttachments(
|
|
5998
|
+
offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
5999
|
+
)
|
|
6000
|
+
);
|
|
5858
6001
|
});
|
|
6002
|
+
return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5859
6003
|
}
|
|
5860
|
-
|
|
6004
|
+
// Outer promise is for hashing and caching files for submission attachments
|
|
6005
|
+
async add(payload) {
|
|
5861
6006
|
const { store } = this.client;
|
|
5862
6007
|
const state = store.getState();
|
|
5863
6008
|
const activeProjectId = state.projectReducer.activeProjectId;
|
|
@@ -5865,12 +6010,12 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5865
6010
|
throw new Error("Expected an active project");
|
|
5866
6011
|
}
|
|
5867
6012
|
const { values, files } = separateFilesFromValues(payload.values);
|
|
5868
|
-
const offlineSubmission = {
|
|
6013
|
+
const offlineSubmission = offline({
|
|
5869
6014
|
...payload,
|
|
5870
6015
|
values,
|
|
5871
6016
|
created_by: state.userReducer.currentUser.id,
|
|
5872
6017
|
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5873
|
-
};
|
|
6018
|
+
});
|
|
5874
6019
|
const promise = this.enqueueRequest({
|
|
5875
6020
|
description: "Respond to form",
|
|
5876
6021
|
method: HttpMethod.POST,
|
|
@@ -5879,20 +6024,22 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5879
6024
|
blockers: [payload.issue, payload.asset, payload.asset_stage, "add-form-entry"].filter(
|
|
5880
6025
|
(x) => x !== void 0
|
|
5881
6026
|
),
|
|
5882
|
-
blocks: [
|
|
6027
|
+
blocks: [offlineSubmission.offline_id]
|
|
5883
6028
|
});
|
|
5884
|
-
const attachFilesPromises = this.getAttachFilesPromises(files, offlineSubmission);
|
|
5885
6029
|
this.dispatch(addFormSubmission(offlineSubmission));
|
|
5886
|
-
|
|
6030
|
+
const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
|
|
6031
|
+
offlineSubmission.offline_id,
|
|
6032
|
+
files
|
|
6033
|
+
);
|
|
6034
|
+
promise.then((result) => {
|
|
5887
6035
|
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5888
6036
|
this.dispatch(setFormSubmission(result));
|
|
5889
6037
|
return result;
|
|
5890
6038
|
}).catch(() => {
|
|
5891
|
-
this.dispatch(deleteFormSubmission(
|
|
6039
|
+
this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
|
|
5892
6040
|
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5893
6041
|
});
|
|
5894
|
-
|
|
5895
|
-
return [offlineSubmission, settledPromise];
|
|
6042
|
+
return [offlineSubmission, offlineFormSubmissionAttachments, promise, attachmentsPromise];
|
|
5896
6043
|
}
|
|
5897
6044
|
// Note currently the bulkAdd method is specific to form submissions for assets
|
|
5898
6045
|
// TODO: adapt the support bulk adding to any model type
|
|
@@ -5993,36 +6140,6 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5993
6140
|
});
|
|
5994
6141
|
return batchPromises;
|
|
5995
6142
|
}
|
|
5996
|
-
update(submission) {
|
|
5997
|
-
const { store } = this.client;
|
|
5998
|
-
const { values, files } = separateFilesFromValues(submission.values);
|
|
5999
|
-
const attachFilesPromises = this.getAttachFilesPromises(files, submission);
|
|
6000
|
-
const offlineSubmission = {
|
|
6001
|
-
...submission,
|
|
6002
|
-
values
|
|
6003
|
-
};
|
|
6004
|
-
const submissionToBeUpdated = selectFormSubmission(submission.offline_id)(store.getState());
|
|
6005
|
-
if (!submissionToBeUpdated) {
|
|
6006
|
-
throw new Error(`Expected submission with offline_id ${submission.offline_id} to exist`);
|
|
6007
|
-
}
|
|
6008
|
-
this.dispatch(updateFormSubmission(offlineSubmission));
|
|
6009
|
-
const promise = this.enqueueRequest({
|
|
6010
|
-
description: "Patch form submission",
|
|
6011
|
-
method: HttpMethod.PATCH,
|
|
6012
|
-
url: `/forms/submissions/${submission.offline_id}/`,
|
|
6013
|
-
payload: offlineSubmission,
|
|
6014
|
-
blockers: [offlineSubmission.issue, offlineSubmission.asset, offlineSubmission.asset_stage].filter(
|
|
6015
|
-
(x) => x !== void 0
|
|
6016
|
-
),
|
|
6017
|
-
blocks: [offlineSubmission.offline_id]
|
|
6018
|
-
});
|
|
6019
|
-
promise.then((createdSubmission) => {
|
|
6020
|
-
this.dispatch(setFormSubmission(createdSubmission));
|
|
6021
|
-
}).catch(() => {
|
|
6022
|
-
this.dispatch(setFormSubmission(submissionToBeUpdated));
|
|
6023
|
-
});
|
|
6024
|
-
return [offlineSubmission, Promise.all([promise, ...attachFilesPromises]).then(() => promise)];
|
|
6025
|
-
}
|
|
6026
6143
|
async delete(submissionId) {
|
|
6027
6144
|
const { store } = this.client;
|
|
6028
6145
|
const state = store.getState();
|
|
@@ -6493,7 +6610,9 @@ class LicenseService extends BaseApiService {
|
|
|
6493
6610
|
method: HttpMethod.GET,
|
|
6494
6611
|
url: `/billing/${license.offline_id}/`,
|
|
6495
6612
|
isAuthNeeded: true,
|
|
6496
|
-
blockers: [
|
|
6613
|
+
blockers: [
|
|
6614
|
+
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6615
|
+
],
|
|
6497
6616
|
blocks: []
|
|
6498
6617
|
});
|
|
6499
6618
|
this.dispatch(updateLicense(result));
|
|
@@ -6505,7 +6624,9 @@ class LicenseService extends BaseApiService {
|
|
|
6505
6624
|
method: HttpMethod.DELETE,
|
|
6506
6625
|
url: `/billing/${license.offline_id}/suspend/`,
|
|
6507
6626
|
isAuthNeeded: true,
|
|
6508
|
-
blockers: [
|
|
6627
|
+
blockers: [
|
|
6628
|
+
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6629
|
+
],
|
|
6509
6630
|
blocks: []
|
|
6510
6631
|
});
|
|
6511
6632
|
this.dispatch(updateLicense(result));
|
|
@@ -6517,7 +6638,9 @@ class LicenseService extends BaseApiService {
|
|
|
6517
6638
|
method: HttpMethod.PATCH,
|
|
6518
6639
|
url: `/billing/${license.offline_id}/suspend/`,
|
|
6519
6640
|
isAuthNeeded: true,
|
|
6520
|
-
blockers: [
|
|
6641
|
+
blockers: [
|
|
6642
|
+
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6643
|
+
],
|
|
6521
6644
|
blocks: []
|
|
6522
6645
|
});
|
|
6523
6646
|
this.dispatch(updateLicense(result));
|
|
@@ -6529,7 +6652,9 @@ class LicenseService extends BaseApiService {
|
|
|
6529
6652
|
method: HttpMethod.DELETE,
|
|
6530
6653
|
url: `/billing/${license.offline_id}/`,
|
|
6531
6654
|
isAuthNeeded: true,
|
|
6532
|
-
blockers: [
|
|
6655
|
+
blockers: [
|
|
6656
|
+
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6657
|
+
],
|
|
6533
6658
|
blocks: []
|
|
6534
6659
|
});
|
|
6535
6660
|
this.dispatch(updateLicense(result));
|
|
@@ -6543,7 +6668,7 @@ class LicenseService extends BaseApiService {
|
|
|
6543
6668
|
isAuthNeeded: true,
|
|
6544
6669
|
payload: { project: project.id },
|
|
6545
6670
|
blockers: [
|
|
6546
|
-
license.organization_owner ? license.organization_owner.toString() : "",
|
|
6671
|
+
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : "",
|
|
6547
6672
|
project.id ? project.id.toString() : ""
|
|
6548
6673
|
],
|
|
6549
6674
|
blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
|
|
@@ -6557,7 +6682,9 @@ class LicenseService extends BaseApiService {
|
|
|
6557
6682
|
method: HttpMethod.DELETE,
|
|
6558
6683
|
url: `/billing/${license.offline_id}/project/`,
|
|
6559
6684
|
isAuthNeeded: true,
|
|
6560
|
-
blockers: [
|
|
6685
|
+
blockers: [
|
|
6686
|
+
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6687
|
+
],
|
|
6561
6688
|
blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
|
|
6562
6689
|
});
|
|
6563
6690
|
this.dispatch(updateLicense(result));
|
|
@@ -6601,27 +6728,20 @@ class LicenseService extends BaseApiService {
|
|
|
6601
6728
|
}
|
|
6602
6729
|
}
|
|
6603
6730
|
class DocumentService extends BaseApiService {
|
|
6604
|
-
|
|
6605
|
-
add(document2) {
|
|
6731
|
+
add(payload) {
|
|
6606
6732
|
const { store } = this.client;
|
|
6607
6733
|
const currentUserId = store.getState().userReducer.currentUser.id;
|
|
6608
|
-
const
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
}
|
|
6612
|
-
const offlineDocument = offline(document2);
|
|
6613
|
-
const submittedDocument = {
|
|
6614
|
-
...offlineDocument,
|
|
6734
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
6735
|
+
const offlineDocument = offline({
|
|
6736
|
+
...payload,
|
|
6615
6737
|
created_by: currentUserId,
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
};
|
|
6620
|
-
this.dispatch(addDocuments([submittedDocument]));
|
|
6738
|
+
submitted_at: submittedAt
|
|
6739
|
+
});
|
|
6740
|
+
this.dispatch(addDocuments([offlineDocument]));
|
|
6621
6741
|
const promise = this.enqueueRequest({
|
|
6622
6742
|
description: "Create Document",
|
|
6623
6743
|
method: HttpMethod.POST,
|
|
6624
|
-
url:
|
|
6744
|
+
url: "/documents/",
|
|
6625
6745
|
payload: offlineDocument,
|
|
6626
6746
|
queryParams: {
|
|
6627
6747
|
parent_document: offlineDocument.parent_document ?? void 0
|
|
@@ -6633,7 +6753,7 @@ class DocumentService extends BaseApiService {
|
|
|
6633
6753
|
promise.catch(() => {
|
|
6634
6754
|
this.dispatch(removeDocuments([offlineDocument.offline_id]));
|
|
6635
6755
|
});
|
|
6636
|
-
return [
|
|
6756
|
+
return [offlineDocument, promise];
|
|
6637
6757
|
}
|
|
6638
6758
|
update(document2) {
|
|
6639
6759
|
const { store } = this.client;
|
|
@@ -7193,6 +7313,72 @@ class GeoImageService extends BaseUploadService {
|
|
|
7193
7313
|
store.dispatch(initializeGeoImages(result));
|
|
7194
7314
|
}
|
|
7195
7315
|
}
|
|
7316
|
+
class IssueAssociationService extends BaseUploadService {
|
|
7317
|
+
add(payload) {
|
|
7318
|
+
const { store } = this.client;
|
|
7319
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7320
|
+
const createdBy = store.getState().userReducer.currentUser.id;
|
|
7321
|
+
const offlineIssueAssociation = offline({
|
|
7322
|
+
...payload,
|
|
7323
|
+
submitted_at: submittedAt,
|
|
7324
|
+
created_by: createdBy
|
|
7325
|
+
});
|
|
7326
|
+
this.dispatch(addIssueAssociation(offlineIssueAssociation));
|
|
7327
|
+
const promise = this.enqueueRequest({
|
|
7328
|
+
description: "Add issue association",
|
|
7329
|
+
method: HttpMethod.POST,
|
|
7330
|
+
url: "/issues/associations/",
|
|
7331
|
+
payload: {
|
|
7332
|
+
offline_id: offlineIssueAssociation.offline_id,
|
|
7333
|
+
submitted_at: submittedAt,
|
|
7334
|
+
created_by: createdBy,
|
|
7335
|
+
...payload
|
|
7336
|
+
},
|
|
7337
|
+
blockers: [
|
|
7338
|
+
payload.associated_issue,
|
|
7339
|
+
...payload.issue ? [payload.issue] : [],
|
|
7340
|
+
...payload.asset ? [payload.asset] : []
|
|
7341
|
+
],
|
|
7342
|
+
blocks: [offlineIssueAssociation.offline_id]
|
|
7343
|
+
});
|
|
7344
|
+
promise.then((issueAssociation) => {
|
|
7345
|
+
this.dispatch(updateIssueAssociation(issueAssociation));
|
|
7346
|
+
}).catch(() => {
|
|
7347
|
+
this.dispatch(deleteIssueAssociation(offlineIssueAssociation.offline_id));
|
|
7348
|
+
});
|
|
7349
|
+
return [offlineIssueAssociation, promise];
|
|
7350
|
+
}
|
|
7351
|
+
async delete(id) {
|
|
7352
|
+
const { store } = this.client;
|
|
7353
|
+
const issueAssociation = selectIssueAssociationById(id)(store.getState());
|
|
7354
|
+
if (!issueAssociation) {
|
|
7355
|
+
throw new Error(`Issue association with id ${id} not found in store.`);
|
|
7356
|
+
}
|
|
7357
|
+
this.dispatch(deleteIssueAssociation(id));
|
|
7358
|
+
const promise = this.enqueueRequest({
|
|
7359
|
+
description: "Delete issue association",
|
|
7360
|
+
method: HttpMethod.DELETE,
|
|
7361
|
+
url: `/issues/associations/${id}/`,
|
|
7362
|
+
blockers: [id],
|
|
7363
|
+
blocks: []
|
|
7364
|
+
});
|
|
7365
|
+
promise.catch(() => {
|
|
7366
|
+
this.dispatch(addIssueAssociation(issueAssociation));
|
|
7367
|
+
});
|
|
7368
|
+
return promise;
|
|
7369
|
+
}
|
|
7370
|
+
async refreshStore(projectId) {
|
|
7371
|
+
const issueAssociations = await this.enqueueRequest({
|
|
7372
|
+
description: "Fetch issue associations",
|
|
7373
|
+
method: HttpMethod.GET,
|
|
7374
|
+
url: "/issues/associations/",
|
|
7375
|
+
queryParams: { project_id: projectId.toString() },
|
|
7376
|
+
blockers: [],
|
|
7377
|
+
blocks: []
|
|
7378
|
+
});
|
|
7379
|
+
this.dispatch(initializeIssueAssociations(issueAssociations));
|
|
7380
|
+
}
|
|
7381
|
+
}
|
|
7196
7382
|
export {
|
|
7197
7383
|
APIError,
|
|
7198
7384
|
AgentService,
|
|
@@ -7221,6 +7407,7 @@ export {
|
|
|
7221
7407
|
GREEN,
|
|
7222
7408
|
GeoImageService,
|
|
7223
7409
|
HttpMethod,
|
|
7410
|
+
IssueAssociationService,
|
|
7224
7411
|
IssueAttachmentService,
|
|
7225
7412
|
IssueCommentService,
|
|
7226
7413
|
IssuePriority,
|
|
@@ -7282,6 +7469,8 @@ export {
|
|
|
7282
7469
|
addGeoImage,
|
|
7283
7470
|
addGeoImages,
|
|
7284
7471
|
addIssue,
|
|
7472
|
+
addIssueAssociation,
|
|
7473
|
+
addIssueAssociations,
|
|
7285
7474
|
addIssueAttachment,
|
|
7286
7475
|
addIssueAttachments,
|
|
7287
7476
|
addIssueComment,
|
|
@@ -7359,6 +7548,8 @@ export {
|
|
|
7359
7548
|
deleteGeoImage,
|
|
7360
7549
|
deleteGeoImages,
|
|
7361
7550
|
deleteIssue,
|
|
7551
|
+
deleteIssueAssociation,
|
|
7552
|
+
deleteIssueAssociations,
|
|
7362
7553
|
deleteIssueAttachment,
|
|
7363
7554
|
deleteIssueAttachments,
|
|
7364
7555
|
deleteIssueComment,
|
|
@@ -7431,6 +7622,7 @@ export {
|
|
|
7431
7622
|
initializeFormSubmissions,
|
|
7432
7623
|
initializeForms,
|
|
7433
7624
|
initializeGeoImages,
|
|
7625
|
+
initializeIssueAssociations,
|
|
7434
7626
|
initializeIssueAttachments,
|
|
7435
7627
|
initializeIssueTypes,
|
|
7436
7628
|
initializeIssueUpdates,
|
|
@@ -7443,6 +7635,8 @@ export {
|
|
|
7443
7635
|
initializeTeams,
|
|
7444
7636
|
initializeWorkspaces,
|
|
7445
7637
|
isToday,
|
|
7638
|
+
issueAssociationReducer,
|
|
7639
|
+
issueAssociationSlice,
|
|
7446
7640
|
issueAttachmentReducer,
|
|
7447
7641
|
issueAttachmentSlice,
|
|
7448
7642
|
issueCommentReducer,
|
|
@@ -7598,6 +7792,11 @@ export {
|
|
|
7598
7792
|
selectIsImportingProjectFile,
|
|
7599
7793
|
selectIsLoggedIn,
|
|
7600
7794
|
selectIssue,
|
|
7795
|
+
selectIssueAssociationById,
|
|
7796
|
+
selectIssueAssociationMapping,
|
|
7797
|
+
selectIssueAssociationsOfAsset,
|
|
7798
|
+
selectIssueAssociationsOfIssue,
|
|
7799
|
+
selectIssueAssociationsToIssue,
|
|
7601
7800
|
selectIssueAttachment,
|
|
7602
7801
|
selectIssueAttachmentMapping,
|
|
7603
7802
|
selectIssueAttachments,
|
|
@@ -7702,6 +7901,8 @@ export {
|
|
|
7702
7901
|
setGeoImages,
|
|
7703
7902
|
setIsFetchingInitialData,
|
|
7704
7903
|
setIsImportingProjectFile,
|
|
7904
|
+
setIssueAssociation,
|
|
7905
|
+
setIssueAssociations,
|
|
7705
7906
|
setIssueAttachment,
|
|
7706
7907
|
setIssueAttachments,
|
|
7707
7908
|
setIssueComment,
|
|
@@ -7755,6 +7956,8 @@ export {
|
|
|
7755
7956
|
updateGeoImage,
|
|
7756
7957
|
updateGeoImages,
|
|
7757
7958
|
updateIssue,
|
|
7959
|
+
updateIssueAssociation,
|
|
7960
|
+
updateIssueAssociations,
|
|
7758
7961
|
updateIssueAttachment,
|
|
7759
7962
|
updateIssueAttachments,
|
|
7760
7963
|
updateIssueType,
|