@overmap-ai/core 1.0.70-depend-on-forms.0 → 1.0.71-fields.0
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 +1893 -1055
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +1891 -1053
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/AssetAttachmentService.d.ts +32 -8
- package/dist/sdk/services/AssetTypeAttachmentService.d.ts +32 -9
- package/dist/sdk/services/AssetTypeFieldValuesAttachmentService.d.ts +13 -0
- package/dist/sdk/services/AssetTypeFieldValuesService.d.ts +20 -0
- package/dist/sdk/services/AssetTypeFieldsAttachmentService.d.ts +12 -0
- package/dist/sdk/services/AssetTypeFieldsService.d.ts +8 -0
- package/dist/sdk/services/BaseAttachmentService.d.ts +18 -20
- package/dist/sdk/services/BaseUploadService.d.ts +2 -1
- package/dist/sdk/services/DocumentAttachmentService.d.ts +30 -8
- package/dist/sdk/services/FormRevisionAttachmentService.d.ts +12 -0
- package/dist/sdk/services/FormRevisionService.d.ts +8 -0
- package/dist/sdk/services/FormService.d.ts +12 -15
- package/dist/sdk/services/FormSubmissionAttachmentService.d.ts +13 -0
- package/dist/sdk/services/FormSubmissionService.d.ts +9 -29
- package/dist/sdk/services/GeoImageService.d.ts +1 -1
- package/dist/sdk/services/IssueAssociationService.d.ts +2 -2
- package/dist/sdk/services/IssueAttachmentService.d.ts +31 -8
- package/dist/sdk/services/IssueService.d.ts +0 -3
- package/dist/sdk/services/IssueTypeFieldValuesAttachmentService.d.ts +13 -0
- package/dist/sdk/services/IssueTypeFieldValuesService.d.ts +10 -0
- package/dist/sdk/services/IssueTypeFieldsAttachmentService.d.ts +12 -0
- package/dist/sdk/services/IssueTypeFieldsService.d.ts +8 -0
- package/dist/sdk/services/ProjectAttachmentService.d.ts +31 -8
- package/dist/sdk/services/TeamService.d.ts +1 -1
- package/dist/sdk/services/WorkspaceService.d.ts +1 -1
- package/dist/sdk/services/index.d.ts +10 -0
- package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +52 -0
- package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +52 -0
- package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +52 -0
- package/dist/store/slices/assetTypeFieldsSlice.d.ts +52 -0
- package/dist/store/slices/formSlice.d.ts +0 -2
- package/dist/store/slices/formSubmissionSlice.d.ts +0 -4
- package/dist/store/slices/index.d.ts +8 -0
- package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +52 -0
- package/dist/store/slices/issueTypeFieldValuesSlice.d.ts +52 -0
- package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +52 -0
- package/dist/store/slices/issueTypeFieldsSlice.d.ts +52 -0
- package/dist/store/store.d.ts +9 -1
- package/dist/typings/files.d.ts +8 -4
- package/dist/typings/models/assets.d.ts +15 -0
- package/dist/typings/models/attachments.d.ts +1 -6
- package/dist/typings/models/base.d.ts +1 -2
- package/dist/typings/models/fields.d.ts +16 -0
- package/dist/typings/models/forms.d.ts +12 -27
- package/dist/typings/models/index.d.ts +1 -0
- package/dist/typings/models/issues.d.ts +15 -0
- package/dist/typings/models/license.d.ts +2 -2
- package/dist/typings/models/projects.d.ts +2 -4
- package/dist/typings/models/store.d.ts +9 -1
- package/dist/utils/file.d.ts +2 -2
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -758,15 +758,15 @@ const wrapMigration = (migrator) => (state) => {
|
|
|
758
758
|
};
|
|
759
759
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
760
760
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
761
|
-
const initialState$
|
|
761
|
+
const initialState$J = {
|
|
762
762
|
accessToken: "",
|
|
763
763
|
refreshToken: "",
|
|
764
764
|
isLoggedIn: false
|
|
765
765
|
};
|
|
766
766
|
const authSlice = createSlice({
|
|
767
767
|
name: "auth",
|
|
768
|
-
initialState: initialState$
|
|
769
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
768
|
+
initialState: initialState$J,
|
|
769
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$J)),
|
|
770
770
|
reducers: {
|
|
771
771
|
setTokens: (state, action) => {
|
|
772
772
|
state.accessToken = action.payload.accessToken;
|
|
@@ -854,11 +854,11 @@ function createModelAdapter(computeModelId) {
|
|
|
854
854
|
};
|
|
855
855
|
}
|
|
856
856
|
const categoryAdapter = createModelAdapter((category) => category.offline_id);
|
|
857
|
-
const initialState$
|
|
857
|
+
const initialState$I = categoryAdapter.getInitialState({});
|
|
858
858
|
const categorySlice = createSlice({
|
|
859
859
|
name: "categories",
|
|
860
|
-
initialState: initialState$
|
|
861
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
860
|
+
initialState: initialState$I,
|
|
861
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$I)),
|
|
862
862
|
reducers: {
|
|
863
863
|
initializeCategories: categoryAdapter.initialize,
|
|
864
864
|
addCategory: categoryAdapter.addOne,
|
|
@@ -902,11 +902,11 @@ const selectIssueCountOfCategory = (categoryId) => (state) => {
|
|
|
902
902
|
};
|
|
903
903
|
const categoryReducer = categorySlice.reducer;
|
|
904
904
|
const assetAdapter = createModelAdapter((asset) => asset.offline_id);
|
|
905
|
-
const initialState$
|
|
905
|
+
const initialState$H = assetAdapter.getInitialState({});
|
|
906
906
|
const assetSlice = createSlice({
|
|
907
907
|
name: "assets",
|
|
908
|
-
initialState: initialState$
|
|
909
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
908
|
+
initialState: initialState$H,
|
|
909
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$H)),
|
|
910
910
|
reducers: {
|
|
911
911
|
initializeAssets: assetAdapter.initialize,
|
|
912
912
|
addAsset: assetAdapter.addOne,
|
|
@@ -958,11 +958,11 @@ const selectNumberOfAssetsOfAssetType = (assetTypeId) => (state) => {
|
|
|
958
958
|
};
|
|
959
959
|
const assetReducer = assetSlice.reducer;
|
|
960
960
|
const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
961
|
-
const initialState$
|
|
961
|
+
const initialState$G = assetAttachmentAdapter.getInitialState({});
|
|
962
962
|
const assetAttachmentSlice = createSlice({
|
|
963
963
|
name: "assetAttachments",
|
|
964
|
-
initialState: initialState$
|
|
965
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
964
|
+
initialState: initialState$G,
|
|
965
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$G)),
|
|
966
966
|
reducers: {
|
|
967
967
|
initializeAssetAttachments: assetAttachmentAdapter.initialize,
|
|
968
968
|
addAssetAttachment: assetAttachmentAdapter.addOne,
|
|
@@ -1023,11 +1023,11 @@ const assetAttachmentReducer = assetAttachmentSlice.reducer;
|
|
|
1023
1023
|
const assetStageCompletionAdapter = createModelAdapter(
|
|
1024
1024
|
(stageCompletion) => stageCompletion.offline_id
|
|
1025
1025
|
);
|
|
1026
|
-
const initialState$
|
|
1026
|
+
const initialState$F = assetStageCompletionAdapter.getInitialState({});
|
|
1027
1027
|
const assetStageCompletionSlice = createSlice({
|
|
1028
1028
|
name: "assetStageCompletions",
|
|
1029
|
-
initialState: initialState$
|
|
1030
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1029
|
+
initialState: initialState$F,
|
|
1030
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$F)),
|
|
1031
1031
|
reducers: {
|
|
1032
1032
|
initializeAssetStageCompletions: assetStageCompletionAdapter.initialize,
|
|
1033
1033
|
addAssetStageCompletion: assetStageCompletionAdapter.addOne,
|
|
@@ -1089,11 +1089,11 @@ const selectAssetStageCompletionsByIds = restructureCreateSelectorWithArgs(
|
|
|
1089
1089
|
);
|
|
1090
1090
|
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1091
1091
|
const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
|
|
1092
|
-
const initialState$
|
|
1092
|
+
const initialState$E = assetStageAdapter.getInitialState({});
|
|
1093
1093
|
const assetStageSlice = createSlice({
|
|
1094
1094
|
name: "assetStages",
|
|
1095
|
-
initialState: initialState$
|
|
1096
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1095
|
+
initialState: initialState$E,
|
|
1096
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$E)),
|
|
1097
1097
|
reducers: {
|
|
1098
1098
|
initializeAssetStages: assetStageAdapter.initialize,
|
|
1099
1099
|
setAssetStage: assetStageAdapter.setOne,
|
|
@@ -1173,11 +1173,11 @@ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
|
1173
1173
|
})
|
|
1174
1174
|
);
|
|
1175
1175
|
const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
|
|
1176
|
-
const initialState$
|
|
1176
|
+
const initialState$D = assetTypeAdapter.getInitialState({});
|
|
1177
1177
|
const assetTypeSlice = createSlice({
|
|
1178
1178
|
name: "assetTypes",
|
|
1179
|
-
initialState: initialState$
|
|
1180
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1179
|
+
initialState: initialState$D,
|
|
1180
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$D)),
|
|
1181
1181
|
reducers: {
|
|
1182
1182
|
initializeAssetTypes: assetTypeAdapter.initialize,
|
|
1183
1183
|
setAssetType: assetTypeAdapter.setOne,
|
|
@@ -1230,11 +1230,11 @@ const assetTypeReducer = assetTypeSlice.reducer;
|
|
|
1230
1230
|
const assetTypeAttachmentAdapter = createModelAdapter(
|
|
1231
1231
|
(attachment) => attachment.offline_id
|
|
1232
1232
|
);
|
|
1233
|
-
const initialState$
|
|
1233
|
+
const initialState$C = assetTypeAttachmentAdapter.getInitialState({});
|
|
1234
1234
|
const assetTypeAttachmentSlice = createSlice({
|
|
1235
1235
|
name: "assetTypeAttachments",
|
|
1236
|
-
initialState: initialState$
|
|
1237
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1236
|
+
initialState: initialState$C,
|
|
1237
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$C)),
|
|
1238
1238
|
reducers: {
|
|
1239
1239
|
initializeAssetTypeAttachments: assetTypeAttachmentAdapter.initialize,
|
|
1240
1240
|
addAssetTypeAttachment: assetTypeAttachmentAdapter.addOne,
|
|
@@ -1293,12 +1293,12 @@ const selectAttachmentsOfAssetTypeByType = restructureCreateSelectorWithArgs(
|
|
|
1293
1293
|
);
|
|
1294
1294
|
const assetTypeAttachmentReducer = assetTypeAttachmentSlice.reducer;
|
|
1295
1295
|
const issueAdapter = createModelAdapter((issue) => issue.offline_id);
|
|
1296
|
-
const initialState$
|
|
1296
|
+
const initialState$B = issueAdapter.getInitialState({});
|
|
1297
1297
|
const issueSlice = createSlice({
|
|
1298
1298
|
name: "issues",
|
|
1299
|
-
initialState: initialState$
|
|
1299
|
+
initialState: initialState$B,
|
|
1300
1300
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1301
|
-
Object.assign(state, initialState$
|
|
1301
|
+
Object.assign(state, initialState$B);
|
|
1302
1302
|
}),
|
|
1303
1303
|
reducers: {
|
|
1304
1304
|
initializeIssues: issueAdapter.initialize,
|
|
@@ -1330,12 +1330,12 @@ const selectIssuesByIds = restructureCreateSelectorWithArgs(
|
|
|
1330
1330
|
);
|
|
1331
1331
|
const issueReducer = issueSlice.reducer;
|
|
1332
1332
|
const issueTypeAdapter = createModelAdapter((issueType) => issueType.offline_id);
|
|
1333
|
-
const initialState$
|
|
1333
|
+
const initialState$A = issueTypeAdapter.getInitialState({});
|
|
1334
1334
|
const issueTypeSlice = createSlice({
|
|
1335
1335
|
name: "issueTypes",
|
|
1336
|
-
initialState: initialState$
|
|
1336
|
+
initialState: initialState$A,
|
|
1337
1337
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1338
|
-
Object.assign(state, initialState$
|
|
1338
|
+
Object.assign(state, initialState$A);
|
|
1339
1339
|
}),
|
|
1340
1340
|
reducers: {
|
|
1341
1341
|
initializeIssueTypes: issueTypeAdapter.initialize,
|
|
@@ -1392,15 +1392,15 @@ const selectIssuesOfIssueTypeCount = (issueTypeId) => (state) => {
|
|
|
1392
1392
|
return selectIssuesOfIssueType(issueTypeId)(state).length;
|
|
1393
1393
|
};
|
|
1394
1394
|
const issueTypeReducer = issueTypeSlice.reducer;
|
|
1395
|
-
const initialState$
|
|
1395
|
+
const initialState$z = {
|
|
1396
1396
|
s3Urls: {}
|
|
1397
1397
|
};
|
|
1398
1398
|
const msPerHour = 1e3 * 60 * 60;
|
|
1399
1399
|
const msPerWeek = msPerHour * 24 * 7;
|
|
1400
1400
|
const fileSlice = createSlice({
|
|
1401
1401
|
name: "file",
|
|
1402
|
-
initialState: initialState$
|
|
1403
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1402
|
+
initialState: initialState$z,
|
|
1403
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
|
|
1404
1404
|
reducers: {
|
|
1405
1405
|
setUploadUrl: (state, action) => {
|
|
1406
1406
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -1427,14 +1427,14 @@ const selectUploadUrl = (sha1) => (state) => {
|
|
|
1427
1427
|
return url;
|
|
1428
1428
|
};
|
|
1429
1429
|
const fileReducer = fileSlice.reducer;
|
|
1430
|
-
const initialState$
|
|
1430
|
+
const initialState$y = {
|
|
1431
1431
|
users: {},
|
|
1432
1432
|
currentUser: null
|
|
1433
1433
|
};
|
|
1434
1434
|
const userSlice = createSlice({
|
|
1435
1435
|
name: "users",
|
|
1436
|
-
initialState: initialState$
|
|
1437
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1436
|
+
initialState: initialState$y,
|
|
1437
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
|
|
1438
1438
|
reducers: {
|
|
1439
1439
|
setUsers: (state, action) => {
|
|
1440
1440
|
const usersMapping = {};
|
|
@@ -1492,11 +1492,11 @@ const selectUsersByIds = restructureCreateSelectorWithArgs(
|
|
|
1492
1492
|
const organizationAccessAdapter = createModelAdapter(
|
|
1493
1493
|
(organizationAccess) => organizationAccess.offline_id
|
|
1494
1494
|
);
|
|
1495
|
-
const initialState$
|
|
1495
|
+
const initialState$x = organizationAccessAdapter.getInitialState({});
|
|
1496
1496
|
const organizationAccessSlice = createSlice({
|
|
1497
1497
|
name: "organizationAccess",
|
|
1498
|
-
initialState: initialState$
|
|
1499
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1498
|
+
initialState: initialState$x,
|
|
1499
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
|
|
1500
1500
|
reducers: {
|
|
1501
1501
|
initializeOrganizationAccesses: organizationAccessAdapter.initialize,
|
|
1502
1502
|
updateOrganizationAccess: organizationAccessAdapter.updateOne,
|
|
@@ -1533,11 +1533,11 @@ const selectOrganizationAccessUserMapping = (state) => {
|
|
|
1533
1533
|
};
|
|
1534
1534
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
1535
1535
|
const licenseAdapter = createModelAdapter((license) => license.offline_id);
|
|
1536
|
-
const initialState$
|
|
1536
|
+
const initialState$w = licenseAdapter.getInitialState({});
|
|
1537
1537
|
const licenseSlice = createSlice({
|
|
1538
1538
|
name: "license",
|
|
1539
|
-
initialState: initialState$
|
|
1540
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1539
|
+
initialState: initialState$w,
|
|
1540
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
|
|
1541
1541
|
reducers: {
|
|
1542
1542
|
initializeLicences: licenseAdapter.initialize,
|
|
1543
1543
|
addLicenses: licenseAdapter.addMany,
|
|
@@ -1562,11 +1562,11 @@ const selectLicensesForProjectsMapping = createSelector(
|
|
|
1562
1562
|
);
|
|
1563
1563
|
const licenseReducer = licenseSlice.reducer;
|
|
1564
1564
|
const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
|
|
1565
|
-
const initialState$
|
|
1565
|
+
const initialState$v = projectAccessAdapter.getInitialState({});
|
|
1566
1566
|
const projectAccessSlice = createSlice({
|
|
1567
1567
|
name: "projectAccess",
|
|
1568
|
-
initialState: initialState$
|
|
1569
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1568
|
+
initialState: initialState$v,
|
|
1569
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
|
|
1570
1570
|
reducers: {
|
|
1571
1571
|
initializeProjectAccesses: projectAccessAdapter.initialize,
|
|
1572
1572
|
updateProjectAccess: projectAccessAdapter.updateOne,
|
|
@@ -1607,14 +1607,14 @@ const selectProjectAccessUserMapping = (state) => {
|
|
|
1607
1607
|
return projectAccesses;
|
|
1608
1608
|
};
|
|
1609
1609
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
1610
|
-
const initialState$
|
|
1610
|
+
const initialState$u = {
|
|
1611
1611
|
projects: {},
|
|
1612
1612
|
activeProjectId: null
|
|
1613
1613
|
};
|
|
1614
1614
|
const projectSlice = createSlice({
|
|
1615
1615
|
name: "projects",
|
|
1616
|
-
initialState: initialState$
|
|
1617
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1616
|
+
initialState: initialState$u,
|
|
1617
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
|
|
1618
1618
|
reducers: {
|
|
1619
1619
|
setProjects: (state, action) => {
|
|
1620
1620
|
const projectsMap = {};
|
|
@@ -1721,13 +1721,13 @@ const selectSortedProjectUsers = createSelector(
|
|
|
1721
1721
|
});
|
|
1722
1722
|
}
|
|
1723
1723
|
);
|
|
1724
|
-
const initialState$
|
|
1724
|
+
const initialState$t = {
|
|
1725
1725
|
organizations: {}
|
|
1726
1726
|
};
|
|
1727
1727
|
const organizationSlice = createSlice({
|
|
1728
1728
|
name: "organizations",
|
|
1729
|
-
initialState: initialState$
|
|
1730
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1729
|
+
initialState: initialState$t,
|
|
1730
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$t)),
|
|
1731
1731
|
reducers: {
|
|
1732
1732
|
setOrganizations: (state, action) => {
|
|
1733
1733
|
for (const org of action.payload) {
|
|
@@ -1818,14 +1818,14 @@ const createOfflineAction = (request2, baseUrl, serviceName) => {
|
|
|
1818
1818
|
}
|
|
1819
1819
|
};
|
|
1820
1820
|
};
|
|
1821
|
-
const initialState$
|
|
1821
|
+
const initialState$s = {
|
|
1822
1822
|
deletedRequests: [],
|
|
1823
1823
|
latestRetryTime: 0
|
|
1824
1824
|
};
|
|
1825
1825
|
const outboxSlice = createSlice({
|
|
1826
1826
|
name: "outbox",
|
|
1827
|
-
initialState: initialState$
|
|
1828
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1827
|
+
initialState: initialState$s,
|
|
1828
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$s)),
|
|
1829
1829
|
reducers: {
|
|
1830
1830
|
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
1831
1831
|
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
@@ -1857,15 +1857,15 @@ const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
|
|
|
1857
1857
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
1858
1858
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
1859
1859
|
const outboxReducer = outboxSlice.reducer;
|
|
1860
|
-
const initialState$
|
|
1860
|
+
const initialState$r = {
|
|
1861
1861
|
projectFiles: {},
|
|
1862
1862
|
activeProjectFileId: null,
|
|
1863
1863
|
isImportingProjectFile: false
|
|
1864
1864
|
};
|
|
1865
1865
|
const projectFileSlice = createSlice({
|
|
1866
1866
|
name: "projectFiles",
|
|
1867
|
-
initialState: initialState$
|
|
1868
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1867
|
+
initialState: initialState$r,
|
|
1868
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
|
|
1869
1869
|
reducers: {
|
|
1870
1870
|
addOrReplaceProjectFiles: (state, action) => {
|
|
1871
1871
|
for (let fileObj of action.payload) {
|
|
@@ -1952,11 +1952,11 @@ const selectProjectFileById = (id) => (state) => {
|
|
|
1952
1952
|
};
|
|
1953
1953
|
const projectFileReducer = projectFileSlice.reducer;
|
|
1954
1954
|
const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
1955
|
-
const initialState$
|
|
1955
|
+
const initialState$q = projectAttachmentAdapter.getInitialState({});
|
|
1956
1956
|
const projectAttachmentSlice = createSlice({
|
|
1957
1957
|
name: "projectAttachments",
|
|
1958
|
-
initialState: initialState$
|
|
1959
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1958
|
+
initialState: initialState$q,
|
|
1959
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1960
1960
|
reducers: {
|
|
1961
1961
|
initializeProjectAttachments: projectAttachmentAdapter.initialize,
|
|
1962
1962
|
addProjectAttachment: projectAttachmentAdapter.addOne,
|
|
@@ -2011,12 +2011,12 @@ const selectAttachmentsOfProjectByType = restructureCreateSelectorWithArgs(
|
|
|
2011
2011
|
)
|
|
2012
2012
|
);
|
|
2013
2013
|
const projectAttachmentReducer = projectAttachmentSlice.reducer;
|
|
2014
|
-
const initialState$
|
|
2014
|
+
const initialState$p = {
|
|
2015
2015
|
isRehydrated: false
|
|
2016
2016
|
};
|
|
2017
2017
|
const rehydratedSlice = createSlice({
|
|
2018
2018
|
name: "rehydrated",
|
|
2019
|
-
initialState: initialState$
|
|
2019
|
+
initialState: initialState$p,
|
|
2020
2020
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
2021
2021
|
reducers: {
|
|
2022
2022
|
setRehydrated: (state, action) => {
|
|
@@ -2041,11 +2041,11 @@ const formRevisionSortFn = (formRevisionA, formRevisionB) => {
|
|
|
2041
2041
|
}
|
|
2042
2042
|
};
|
|
2043
2043
|
const formRevisionAdapter = createModelAdapter((revision) => revision.offline_id);
|
|
2044
|
-
const initialState$
|
|
2044
|
+
const initialState$o = formRevisionAdapter.getInitialState({});
|
|
2045
2045
|
const formRevisionsSlice = createSlice({
|
|
2046
2046
|
name: "formRevisions",
|
|
2047
|
-
initialState: initialState$
|
|
2048
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2047
|
+
initialState: initialState$o,
|
|
2048
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
2049
2049
|
reducers: {
|
|
2050
2050
|
initializeFormRevisions: formRevisionAdapter.initialize,
|
|
2051
2051
|
setFormRevision: formRevisionAdapter.setOne,
|
|
@@ -2117,11 +2117,11 @@ const selectLatestFormRevisionByForm = createSelector([selectFormRevisionMapping
|
|
|
2117
2117
|
});
|
|
2118
2118
|
const formRevisionReducer = formRevisionsSlice.reducer;
|
|
2119
2119
|
const formAdapter = createModelAdapter((form) => form.offline_id);
|
|
2120
|
-
const initialState$
|
|
2120
|
+
const initialState$n = formAdapter.getInitialState({});
|
|
2121
2121
|
const formSlice = createSlice({
|
|
2122
2122
|
name: "forms",
|
|
2123
|
-
initialState: initialState$
|
|
2124
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2123
|
+
initialState: initialState$n,
|
|
2124
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
2125
2125
|
reducers: {
|
|
2126
2126
|
initializeForms: formAdapter.initialize,
|
|
2127
2127
|
setForm: formAdapter.setOne,
|
|
@@ -2167,34 +2167,18 @@ const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
|
2167
2167
|
const selectFormById = (formId) => (state) => {
|
|
2168
2168
|
return state.formReducer.instances[formId];
|
|
2169
2169
|
};
|
|
2170
|
-
const selectFormOfAssetType = restructureCreateSelectorWithArgs(
|
|
2171
|
-
createSelector(
|
|
2172
|
-
[selectFormMapping, (_state, assetTypeId) => assetTypeId],
|
|
2173
|
-
(formsMapping, assetTypeId) => {
|
|
2174
|
-
return Object.values(formsMapping).find((form) => form.asset_type === assetTypeId);
|
|
2175
|
-
}
|
|
2176
|
-
)
|
|
2177
|
-
);
|
|
2178
|
-
const selectFormOfIssueType = restructureCreateSelectorWithArgs(
|
|
2179
|
-
createSelector(
|
|
2180
|
-
[selectFormMapping, (_state, issueTypeId) => issueTypeId],
|
|
2181
|
-
(formsMapping, issueTypeId) => {
|
|
2182
|
-
return Object.values(formsMapping).find((form) => form.issue_type === issueTypeId);
|
|
2183
|
-
}
|
|
2184
|
-
)
|
|
2185
|
-
);
|
|
2186
2170
|
const selectFormsCount = createSelector([selectFormMapping], (formsMapping) => {
|
|
2187
2171
|
return Object.keys(formsMapping).length;
|
|
2188
2172
|
});
|
|
2189
2173
|
const selectGeneralFormCount = createSelector([selectFormMapping], (formsMapping) => {
|
|
2190
|
-
return Object.values(formsMapping).
|
|
2174
|
+
return Object.values(formsMapping).length;
|
|
2191
2175
|
});
|
|
2192
2176
|
const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
|
|
2193
|
-
const initialState$
|
|
2177
|
+
const initialState$m = submissionAdapter.getInitialState({});
|
|
2194
2178
|
const formSubmissionSlice = createSlice({
|
|
2195
2179
|
name: "formSubmissions",
|
|
2196
|
-
initialState: initialState$
|
|
2197
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2180
|
+
initialState: initialState$m,
|
|
2181
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
|
|
2198
2182
|
reducers: {
|
|
2199
2183
|
initializeFormSubmissions: submissionAdapter.initialize,
|
|
2200
2184
|
setFormSubmission: submissionAdapter.setOne,
|
|
@@ -2297,54 +2281,6 @@ const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
|
2297
2281
|
}
|
|
2298
2282
|
)
|
|
2299
2283
|
);
|
|
2300
|
-
const selectAttachedFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
2301
|
-
createSelector(
|
|
2302
|
-
[
|
|
2303
|
-
(state) => state.issueReducer.instances,
|
|
2304
|
-
(state) => state.formReducer.instances,
|
|
2305
|
-
(state) => state.formRevisionReducer.instances,
|
|
2306
|
-
(state) => state.formSubmissionReducer.instances,
|
|
2307
|
-
(_state, issueId) => issueId
|
|
2308
|
-
],
|
|
2309
|
-
(issues, forms, formRevisions, submissions, issueId) => {
|
|
2310
|
-
const issue = issues[issueId];
|
|
2311
|
-
if (!issue)
|
|
2312
|
-
return [];
|
|
2313
|
-
if (!issue.issue_type) {
|
|
2314
|
-
return Object.values(submissions).filter((submission) => submission.issue === issueId);
|
|
2315
|
-
}
|
|
2316
|
-
const issueTypeForms = new Set(
|
|
2317
|
-
Object.keys(forms).filter((formId) => forms[formId].issue_type === issue.issue_type)
|
|
2318
|
-
);
|
|
2319
|
-
const issueTypeFormRevisions = new Set(
|
|
2320
|
-
Object.keys(formRevisions).filter(
|
|
2321
|
-
(formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
|
|
2322
|
-
)
|
|
2323
|
-
);
|
|
2324
|
-
return Object.values(submissions).filter(
|
|
2325
|
-
(submission) => submission.issue === issueId && !issueTypeFormRevisions.has(submission.form_revision)
|
|
2326
|
-
);
|
|
2327
|
-
}
|
|
2328
|
-
)
|
|
2329
|
-
);
|
|
2330
|
-
const selectFormSubmissionsByIssues = restructureCreateSelectorWithArgs(
|
|
2331
|
-
createSelector(
|
|
2332
|
-
[selectFormSubmissions, (_state, issueIds) => issueIds],
|
|
2333
|
-
(submissions, issueIds) => {
|
|
2334
|
-
var _a2;
|
|
2335
|
-
const issueSubmissions = {};
|
|
2336
|
-
for (const issueId of issueIds) {
|
|
2337
|
-
issueSubmissions[issueId] = [];
|
|
2338
|
-
}
|
|
2339
|
-
for (const submission of submissions) {
|
|
2340
|
-
if (submission.issue && issueIds.includes(submission.issue)) {
|
|
2341
|
-
(_a2 = issueSubmissions[submission.issue]) == null ? void 0 : _a2.push(submission);
|
|
2342
|
-
}
|
|
2343
|
-
}
|
|
2344
|
-
return issueSubmissions;
|
|
2345
|
-
}
|
|
2346
|
-
)
|
|
2347
|
-
);
|
|
2348
2284
|
const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
2349
2285
|
createSelector(
|
|
2350
2286
|
[selectFormSubmissions, (_state, assetId) => assetId],
|
|
@@ -2355,62 +2291,15 @@ const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
|
2355
2291
|
}
|
|
2356
2292
|
)
|
|
2357
2293
|
);
|
|
2358
|
-
const selectAttachedFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
2359
|
-
createSelector(
|
|
2360
|
-
[
|
|
2361
|
-
(state) => state.assetReducer.instances,
|
|
2362
|
-
(state) => state.formReducer.instances,
|
|
2363
|
-
(state) => state.formRevisionReducer.instances,
|
|
2364
|
-
(state) => state.formSubmissionReducer.instances,
|
|
2365
|
-
(_state, assetId) => assetId
|
|
2366
|
-
],
|
|
2367
|
-
(assets, forms, formRevisions, submissions, assetId) => {
|
|
2368
|
-
const asset = assets[assetId];
|
|
2369
|
-
if (!asset)
|
|
2370
|
-
return [];
|
|
2371
|
-
if (!asset.asset_type) {
|
|
2372
|
-
return Object.values(submissions).filter((submission) => submission.asset === assetId);
|
|
2373
|
-
}
|
|
2374
|
-
const issueTypeForms = new Set(
|
|
2375
|
-
Object.keys(forms).filter((formId) => forms[formId].asset_type === asset.asset_type)
|
|
2376
|
-
);
|
|
2377
|
-
const issueTypeFormRevisions = new Set(
|
|
2378
|
-
Object.keys(formRevisions).filter(
|
|
2379
|
-
(formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
|
|
2380
|
-
)
|
|
2381
|
-
);
|
|
2382
|
-
return Object.values(submissions).filter(
|
|
2383
|
-
(submission) => submission.asset === assetId && !issueTypeFormRevisions.has(submission.form_revision)
|
|
2384
|
-
);
|
|
2385
|
-
}
|
|
2386
|
-
)
|
|
2387
|
-
);
|
|
2388
|
-
const selectFormSubmissionsByAssets = createSelector(
|
|
2389
|
-
[selectFormSubmissionsMapping, selectAssetsMapping],
|
|
2390
|
-
(submissions, assets) => {
|
|
2391
|
-
var _a2;
|
|
2392
|
-
const assetSubmissionMapping = {};
|
|
2393
|
-
for (const assetId in assets) {
|
|
2394
|
-
assetSubmissionMapping[assetId] = [];
|
|
2395
|
-
}
|
|
2396
|
-
for (const submissionId in submissions) {
|
|
2397
|
-
const submission = submissions[submissionId];
|
|
2398
|
-
if (submission.asset) {
|
|
2399
|
-
(_a2 = assetSubmissionMapping[submission.asset]) == null ? void 0 : _a2.push(submission);
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
return assetSubmissionMapping;
|
|
2403
|
-
}
|
|
2404
|
-
);
|
|
2405
2294
|
const formSubmissionReducer = formSubmissionSlice.reducer;
|
|
2406
2295
|
const formSubmissionAttachmentAdapter = createModelAdapter(
|
|
2407
2296
|
(attachment) => attachment.offline_id
|
|
2408
2297
|
);
|
|
2409
|
-
const initialState$
|
|
2298
|
+
const initialState$l = formSubmissionAttachmentAdapter.getInitialState({});
|
|
2410
2299
|
const formSubmissionAttachmentSlice = createSlice({
|
|
2411
2300
|
name: "formSubmissionAttachments",
|
|
2412
|
-
initialState: initialState$
|
|
2413
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2301
|
+
initialState: initialState$l,
|
|
2302
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
|
|
2414
2303
|
reducers: {
|
|
2415
2304
|
initializeFormSubmissionAttachments: formSubmissionAttachmentAdapter.initialize,
|
|
2416
2305
|
addFormSubmissionAttachment: formSubmissionAttachmentAdapter.addOne,
|
|
@@ -2453,7 +2342,9 @@ const selectAttachmentsOfFormSubmission = restructureCreateSelectorWithArgs(
|
|
|
2453
2342
|
[selectFormSubmissionAttachmentsMapping, (_state, submissionId) => submissionId],
|
|
2454
2343
|
(attachmentsMapping, submissionId) => {
|
|
2455
2344
|
return fallbackToEmptyArray(
|
|
2456
|
-
Object.values(attachmentsMapping).filter(
|
|
2345
|
+
Object.values(attachmentsMapping).filter(
|
|
2346
|
+
(attachment) => attachment.form_submission === submissionId
|
|
2347
|
+
)
|
|
2457
2348
|
);
|
|
2458
2349
|
}
|
|
2459
2350
|
)
|
|
@@ -2462,11 +2353,11 @@ const formSubmissionAttachmentReducer = formSubmissionAttachmentSlice.reducer;
|
|
|
2462
2353
|
const formRevisionAttachmentAdapter = createModelAdapter(
|
|
2463
2354
|
(attachment) => attachment.offline_id
|
|
2464
2355
|
);
|
|
2465
|
-
const initialState$
|
|
2356
|
+
const initialState$k = formRevisionAttachmentAdapter.getInitialState({});
|
|
2466
2357
|
const formRevisionAttachmentSlice = createSlice({
|
|
2467
2358
|
name: "formRevisionAttachments",
|
|
2468
|
-
initialState: initialState$
|
|
2469
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2359
|
+
initialState: initialState$k,
|
|
2360
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
|
|
2470
2361
|
reducers: {
|
|
2471
2362
|
initializeFormRevisionAttachments: formRevisionAttachmentAdapter.initialize,
|
|
2472
2363
|
addFormRevisionAttachment: formRevisionAttachmentAdapter.addOne,
|
|
@@ -2498,17 +2389,17 @@ const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
|
|
|
2498
2389
|
[selectFormRevisionAttachmentsMapping, (_state, revisionId) => revisionId],
|
|
2499
2390
|
(attachments, revisionId) => {
|
|
2500
2391
|
return fallbackToEmptyArray(
|
|
2501
|
-
Object.values(attachments).filter((attachment) => attachment.
|
|
2392
|
+
Object.values(attachments).filter((attachment) => attachment.form_revision === revisionId)
|
|
2502
2393
|
);
|
|
2503
2394
|
}
|
|
2504
2395
|
)
|
|
2505
2396
|
);
|
|
2506
2397
|
const formRevisionAttachmentReducer = formRevisionAttachmentSlice.reducer;
|
|
2507
2398
|
const workspaceAdapter = createModelAdapter((workspace) => workspace.offline_id);
|
|
2508
|
-
const initialState$
|
|
2399
|
+
const initialState$j = workspaceAdapter.getInitialState({});
|
|
2509
2400
|
const workspaceSlice = createSlice({
|
|
2510
2401
|
name: "workspace",
|
|
2511
|
-
initialState: initialState$
|
|
2402
|
+
initialState: initialState$j,
|
|
2512
2403
|
reducers: {
|
|
2513
2404
|
initializeWorkspaces: workspaceAdapter.initialize,
|
|
2514
2405
|
setWorkspaces: workspaceAdapter.setMany,
|
|
@@ -2539,10 +2430,10 @@ const selectPermittedWorkspaceIds = createSelector(
|
|
|
2539
2430
|
);
|
|
2540
2431
|
const workspaceReducer = workspaceSlice.reducer;
|
|
2541
2432
|
const emailDomainAdapter = createModelAdapter((emailDomain) => emailDomain.offline_id);
|
|
2542
|
-
const initialState$
|
|
2433
|
+
const initialState$i = emailDomainAdapter.getInitialState({});
|
|
2543
2434
|
const emailDomainsSlice = createSlice({
|
|
2544
2435
|
name: "emailDomains",
|
|
2545
|
-
initialState: initialState$
|
|
2436
|
+
initialState: initialState$i,
|
|
2546
2437
|
reducers: {
|
|
2547
2438
|
initializeEmailDomains: emailDomainAdapter.initialize,
|
|
2548
2439
|
addEmailDomain: emailDomainAdapter.addOne,
|
|
@@ -2563,14 +2454,14 @@ const selectEmailDomainsOfOrganization = restructureCreateSelectorWithArgs(
|
|
|
2563
2454
|
)
|
|
2564
2455
|
);
|
|
2565
2456
|
const emailDomainsReducer = emailDomainsSlice.reducer;
|
|
2566
|
-
const initialState$
|
|
2457
|
+
const initialState$h = {
|
|
2567
2458
|
documents: {}
|
|
2568
2459
|
};
|
|
2569
2460
|
const documentSlice = createSlice({
|
|
2570
2461
|
name: "documents",
|
|
2571
|
-
initialState: initialState$
|
|
2462
|
+
initialState: initialState$h,
|
|
2572
2463
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2573
|
-
Object.assign(state, initialState$
|
|
2464
|
+
Object.assign(state, initialState$h);
|
|
2574
2465
|
}),
|
|
2575
2466
|
reducers: {
|
|
2576
2467
|
setDocuments: (state, action) => {
|
|
@@ -2759,11 +2650,11 @@ const selectRootDocuments = createSelector(
|
|
|
2759
2650
|
);
|
|
2760
2651
|
const documentsReducer = documentSlice.reducer;
|
|
2761
2652
|
const documentAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2762
|
-
const initialState$
|
|
2653
|
+
const initialState$g = documentAttachmentAdapter.getInitialState({});
|
|
2763
2654
|
const documentAttachmentSlice = createSlice({
|
|
2764
2655
|
name: "documentAttachments",
|
|
2765
|
-
initialState: initialState$
|
|
2766
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2656
|
+
initialState: initialState$g,
|
|
2657
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
2767
2658
|
reducers: {
|
|
2768
2659
|
initializeDocumentAttachments: documentAttachmentAdapter.initialize,
|
|
2769
2660
|
addDocumentAttachment: documentAttachmentAdapter.addOne,
|
|
@@ -2822,11 +2713,11 @@ const selectAttachmentsOfDocumentByType = restructureCreateSelectorWithArgs(
|
|
|
2822
2713
|
);
|
|
2823
2714
|
const documentAttachmentReducer = documentAttachmentSlice.reducer;
|
|
2824
2715
|
const teamAdapter = createModelAdapter((team) => team.offline_id);
|
|
2825
|
-
const initialState$
|
|
2716
|
+
const initialState$f = teamAdapter.getInitialState({});
|
|
2826
2717
|
const teamSlice = createSlice({
|
|
2827
2718
|
name: "teams",
|
|
2828
|
-
initialState: initialState$
|
|
2829
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2719
|
+
initialState: initialState$f,
|
|
2720
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
|
|
2830
2721
|
reducers: {
|
|
2831
2722
|
setTeam: teamAdapter.setOne,
|
|
2832
2723
|
initializeTeams: teamAdapter.initialize,
|
|
@@ -2877,11 +2768,11 @@ const teamReducer = teamSlice.reducer;
|
|
|
2877
2768
|
const agentUserConversationAdapter = createModelAdapter(
|
|
2878
2769
|
(conversation) => conversation.offline_id
|
|
2879
2770
|
);
|
|
2880
|
-
const initialState$
|
|
2771
|
+
const initialState$e = agentUserConversationAdapter.getInitialState({});
|
|
2881
2772
|
const agentsSlice = createSlice({
|
|
2882
2773
|
name: "agents",
|
|
2883
|
-
initialState: initialState$
|
|
2884
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2774
|
+
initialState: initialState$e,
|
|
2775
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
|
|
2885
2776
|
reducers: {
|
|
2886
2777
|
initializeConversations: agentUserConversationAdapter.initialize,
|
|
2887
2778
|
addConversation: agentUserConversationAdapter.addOne,
|
|
@@ -2903,11 +2794,11 @@ const selectConversation = restructureCreateSelectorWithArgs(
|
|
|
2903
2794
|
);
|
|
2904
2795
|
const agentsReducer = agentsSlice.reducer;
|
|
2905
2796
|
const issueCommentAdapter = createModelAdapter((comment) => comment.offline_id);
|
|
2906
|
-
const initialState$
|
|
2797
|
+
const initialState$d = issueCommentAdapter.getInitialState({});
|
|
2907
2798
|
const issueCommentSlice = createSlice({
|
|
2908
2799
|
name: "issueComments",
|
|
2909
|
-
initialState: initialState$
|
|
2910
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2800
|
+
initialState: initialState$d,
|
|
2801
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
|
|
2911
2802
|
reducers: {
|
|
2912
2803
|
addIssueComment: issueCommentAdapter.addOne,
|
|
2913
2804
|
addIssueComments: issueCommentAdapter.addMany,
|
|
@@ -2936,11 +2827,11 @@ const selectCommentsOfIssue = restructureCreateSelectorWithArgs(
|
|
|
2936
2827
|
);
|
|
2937
2828
|
const issueCommentReducer = issueCommentSlice.reducer;
|
|
2938
2829
|
const issueUpdateAdapter = createModelAdapter((issueUpdate) => issueUpdate.offline_id);
|
|
2939
|
-
const initialState$
|
|
2830
|
+
const initialState$c = issueUpdateAdapter.getInitialState({});
|
|
2940
2831
|
const issueUpdateSlice = createSlice({
|
|
2941
2832
|
name: "issueUpdates",
|
|
2942
|
-
initialState: initialState$
|
|
2943
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2833
|
+
initialState: initialState$c,
|
|
2834
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
|
|
2944
2835
|
reducers: {
|
|
2945
2836
|
initializeIssueUpdates: issueUpdateAdapter.setMany,
|
|
2946
2837
|
setIssueUpdate: issueUpdateAdapter.setOne,
|
|
@@ -2969,11 +2860,11 @@ const selectIssueUpdatesOfIssue = restructureCreateSelectorWithArgs(
|
|
|
2969
2860
|
);
|
|
2970
2861
|
const issueUpdateReducer = issueUpdateSlice.reducer;
|
|
2971
2862
|
const issueAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
|
|
2972
|
-
const initialState$
|
|
2863
|
+
const initialState$b = issueAttachmentAdapter.getInitialState({});
|
|
2973
2864
|
const issueAttachmentSlice = createSlice({
|
|
2974
2865
|
name: "issueAttachments",
|
|
2975
|
-
initialState: initialState$
|
|
2976
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2866
|
+
initialState: initialState$b,
|
|
2867
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
|
|
2977
2868
|
reducers: {
|
|
2978
2869
|
initializeIssueAttachments: issueAttachmentAdapter.initialize,
|
|
2979
2870
|
addIssueAttachment: issueAttachmentAdapter.addOne,
|
|
@@ -3031,23 +2922,23 @@ const selectAttachmentsOfIssueByType = restructureCreateSelectorWithArgs(
|
|
|
3031
2922
|
)
|
|
3032
2923
|
);
|
|
3033
2924
|
const issueAttachmentReducer = issueAttachmentSlice.reducer;
|
|
3034
|
-
const initialState$
|
|
2925
|
+
const initialState$a = {
|
|
3035
2926
|
version: 0
|
|
3036
2927
|
};
|
|
3037
2928
|
const versioningSlice = createSlice({
|
|
3038
2929
|
name: "versioning",
|
|
3039
|
-
initialState: initialState$
|
|
2930
|
+
initialState: initialState$a,
|
|
3040
2931
|
reducers: {}
|
|
3041
2932
|
});
|
|
3042
2933
|
const versioningReducer = versioningSlice.reducer;
|
|
3043
2934
|
const geoImageAdapter = createModelAdapter((model) => model.offline_id);
|
|
3044
|
-
const initialState$
|
|
2935
|
+
const initialState$9 = geoImageAdapter.getInitialState({});
|
|
3045
2936
|
const geoImageSlice = createSlice({
|
|
3046
2937
|
name: "geoImages",
|
|
3047
|
-
initialState: initialState$
|
|
2938
|
+
initialState: initialState$9,
|
|
3048
2939
|
extraReducers: (builder) => {
|
|
3049
2940
|
builder.addCase("RESET", (state) => {
|
|
3050
|
-
Object.assign(state, initialState$
|
|
2941
|
+
Object.assign(state, initialState$9);
|
|
3051
2942
|
});
|
|
3052
2943
|
},
|
|
3053
2944
|
reducers: {
|
|
@@ -3085,11 +2976,11 @@ const selectGeoImagesOfProject = restructureCreateSelectorWithArgs(
|
|
|
3085
2976
|
);
|
|
3086
2977
|
const geoImageReducer = geoImageSlice.reducer;
|
|
3087
2978
|
const issueAssociationAdapter = createModelAdapter((assoc) => assoc.offline_id);
|
|
3088
|
-
const initialState = issueAssociationAdapter.getInitialState({});
|
|
2979
|
+
const initialState$8 = issueAssociationAdapter.getInitialState({});
|
|
3089
2980
|
const issueAssociationSlice = createSlice({
|
|
3090
2981
|
name: "issueAssociations",
|
|
3091
|
-
initialState,
|
|
3092
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
|
|
2982
|
+
initialState: initialState$8,
|
|
2983
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
3093
2984
|
reducers: {
|
|
3094
2985
|
initializeIssueAssociations: issueAssociationAdapter.initialize,
|
|
3095
2986
|
addIssueAssociation: issueAssociationAdapter.addOne,
|
|
@@ -3147,86 +3038,462 @@ const selectIssueAssociationsOfAsset = restructureCreateSelectorWithArgs(
|
|
|
3147
3038
|
)
|
|
3148
3039
|
);
|
|
3149
3040
|
const issueAssociationReducer = issueAssociationSlice.reducer;
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
constructor(sdk) {
|
|
3167
|
-
__publicField(this, "client");
|
|
3168
|
-
CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
|
|
3169
|
-
this.client = sdk;
|
|
3170
|
-
}
|
|
3171
|
-
async enqueueRequest(requestDetails) {
|
|
3172
|
-
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3173
|
-
}
|
|
3174
|
-
dispatch(action) {
|
|
3175
|
-
this.client.store.dispatch(action);
|
|
3041
|
+
const issueTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
|
|
3042
|
+
const initialState$7 = issueTypeFieldsAdapter.getInitialState({});
|
|
3043
|
+
const issueTypeFieldsSlice = createSlice({
|
|
3044
|
+
name: "issueTypeFields",
|
|
3045
|
+
initialState: initialState$7,
|
|
3046
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
3047
|
+
reducers: {
|
|
3048
|
+
initializeIssueTypeFields: issueTypeFieldsAdapter.initialize,
|
|
3049
|
+
addIssueTypeFields: issueTypeFieldsAdapter.addOne,
|
|
3050
|
+
addIssueTypeFieldsMany: issueTypeFieldsAdapter.addMany,
|
|
3051
|
+
setIssueTypeFields: issueTypeFieldsAdapter.setOne,
|
|
3052
|
+
setIssueTypeFieldsMany: issueTypeFieldsAdapter.setMany,
|
|
3053
|
+
updateIssueTypeFields: issueTypeFieldsAdapter.updateOne,
|
|
3054
|
+
updateIssueTypeFieldsMany: issueTypeFieldsAdapter.updateMany,
|
|
3055
|
+
deleteIssueTypeFields: issueTypeFieldsAdapter.deleteOne,
|
|
3056
|
+
deleteIssueTypeFieldsMany: issueTypeFieldsAdapter.deleteMany
|
|
3176
3057
|
}
|
|
3177
|
-
}
|
|
3178
|
-
const
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
projectFileReducer,
|
|
3201
|
-
rehydratedReducer,
|
|
3202
|
-
formReducer,
|
|
3203
|
-
formRevisionReducer,
|
|
3204
|
-
formRevisionAttachmentReducer,
|
|
3205
|
-
formSubmissionAttachmentReducer,
|
|
3206
|
-
formSubmissionReducer,
|
|
3207
|
-
userReducer,
|
|
3208
|
-
workspaceReducer,
|
|
3209
|
-
emailDomainsReducer,
|
|
3210
|
-
licenseReducer,
|
|
3211
|
-
documentsReducer,
|
|
3212
|
-
documentAttachmentReducer,
|
|
3213
|
-
teamReducer,
|
|
3214
|
-
agentsReducer,
|
|
3215
|
-
issueCommentReducer,
|
|
3216
|
-
issueUpdateReducer,
|
|
3217
|
-
geoImageReducer,
|
|
3218
|
-
issueAssociationReducer
|
|
3058
|
+
});
|
|
3059
|
+
const {
|
|
3060
|
+
initializeIssueTypeFields,
|
|
3061
|
+
addIssueTypeFields,
|
|
3062
|
+
addIssueTypeFieldsMany,
|
|
3063
|
+
setIssueTypeFields,
|
|
3064
|
+
setIssueTypeFieldsMany,
|
|
3065
|
+
updateIssueTypeFields,
|
|
3066
|
+
updateIssueTypeFieldsMany,
|
|
3067
|
+
deleteIssueTypeFields,
|
|
3068
|
+
deleteIssueTypeFieldsMany
|
|
3069
|
+
} = issueTypeFieldsSlice.actions;
|
|
3070
|
+
const selectIssueTypeFieldsMapping = (state) => state.issueTypeFieldsReducer.instances;
|
|
3071
|
+
const selectIssueTypeFields = createSelector([selectIssueTypeFieldsMapping], (fieldsMapping) => {
|
|
3072
|
+
return Object.values(fieldsMapping);
|
|
3073
|
+
});
|
|
3074
|
+
const selectIssueTypeFieldsOfIssueType = restructureCreateSelectorWithArgs(
|
|
3075
|
+
createSelector([selectIssueTypeFields, (_state, issueTypeId) => issueTypeId], (fields, issueTypeId) => {
|
|
3076
|
+
return fallbackToEmptyArray(fields.filter((field) => field.issue_type === issueTypeId));
|
|
3077
|
+
})
|
|
3078
|
+
);
|
|
3079
|
+
const selectIssueTypeFieldsById = (fieldsId) => (state) => {
|
|
3080
|
+
return state.issueTypeFieldsReducer.instances[fieldsId];
|
|
3219
3081
|
};
|
|
3220
|
-
const
|
|
3221
|
-
const
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3082
|
+
const issueTypeFieldsReducer = issueTypeFieldsSlice.reducer;
|
|
3083
|
+
const issueTypeFieldValuesAdapter = createModelAdapter(
|
|
3084
|
+
(fieldValues) => fieldValues.offline_id
|
|
3085
|
+
);
|
|
3086
|
+
const initialState$6 = issueTypeFieldValuesAdapter.getInitialState({});
|
|
3087
|
+
const issueTypeFieldValuesSlice = createSlice({
|
|
3088
|
+
name: "issueTypeFieldValues",
|
|
3089
|
+
initialState: initialState$6,
|
|
3090
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
3091
|
+
reducers: {
|
|
3092
|
+
initializeIssueTypeFieldValues: issueTypeFieldValuesAdapter.initialize,
|
|
3093
|
+
addIssueTypeFieldValues: issueTypeFieldValuesAdapter.addOne,
|
|
3094
|
+
addIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.addMany,
|
|
3095
|
+
setIssueTypeFieldValues: issueTypeFieldValuesAdapter.setOne,
|
|
3096
|
+
setIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.setMany,
|
|
3097
|
+
updateIssueTypeFieldValues: issueTypeFieldValuesAdapter.updateOne,
|
|
3098
|
+
updateIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.updateMany,
|
|
3099
|
+
deleteIssueTypeFieldValues: issueTypeFieldValuesAdapter.deleteOne,
|
|
3100
|
+
deleteIssueTypeFieldValuesMany: issueTypeFieldValuesAdapter.deleteMany
|
|
3225
3101
|
}
|
|
3226
|
-
|
|
3102
|
+
});
|
|
3103
|
+
const {
|
|
3104
|
+
initializeIssueTypeFieldValues,
|
|
3105
|
+
addIssueTypeFieldValues,
|
|
3106
|
+
addIssueTypeFieldValuesMany,
|
|
3107
|
+
setIssueTypeFieldValues,
|
|
3108
|
+
setIssueTypeFieldValuesMany,
|
|
3109
|
+
updateIssueTypeFieldValues,
|
|
3110
|
+
updateIssueTypeFieldValuesMany,
|
|
3111
|
+
deleteIssueTypeFieldValues,
|
|
3112
|
+
deleteIssueTypeFieldValuesMany
|
|
3113
|
+
} = issueTypeFieldValuesSlice.actions;
|
|
3114
|
+
const selectIssueTypeFieldValuesMapping = (state) => state.issueTypeFieldValuesReducer.instances;
|
|
3115
|
+
const selectIssueTypeFieldValues = createSelector([selectIssueTypeFieldValuesMapping], (fieldValuesMapping) => {
|
|
3116
|
+
return Object.values(fieldValuesMapping);
|
|
3117
|
+
});
|
|
3118
|
+
const selectIssueTypeFieldValuesOfIssue = restructureCreateSelectorWithArgs(
|
|
3119
|
+
createSelector([selectIssueTypeFieldValues, (_state, issueId) => issueId], (fieldValues, issueId) => {
|
|
3120
|
+
return fallbackToEmptyArray(fieldValues.filter((fieldValue) => fieldValue.issue === issueId));
|
|
3121
|
+
})
|
|
3122
|
+
);
|
|
3123
|
+
const selectIssueTypeFieldValuesById = (fieldValuesId) => (state) => {
|
|
3124
|
+
return state.issueTypeFieldValuesReducer.instances[fieldValuesId];
|
|
3227
3125
|
};
|
|
3228
|
-
|
|
3229
|
-
|
|
3126
|
+
const issueTypeFieldValuesReducer = issueTypeFieldValuesSlice.reducer;
|
|
3127
|
+
const issueTypeFieldsAttachmentAdapter = createModelAdapter(
|
|
3128
|
+
(attachment) => attachment.offline_id
|
|
3129
|
+
);
|
|
3130
|
+
const initialState$5 = issueTypeFieldsAttachmentAdapter.getInitialState({});
|
|
3131
|
+
const issueTypeFieldsAttachmentSlice = createSlice({
|
|
3132
|
+
name: "issueTypeFieldsAttachments",
|
|
3133
|
+
initialState: initialState$5,
|
|
3134
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
3135
|
+
reducers: {
|
|
3136
|
+
initializeIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.initialize,
|
|
3137
|
+
addIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.addOne,
|
|
3138
|
+
addIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.addMany,
|
|
3139
|
+
setIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.setOne,
|
|
3140
|
+
setIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.setMany,
|
|
3141
|
+
updateIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.updateOne,
|
|
3142
|
+
updateIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.updateMany,
|
|
3143
|
+
deleteIssueTypeFieldsAttachment: issueTypeFieldsAttachmentAdapter.deleteOne,
|
|
3144
|
+
deleteIssueTypeFieldsAttachments: issueTypeFieldsAttachmentAdapter.deleteMany
|
|
3145
|
+
}
|
|
3146
|
+
});
|
|
3147
|
+
const {
|
|
3148
|
+
initializeIssueTypeFieldsAttachments,
|
|
3149
|
+
addIssueTypeFieldsAttachment,
|
|
3150
|
+
addIssueTypeFieldsAttachments,
|
|
3151
|
+
setIssueTypeFieldsAttachment,
|
|
3152
|
+
setIssueTypeFieldsAttachments,
|
|
3153
|
+
updateIssueTypeFieldsAttachment,
|
|
3154
|
+
updateIssueTypeFieldsAttachments,
|
|
3155
|
+
deleteIssueTypeFieldsAttachment,
|
|
3156
|
+
deleteIssueTypeFieldsAttachments
|
|
3157
|
+
} = issueTypeFieldsAttachmentSlice.actions;
|
|
3158
|
+
const selectIssueTypeFieldsAttachmentsMapping = (state) => state.issueTypeFieldsAttachmentReducer.instances;
|
|
3159
|
+
const selectIssueTypeFieldsAttachments = createSelector(
|
|
3160
|
+
[selectIssueTypeFieldsAttachmentsMapping],
|
|
3161
|
+
(attachmentsMapping) => {
|
|
3162
|
+
return Object.values(attachmentsMapping);
|
|
3163
|
+
}
|
|
3164
|
+
);
|
|
3165
|
+
const selectAttachmentsOfIssueTypeFields = restructureCreateSelectorWithArgs(
|
|
3166
|
+
createSelector(
|
|
3167
|
+
[selectIssueTypeFieldsAttachments, (_state, fieldsRevision) => fieldsRevision],
|
|
3168
|
+
(attachments, fieldsRevision) => {
|
|
3169
|
+
return fallbackToEmptyArray(
|
|
3170
|
+
attachments.filter((attachment) => attachment.fields_revision === fieldsRevision)
|
|
3171
|
+
);
|
|
3172
|
+
}
|
|
3173
|
+
)
|
|
3174
|
+
);
|
|
3175
|
+
const selectIssueTypeFieldsAttachmentById = (attachmentId) => (state) => {
|
|
3176
|
+
return state.issueTypeFieldsAttachmentReducer.instances[attachmentId];
|
|
3177
|
+
};
|
|
3178
|
+
const issueTypeFieldsAttachmentReducer = issueTypeFieldsAttachmentSlice.reducer;
|
|
3179
|
+
const issueTypeFieldValuesAttachmentAdapter = createModelAdapter(
|
|
3180
|
+
(attachment) => attachment.offline_id
|
|
3181
|
+
);
|
|
3182
|
+
const initialState$4 = issueTypeFieldValuesAttachmentAdapter.getInitialState({});
|
|
3183
|
+
const issueTypeFieldValuesAttachmentSlice = createSlice({
|
|
3184
|
+
name: "issueTypeFieldValuesAttachments",
|
|
3185
|
+
initialState: initialState$4,
|
|
3186
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
|
|
3187
|
+
reducers: {
|
|
3188
|
+
initializeIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.initialize,
|
|
3189
|
+
addIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.addOne,
|
|
3190
|
+
addIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.addMany,
|
|
3191
|
+
setIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.setOne,
|
|
3192
|
+
setIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.setMany,
|
|
3193
|
+
updateIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.updateOne,
|
|
3194
|
+
updateIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.updateMany,
|
|
3195
|
+
deleteIssueTypeFieldValuesAttachment: issueTypeFieldValuesAttachmentAdapter.deleteOne,
|
|
3196
|
+
deleteIssueTypeFieldValuesAttachments: issueTypeFieldValuesAttachmentAdapter.deleteMany
|
|
3197
|
+
}
|
|
3198
|
+
});
|
|
3199
|
+
const {
|
|
3200
|
+
initializeIssueTypeFieldValuesAttachments,
|
|
3201
|
+
addIssueTypeFieldValuesAttachment,
|
|
3202
|
+
addIssueTypeFieldValuesAttachments,
|
|
3203
|
+
setIssueTypeFieldValuesAttachment,
|
|
3204
|
+
setIssueTypeFieldValuesAttachments,
|
|
3205
|
+
updateIssueTypeFieldValuesAttachment,
|
|
3206
|
+
updateIssueTypeFieldValuesAttachments,
|
|
3207
|
+
deleteIssueTypeFieldValuesAttachment,
|
|
3208
|
+
deleteIssueTypeFieldValuesAttachments
|
|
3209
|
+
} = issueTypeFieldValuesAttachmentSlice.actions;
|
|
3210
|
+
const selectIssueTypeFieldValuesAttachmentsMapping = (state) => state.issueTypeFieldValuesAttachmentReducer.instances;
|
|
3211
|
+
const selectIssueTypeFieldValuesAttachments = createSelector(
|
|
3212
|
+
[selectIssueTypeFieldValuesAttachmentsMapping],
|
|
3213
|
+
(attachmentsMapping) => {
|
|
3214
|
+
return Object.values(attachmentsMapping);
|
|
3215
|
+
}
|
|
3216
|
+
);
|
|
3217
|
+
const selectAttachmentsOfIssueTypeFieldValues = restructureCreateSelectorWithArgs(
|
|
3218
|
+
createSelector(
|
|
3219
|
+
[selectIssueTypeFieldValuesAttachments, (_state, fieldValuesId) => fieldValuesId],
|
|
3220
|
+
(attachments, fieldValuesId) => {
|
|
3221
|
+
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === fieldValuesId));
|
|
3222
|
+
}
|
|
3223
|
+
)
|
|
3224
|
+
);
|
|
3225
|
+
const selectIssueTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3226
|
+
return state.issueTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3227
|
+
};
|
|
3228
|
+
const issueTypeFieldValuesAttachmentReducer = issueTypeFieldValuesAttachmentSlice.reducer;
|
|
3229
|
+
const assetTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
|
|
3230
|
+
const initialState$3 = assetTypeFieldsAdapter.getInitialState({});
|
|
3231
|
+
const assetTypeFieldsSlice = createSlice({
|
|
3232
|
+
name: "assetTypeFields",
|
|
3233
|
+
initialState: initialState$3,
|
|
3234
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
|
|
3235
|
+
reducers: {
|
|
3236
|
+
initializeAssetTypeFields: assetTypeFieldsAdapter.initialize,
|
|
3237
|
+
addAssetTypeFields: assetTypeFieldsAdapter.addOne,
|
|
3238
|
+
addAssetTypeFieldsMany: assetTypeFieldsAdapter.addMany,
|
|
3239
|
+
setAssetTypeFields: assetTypeFieldsAdapter.setOne,
|
|
3240
|
+
setAssetTypeFieldsMany: assetTypeFieldsAdapter.setMany,
|
|
3241
|
+
updateAssetTypeFields: assetTypeFieldsAdapter.updateOne,
|
|
3242
|
+
updateAssetTypeFieldsMany: assetTypeFieldsAdapter.updateMany,
|
|
3243
|
+
deleteAssetTypeFields: assetTypeFieldsAdapter.deleteOne,
|
|
3244
|
+
deleteAssetTypeFieldsMany: assetTypeFieldsAdapter.deleteMany
|
|
3245
|
+
}
|
|
3246
|
+
});
|
|
3247
|
+
const {
|
|
3248
|
+
initializeAssetTypeFields,
|
|
3249
|
+
addAssetTypeFields,
|
|
3250
|
+
addAssetTypeFieldsMany,
|
|
3251
|
+
setAssetTypeFields,
|
|
3252
|
+
setAssetTypeFieldsMany,
|
|
3253
|
+
updateAssetTypeFields,
|
|
3254
|
+
updateAssetTypeFieldsMany,
|
|
3255
|
+
deleteAssetTypeFields,
|
|
3256
|
+
deleteAssetTypeFieldsMany
|
|
3257
|
+
} = assetTypeFieldsSlice.actions;
|
|
3258
|
+
const selectAssetTypeFieldsMapping = (state) => state.assetTypeFieldsReducer.instances;
|
|
3259
|
+
const selectAssetTypeFields = createSelector([selectAssetTypeFieldsMapping], (fieldsMapping) => {
|
|
3260
|
+
return Object.values(fieldsMapping);
|
|
3261
|
+
});
|
|
3262
|
+
const selectAssetTypeFieldsOfAssetType = restructureCreateSelectorWithArgs(
|
|
3263
|
+
createSelector([selectAssetTypeFields, (_state, assetTypeId) => assetTypeId], (fields, assetTypeId) => {
|
|
3264
|
+
return fallbackToEmptyArray(fields.filter((field) => field.asset_type === assetTypeId));
|
|
3265
|
+
})
|
|
3266
|
+
);
|
|
3267
|
+
const selectAssetTypeFieldsById = (fieldsId) => (state) => {
|
|
3268
|
+
return state.assetTypeFieldsReducer.instances[fieldsId];
|
|
3269
|
+
};
|
|
3270
|
+
const assetTypeFieldsReducer = assetTypeFieldsSlice.reducer;
|
|
3271
|
+
const assetTypeFieldValuesAdapter = createModelAdapter(
|
|
3272
|
+
(fieldValues) => fieldValues.offline_id
|
|
3273
|
+
);
|
|
3274
|
+
const initialState$2 = assetTypeFieldValuesAdapter.getInitialState({});
|
|
3275
|
+
const assetTypeFieldValuesSlice = createSlice({
|
|
3276
|
+
name: "assetTypeFieldValues",
|
|
3277
|
+
initialState: initialState$2,
|
|
3278
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
|
|
3279
|
+
reducers: {
|
|
3280
|
+
initializeAssetTypeFieldValues: assetTypeFieldValuesAdapter.initialize,
|
|
3281
|
+
addAssetTypeFieldValues: assetTypeFieldValuesAdapter.addOne,
|
|
3282
|
+
addAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.addMany,
|
|
3283
|
+
setAssetTypeFieldValues: assetTypeFieldValuesAdapter.setOne,
|
|
3284
|
+
setAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.setMany,
|
|
3285
|
+
updateAssetTypeFieldValues: assetTypeFieldValuesAdapter.updateOne,
|
|
3286
|
+
updateAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.updateMany,
|
|
3287
|
+
deleteAssetTypeFieldValues: assetTypeFieldValuesAdapter.deleteOne,
|
|
3288
|
+
deleteAssetTypeFieldValuesMany: assetTypeFieldValuesAdapter.deleteMany
|
|
3289
|
+
}
|
|
3290
|
+
});
|
|
3291
|
+
const {
|
|
3292
|
+
initializeAssetTypeFieldValues,
|
|
3293
|
+
addAssetTypeFieldValues,
|
|
3294
|
+
addAssetTypeFieldValuesMany,
|
|
3295
|
+
setAssetTypeFieldValues,
|
|
3296
|
+
setAssetTypeFieldValuesMany,
|
|
3297
|
+
updateAssetTypeFieldValues,
|
|
3298
|
+
updateAssetTypeFieldValuesMany,
|
|
3299
|
+
deleteAssetTypeFieldValues,
|
|
3300
|
+
deleteAssetTypeFieldValuesMany
|
|
3301
|
+
} = assetTypeFieldValuesSlice.actions;
|
|
3302
|
+
const selectAssetTypeFieldValuesMapping = (state) => state.assetTypeFieldValuesReducer.instances;
|
|
3303
|
+
const selectAssetTypeFieldValues = createSelector([selectAssetTypeFieldValuesMapping], (fieldValuesMapping) => {
|
|
3304
|
+
return Object.values(fieldValuesMapping);
|
|
3305
|
+
});
|
|
3306
|
+
const selectAssetTypeFieldValuesOfAsset = restructureCreateSelectorWithArgs(
|
|
3307
|
+
createSelector([selectAssetTypeFieldValues, (_state, assetId) => assetId], (fieldValues, assetId) => {
|
|
3308
|
+
return fallbackToEmptyArray(fieldValues.filter((fieldValue) => fieldValue.asset === assetId));
|
|
3309
|
+
})
|
|
3310
|
+
);
|
|
3311
|
+
const selectAssetTypeFieldValuesById = (fieldValuesId) => (state) => {
|
|
3312
|
+
return state.assetTypeFieldValuesReducer.instances[fieldValuesId];
|
|
3313
|
+
};
|
|
3314
|
+
const assetTypeFieldValuesReducer = assetTypeFieldValuesSlice.reducer;
|
|
3315
|
+
const assetTypeFieldsAttachmentAdapter = createModelAdapter(
|
|
3316
|
+
(attachment) => attachment.offline_id
|
|
3317
|
+
);
|
|
3318
|
+
const initialState$1 = assetTypeFieldsAttachmentAdapter.getInitialState({});
|
|
3319
|
+
const assetTypeFieldsAttachmentSlice = createSlice({
|
|
3320
|
+
name: "assetTypeFieldsAttachments",
|
|
3321
|
+
initialState: initialState$1,
|
|
3322
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
|
|
3323
|
+
reducers: {
|
|
3324
|
+
initializeAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.initialize,
|
|
3325
|
+
addAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.addOne,
|
|
3326
|
+
addAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.addMany,
|
|
3327
|
+
setAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.setOne,
|
|
3328
|
+
setAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.setMany,
|
|
3329
|
+
updateAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.updateOne,
|
|
3330
|
+
updateAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.updateMany,
|
|
3331
|
+
deleteAssetTypeFieldsAttachment: assetTypeFieldsAttachmentAdapter.deleteOne,
|
|
3332
|
+
deleteAssetTypeFieldsAttachments: assetTypeFieldsAttachmentAdapter.deleteMany
|
|
3333
|
+
}
|
|
3334
|
+
});
|
|
3335
|
+
const {
|
|
3336
|
+
initializeAssetTypeFieldsAttachments,
|
|
3337
|
+
addAssetTypeFieldsAttachment,
|
|
3338
|
+
addAssetTypeFieldsAttachments,
|
|
3339
|
+
setAssetTypeFieldsAttachment,
|
|
3340
|
+
setAssetTypeFieldsAttachments,
|
|
3341
|
+
updateAssetTypeFieldsAttachment,
|
|
3342
|
+
updateAssetTypeFieldsAttachments,
|
|
3343
|
+
deleteAssetTypeFieldsAttachment,
|
|
3344
|
+
deleteAssetTypeFieldsAttachments
|
|
3345
|
+
} = assetTypeFieldsAttachmentSlice.actions;
|
|
3346
|
+
const selectAssetTypeFieldsAttachmentsMapping = (state) => state.assetTypeFieldsAttachmentReducer.instances;
|
|
3347
|
+
const selectAssetTypeFieldsAttachments = createSelector(
|
|
3348
|
+
[selectAssetTypeFieldsAttachmentsMapping],
|
|
3349
|
+
(attachmentsMapping) => {
|
|
3350
|
+
return Object.values(attachmentsMapping);
|
|
3351
|
+
}
|
|
3352
|
+
);
|
|
3353
|
+
const selectAttachmentsOfAssetTypeFields = restructureCreateSelectorWithArgs(
|
|
3354
|
+
createSelector([selectAssetTypeFieldsAttachments, (_state, id) => id], (attachments, id) => {
|
|
3355
|
+
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.fields_revision === id));
|
|
3356
|
+
})
|
|
3357
|
+
);
|
|
3358
|
+
const selectAssetTypeFieldsAttachmentById = (attachmentId) => (state) => {
|
|
3359
|
+
return state.assetTypeFieldsAttachmentReducer.instances[attachmentId];
|
|
3360
|
+
};
|
|
3361
|
+
const assetTypeFieldsAttachmentReducer = assetTypeFieldsAttachmentSlice.reducer;
|
|
3362
|
+
const assetTypeFieldValuesAttachmentAdapter = createModelAdapter(
|
|
3363
|
+
(attachment) => attachment.offline_id
|
|
3364
|
+
);
|
|
3365
|
+
const initialState = assetTypeFieldValuesAttachmentAdapter.getInitialState({});
|
|
3366
|
+
const assetTypeFieldValuesAttachmentSlice = createSlice({
|
|
3367
|
+
name: "assetTypeFieldValuesAttachments",
|
|
3368
|
+
initialState,
|
|
3369
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
|
|
3370
|
+
reducers: {
|
|
3371
|
+
initializeAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.initialize,
|
|
3372
|
+
addAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.addOne,
|
|
3373
|
+
addAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.addMany,
|
|
3374
|
+
setAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.setOne,
|
|
3375
|
+
setAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.setMany,
|
|
3376
|
+
updateAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.updateOne,
|
|
3377
|
+
updateAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.updateMany,
|
|
3378
|
+
deleteAssetTypeFieldValuesAttachment: assetTypeFieldValuesAttachmentAdapter.deleteOne,
|
|
3379
|
+
deleteAssetTypeFieldValuesAttachments: assetTypeFieldValuesAttachmentAdapter.deleteMany
|
|
3380
|
+
}
|
|
3381
|
+
});
|
|
3382
|
+
const {
|
|
3383
|
+
initializeAssetTypeFieldValuesAttachments,
|
|
3384
|
+
addAssetTypeFieldValuesAttachment,
|
|
3385
|
+
addAssetTypeFieldValuesAttachments,
|
|
3386
|
+
setAssetTypeFieldValuesAttachment,
|
|
3387
|
+
setAssetTypeFieldValuesAttachments,
|
|
3388
|
+
updateAssetTypeFieldValuesAttachment,
|
|
3389
|
+
updateAssetTypeFieldValuesAttachments,
|
|
3390
|
+
deleteAssetTypeFieldValuesAttachment,
|
|
3391
|
+
deleteAssetTypeFieldValuesAttachments
|
|
3392
|
+
} = assetTypeFieldValuesAttachmentSlice.actions;
|
|
3393
|
+
const selectAssetTypeFieldValuesAttachmentsMapping = (state) => state.assetTypeFieldValuesAttachmentReducer.instances;
|
|
3394
|
+
const selectAssetTypeFieldValuesAttachments = createSelector(
|
|
3395
|
+
[selectAssetTypeFieldValuesAttachmentsMapping],
|
|
3396
|
+
(attachmentsMapping) => {
|
|
3397
|
+
return Object.values(attachmentsMapping);
|
|
3398
|
+
}
|
|
3399
|
+
);
|
|
3400
|
+
const selectAttachmentsOfAssetTypeFieldValues = restructureCreateSelectorWithArgs(
|
|
3401
|
+
createSelector([selectAssetTypeFieldValuesAttachments, (_state, id) => id], (attachments, id) => {
|
|
3402
|
+
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === id));
|
|
3403
|
+
})
|
|
3404
|
+
);
|
|
3405
|
+
const selectAssetTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3406
|
+
return state.assetTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3407
|
+
};
|
|
3408
|
+
const assetTypeFieldValuesAttachmentReducer = assetTypeFieldValuesAttachmentSlice.reducer;
|
|
3409
|
+
let clientStore;
|
|
3410
|
+
function setClientStore(store) {
|
|
3411
|
+
clientStore = store;
|
|
3412
|
+
}
|
|
3413
|
+
function getClientStore() {
|
|
3414
|
+
return clientStore;
|
|
3415
|
+
}
|
|
3416
|
+
let clientSDK;
|
|
3417
|
+
function setClientSDK(sdkCtor) {
|
|
3418
|
+
clientSDK = sdkCtor;
|
|
3419
|
+
}
|
|
3420
|
+
function getClientSDK() {
|
|
3421
|
+
return clientSDK;
|
|
3422
|
+
}
|
|
3423
|
+
const CLASS_NAME_TO_SERVICE = {};
|
|
3424
|
+
class BaseService {
|
|
3425
|
+
constructor(sdk) {
|
|
3426
|
+
__publicField(this, "client");
|
|
3427
|
+
CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
|
|
3428
|
+
this.client = sdk;
|
|
3429
|
+
}
|
|
3430
|
+
async enqueueRequest(requestDetails) {
|
|
3431
|
+
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
3432
|
+
}
|
|
3433
|
+
dispatch(action) {
|
|
3434
|
+
this.client.store.dispatch(action);
|
|
3435
|
+
}
|
|
3436
|
+
}
|
|
3437
|
+
const VERSION_REDUCER_KEY = "versioning";
|
|
3438
|
+
const overmapReducers = {
|
|
3439
|
+
// TODO: attachmentReducer,
|
|
3440
|
+
[VERSION_REDUCER_KEY]: versioningReducer,
|
|
3441
|
+
fileReducer,
|
|
3442
|
+
authReducer,
|
|
3443
|
+
categoryReducer,
|
|
3444
|
+
assetReducer,
|
|
3445
|
+
assetAttachmentReducer,
|
|
3446
|
+
assetStageCompletionReducer,
|
|
3447
|
+
assetStageReducer,
|
|
3448
|
+
assetTypeReducer,
|
|
3449
|
+
assetTypeAttachmentReducer,
|
|
3450
|
+
issueReducer,
|
|
3451
|
+
issueAttachmentReducer,
|
|
3452
|
+
issueTypeReducer,
|
|
3453
|
+
organizationReducer,
|
|
3454
|
+
outboxReducer,
|
|
3455
|
+
projectReducer,
|
|
3456
|
+
projectAttachmentReducer,
|
|
3457
|
+
projectAccessReducer,
|
|
3458
|
+
organizationAccessReducer,
|
|
3459
|
+
projectFileReducer,
|
|
3460
|
+
rehydratedReducer,
|
|
3461
|
+
formReducer,
|
|
3462
|
+
formRevisionReducer,
|
|
3463
|
+
formRevisionAttachmentReducer,
|
|
3464
|
+
formSubmissionAttachmentReducer,
|
|
3465
|
+
formSubmissionReducer,
|
|
3466
|
+
userReducer,
|
|
3467
|
+
workspaceReducer,
|
|
3468
|
+
emailDomainsReducer,
|
|
3469
|
+
licenseReducer,
|
|
3470
|
+
documentsReducer,
|
|
3471
|
+
documentAttachmentReducer,
|
|
3472
|
+
teamReducer,
|
|
3473
|
+
agentsReducer,
|
|
3474
|
+
issueCommentReducer,
|
|
3475
|
+
issueUpdateReducer,
|
|
3476
|
+
geoImageReducer,
|
|
3477
|
+
issueAssociationReducer,
|
|
3478
|
+
issueTypeFieldsReducer,
|
|
3479
|
+
issueTypeFieldValuesReducer,
|
|
3480
|
+
issueTypeFieldsAttachmentReducer,
|
|
3481
|
+
issueTypeFieldValuesAttachmentReducer,
|
|
3482
|
+
assetTypeFieldsReducer,
|
|
3483
|
+
assetTypeFieldValuesReducer,
|
|
3484
|
+
assetTypeFieldsAttachmentReducer,
|
|
3485
|
+
assetTypeFieldValuesAttachmentReducer
|
|
3486
|
+
};
|
|
3487
|
+
const overmapReducer = combineReducers(overmapReducers);
|
|
3488
|
+
const resetStore = "RESET";
|
|
3489
|
+
const overmapRootReducer = (state, action) => {
|
|
3490
|
+
if (action.type === "auth/setLoggedIn" && !action.payload) {
|
|
3491
|
+
return overmapReducer(void 0, action);
|
|
3492
|
+
}
|
|
3493
|
+
return overmapReducer(state, action);
|
|
3494
|
+
};
|
|
3495
|
+
let __OUTBOX_COORDINATOR = null;
|
|
3496
|
+
function getOutboxCoordinator() {
|
|
3230
3497
|
const clientStore2 = getClientStore();
|
|
3231
3498
|
if (!clientStore2) {
|
|
3232
3499
|
console.warn("Client store not set; cannot get outbox coordinator yet.");
|
|
@@ -3857,9 +4124,6 @@ class CategoryService extends BaseApiService {
|
|
|
3857
4124
|
description: "Create Category",
|
|
3858
4125
|
method: HttpMethod.POST,
|
|
3859
4126
|
url: "/categories/",
|
|
3860
|
-
queryParams: {
|
|
3861
|
-
workspace_id: payload.workspace.toString()
|
|
3862
|
-
},
|
|
3863
4127
|
payload: offlineCategory,
|
|
3864
4128
|
blockers: [payload.workspace],
|
|
3865
4129
|
blocks: [offlineCategory.offline_id]
|
|
@@ -4072,7 +4336,10 @@ class AssetService extends BaseApiService {
|
|
|
4072
4336
|
const result = await this.enqueueRequest({
|
|
4073
4337
|
description: "Get assets",
|
|
4074
4338
|
method: HttpMethod.GET,
|
|
4075
|
-
url:
|
|
4339
|
+
url: "/assets/",
|
|
4340
|
+
queryParams: {
|
|
4341
|
+
project: projectId.toString()
|
|
4342
|
+
},
|
|
4076
4343
|
blockers: [],
|
|
4077
4344
|
blocks: []
|
|
4078
4345
|
});
|
|
@@ -4093,7 +4360,7 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4093
4360
|
const promise = this.enqueueRequest({
|
|
4094
4361
|
description: "Add asset stage completion",
|
|
4095
4362
|
method: HttpMethod.POST,
|
|
4096
|
-
url: "/
|
|
4363
|
+
url: "/asset-stage-completions/",
|
|
4097
4364
|
payload: {
|
|
4098
4365
|
offline_id: offlineStageCompletion.offline_id,
|
|
4099
4366
|
submitted_at: submittedAt,
|
|
@@ -4120,7 +4387,7 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4120
4387
|
const promise = this.enqueueRequest({
|
|
4121
4388
|
description: "Delete asset stage completion",
|
|
4122
4389
|
method: HttpMethod.DELETE,
|
|
4123
|
-
url: `/
|
|
4390
|
+
url: `/asset-stage-completions/${id}/`,
|
|
4124
4391
|
blockers: [id],
|
|
4125
4392
|
blocks: []
|
|
4126
4393
|
});
|
|
@@ -4146,7 +4413,7 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4146
4413
|
const promise = this.enqueueRequest({
|
|
4147
4414
|
description: "Bulk create asset stage completions",
|
|
4148
4415
|
method: HttpMethod.POST,
|
|
4149
|
-
url: "/
|
|
4416
|
+
url: "/asset-stage-completions/bulk/",
|
|
4150
4417
|
payload: {
|
|
4151
4418
|
submitted_at: submittedAt,
|
|
4152
4419
|
completions: payload
|
|
@@ -4168,7 +4435,7 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4168
4435
|
const promise = this.enqueueRequest({
|
|
4169
4436
|
description: "Deleting asset stage completions",
|
|
4170
4437
|
method: HttpMethod.DELETE,
|
|
4171
|
-
url: "/
|
|
4438
|
+
url: "/asset-stage-completions/bulk/",
|
|
4172
4439
|
payload: {
|
|
4173
4440
|
completion_ids: ids
|
|
4174
4441
|
},
|
|
@@ -4184,7 +4451,10 @@ class AssetStageCompletionService extends BaseApiService {
|
|
|
4184
4451
|
const result = await this.enqueueRequest({
|
|
4185
4452
|
description: "Get asset stage completions",
|
|
4186
4453
|
method: HttpMethod.GET,
|
|
4187
|
-
url:
|
|
4454
|
+
url: "/asset-stage-completions/",
|
|
4455
|
+
queryParams: {
|
|
4456
|
+
project: projectId.toString()
|
|
4457
|
+
},
|
|
4188
4458
|
blockers: [],
|
|
4189
4459
|
blocks: []
|
|
4190
4460
|
});
|
|
@@ -4205,7 +4475,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4205
4475
|
const promise = this.enqueueRequest({
|
|
4206
4476
|
description: "Add asset stages",
|
|
4207
4477
|
method: HttpMethod.POST,
|
|
4208
|
-
url: "/
|
|
4478
|
+
url: "/asset-stages/bulk/",
|
|
4209
4479
|
payload: {
|
|
4210
4480
|
submitted_at: submittedAt,
|
|
4211
4481
|
asset_type: assetTypeId,
|
|
@@ -4229,7 +4499,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4229
4499
|
return this.enqueueRequest({
|
|
4230
4500
|
description: "Edit asset stages",
|
|
4231
4501
|
method: HttpMethod.PATCH,
|
|
4232
|
-
url: `/
|
|
4502
|
+
url: `/asset-types/${assetTypeId}/bulk-update-stages/`,
|
|
4233
4503
|
payload: {
|
|
4234
4504
|
stages: stagesToUpdate
|
|
4235
4505
|
},
|
|
@@ -4247,7 +4517,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4247
4517
|
const promise = this.enqueueRequest({
|
|
4248
4518
|
description: "Delete asset stages",
|
|
4249
4519
|
method: HttpMethod.DELETE,
|
|
4250
|
-
url: "/
|
|
4520
|
+
url: "/asset-stages/bulk/",
|
|
4251
4521
|
payload: {
|
|
4252
4522
|
stage_ids: idsToDelete
|
|
4253
4523
|
},
|
|
@@ -4272,7 +4542,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4272
4542
|
const promise = this.enqueueRequest({
|
|
4273
4543
|
description: "Update asset stage",
|
|
4274
4544
|
method: HttpMethod.PATCH,
|
|
4275
|
-
url: `/
|
|
4545
|
+
url: `/asset-stages/${assetStage.offline_id}/`,
|
|
4276
4546
|
payload: {
|
|
4277
4547
|
name: payload.name,
|
|
4278
4548
|
description: payload.description,
|
|
@@ -4300,7 +4570,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4300
4570
|
await this.enqueueRequest({
|
|
4301
4571
|
description: "Link asset stage to form",
|
|
4302
4572
|
method: HttpMethod.POST,
|
|
4303
|
-
url: `/
|
|
4573
|
+
url: `/asset-stages/${stageId}/associate-with-form/`,
|
|
4304
4574
|
payload: { form: formId },
|
|
4305
4575
|
blockers: [stageId, formId],
|
|
4306
4576
|
blocks: [stageId]
|
|
@@ -4321,7 +4591,7 @@ class AssetStageService extends BaseApiService {
|
|
|
4321
4591
|
await this.enqueueRequest({
|
|
4322
4592
|
description: "Unlink asset stage from form",
|
|
4323
4593
|
method: HttpMethod.DELETE,
|
|
4324
|
-
url: `/
|
|
4594
|
+
url: `/asset-stages/${stageId}/associate-with-form/`,
|
|
4325
4595
|
blockers: [stageId, formId],
|
|
4326
4596
|
blocks: [stageId]
|
|
4327
4597
|
});
|
|
@@ -4334,7 +4604,10 @@ class AssetStageService extends BaseApiService {
|
|
|
4334
4604
|
const result = await this.enqueueRequest({
|
|
4335
4605
|
description: "Get asset stages",
|
|
4336
4606
|
method: HttpMethod.GET,
|
|
4337
|
-
url:
|
|
4607
|
+
url: "/asset-stages/",
|
|
4608
|
+
queryParams: {
|
|
4609
|
+
project: projectId.toString()
|
|
4610
|
+
},
|
|
4338
4611
|
blockers: [],
|
|
4339
4612
|
blocks: []
|
|
4340
4613
|
});
|
|
@@ -4351,7 +4624,12 @@ class BaseUploadService extends BaseApiService {
|
|
|
4351
4624
|
projectAttachmentReducer: projectAttachmentReducer2,
|
|
4352
4625
|
formRevisionAttachmentReducer: formRevisionAttachmentReducer2,
|
|
4353
4626
|
formSubmissionAttachmentReducer: formSubmissionAttachmentReducer2,
|
|
4354
|
-
geoImageReducer: geoImageReducer2
|
|
4627
|
+
geoImageReducer: geoImageReducer2,
|
|
4628
|
+
// fields
|
|
4629
|
+
assetTypeFieldsAttachmentReducer: assetTypeFieldsAttachmentReducer2,
|
|
4630
|
+
assetTypeFieldValuesAttachmentReducer: assetTypeFieldValuesAttachmentReducer2,
|
|
4631
|
+
issueTypeFieldsAttachmentReducer: issueTypeFieldsAttachmentReducer2,
|
|
4632
|
+
issueTypeFieldValuesAttachmentReducer: issueTypeFieldValuesAttachmentReducer2
|
|
4355
4633
|
} = this.client.store.getState();
|
|
4356
4634
|
const objectsWithSha1 = [].concat(
|
|
4357
4635
|
Object.values(issueAttachmentReducer2.instances),
|
|
@@ -4361,7 +4639,11 @@ class BaseUploadService extends BaseApiService {
|
|
|
4361
4639
|
Object.values(projectAttachmentReducer2.instances),
|
|
4362
4640
|
Object.values(formRevisionAttachmentReducer2.instances),
|
|
4363
4641
|
Object.values(formSubmissionAttachmentReducer2.instances),
|
|
4364
|
-
Object.values(geoImageReducer2.instances)
|
|
4642
|
+
Object.values(geoImageReducer2.instances),
|
|
4643
|
+
Object.values(assetTypeFieldsAttachmentReducer2.instances),
|
|
4644
|
+
Object.values(assetTypeFieldValuesAttachmentReducer2.instances),
|
|
4645
|
+
Object.values(issueTypeFieldsAttachmentReducer2.instances),
|
|
4646
|
+
Object.values(issueTypeFieldValuesAttachmentReducer2.instances)
|
|
4365
4647
|
);
|
|
4366
4648
|
return objectsWithSha1.filter((object) => object.file_sha1 === sha1).length;
|
|
4367
4649
|
}
|
|
@@ -4383,41 +4665,20 @@ class BaseUploadService extends BaseApiService {
|
|
|
4383
4665
|
}
|
|
4384
4666
|
return promisesBySha1;
|
|
4385
4667
|
}
|
|
4386
|
-
|
|
4387
|
-
const
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
attachUrlPrefix: "/assets",
|
|
4397
|
-
deleteUrlPrefix: "/assets",
|
|
4398
|
-
fetchUrlPostfix: "/asset-attachments"
|
|
4399
|
-
},
|
|
4400
|
-
[AttachmentModel.AssetType]: {
|
|
4401
|
-
name: "asset type",
|
|
4402
|
-
attachUrlPrefix: "/assets/types",
|
|
4403
|
-
deleteUrlPrefix: "/assets/types",
|
|
4404
|
-
fetchUrlPostfix: "/asset-type-attachments"
|
|
4405
|
-
},
|
|
4406
|
-
[AttachmentModel.Project]: {
|
|
4407
|
-
name: "project",
|
|
4408
|
-
attachUrlPrefix: "/projects",
|
|
4409
|
-
deleteUrlPrefix: "/projects",
|
|
4410
|
-
fetchUrlPostfix: "/attachments"
|
|
4411
|
-
},
|
|
4412
|
-
[AttachmentModel.Document]: {
|
|
4413
|
-
name: "document",
|
|
4414
|
-
attachUrlPrefix: "/documents",
|
|
4415
|
-
deleteUrlPrefix: "/documents",
|
|
4416
|
-
fetchUrlPostfix: "/document-attachments"
|
|
4668
|
+
async getFilePayload(file) {
|
|
4669
|
+
const sha1 = await hashFile(file);
|
|
4670
|
+
const filePayload = {
|
|
4671
|
+
sha1,
|
|
4672
|
+
file_type: file.type,
|
|
4673
|
+
extension: file.name.split(".").pop(),
|
|
4674
|
+
size: file.size
|
|
4675
|
+
};
|
|
4676
|
+
await this.client.files.addCache(file, sha1);
|
|
4677
|
+
return filePayload;
|
|
4417
4678
|
}
|
|
4418
|
-
}
|
|
4679
|
+
}
|
|
4419
4680
|
class BaseAttachmentService extends BaseUploadService {
|
|
4420
|
-
async
|
|
4681
|
+
async _bulkAdd(payloads) {
|
|
4421
4682
|
var _a2;
|
|
4422
4683
|
const { store } = this.client;
|
|
4423
4684
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
@@ -4425,39 +4686,36 @@ class BaseAttachmentService extends BaseUploadService {
|
|
|
4425
4686
|
const offlineAttachments = [];
|
|
4426
4687
|
const attachmentPayloads = [];
|
|
4427
4688
|
const filePayloads = {};
|
|
4428
|
-
for (const
|
|
4429
|
-
const
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
extension: file.name.split(".").pop(),
|
|
4435
|
-
size: file.size
|
|
4436
|
-
};
|
|
4437
|
-
await this.client.files.addCache(file, sha1);
|
|
4438
|
-
}
|
|
4439
|
-
const offlineAttachment = buildOfflineAttachment({
|
|
4689
|
+
for (const payload of payloads) {
|
|
4690
|
+
const { modelId, file } = payload;
|
|
4691
|
+
const filePayload = await this.getFilePayload(file);
|
|
4692
|
+
if (!(filePayload.sha1 in filePayloads))
|
|
4693
|
+
filePayloads[filePayload.sha1] = filePayload;
|
|
4694
|
+
const offlineAttachment = this.buildOfflineAttachment({
|
|
4440
4695
|
file,
|
|
4441
|
-
sha1,
|
|
4442
|
-
submittedAt,
|
|
4443
|
-
createdBy,
|
|
4696
|
+
file_sha1: filePayload.sha1,
|
|
4697
|
+
submitted_at: submittedAt,
|
|
4698
|
+
created_by: createdBy,
|
|
4444
4699
|
description: "",
|
|
4445
4700
|
modelId
|
|
4446
4701
|
});
|
|
4447
4702
|
offlineAttachments.push(offlineAttachment);
|
|
4448
|
-
attachmentPayloads.push(
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4703
|
+
attachmentPayloads.push(
|
|
4704
|
+
this.buildAttachmentPayload({
|
|
4705
|
+
offline_id: offlineAttachment.offline_id,
|
|
4706
|
+
file_name: offlineAttachment.file_name,
|
|
4707
|
+
file_sha1: offlineAttachment.file_sha1,
|
|
4708
|
+
file_extension: filePayload.extension,
|
|
4709
|
+
description: offlineAttachment.description,
|
|
4710
|
+
modelId
|
|
4711
|
+
})
|
|
4712
|
+
);
|
|
4454
4713
|
}
|
|
4455
4714
|
this.dispatch(this.addAttachments(offlineAttachments));
|
|
4456
|
-
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4457
4715
|
const promise = this.enqueueRequest({
|
|
4458
|
-
description: `
|
|
4716
|
+
description: `Add ${this.name}`,
|
|
4459
4717
|
method: HttpMethod.POST,
|
|
4460
|
-
url: `${
|
|
4718
|
+
url: `${this.url}/bulk/`,
|
|
4461
4719
|
payload: {
|
|
4462
4720
|
submitted_at: submittedAt,
|
|
4463
4721
|
attachments: attachmentPayloads,
|
|
@@ -4474,7 +4732,7 @@ class BaseAttachmentService extends BaseUploadService {
|
|
|
4474
4732
|
});
|
|
4475
4733
|
return [offlineAttachments, promise.then(({ attachments }) => attachments)];
|
|
4476
4734
|
}
|
|
4477
|
-
async
|
|
4735
|
+
async _delete(attachmendId) {
|
|
4478
4736
|
const { store } = this.client;
|
|
4479
4737
|
const attachment = this.selectAttachment(attachmendId)(store.getState());
|
|
4480
4738
|
if (!attachment) {
|
|
@@ -4483,11 +4741,10 @@ class BaseAttachmentService extends BaseUploadService {
|
|
|
4483
4741
|
);
|
|
4484
4742
|
}
|
|
4485
4743
|
this.dispatch(this.removeAttachment(attachment.offline_id));
|
|
4486
|
-
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4487
4744
|
const promise = this.enqueueRequest({
|
|
4488
|
-
description:
|
|
4745
|
+
description: `Delete ${this.name}`,
|
|
4489
4746
|
method: HttpMethod.DELETE,
|
|
4490
|
-
url: `${
|
|
4747
|
+
url: `${this.url}/${attachmendId}/`,
|
|
4491
4748
|
blockers: [attachmendId],
|
|
4492
4749
|
blocks: []
|
|
4493
4750
|
});
|
|
@@ -4500,24 +4757,12 @@ class BaseAttachmentService extends BaseUploadService {
|
|
|
4500
4757
|
});
|
|
4501
4758
|
return promise;
|
|
4502
4759
|
}
|
|
4503
|
-
// Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
|
|
4504
|
-
// so for some attachment model services, this method will have to be overridden.
|
|
4505
|
-
async refreshStore(projectId, _organizationId) {
|
|
4506
|
-
const meta = AttachmentModelMeta[this.attachmentModel];
|
|
4507
|
-
const result = await this.enqueueRequest({
|
|
4508
|
-
description: `Get ${meta.name} attachments`,
|
|
4509
|
-
method: HttpMethod.GET,
|
|
4510
|
-
url: `/projects/${projectId}${meta.fetchUrlPostfix}/`,
|
|
4511
|
-
blocks: [],
|
|
4512
|
-
blockers: []
|
|
4513
|
-
});
|
|
4514
|
-
this.dispatch(this.initializeAttachments(result));
|
|
4515
|
-
}
|
|
4516
4760
|
}
|
|
4517
4761
|
class AssetAttachmentService extends BaseAttachmentService {
|
|
4518
4762
|
constructor() {
|
|
4519
4763
|
super(...arguments);
|
|
4520
|
-
__publicField(this, "
|
|
4764
|
+
__publicField(this, "name", "Asset Attachment");
|
|
4765
|
+
__publicField(this, "url", "/asset-attachments");
|
|
4521
4766
|
__publicField(this, "initializeAttachments", initializeAssetAttachments);
|
|
4522
4767
|
__publicField(this, "addAttachments", addAssetAttachments);
|
|
4523
4768
|
__publicField(this, "updateAttachments", updateAssetAttachments);
|
|
@@ -4529,20 +4774,39 @@ class AssetAttachmentService extends BaseAttachmentService {
|
|
|
4529
4774
|
buildOfflineAttachment(data) {
|
|
4530
4775
|
return offline({
|
|
4531
4776
|
file: URL.createObjectURL(data.file),
|
|
4532
|
-
file_sha1: data.
|
|
4533
|
-
created_by: data.
|
|
4777
|
+
file_sha1: data.file_sha1,
|
|
4778
|
+
created_by: data.created_by,
|
|
4534
4779
|
file_name: data.file.name,
|
|
4535
4780
|
file_type: data.file.type,
|
|
4536
|
-
submitted_at: data.
|
|
4781
|
+
submitted_at: data.submitted_at,
|
|
4537
4782
|
description: data.description,
|
|
4538
4783
|
asset: data.modelId
|
|
4539
4784
|
});
|
|
4540
4785
|
}
|
|
4541
|
-
|
|
4542
|
-
return
|
|
4786
|
+
buildAttachmentPayload(data) {
|
|
4787
|
+
return {
|
|
4788
|
+
...data,
|
|
4789
|
+
asset: data.modelId
|
|
4790
|
+
};
|
|
4791
|
+
}
|
|
4792
|
+
async bulkAdd(payloads) {
|
|
4793
|
+
return this._bulkAdd(payloads.map((p) => ({ modelId: p.assetId, file: p.file })));
|
|
4543
4794
|
}
|
|
4544
|
-
async
|
|
4545
|
-
return this.
|
|
4795
|
+
async delete(id) {
|
|
4796
|
+
return this._delete(id);
|
|
4797
|
+
}
|
|
4798
|
+
async refreshStore(projectId) {
|
|
4799
|
+
const result = await this.enqueueRequest({
|
|
4800
|
+
description: "Get asset attachments",
|
|
4801
|
+
method: HttpMethod.GET,
|
|
4802
|
+
url: `${this.url}/`,
|
|
4803
|
+
queryParams: {
|
|
4804
|
+
project: projectId.toString()
|
|
4805
|
+
},
|
|
4806
|
+
blocks: [],
|
|
4807
|
+
blockers: []
|
|
4808
|
+
});
|
|
4809
|
+
this.dispatch(initializeAssetAttachments(result));
|
|
4546
4810
|
}
|
|
4547
4811
|
}
|
|
4548
4812
|
class AssetTypeService extends BaseApiService {
|
|
@@ -4559,7 +4823,7 @@ class AssetTypeService extends BaseApiService {
|
|
|
4559
4823
|
const promise = this.enqueueRequest({
|
|
4560
4824
|
description: "Create asset type",
|
|
4561
4825
|
method: HttpMethod.POST,
|
|
4562
|
-
url:
|
|
4826
|
+
url: "/asset-types/",
|
|
4563
4827
|
payload: { ...offlineAssetType },
|
|
4564
4828
|
blockers: [],
|
|
4565
4829
|
blocks: [offlineAssetType.offline_id]
|
|
@@ -4585,7 +4849,7 @@ class AssetTypeService extends BaseApiService {
|
|
|
4585
4849
|
const promise = this.enqueueRequest({
|
|
4586
4850
|
description: "Update asset type",
|
|
4587
4851
|
method: HttpMethod.PATCH,
|
|
4588
|
-
url: `/
|
|
4852
|
+
url: `/asset-types/${payload.offline_id}/`,
|
|
4589
4853
|
payload: {
|
|
4590
4854
|
icon: payload.icon,
|
|
4591
4855
|
color: payload.color,
|
|
@@ -4619,7 +4883,7 @@ class AssetTypeService extends BaseApiService {
|
|
|
4619
4883
|
return this.enqueueRequest({
|
|
4620
4884
|
description: "Delete asset type",
|
|
4621
4885
|
method: HttpMethod.DELETE,
|
|
4622
|
-
url: `/
|
|
4886
|
+
url: `/asset-types/${assetTypeId}/`,
|
|
4623
4887
|
blockers: [assetTypeId],
|
|
4624
4888
|
blocks: []
|
|
4625
4889
|
}).catch((e) => {
|
|
@@ -4634,7 +4898,10 @@ class AssetTypeService extends BaseApiService {
|
|
|
4634
4898
|
const result = await this.enqueueRequest({
|
|
4635
4899
|
description: "Get asset types",
|
|
4636
4900
|
method: HttpMethod.GET,
|
|
4637
|
-
url:
|
|
4901
|
+
url: "/asset-types/",
|
|
4902
|
+
queryParams: {
|
|
4903
|
+
project: projectId.toString()
|
|
4904
|
+
},
|
|
4638
4905
|
blockers: [],
|
|
4639
4906
|
blocks: []
|
|
4640
4907
|
});
|
|
@@ -4644,8 +4911,8 @@ class AssetTypeService extends BaseApiService {
|
|
|
4644
4911
|
class AssetTypeAttachmentService extends BaseAttachmentService {
|
|
4645
4912
|
constructor() {
|
|
4646
4913
|
super(...arguments);
|
|
4647
|
-
__publicField(this, "
|
|
4648
|
-
__publicField(this, "
|
|
4914
|
+
__publicField(this, "name", "Asset Type Attachment");
|
|
4915
|
+
__publicField(this, "url", "/asset-type-attachments");
|
|
4649
4916
|
__publicField(this, "addAttachments", addAssetTypeAttachments);
|
|
4650
4917
|
__publicField(this, "updateAttachments", updateAssetTypeAttachments);
|
|
4651
4918
|
__publicField(this, "removeAttachments", deleteAssetTypeAttachments);
|
|
@@ -4656,20 +4923,39 @@ class AssetTypeAttachmentService extends BaseAttachmentService {
|
|
|
4656
4923
|
buildOfflineAttachment(data) {
|
|
4657
4924
|
return offline({
|
|
4658
4925
|
file: URL.createObjectURL(data.file),
|
|
4659
|
-
file_sha1: data.
|
|
4660
|
-
created_by: data.
|
|
4926
|
+
file_sha1: data.file_sha1,
|
|
4927
|
+
created_by: data.created_by,
|
|
4661
4928
|
file_name: data.file.name,
|
|
4662
4929
|
file_type: data.file.type,
|
|
4663
|
-
submitted_at: data.
|
|
4930
|
+
submitted_at: data.submitted_at,
|
|
4664
4931
|
description: data.description,
|
|
4665
4932
|
asset_type: data.modelId
|
|
4666
4933
|
});
|
|
4667
4934
|
}
|
|
4668
|
-
|
|
4669
|
-
return
|
|
4935
|
+
buildAttachmentPayload(data) {
|
|
4936
|
+
return {
|
|
4937
|
+
...data,
|
|
4938
|
+
asset_type: data.modelId
|
|
4939
|
+
};
|
|
4940
|
+
}
|
|
4941
|
+
async bulkAdd(payloads) {
|
|
4942
|
+
return this._bulkAdd(payloads.map((p) => ({ modelId: p.assetTypeId, file: p.file })));
|
|
4670
4943
|
}
|
|
4671
|
-
async
|
|
4672
|
-
return this.
|
|
4944
|
+
async delete(attachmentId) {
|
|
4945
|
+
return this._delete(attachmentId);
|
|
4946
|
+
}
|
|
4947
|
+
async refreshStore(projectId) {
|
|
4948
|
+
const result = await this.enqueueRequest({
|
|
4949
|
+
description: "Get asset type attachments",
|
|
4950
|
+
method: HttpMethod.GET,
|
|
4951
|
+
url: `${this.url}/`,
|
|
4952
|
+
queryParams: {
|
|
4953
|
+
project: projectId.toString()
|
|
4954
|
+
},
|
|
4955
|
+
blocks: [],
|
|
4956
|
+
blockers: []
|
|
4957
|
+
});
|
|
4958
|
+
this.dispatch(initializeAssetTypeAttachments(result));
|
|
4673
4959
|
}
|
|
4674
4960
|
}
|
|
4675
4961
|
class IssueCommentService extends BaseApiService {
|
|
@@ -4685,7 +4971,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
4685
4971
|
const promise = this.enqueueRequest({
|
|
4686
4972
|
description: "Add issue comment",
|
|
4687
4973
|
method: HttpMethod.POST,
|
|
4688
|
-
url:
|
|
4974
|
+
url: "/issue-comments/",
|
|
4689
4975
|
payload: offlineComment,
|
|
4690
4976
|
blockers: [payload.issue],
|
|
4691
4977
|
blocks: [offlineComment.offline_id]
|
|
@@ -4709,7 +4995,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
4709
4995
|
const promise = this.enqueueRequest({
|
|
4710
4996
|
description: "Edit issue comment",
|
|
4711
4997
|
method: HttpMethod.PATCH,
|
|
4712
|
-
url: `/
|
|
4998
|
+
url: `/issue-comments/${payload.offline_id}/`,
|
|
4713
4999
|
payload,
|
|
4714
5000
|
blockers: [payload.offline_id],
|
|
4715
5001
|
blocks: [payload.offline_id]
|
|
@@ -4728,7 +5014,7 @@ class IssueCommentService extends BaseApiService {
|
|
|
4728
5014
|
const promise = this.enqueueRequest({
|
|
4729
5015
|
description: "Delete comment",
|
|
4730
5016
|
method: HttpMethod.DELETE,
|
|
4731
|
-
url: `/
|
|
5017
|
+
url: `/issue-comments/${id}/`,
|
|
4732
5018
|
blockers: [id],
|
|
4733
5019
|
blocks: []
|
|
4734
5020
|
});
|
|
@@ -4741,7 +5027,10 @@ class IssueCommentService extends BaseApiService {
|
|
|
4741
5027
|
const result = await this.enqueueRequest({
|
|
4742
5028
|
description: "Get comments",
|
|
4743
5029
|
method: HttpMethod.GET,
|
|
4744
|
-
url:
|
|
5030
|
+
url: "/issue-comments/",
|
|
5031
|
+
queryParams: {
|
|
5032
|
+
project: projectId.toString()
|
|
5033
|
+
},
|
|
4745
5034
|
blockers: [],
|
|
4746
5035
|
blocks: []
|
|
4747
5036
|
});
|
|
@@ -4753,27 +5042,21 @@ class IssueUpdateService extends BaseApiService {
|
|
|
4753
5042
|
const result = await this.enqueueRequest({
|
|
4754
5043
|
description: "Get issue updates",
|
|
4755
5044
|
method: HttpMethod.GET,
|
|
4756
|
-
url:
|
|
5045
|
+
url: "/issue-updates/",
|
|
5046
|
+
queryParams: {
|
|
5047
|
+
project: projectId.toString()
|
|
5048
|
+
},
|
|
4757
5049
|
blockers: [],
|
|
4758
5050
|
blocks: []
|
|
4759
5051
|
});
|
|
4760
|
-
|
|
4761
|
-
filteredResult = filteredResult.map((comment) => {
|
|
4762
|
-
return { ...comment };
|
|
4763
|
-
});
|
|
4764
|
-
if (result.length !== filteredResult.length) {
|
|
4765
|
-
console.error(
|
|
4766
|
-
`Received duplicate comments from the API (new length ${filteredResult.length}); filtered in browser.`
|
|
4767
|
-
);
|
|
4768
|
-
}
|
|
4769
|
-
this.dispatch(initializeIssueUpdates(filteredResult));
|
|
5052
|
+
this.dispatch(initializeIssueUpdates(result));
|
|
4770
5053
|
}
|
|
4771
5054
|
}
|
|
4772
5055
|
class IssueAttachmentService extends BaseAttachmentService {
|
|
4773
5056
|
constructor() {
|
|
4774
5057
|
super(...arguments);
|
|
4775
|
-
__publicField(this, "
|
|
4776
|
-
__publicField(this, "
|
|
5058
|
+
__publicField(this, "name", "Issue Attachment");
|
|
5059
|
+
__publicField(this, "url", "/issue-attachments");
|
|
4777
5060
|
__publicField(this, "addAttachments", addIssueAttachments);
|
|
4778
5061
|
__publicField(this, "updateAttachments", updateIssueAttachments);
|
|
4779
5062
|
__publicField(this, "removeAttachments", deleteIssueAttachments);
|
|
@@ -4784,24 +5067,42 @@ class IssueAttachmentService extends BaseAttachmentService {
|
|
|
4784
5067
|
buildOfflineAttachment(data) {
|
|
4785
5068
|
return offline({
|
|
4786
5069
|
file: URL.createObjectURL(data.file),
|
|
4787
|
-
file_sha1: data.
|
|
4788
|
-
created_by: data.
|
|
5070
|
+
file_sha1: data.file_sha1,
|
|
5071
|
+
created_by: data.created_by,
|
|
4789
5072
|
file_name: data.file.name,
|
|
4790
5073
|
file_type: data.file.type,
|
|
4791
|
-
submitted_at: data.
|
|
5074
|
+
submitted_at: data.submitted_at,
|
|
4792
5075
|
description: data.description,
|
|
4793
5076
|
issue: data.modelId
|
|
4794
5077
|
});
|
|
4795
5078
|
}
|
|
4796
|
-
|
|
4797
|
-
return
|
|
5079
|
+
buildAttachmentPayload(data) {
|
|
5080
|
+
return {
|
|
5081
|
+
...data,
|
|
5082
|
+
issue: data.modelId
|
|
5083
|
+
};
|
|
5084
|
+
}
|
|
5085
|
+
async bulkAdd(payloads) {
|
|
5086
|
+
return this._bulkAdd(payloads.map((p) => ({ modelId: p.issueId, file: p.file })));
|
|
4798
5087
|
}
|
|
4799
|
-
async
|
|
4800
|
-
return this.
|
|
5088
|
+
async delete(id) {
|
|
5089
|
+
return this._delete(id);
|
|
5090
|
+
}
|
|
5091
|
+
async refreshStore(projectId) {
|
|
5092
|
+
const result = await this.enqueueRequest({
|
|
5093
|
+
description: "Get issue attachments",
|
|
5094
|
+
method: HttpMethod.GET,
|
|
5095
|
+
url: `${this.url}/`,
|
|
5096
|
+
queryParams: {
|
|
5097
|
+
project: projectId.toString()
|
|
5098
|
+
},
|
|
5099
|
+
blocks: [],
|
|
5100
|
+
blockers: []
|
|
5101
|
+
});
|
|
5102
|
+
this.dispatch(initializeIssueAttachments(result));
|
|
4801
5103
|
}
|
|
4802
5104
|
}
|
|
4803
5105
|
class IssueService extends BaseApiService {
|
|
4804
|
-
// Basic CRUD functions
|
|
4805
5106
|
add(payload) {
|
|
4806
5107
|
var _a2;
|
|
4807
5108
|
const { store } = this.client;
|
|
@@ -4819,10 +5120,6 @@ class IssueService extends BaseApiService {
|
|
|
4819
5120
|
description: "Create issue",
|
|
4820
5121
|
method: HttpMethod.POST,
|
|
4821
5122
|
url: "/issues/",
|
|
4822
|
-
queryParams: {
|
|
4823
|
-
workspace_id: payload.index_workspace,
|
|
4824
|
-
...payload.issue_type ? { issue_type: payload.issue_type } : {}
|
|
4825
|
-
},
|
|
4826
5123
|
payload: offlineIssue,
|
|
4827
5124
|
blockers: ["add-issue", ...offlineIssue.index_workspace ? [offlineIssue.index_workspace] : []],
|
|
4828
5125
|
blocks: [offlineIssue.offline_id]
|
|
@@ -4978,7 +5275,10 @@ class IssueService extends BaseApiService {
|
|
|
4978
5275
|
const result = await this.enqueueRequest({
|
|
4979
5276
|
description: "Get issues",
|
|
4980
5277
|
method: HttpMethod.GET,
|
|
4981
|
-
url:
|
|
5278
|
+
url: "/issues/",
|
|
5279
|
+
queryParams: {
|
|
5280
|
+
project: projectId.toString()
|
|
5281
|
+
},
|
|
4982
5282
|
blockers: [],
|
|
4983
5283
|
blocks: []
|
|
4984
5284
|
});
|
|
@@ -4998,7 +5298,7 @@ class IssueTypeService extends BaseApiService {
|
|
|
4998
5298
|
this.dispatch(addIssueType(offlineIssueType));
|
|
4999
5299
|
const promise = this.enqueueRequest({
|
|
5000
5300
|
method: HttpMethod.POST,
|
|
5001
|
-
url:
|
|
5301
|
+
url: "/issue-types/",
|
|
5002
5302
|
// Sending only whats needed here
|
|
5003
5303
|
payload: {
|
|
5004
5304
|
offline_id: offlineIssueType.offline_id,
|
|
@@ -5032,7 +5332,7 @@ class IssueTypeService extends BaseApiService {
|
|
|
5032
5332
|
this.dispatch(updateIssueType(offlineUpdatedIssueType));
|
|
5033
5333
|
const promise = this.enqueueRequest({
|
|
5034
5334
|
method: HttpMethod.PATCH,
|
|
5035
|
-
url: `/
|
|
5335
|
+
url: `/issue-types/${payload.offline_id}/`,
|
|
5036
5336
|
payload,
|
|
5037
5337
|
blockers: [payload.offline_id],
|
|
5038
5338
|
blocks: [payload.offline_id]
|
|
@@ -5056,7 +5356,7 @@ class IssueTypeService extends BaseApiService {
|
|
|
5056
5356
|
this.dispatch(deleteIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
|
|
5057
5357
|
const promise = this.enqueueRequest({
|
|
5058
5358
|
method: HttpMethod.DELETE,
|
|
5059
|
-
url: `/
|
|
5359
|
+
url: `/issue-types/${id}/`,
|
|
5060
5360
|
blockers: [id],
|
|
5061
5361
|
blocks: []
|
|
5062
5362
|
});
|
|
@@ -5069,7 +5369,10 @@ class IssueTypeService extends BaseApiService {
|
|
|
5069
5369
|
async refreshStore(organizationId) {
|
|
5070
5370
|
const result = await this.enqueueRequest({
|
|
5071
5371
|
method: HttpMethod.GET,
|
|
5072
|
-
url:
|
|
5372
|
+
url: "/issue-types/",
|
|
5373
|
+
queryParams: {
|
|
5374
|
+
organization: organizationId.toString()
|
|
5375
|
+
},
|
|
5073
5376
|
blockers: [],
|
|
5074
5377
|
blocks: []
|
|
5075
5378
|
});
|
|
@@ -5213,8 +5516,8 @@ class ProjectFileService extends BaseApiService {
|
|
|
5213
5516
|
class ProjectAttachmentService extends BaseAttachmentService {
|
|
5214
5517
|
constructor() {
|
|
5215
5518
|
super(...arguments);
|
|
5216
|
-
__publicField(this, "
|
|
5217
|
-
__publicField(this, "
|
|
5519
|
+
__publicField(this, "name", "Project Attachment");
|
|
5520
|
+
__publicField(this, "url", "/project-attachments");
|
|
5218
5521
|
__publicField(this, "addAttachments", addProjectAttachments);
|
|
5219
5522
|
__publicField(this, "updateAttachments", updateProjectAttachments);
|
|
5220
5523
|
__publicField(this, "removeAttachments", deleteProjectAttachments);
|
|
@@ -5225,41 +5528,54 @@ class ProjectAttachmentService extends BaseAttachmentService {
|
|
|
5225
5528
|
buildOfflineAttachment(data) {
|
|
5226
5529
|
return offline({
|
|
5227
5530
|
file: URL.createObjectURL(data.file),
|
|
5228
|
-
file_sha1: data.
|
|
5229
|
-
created_by: data.
|
|
5531
|
+
file_sha1: data.file_sha1,
|
|
5532
|
+
created_by: data.created_by,
|
|
5230
5533
|
file_name: data.file.name,
|
|
5231
5534
|
file_type: data.file.type,
|
|
5232
|
-
submitted_at: data.
|
|
5535
|
+
submitted_at: data.submitted_at,
|
|
5233
5536
|
description: data.description,
|
|
5234
5537
|
project: data.modelId
|
|
5235
5538
|
});
|
|
5236
5539
|
}
|
|
5237
|
-
|
|
5238
|
-
return
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
}
|
|
5540
|
+
buildAttachmentPayload(data) {
|
|
5541
|
+
return {
|
|
5542
|
+
...data,
|
|
5543
|
+
project: data.modelId
|
|
5544
|
+
};
|
|
5545
|
+
}
|
|
5546
|
+
async bulkAdd(payloads) {
|
|
5547
|
+
return this._bulkAdd(payloads.map((p) => ({ modelId: p.projectId, file: p.file })));
|
|
5548
|
+
}
|
|
5549
|
+
async delete(attachmentId) {
|
|
5550
|
+
return this._delete(attachmentId);
|
|
5551
|
+
}
|
|
5552
|
+
async refreshStore(projectId) {
|
|
5553
|
+
const result = await this.enqueueRequest({
|
|
5554
|
+
description: "Get project attachments",
|
|
5555
|
+
method: HttpMethod.GET,
|
|
5556
|
+
url: `${this.url}/`,
|
|
5557
|
+
queryParams: {
|
|
5558
|
+
project: projectId.toString()
|
|
5559
|
+
},
|
|
5560
|
+
blockers: [],
|
|
5561
|
+
blocks: []
|
|
5562
|
+
});
|
|
5563
|
+
this.dispatch(initializeProjectAttachments(result));
|
|
5564
|
+
}
|
|
5243
5565
|
}
|
|
5244
5566
|
class ProjectService extends BaseApiService {
|
|
5245
5567
|
async add(payload) {
|
|
5246
|
-
if (!payload.organization_owner && !payload.user_owner) {
|
|
5247
|
-
throw new Error("Project type was not chosen when trying to create a project");
|
|
5248
|
-
}
|
|
5249
5568
|
if (!payload.bounds && !payload.canvas_bounds) {
|
|
5250
5569
|
throw new Error("Project must either have bounds or canvas_bounds set");
|
|
5251
5570
|
}
|
|
5252
|
-
const isOrganizationProject = !!payload.organization_owner;
|
|
5253
|
-
const url = isOrganizationProject ? `/organizations/${payload.organization_owner}/projects/` : "/projects/";
|
|
5254
|
-
const projectType = isOrganizationProject ? { organization_owner: payload.organization_owner } : { user_owner: payload.user_owner };
|
|
5255
5571
|
return await this.enqueueRequest({
|
|
5256
5572
|
description: "Create project",
|
|
5257
5573
|
method: HttpMethod.POST,
|
|
5258
|
-
url,
|
|
5574
|
+
url: "/projects/",
|
|
5259
5575
|
payload: {
|
|
5260
5576
|
name: payload.name,
|
|
5261
5577
|
bounds: payload.bounds,
|
|
5262
|
-
|
|
5578
|
+
organization_owner: payload.organization_owner
|
|
5263
5579
|
},
|
|
5264
5580
|
blockers: [],
|
|
5265
5581
|
blocks: []
|
|
@@ -5387,88 +5703,33 @@ const separateImageFromFields = async (fields) => {
|
|
|
5387
5703
|
return { fields: newFields, images };
|
|
5388
5704
|
};
|
|
5389
5705
|
class FormService extends BaseUploadService {
|
|
5390
|
-
|
|
5706
|
+
add(payload, initialRevision) {
|
|
5391
5707
|
var _a2;
|
|
5708
|
+
const { store } = this.client;
|
|
5392
5709
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5393
|
-
const createdBy = (_a2 =
|
|
5394
|
-
const
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
const sha1 = await hashFile(file);
|
|
5399
|
-
if (!(sha1 in filePayloads)) {
|
|
5400
|
-
filePayloads[sha1] = {
|
|
5401
|
-
sha1,
|
|
5402
|
-
file_type: file.type,
|
|
5403
|
-
extension: file.name.split(".").pop(),
|
|
5404
|
-
size: file.size
|
|
5405
|
-
};
|
|
5406
|
-
await this.client.files.addCache(file, sha1);
|
|
5407
|
-
}
|
|
5408
|
-
const offlineFormRevisionAttachment = offline({
|
|
5409
|
-
file: URL.createObjectURL(file),
|
|
5410
|
-
file_type: file.type,
|
|
5411
|
-
file_name: file.name,
|
|
5412
|
-
file_sha1: sha1,
|
|
5413
|
-
created_by: createdBy,
|
|
5414
|
-
revision: revisionId,
|
|
5415
|
-
submitted_at: submittedAt,
|
|
5416
|
-
field_identifier: fieldIdentifier
|
|
5417
|
-
});
|
|
5418
|
-
offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
|
|
5419
|
-
const attachmentPayload = {
|
|
5420
|
-
offline_id: offlineFormRevisionAttachment.offline_id,
|
|
5421
|
-
name: file.name,
|
|
5422
|
-
field_identifier: fieldIdentifier,
|
|
5423
|
-
sha1
|
|
5424
|
-
};
|
|
5425
|
-
attachmentPayloads.push(attachmentPayload);
|
|
5426
|
-
}
|
|
5427
|
-
this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
|
|
5428
|
-
const promise = this.enqueueRequest({
|
|
5429
|
-
description: "Attach files to form revision",
|
|
5430
|
-
method: HttpMethod.POST,
|
|
5431
|
-
url: `/forms/revisions/${revisionId}/attachments/bulk/`,
|
|
5432
|
-
payload: {
|
|
5433
|
-
submitted_at: submittedAt,
|
|
5434
|
-
attachments: attachmentPayloads,
|
|
5435
|
-
files: Object.values(filePayloads)
|
|
5436
|
-
},
|
|
5437
|
-
blockers: [revisionId],
|
|
5438
|
-
blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
5439
|
-
});
|
|
5440
|
-
promise.then((result) => {
|
|
5441
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
5442
|
-
this.dispatch(updateFormRevisionAttachments(result.attachments));
|
|
5443
|
-
}).catch(() => {
|
|
5444
|
-
this.dispatch(
|
|
5445
|
-
deleteFormRevisionAttachments(
|
|
5446
|
-
offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
5447
|
-
)
|
|
5448
|
-
);
|
|
5710
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5711
|
+
const offlineForm = offline({
|
|
5712
|
+
...payload,
|
|
5713
|
+
submitted_at: submittedAt,
|
|
5714
|
+
created_by: createdBy
|
|
5449
5715
|
});
|
|
5450
|
-
return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5451
|
-
}
|
|
5452
|
-
async add(ownerId, form, initialRevision, urlPrefix) {
|
|
5453
|
-
const { fields, images } = await separateImageFromFields(initialRevision.fields);
|
|
5454
5716
|
const offlineFormRevision = offline({
|
|
5455
5717
|
...initialRevision,
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
revision: "Pending"
|
|
5718
|
+
form: offlineForm.offline_id,
|
|
5719
|
+
revision: "Pending",
|
|
5720
|
+
submitted_at: submittedAt,
|
|
5721
|
+
created_by: createdBy
|
|
5461
5722
|
});
|
|
5462
|
-
this.dispatch(addForm(
|
|
5723
|
+
this.dispatch(addForm(offlineForm));
|
|
5463
5724
|
this.dispatch(addFormRevision(offlineFormRevision));
|
|
5464
5725
|
const formPromise = this.enqueueRequest({
|
|
5465
5726
|
description: "Create form",
|
|
5466
5727
|
method: HttpMethod.POST,
|
|
5467
|
-
url:
|
|
5728
|
+
url: "/forms/",
|
|
5468
5729
|
payload: {
|
|
5469
5730
|
// Sending exactly what is currently needed for the endpoint
|
|
5470
|
-
offline_id:
|
|
5471
|
-
submitted_at:
|
|
5731
|
+
offline_id: offlineForm.offline_id,
|
|
5732
|
+
submitted_at: offlineForm.submitted_at,
|
|
5472
5733
|
initial_revision: {
|
|
5473
5734
|
offline_id: offlineFormRevision.offline_id,
|
|
5474
5735
|
submitted_at: offlineFormRevision.submitted_at,
|
|
@@ -5477,134 +5738,41 @@ class FormService extends BaseUploadService {
|
|
|
5477
5738
|
fields: offlineFormRevision.fields
|
|
5478
5739
|
}
|
|
5479
5740
|
},
|
|
5480
|
-
blockers: [
|
|
5481
|
-
|
|
5741
|
+
blockers: [
|
|
5742
|
+
...payload.project ? [payload.project.toString()] : [],
|
|
5743
|
+
...payload.organization ? [payload.organization.toString()] : []
|
|
5744
|
+
],
|
|
5745
|
+
blocks: [offlineForm.offline_id, offlineFormRevision.offline_id]
|
|
5482
5746
|
});
|
|
5483
|
-
const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
|
|
5484
|
-
offlineFormRevision.offline_id,
|
|
5485
|
-
images
|
|
5486
|
-
);
|
|
5487
5747
|
void formPromise.catch((e) => {
|
|
5488
|
-
this.dispatch(deleteForm(
|
|
5748
|
+
this.dispatch(deleteForm(offlineForm.offline_id));
|
|
5489
5749
|
this.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
|
|
5490
5750
|
throw e;
|
|
5491
5751
|
});
|
|
5492
|
-
return [
|
|
5493
|
-
}
|
|
5494
|
-
addForOrganization(organizationId, initialRevision) {
|
|
5495
|
-
var _a2;
|
|
5496
|
-
const state = this.client.store.getState();
|
|
5497
|
-
const offlineForm = offline({
|
|
5498
|
-
favorite: false,
|
|
5499
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5500
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5501
|
-
organization: organizationId
|
|
5502
|
-
});
|
|
5503
|
-
return this.add(
|
|
5504
|
-
organizationId.toString(),
|
|
5505
|
-
offlineForm,
|
|
5506
|
-
initialRevision,
|
|
5507
|
-
`/organizations/${organizationId}/create-form/`
|
|
5508
|
-
);
|
|
5509
|
-
}
|
|
5510
|
-
addForProject(projectId, initialRevision) {
|
|
5511
|
-
var _a2;
|
|
5512
|
-
const state = this.client.store.getState();
|
|
5513
|
-
const offlineForm = offline({
|
|
5514
|
-
favorite: false,
|
|
5515
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5516
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5517
|
-
project: projectId
|
|
5518
|
-
});
|
|
5519
|
-
return this.add(projectId.toString(), offlineForm, initialRevision, `/projects/${projectId}/create-form/`);
|
|
5520
|
-
}
|
|
5521
|
-
addForIssueType(issueTypeId, initialRevision) {
|
|
5522
|
-
var _a2;
|
|
5523
|
-
const state = this.client.store.getState();
|
|
5524
|
-
const offlineForm = offline({
|
|
5525
|
-
favorite: false,
|
|
5526
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5527
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5528
|
-
issue_type: issueTypeId
|
|
5529
|
-
});
|
|
5530
|
-
return this.add(issueTypeId, offlineForm, initialRevision, `/issues/types/${issueTypeId}/create-form/`);
|
|
5531
|
-
}
|
|
5532
|
-
addForAssetType(assetTypeId, initialRevision) {
|
|
5533
|
-
var _a2;
|
|
5534
|
-
const state = this.client.store.getState();
|
|
5535
|
-
const offlineForm = offline({
|
|
5536
|
-
favorite: false,
|
|
5537
|
-
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
5538
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5539
|
-
asset_type: assetTypeId
|
|
5540
|
-
});
|
|
5541
|
-
return this.add(assetTypeId, offlineForm, initialRevision, `/assets/types/${assetTypeId}/create-form/`);
|
|
5542
|
-
}
|
|
5543
|
-
async createRevision(formId, revision) {
|
|
5544
|
-
var _a2;
|
|
5545
|
-
const offlineRevision = offline(revision);
|
|
5546
|
-
const { store } = this.client;
|
|
5547
|
-
const state = store.getState();
|
|
5548
|
-
const createdBy = (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5549
|
-
const { fields, images } = await separateImageFromFields(offlineRevision.fields);
|
|
5550
|
-
const fullRevision = {
|
|
5551
|
-
...offlineRevision,
|
|
5552
|
-
fields,
|
|
5553
|
-
created_by: createdBy,
|
|
5554
|
-
revision: "Pending",
|
|
5555
|
-
form: formId,
|
|
5556
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5557
|
-
};
|
|
5558
|
-
this.dispatch(addFormRevision(fullRevision));
|
|
5559
|
-
const promise = this.enqueueRequest({
|
|
5560
|
-
description: "Create form revision",
|
|
5561
|
-
method: HttpMethod.PATCH,
|
|
5562
|
-
url: `/forms/${formId}/`,
|
|
5563
|
-
payload: {
|
|
5564
|
-
initial_revision: {
|
|
5565
|
-
offline_id: fullRevision.offline_id,
|
|
5566
|
-
submitted_at: fullRevision.submitted_at,
|
|
5567
|
-
title: fullRevision.title,
|
|
5568
|
-
description: fullRevision.description,
|
|
5569
|
-
fields: fullRevision.fields
|
|
5570
|
-
}
|
|
5571
|
-
},
|
|
5572
|
-
blockers: [formId],
|
|
5573
|
-
blocks: [offlineRevision.offline_id]
|
|
5574
|
-
});
|
|
5575
|
-
const [offlineFormRevisionAttachments, attachmentsPromise] = await this.bulkAddRevisionAttachments(
|
|
5576
|
-
fullRevision.offline_id,
|
|
5577
|
-
images
|
|
5578
|
-
);
|
|
5579
|
-
void promise.then((result) => {
|
|
5580
|
-
this.dispatch(setFormRevision(result));
|
|
5581
|
-
}).catch(() => {
|
|
5582
|
-
this.dispatch(deleteFormRevision(fullRevision.offline_id));
|
|
5583
|
-
});
|
|
5584
|
-
return [fullRevision, offlineFormRevisionAttachments, promise, attachmentsPromise];
|
|
5752
|
+
return [offlineForm, offlineFormRevision, formPromise];
|
|
5585
5753
|
}
|
|
5586
|
-
async delete(
|
|
5754
|
+
async delete(id) {
|
|
5587
5755
|
const { store } = this.client;
|
|
5588
5756
|
const state = store.getState();
|
|
5589
|
-
const form = selectFormById(
|
|
5757
|
+
const form = selectFormById(id)(state);
|
|
5590
5758
|
if (!form) {
|
|
5591
5759
|
throw new Error("Expected form to exist");
|
|
5592
5760
|
}
|
|
5593
|
-
const formSubmissions = selectFormSubmissionsOfForm(
|
|
5761
|
+
const formSubmissions = selectFormSubmissionsOfForm(id)(state);
|
|
5594
5762
|
if (formSubmissions.length > 0) {
|
|
5595
5763
|
this.dispatch(deleteFormSubmissions(formSubmissions.map(({ offline_id }) => offline_id)));
|
|
5596
5764
|
}
|
|
5597
|
-
const formRevisions = selectFormRevisionsOfForm(
|
|
5765
|
+
const formRevisions = selectFormRevisionsOfForm(id)(state);
|
|
5598
5766
|
if (formRevisions.length > 0) {
|
|
5599
5767
|
this.dispatch(deleteFormRevisions(formRevisions.map(({ offline_id }) => offline_id)));
|
|
5600
5768
|
}
|
|
5601
|
-
this.dispatch(deleteForm(
|
|
5769
|
+
this.dispatch(deleteForm(id));
|
|
5602
5770
|
try {
|
|
5603
5771
|
return await this.enqueueRequest({
|
|
5604
5772
|
description: "Delete form",
|
|
5605
5773
|
method: HttpMethod.DELETE,
|
|
5606
|
-
url: `/forms/${
|
|
5607
|
-
blockers: [
|
|
5774
|
+
url: `/forms/${id}/`,
|
|
5775
|
+
blockers: [id],
|
|
5608
5776
|
blocks: []
|
|
5609
5777
|
});
|
|
5610
5778
|
} catch (e) {
|
|
@@ -5618,65 +5786,31 @@ class FormService extends BaseUploadService {
|
|
|
5618
5786
|
throw e;
|
|
5619
5787
|
}
|
|
5620
5788
|
}
|
|
5621
|
-
async refreshStore(projectId) {
|
|
5622
|
-
|
|
5623
|
-
const
|
|
5624
|
-
const attachments = [];
|
|
5625
|
-
const projectFormsResult = await this.enqueueRequest({
|
|
5789
|
+
async refreshStore(projectId, organizationId) {
|
|
5790
|
+
let forms = [];
|
|
5791
|
+
const projectForms = await this.enqueueRequest({
|
|
5626
5792
|
description: "Fetch project forms",
|
|
5627
5793
|
method: HttpMethod.GET,
|
|
5628
|
-
url:
|
|
5794
|
+
url: "/forms/",
|
|
5795
|
+
queryParams: {
|
|
5796
|
+
project: projectId.toString()
|
|
5797
|
+
},
|
|
5629
5798
|
blockers: [projectId.toString()],
|
|
5630
5799
|
blocks: []
|
|
5631
5800
|
});
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
for (const revision of projectFormsResult.revisions)
|
|
5635
|
-
revisions.push(revision);
|
|
5636
|
-
for (const attachment of projectFormsResult.attachments)
|
|
5637
|
-
attachments.push(attachment);
|
|
5638
|
-
const organizationFormsResult = await this.enqueueRequest({
|
|
5801
|
+
forms = forms.concat(projectForms);
|
|
5802
|
+
const organizationForms = await this.enqueueRequest({
|
|
5639
5803
|
description: "Fetch organization forms",
|
|
5640
5804
|
method: HttpMethod.GET,
|
|
5641
|
-
url:
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
forms.push(form);
|
|
5647
|
-
for (const revision of organizationFormsResult.revisions)
|
|
5648
|
-
revisions.push(revision);
|
|
5649
|
-
for (const attachment of organizationFormsResult.attachments)
|
|
5650
|
-
attachments.push(attachment);
|
|
5651
|
-
const assetTypeFormsResult = await this.enqueueRequest({
|
|
5652
|
-
description: "Fetch asset type forms",
|
|
5653
|
-
method: HttpMethod.GET,
|
|
5654
|
-
url: `/projects/${projectId}/asset-types/forms/`,
|
|
5655
|
-
blockers: [projectId.toString()],
|
|
5656
|
-
blocks: []
|
|
5657
|
-
});
|
|
5658
|
-
for (const form of assetTypeFormsResult.forms)
|
|
5659
|
-
forms.push(form);
|
|
5660
|
-
for (const revision of assetTypeFormsResult.revisions)
|
|
5661
|
-
revisions.push(revision);
|
|
5662
|
-
for (const attachment of assetTypeFormsResult.attachments)
|
|
5663
|
-
attachments.push(attachment);
|
|
5664
|
-
const issueTypeFormsResult = await this.enqueueRequest({
|
|
5665
|
-
description: "Fetch issue type forms",
|
|
5666
|
-
method: HttpMethod.GET,
|
|
5667
|
-
url: `/projects/${projectId}/issue-types/forms/`,
|
|
5668
|
-
blockers: [projectId.toString()],
|
|
5805
|
+
url: "/forms/",
|
|
5806
|
+
queryParams: {
|
|
5807
|
+
organization: organizationId.toString()
|
|
5808
|
+
},
|
|
5809
|
+
blockers: [organizationId.toString()],
|
|
5669
5810
|
blocks: []
|
|
5670
5811
|
});
|
|
5671
|
-
|
|
5672
|
-
forms.push(form);
|
|
5673
|
-
for (const revision of issueTypeFormsResult.revisions)
|
|
5674
|
-
revisions.push(revision);
|
|
5675
|
-
for (const attachment of issueTypeFormsResult.attachments)
|
|
5676
|
-
attachments.push(attachment);
|
|
5812
|
+
forms = forms.concat(organizationForms);
|
|
5677
5813
|
this.dispatch(initializeForms(forms));
|
|
5678
|
-
this.dispatch(initializeFormRevisions(revisions));
|
|
5679
|
-
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
5680
5814
|
}
|
|
5681
5815
|
}
|
|
5682
5816
|
const isArrayOfFiles = (value) => {
|
|
@@ -5698,95 +5832,11 @@ const separateFilesFromValues = (values) => {
|
|
|
5698
5832
|
return { values: newValues, files };
|
|
5699
5833
|
};
|
|
5700
5834
|
class FormSubmissionService extends BaseUploadService {
|
|
5701
|
-
|
|
5702
|
-
var _a2;
|
|
5703
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5704
|
-
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
5705
|
-
const filePayloads = {};
|
|
5706
|
-
const offlineFormSubmissionAttachments = [];
|
|
5707
|
-
const attachmentPayloads = [];
|
|
5708
|
-
for (const [fieldIdentifier, filesArray] of Object.entries(files)) {
|
|
5709
|
-
for (const file of filesArray) {
|
|
5710
|
-
const sha1 = await hashFile(file);
|
|
5711
|
-
if (!(sha1 in filePayloads)) {
|
|
5712
|
-
filePayloads[sha1] = {
|
|
5713
|
-
sha1,
|
|
5714
|
-
file_type: file.type,
|
|
5715
|
-
extension: file.name.split(".").pop(),
|
|
5716
|
-
size: file.size
|
|
5717
|
-
};
|
|
5718
|
-
await this.client.files.addCache(file, sha1);
|
|
5719
|
-
}
|
|
5720
|
-
const offlineFormSubmissionAttachment = offline({
|
|
5721
|
-
file: URL.createObjectURL(file),
|
|
5722
|
-
file_type: file.type,
|
|
5723
|
-
file_name: file.name,
|
|
5724
|
-
file_sha1: sha1,
|
|
5725
|
-
created_by: createdBy,
|
|
5726
|
-
submission: submissionId,
|
|
5727
|
-
submitted_at: submittedAt,
|
|
5728
|
-
field_identifier: fieldIdentifier
|
|
5729
|
-
});
|
|
5730
|
-
offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
|
|
5731
|
-
const attachmentPayload = {
|
|
5732
|
-
offline_id: offlineFormSubmissionAttachment.offline_id,
|
|
5733
|
-
name: file.name,
|
|
5734
|
-
sha1,
|
|
5735
|
-
field_identifier: fieldIdentifier
|
|
5736
|
-
};
|
|
5737
|
-
attachmentPayloads.push(attachmentPayload);
|
|
5738
|
-
}
|
|
5739
|
-
}
|
|
5740
|
-
this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
|
|
5741
|
-
const promise = this.enqueueRequest({
|
|
5742
|
-
description: "Attach files to form submission",
|
|
5743
|
-
method: HttpMethod.POST,
|
|
5744
|
-
url: `/forms/submissions/${submissionId}/attachments/bulk/`,
|
|
5745
|
-
payload: {
|
|
5746
|
-
submitted_at: submittedAt,
|
|
5747
|
-
attachments: attachmentPayloads,
|
|
5748
|
-
files: Object.values(filePayloads)
|
|
5749
|
-
},
|
|
5750
|
-
blockers: [submissionId],
|
|
5751
|
-
blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
5752
|
-
});
|
|
5753
|
-
promise.then((result) => {
|
|
5754
|
-
this.processPresignedUrls(result.presigned_urls);
|
|
5755
|
-
this.dispatch(updateFormSubmissionAttachments(result.attachments));
|
|
5756
|
-
}).catch(() => {
|
|
5757
|
-
this.dispatch(
|
|
5758
|
-
deleteFormSubmissionAttachments(
|
|
5759
|
-
offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
5760
|
-
)
|
|
5761
|
-
);
|
|
5762
|
-
});
|
|
5763
|
-
return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
|
|
5764
|
-
}
|
|
5765
|
-
async bulkDeleteSubmissionAttachments(submissionId, attachmentsIds) {
|
|
5766
|
-
const { store } = this.client;
|
|
5767
|
-
const state = store.getState();
|
|
5768
|
-
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
5769
|
-
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
5770
|
-
try {
|
|
5771
|
-
await this.enqueueRequest({
|
|
5772
|
-
description: "Delete form submission attachments",
|
|
5773
|
-
method: HttpMethod.DELETE,
|
|
5774
|
-
url: `/forms/submissions/${submissionId}/attachments/bulk/`,
|
|
5775
|
-
payload: { attachments: attachmentsIds },
|
|
5776
|
-
blockers: [submissionId, ...attachmentsIds],
|
|
5777
|
-
blocks: []
|
|
5778
|
-
});
|
|
5779
|
-
} catch (e) {
|
|
5780
|
-
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
5781
|
-
throw e;
|
|
5782
|
-
}
|
|
5783
|
-
}
|
|
5784
|
-
// Outer promise is for hashing and caching files for submission attachments
|
|
5785
|
-
async add(payload) {
|
|
5835
|
+
add(payload) {
|
|
5786
5836
|
var _a2;
|
|
5787
5837
|
const { store } = this.client;
|
|
5788
5838
|
const state = store.getState();
|
|
5789
|
-
const { values
|
|
5839
|
+
const { values } = separateFilesFromValues(payload.values);
|
|
5790
5840
|
const offlineSubmission = offline({
|
|
5791
5841
|
...payload,
|
|
5792
5842
|
values,
|
|
@@ -5796,7 +5846,7 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5796
5846
|
const promise = this.enqueueRequest({
|
|
5797
5847
|
description: "Respond to form",
|
|
5798
5848
|
method: HttpMethod.POST,
|
|
5799
|
-
url:
|
|
5849
|
+
url: "/form-submissions/",
|
|
5800
5850
|
payload: offlineSubmission,
|
|
5801
5851
|
blockers: [payload.issue, payload.asset, payload.asset_stage, "add-form-entry"].filter(
|
|
5802
5852
|
(x) => x !== void 0
|
|
@@ -5804,10 +5854,6 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5804
5854
|
blocks: [offlineSubmission.offline_id]
|
|
5805
5855
|
});
|
|
5806
5856
|
this.dispatch(addFormSubmission(offlineSubmission));
|
|
5807
|
-
const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
|
|
5808
|
-
offlineSubmission.offline_id,
|
|
5809
|
-
files
|
|
5810
|
-
);
|
|
5811
5857
|
promise.then((result) => {
|
|
5812
5858
|
this.dispatch(addActiveProjectFormSubmissionsCount(1));
|
|
5813
5859
|
this.dispatch(setFormSubmission(result));
|
|
@@ -5816,115 +5862,16 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5816
5862
|
this.dispatch(deleteFormSubmission(offlineSubmission.offline_id));
|
|
5817
5863
|
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5818
5864
|
});
|
|
5819
|
-
return [offlineSubmission,
|
|
5820
|
-
}
|
|
5821
|
-
// Note currently the bulkAdd method is specific to form submissions for assets
|
|
5822
|
-
// TODO: adapt the support bulk adding to any model type
|
|
5823
|
-
async bulkAdd(args, batchSize) {
|
|
5824
|
-
const { formRevision, commonFieldValues, fieldValuesByAsset } = args;
|
|
5825
|
-
const { values: fileSeperatedCommonFieldValues, files: commonFiles } = separateFilesFromValues(commonFieldValues);
|
|
5826
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5827
|
-
const transactionId = v4();
|
|
5828
|
-
const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset), batchSize);
|
|
5829
|
-
const bulkAddBatches = await Promise.all(
|
|
5830
|
-
assetIdBatches.map(async (assetIdBatch) => {
|
|
5831
|
-
const batchId = v4();
|
|
5832
|
-
const submissionPayloads = [];
|
|
5833
|
-
const attachmentPayloads = [];
|
|
5834
|
-
const files = { ...commonFiles };
|
|
5835
|
-
for (const assetId of assetIdBatch) {
|
|
5836
|
-
const { values: fileSeperatedSubmissionSpecificValues, files: submissionSpecificFiles } = separateFilesFromValues(fieldValuesByAsset[assetId] ?? {});
|
|
5837
|
-
Object.assign(files, submissionSpecificFiles);
|
|
5838
|
-
const submissionPayload = offline({
|
|
5839
|
-
asset_id: assetId,
|
|
5840
|
-
form_data: fileSeperatedSubmissionSpecificValues
|
|
5841
|
-
});
|
|
5842
|
-
submissionPayloads.push(submissionPayload);
|
|
5843
|
-
for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
|
|
5844
|
-
for (const file of fileArray) {
|
|
5845
|
-
const sha1 = await hashFile(file);
|
|
5846
|
-
await this.client.files.addCache(file, sha1);
|
|
5847
|
-
const attachmentPayload = offline({
|
|
5848
|
-
submission_id: submissionPayload.offline_id,
|
|
5849
|
-
sha1,
|
|
5850
|
-
name: file.name,
|
|
5851
|
-
field_identifier: fieldIdentifier
|
|
5852
|
-
});
|
|
5853
|
-
attachmentPayloads.push(attachmentPayload);
|
|
5854
|
-
}
|
|
5855
|
-
}
|
|
5856
|
-
}
|
|
5857
|
-
const filePaylods = [];
|
|
5858
|
-
for (const file of Object.values(files).flat()) {
|
|
5859
|
-
const sha1 = await hashFile(file);
|
|
5860
|
-
const filePayload = {
|
|
5861
|
-
sha1,
|
|
5862
|
-
extension: file.name.split(".").pop() || "",
|
|
5863
|
-
file_type: file.type,
|
|
5864
|
-
size: file.size
|
|
5865
|
-
};
|
|
5866
|
-
filePaylods.push(filePayload);
|
|
5867
|
-
}
|
|
5868
|
-
return {
|
|
5869
|
-
batchId,
|
|
5870
|
-
payload: {
|
|
5871
|
-
transaction_id: transactionId,
|
|
5872
|
-
form_data: fileSeperatedCommonFieldValues,
|
|
5873
|
-
submitted_at: submittedAt,
|
|
5874
|
-
submissions: submissionPayloads,
|
|
5875
|
-
attachments: attachmentPayloads,
|
|
5876
|
-
files: filePaylods
|
|
5877
|
-
}
|
|
5878
|
-
};
|
|
5879
|
-
})
|
|
5880
|
-
);
|
|
5881
|
-
const batchPromises = [];
|
|
5882
|
-
let prevBatchId = null;
|
|
5883
|
-
for (const batch of bulkAddBatches) {
|
|
5884
|
-
const { payload, batchId } = batch;
|
|
5885
|
-
const batchAssetIds = payload.submissions.map((x) => x.asset_id);
|
|
5886
|
-
const batchSubmissionOfflineIds = payload.submissions.map((x) => x.offline_id);
|
|
5887
|
-
const batchAttachmentsOfflineIds = payload.attachments.map((x) => x.offline_id);
|
|
5888
|
-
const blockers = batchAssetIds;
|
|
5889
|
-
if (prevBatchId)
|
|
5890
|
-
blockers.push(prevBatchId);
|
|
5891
|
-
const blocks = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
5892
|
-
const promise = this.enqueueRequest({
|
|
5893
|
-
description: "Bulk add form submissions",
|
|
5894
|
-
method: HttpMethod.POST,
|
|
5895
|
-
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
5896
|
-
payload,
|
|
5897
|
-
blockers,
|
|
5898
|
-
blocks
|
|
5899
|
-
});
|
|
5900
|
-
void promise.then(({ presigned_urls }) => {
|
|
5901
|
-
this.processPresignedUrls(presigned_urls);
|
|
5902
|
-
});
|
|
5903
|
-
prevBatchId = batchId;
|
|
5904
|
-
batchPromises.push(promise);
|
|
5905
|
-
}
|
|
5906
|
-
void Promise.all(batchPromises).then((results) => {
|
|
5907
|
-
const createdSubmissions = [];
|
|
5908
|
-
const createdAttachments = [];
|
|
5909
|
-
for (const result of results) {
|
|
5910
|
-
for (const createdSubmission of result.submissions)
|
|
5911
|
-
createdSubmissions.push(createdSubmission);
|
|
5912
|
-
for (const createdAttachment of result.attachments)
|
|
5913
|
-
createdAttachments.push(createdAttachment);
|
|
5914
|
-
}
|
|
5915
|
-
this.dispatch(addFormSubmissions(createdSubmissions));
|
|
5916
|
-
this.dispatch(addFormSubmissionAttachments(createdAttachments));
|
|
5917
|
-
});
|
|
5918
|
-
return batchPromises;
|
|
5865
|
+
return [offlineSubmission, promise];
|
|
5919
5866
|
}
|
|
5920
|
-
|
|
5867
|
+
update(payload) {
|
|
5921
5868
|
const { store } = this.client;
|
|
5922
5869
|
const state = store.getState();
|
|
5923
5870
|
const submissionToBeUpdated = selectFormSubmissionById(payload.offline_id)(state);
|
|
5924
5871
|
if (!submissionToBeUpdated) {
|
|
5925
5872
|
throw new Error(`Expected submission with offline_id ${payload.offline_id} to exist`);
|
|
5926
5873
|
}
|
|
5927
|
-
const { values
|
|
5874
|
+
const { values } = separateFilesFromValues(payload.values ?? {});
|
|
5928
5875
|
const updatedSubmission = {
|
|
5929
5876
|
...submissionToBeUpdated,
|
|
5930
5877
|
...payload,
|
|
@@ -5938,57 +5885,36 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5938
5885
|
const promise = this.enqueueRequest({
|
|
5939
5886
|
description: "Delete user form submissions",
|
|
5940
5887
|
method: HttpMethod.PATCH,
|
|
5941
|
-
url: `/
|
|
5888
|
+
url: `/form-submissions/${updatedSubmission.offline_id}/`,
|
|
5942
5889
|
// TODO: send just payload when FormSubmissionDeserializer is updated to handle partial updates
|
|
5943
5890
|
payload: updatedSubmission,
|
|
5944
5891
|
blockers: [updatedSubmission.offline_id],
|
|
5945
5892
|
blocks: [updatedSubmission.offline_id]
|
|
5946
5893
|
});
|
|
5947
|
-
const formSubmissionAttachments = selectAttachmentsOfFormSubmission(payload.offline_id)(state);
|
|
5948
|
-
const formSubmissionAttachmentIdsToBeDeleted = [];
|
|
5949
|
-
for (const attachment of formSubmissionAttachments) {
|
|
5950
|
-
if (attachment.field_identifier in files) {
|
|
5951
|
-
formSubmissionAttachmentIdsToBeDeleted.push(attachment.offline_id);
|
|
5952
|
-
}
|
|
5953
|
-
}
|
|
5954
|
-
const [offlineFormSubmissionAttachments, attachmentsPromise] = await this.bulkAddSubmissionAttachments(
|
|
5955
|
-
payload.offline_id,
|
|
5956
|
-
files
|
|
5957
|
-
);
|
|
5958
|
-
const deleteAttachmentsPromise = this.bulkDeleteSubmissionAttachments(
|
|
5959
|
-
payload.offline_id,
|
|
5960
|
-
formSubmissionAttachmentIdsToBeDeleted
|
|
5961
|
-
);
|
|
5962
5894
|
promise.then((result) => {
|
|
5963
5895
|
this.dispatch(setFormSubmission(result));
|
|
5964
5896
|
}).catch(() => {
|
|
5965
5897
|
this.dispatch(setFormSubmission(submissionToBeUpdated));
|
|
5966
5898
|
});
|
|
5967
|
-
return [
|
|
5968
|
-
updatedSubmission,
|
|
5969
|
-
offlineFormSubmissionAttachments,
|
|
5970
|
-
promise,
|
|
5971
|
-
attachmentsPromise,
|
|
5972
|
-
deleteAttachmentsPromise
|
|
5973
|
-
];
|
|
5899
|
+
return [updatedSubmission, promise];
|
|
5974
5900
|
}
|
|
5975
|
-
async delete(
|
|
5901
|
+
async delete(id) {
|
|
5976
5902
|
const { store } = this.client;
|
|
5977
5903
|
const state = store.getState();
|
|
5978
|
-
const submissionToBeDeleted = selectFormSubmissionById(
|
|
5904
|
+
const submissionToBeDeleted = selectFormSubmissionById(id)(state);
|
|
5979
5905
|
if (!submissionToBeDeleted) {
|
|
5980
|
-
throw new Error(`Expected submission with offline_id ${
|
|
5906
|
+
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
5981
5907
|
}
|
|
5982
|
-
const submissionAttachments = selectAttachmentsOfFormSubmission(
|
|
5983
|
-
this.dispatch(deleteFormSubmission(
|
|
5908
|
+
const submissionAttachments = selectAttachmentsOfFormSubmission(id)(state);
|
|
5909
|
+
this.dispatch(deleteFormSubmission(id));
|
|
5984
5910
|
this.dispatch(addActiveProjectFormSubmissionsCount(-1));
|
|
5985
5911
|
this.dispatch(deleteFormSubmissionAttachments(submissionAttachments.map((x) => x.offline_id)));
|
|
5986
5912
|
try {
|
|
5987
5913
|
return await this.enqueueRequest({
|
|
5988
5914
|
description: "Delete user form submissions",
|
|
5989
5915
|
method: HttpMethod.DELETE,
|
|
5990
|
-
url: `/
|
|
5991
|
-
blockers: [
|
|
5916
|
+
url: `/form-submissions/${id}/`,
|
|
5917
|
+
blockers: [id],
|
|
5992
5918
|
blocks: []
|
|
5993
5919
|
});
|
|
5994
5920
|
} catch (e) {
|
|
@@ -5999,50 +5925,17 @@ class FormSubmissionService extends BaseUploadService {
|
|
|
5999
5925
|
}
|
|
6000
5926
|
}
|
|
6001
5927
|
async refreshStore(projectId) {
|
|
6002
|
-
const
|
|
6003
|
-
|
|
6004
|
-
description: "Fetch model submissions",
|
|
6005
|
-
method: HttpMethod.GET,
|
|
6006
|
-
url: `/forms/in-project/${projectId}/submissions/model/latest/`,
|
|
6007
|
-
blockers: [],
|
|
6008
|
-
blocks: []
|
|
6009
|
-
});
|
|
6010
|
-
for (const modelSubmission of modelSubmissions) {
|
|
6011
|
-
formSubmissions[modelSubmission.offline_id] = modelSubmission;
|
|
6012
|
-
}
|
|
6013
|
-
const standaloneSubmissions = await this.enqueueRequest({
|
|
6014
|
-
description: "Fetch standalone submissions",
|
|
6015
|
-
method: HttpMethod.GET,
|
|
6016
|
-
url: `/forms/in-project/${projectId}/submissions/standalone/`,
|
|
6017
|
-
blockers: [],
|
|
6018
|
-
blocks: []
|
|
6019
|
-
});
|
|
6020
|
-
for (const standaloneSubmission of standaloneSubmissions) {
|
|
6021
|
-
formSubmissions[standaloneSubmission.offline_id] = standaloneSubmission;
|
|
6022
|
-
}
|
|
6023
|
-
this.dispatch(initializeFormSubmissions(Object.values(formSubmissions)));
|
|
6024
|
-
const attachments = {};
|
|
6025
|
-
const modelAttachments = await this.enqueueRequest({
|
|
6026
|
-
description: "Fetch model submission attachments",
|
|
6027
|
-
method: HttpMethod.GET,
|
|
6028
|
-
url: `/forms/in-project/${projectId}/attachments/model/latest/`,
|
|
6029
|
-
blockers: [],
|
|
6030
|
-
blocks: []
|
|
6031
|
-
});
|
|
6032
|
-
for (const modelAttachment of modelAttachments) {
|
|
6033
|
-
attachments[modelAttachment.offline_id] = modelAttachment;
|
|
6034
|
-
}
|
|
6035
|
-
const standaloneAttachments = await this.enqueueRequest({
|
|
6036
|
-
description: "Fetch standalone submission attachments",
|
|
5928
|
+
const result = await this.enqueueRequest({
|
|
5929
|
+
description: "Fetch form submissions",
|
|
6037
5930
|
method: HttpMethod.GET,
|
|
6038
|
-
url:
|
|
5931
|
+
url: "/form-submissions/",
|
|
5932
|
+
queryParams: {
|
|
5933
|
+
project: projectId.toString()
|
|
5934
|
+
},
|
|
6039
5935
|
blockers: [],
|
|
6040
5936
|
blocks: []
|
|
6041
5937
|
});
|
|
6042
|
-
|
|
6043
|
-
attachments[standaloneAttachent.offline_id] = standaloneAttachent;
|
|
6044
|
-
}
|
|
6045
|
-
this.dispatch(initializeFormSubmissionAttachments(Object.values(attachments)));
|
|
5938
|
+
this.dispatch(initializeFormSubmissions(result));
|
|
6046
5939
|
}
|
|
6047
5940
|
}
|
|
6048
5941
|
class WorkspaceService extends BaseApiService {
|
|
@@ -6094,22 +5987,22 @@ class WorkspaceService extends BaseApiService {
|
|
|
6094
5987
|
});
|
|
6095
5988
|
return [workspace, promise];
|
|
6096
5989
|
}
|
|
6097
|
-
delete(
|
|
5990
|
+
delete(id) {
|
|
6098
5991
|
const { store } = this.client;
|
|
6099
|
-
const originalWorkspace = selectWorkspaceById(
|
|
6100
|
-
|
|
5992
|
+
const originalWorkspace = selectWorkspaceById(id)(store.getState());
|
|
5993
|
+
if (!originalWorkspace) {
|
|
5994
|
+
throw new Error(`Expected an existing workspace with id ${id}`);
|
|
5995
|
+
}
|
|
5996
|
+
this.dispatch(deleteWorkspace(id));
|
|
6101
5997
|
const promise = this.enqueueRequest({
|
|
6102
5998
|
description: "Delete Workspace",
|
|
6103
5999
|
method: HttpMethod.DELETE,
|
|
6104
|
-
url: `/workspaces/${
|
|
6105
|
-
blockers: [
|
|
6000
|
+
url: `/workspaces/${id}/`,
|
|
6001
|
+
blockers: [id],
|
|
6106
6002
|
blocks: []
|
|
6107
6003
|
});
|
|
6108
|
-
void promise.
|
|
6109
|
-
|
|
6110
|
-
if (originalWorkspace) {
|
|
6111
|
-
this.dispatch(addWorkspace(originalWorkspace));
|
|
6112
|
-
}
|
|
6004
|
+
void promise.catch((reason) => {
|
|
6005
|
+
this.dispatch(addWorkspace(originalWorkspace));
|
|
6113
6006
|
throw reason;
|
|
6114
6007
|
});
|
|
6115
6008
|
return promise;
|
|
@@ -6487,9 +6380,7 @@ class LicenseService extends BaseApiService {
|
|
|
6487
6380
|
method: HttpMethod.GET,
|
|
6488
6381
|
url: `/billing/${license.offline_id}/`,
|
|
6489
6382
|
isAuthNeeded: true,
|
|
6490
|
-
blockers: [
|
|
6491
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6492
|
-
],
|
|
6383
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6493
6384
|
blocks: []
|
|
6494
6385
|
});
|
|
6495
6386
|
this.dispatch(updateLicense(result));
|
|
@@ -6501,9 +6392,7 @@ class LicenseService extends BaseApiService {
|
|
|
6501
6392
|
method: HttpMethod.DELETE,
|
|
6502
6393
|
url: `/billing/${license.offline_id}/suspend/`,
|
|
6503
6394
|
isAuthNeeded: true,
|
|
6504
|
-
blockers: [
|
|
6505
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6506
|
-
],
|
|
6395
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6507
6396
|
blocks: []
|
|
6508
6397
|
});
|
|
6509
6398
|
this.dispatch(updateLicense(result));
|
|
@@ -6515,9 +6404,7 @@ class LicenseService extends BaseApiService {
|
|
|
6515
6404
|
method: HttpMethod.PATCH,
|
|
6516
6405
|
url: `/billing/${license.offline_id}/suspend/`,
|
|
6517
6406
|
isAuthNeeded: true,
|
|
6518
|
-
blockers: [
|
|
6519
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6520
|
-
],
|
|
6407
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6521
6408
|
blocks: []
|
|
6522
6409
|
});
|
|
6523
6410
|
this.dispatch(updateLicense(result));
|
|
@@ -6529,9 +6416,7 @@ class LicenseService extends BaseApiService {
|
|
|
6529
6416
|
method: HttpMethod.DELETE,
|
|
6530
6417
|
url: `/billing/${license.offline_id}/`,
|
|
6531
6418
|
isAuthNeeded: true,
|
|
6532
|
-
blockers: [
|
|
6533
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6534
|
-
],
|
|
6419
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6535
6420
|
blocks: []
|
|
6536
6421
|
});
|
|
6537
6422
|
this.dispatch(updateLicense(result));
|
|
@@ -6545,7 +6430,7 @@ class LicenseService extends BaseApiService {
|
|
|
6545
6430
|
isAuthNeeded: true,
|
|
6546
6431
|
payload: { project: project.id },
|
|
6547
6432
|
blockers: [
|
|
6548
|
-
license.organization_owner ? license.organization_owner.toString() :
|
|
6433
|
+
license.organization_owner ? license.organization_owner.toString() : "",
|
|
6549
6434
|
project.id ? project.id.toString() : ""
|
|
6550
6435
|
],
|
|
6551
6436
|
blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
|
|
@@ -6559,9 +6444,7 @@ class LicenseService extends BaseApiService {
|
|
|
6559
6444
|
method: HttpMethod.DELETE,
|
|
6560
6445
|
url: `/billing/${license.offline_id}/project/`,
|
|
6561
6446
|
isAuthNeeded: true,
|
|
6562
|
-
blockers: [
|
|
6563
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6564
|
-
],
|
|
6447
|
+
blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
|
|
6565
6448
|
blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
|
|
6566
6449
|
});
|
|
6567
6450
|
this.dispatch(updateLicense(result));
|
|
@@ -6754,8 +6637,8 @@ class DocumentService extends BaseApiService {
|
|
|
6754
6637
|
class DocumentAttachmentService extends BaseAttachmentService {
|
|
6755
6638
|
constructor() {
|
|
6756
6639
|
super(...arguments);
|
|
6757
|
-
__publicField(this, "
|
|
6758
|
-
__publicField(this, "
|
|
6640
|
+
__publicField(this, "name", "Document Attachment");
|
|
6641
|
+
__publicField(this, "url", "/document-attachments");
|
|
6759
6642
|
__publicField(this, "addAttachments", addDocumentAttachments);
|
|
6760
6643
|
__publicField(this, "updateAttachments", updateDocumentAttachments);
|
|
6761
6644
|
__publicField(this, "removeAttachments", deleteDocumentAttachments);
|
|
@@ -6766,17 +6649,23 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6766
6649
|
buildOfflineAttachment(data) {
|
|
6767
6650
|
return offline({
|
|
6768
6651
|
file: URL.createObjectURL(data.file),
|
|
6769
|
-
file_sha1: data.
|
|
6770
|
-
created_by: data.
|
|
6652
|
+
file_sha1: data.file_sha1,
|
|
6653
|
+
created_by: data.created_by,
|
|
6771
6654
|
file_name: data.file.name,
|
|
6772
6655
|
file_type: data.file.type,
|
|
6773
|
-
submitted_at: data.
|
|
6656
|
+
submitted_at: data.submitted_at,
|
|
6774
6657
|
description: data.description,
|
|
6775
6658
|
document: data.modelId
|
|
6776
6659
|
});
|
|
6777
6660
|
}
|
|
6661
|
+
buildAttachmentPayload(data) {
|
|
6662
|
+
return {
|
|
6663
|
+
...data,
|
|
6664
|
+
document: data.modelId
|
|
6665
|
+
};
|
|
6666
|
+
}
|
|
6778
6667
|
// NOTE: overriding the method from BaseAttachmentService since document attachments get vectorized
|
|
6779
|
-
async
|
|
6668
|
+
async bulkAdd(payloads) {
|
|
6780
6669
|
var _a2;
|
|
6781
6670
|
const { store } = this.client;
|
|
6782
6671
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
@@ -6785,40 +6674,36 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6785
6674
|
const attachmentPayloads = [];
|
|
6786
6675
|
const filePayloads = {};
|
|
6787
6676
|
const sha1ToAttachmentIds = {};
|
|
6788
|
-
for (const
|
|
6789
|
-
const
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
extension: file.name.split(".").pop(),
|
|
6795
|
-
size: file.size
|
|
6796
|
-
};
|
|
6797
|
-
sha1ToAttachmentIds[sha1] = [];
|
|
6798
|
-
await this.client.files.addCache(file, sha1);
|
|
6677
|
+
for (const payload of payloads) {
|
|
6678
|
+
const { documentId, file } = payload;
|
|
6679
|
+
const filePayload = await this.getFilePayload(file);
|
|
6680
|
+
if (!(filePayload.sha1 in filePayloads)) {
|
|
6681
|
+
filePayloads[filePayload.sha1] = filePayload;
|
|
6682
|
+
sha1ToAttachmentIds[filePayload.sha1] = [];
|
|
6799
6683
|
}
|
|
6800
6684
|
const offlineAttachment = this.buildOfflineAttachment({
|
|
6801
6685
|
file,
|
|
6802
|
-
sha1,
|
|
6803
|
-
submittedAt,
|
|
6804
|
-
createdBy,
|
|
6686
|
+
file_sha1: filePayload.sha1,
|
|
6687
|
+
submitted_at: submittedAt,
|
|
6688
|
+
created_by: createdBy,
|
|
6805
6689
|
description: "",
|
|
6806
6690
|
modelId: documentId
|
|
6807
6691
|
});
|
|
6808
6692
|
offlineAttachments.push(offlineAttachment);
|
|
6809
6693
|
attachmentPayloads.push({
|
|
6810
6694
|
offline_id: offlineAttachment.offline_id,
|
|
6811
|
-
|
|
6812
|
-
|
|
6695
|
+
file_name: offlineAttachment.file_name,
|
|
6696
|
+
file_sha1: offlineAttachment.file_sha1,
|
|
6697
|
+
file_extension: filePayload.extension,
|
|
6813
6698
|
description: offlineAttachment.description
|
|
6814
6699
|
});
|
|
6815
|
-
sha1ToAttachmentIds[sha1].push(offlineAttachment.offline_id);
|
|
6700
|
+
sha1ToAttachmentIds[filePayload.sha1].push(offlineAttachment.offline_id);
|
|
6816
6701
|
}
|
|
6817
6702
|
this.dispatch(this.addAttachments(offlineAttachments));
|
|
6818
6703
|
const promise = this.enqueueRequest({
|
|
6819
6704
|
description: "Attach files to document",
|
|
6820
6705
|
method: HttpMethod.POST,
|
|
6821
|
-
url:
|
|
6706
|
+
url: "/document-attachments/bulk/",
|
|
6822
6707
|
payload: {
|
|
6823
6708
|
submitted_at: submittedAt,
|
|
6824
6709
|
attachments: attachmentPayloads,
|
|
@@ -6843,14 +6728,14 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6843
6728
|
});
|
|
6844
6729
|
return [offlineAttachments, promise.then(({ attachments }) => attachments)];
|
|
6845
6730
|
}
|
|
6846
|
-
async
|
|
6847
|
-
return this.
|
|
6731
|
+
async delete(id) {
|
|
6732
|
+
return this._delete(id);
|
|
6848
6733
|
}
|
|
6849
6734
|
makeReadable(attachmnentId) {
|
|
6850
6735
|
void this.enqueueRequest({
|
|
6851
6736
|
description: "Add attachment to AI assistant",
|
|
6852
6737
|
method: HttpMethod.PATCH,
|
|
6853
|
-
url: `/
|
|
6738
|
+
url: `/document-attachments/${attachmnentId}/`,
|
|
6854
6739
|
payload: {
|
|
6855
6740
|
readable_to_assistant: true
|
|
6856
6741
|
},
|
|
@@ -6867,7 +6752,7 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6867
6752
|
blocks: [],
|
|
6868
6753
|
blockers: []
|
|
6869
6754
|
});
|
|
6870
|
-
this.dispatch(
|
|
6755
|
+
this.dispatch(initializeDocumentAttachments(projectDocumentAttachments));
|
|
6871
6756
|
const organizationDocumentAttachments = await this.enqueueRequest({
|
|
6872
6757
|
description: "Get document attachments",
|
|
6873
6758
|
method: HttpMethod.GET,
|
|
@@ -7002,21 +6887,21 @@ class TeamService extends BaseApiService {
|
|
|
7002
6887
|
});
|
|
7003
6888
|
return [offlineUpdatedTeam, promise];
|
|
7004
6889
|
}
|
|
7005
|
-
async delete(
|
|
6890
|
+
async delete(id) {
|
|
7006
6891
|
const { store } = this.client;
|
|
7007
6892
|
const state = store.getState();
|
|
7008
|
-
const team = selectTeamById(
|
|
6893
|
+
const team = selectTeamById(id)(state);
|
|
7009
6894
|
if (!team) {
|
|
7010
|
-
throw new Error(`Expected team with id ${
|
|
6895
|
+
throw new Error(`Expected team with id ${id} to exist`);
|
|
7011
6896
|
}
|
|
7012
|
-
this.dispatch(deleteTeam(
|
|
6897
|
+
this.dispatch(deleteTeam(id));
|
|
7013
6898
|
try {
|
|
7014
6899
|
return await this.enqueueRequest({
|
|
7015
6900
|
description: "Delete team",
|
|
7016
6901
|
method: HttpMethod.DELETE,
|
|
7017
|
-
url: `/organizations/teams/${
|
|
7018
|
-
blockers: [
|
|
7019
|
-
blocks: [
|
|
6902
|
+
url: `/organizations/teams/${id}/`,
|
|
6903
|
+
blockers: [id],
|
|
6904
|
+
blocks: [id]
|
|
7020
6905
|
});
|
|
7021
6906
|
} catch (e) {
|
|
7022
6907
|
this.dispatch(setTeam(team));
|
|
@@ -7111,17 +6996,11 @@ class GeoImageService extends BaseUploadService {
|
|
|
7111
6996
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7112
6997
|
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7113
6998
|
const projectId = payloadWithoutFile.project;
|
|
7114
|
-
const
|
|
7115
|
-
const filePayload = {
|
|
7116
|
-
sha1,
|
|
7117
|
-
file_type: file.type,
|
|
7118
|
-
extension: file.name.split(".").pop(),
|
|
7119
|
-
size: file.size
|
|
7120
|
-
};
|
|
6999
|
+
const filePayload = await this.getFilePayload(file);
|
|
7121
7000
|
const offlineMapImage = offline({
|
|
7122
7001
|
...payloadWithoutFile,
|
|
7123
7002
|
file_name: file.name,
|
|
7124
|
-
file_sha1: sha1,
|
|
7003
|
+
file_sha1: filePayload.sha1,
|
|
7125
7004
|
file: URL.createObjectURL(file),
|
|
7126
7005
|
submitted_at: submittedAt,
|
|
7127
7006
|
created_by: createdBy
|
|
@@ -7164,23 +7043,16 @@ class GeoImageService extends BaseUploadService {
|
|
|
7164
7043
|
const offlineGeoImages = [];
|
|
7165
7044
|
const offlineIds = [];
|
|
7166
7045
|
const geoImagePayloads = [];
|
|
7167
|
-
const
|
|
7046
|
+
const filePayloads = {};
|
|
7168
7047
|
for (const payloadAndFile of payloads) {
|
|
7169
7048
|
const { file, ...payload } = payloadAndFile;
|
|
7170
|
-
const
|
|
7171
|
-
if (!(sha1 in
|
|
7172
|
-
|
|
7173
|
-
sha1,
|
|
7174
|
-
file_type: file.type,
|
|
7175
|
-
extension: file.name.split(".").pop(),
|
|
7176
|
-
size: file.size
|
|
7177
|
-
};
|
|
7178
|
-
await this.client.files.addCache(file, sha1);
|
|
7179
|
-
}
|
|
7049
|
+
const filePayload = await this.getFilePayload(file);
|
|
7050
|
+
if (!(filePayload.sha1 in filePayloads))
|
|
7051
|
+
filePayloads[filePayload.sha1] = filePayload;
|
|
7180
7052
|
const offlineMapImage = offline({
|
|
7181
7053
|
...payload,
|
|
7182
7054
|
file_name: file.name,
|
|
7183
|
-
file_sha1: sha1,
|
|
7055
|
+
file_sha1: filePayload.sha1,
|
|
7184
7056
|
file: URL.createObjectURL(file),
|
|
7185
7057
|
submitted_at: submittedAt,
|
|
7186
7058
|
created_by: createdBy,
|
|
@@ -7209,7 +7081,7 @@ class GeoImageService extends BaseUploadService {
|
|
|
7209
7081
|
submitted_at: submittedAt,
|
|
7210
7082
|
project: projectId,
|
|
7211
7083
|
geo_images: geoImagePayloads,
|
|
7212
|
-
files: Object.values(
|
|
7084
|
+
files: Object.values(filePayloads)
|
|
7213
7085
|
},
|
|
7214
7086
|
blocks: [projectId.toString()],
|
|
7215
7087
|
blockers: offlineIds
|
|
@@ -7246,20 +7118,20 @@ class GeoImageService extends BaseUploadService {
|
|
|
7246
7118
|
});
|
|
7247
7119
|
return [updatedGeoImage, promise];
|
|
7248
7120
|
}
|
|
7249
|
-
async delete(
|
|
7121
|
+
async delete(id) {
|
|
7250
7122
|
const { store } = this.client;
|
|
7251
7123
|
const state = store.getState();
|
|
7252
|
-
const geoImageToDelete = selectGeoImageById(
|
|
7124
|
+
const geoImageToDelete = selectGeoImageById(id)(state);
|
|
7253
7125
|
if (!geoImageToDelete) {
|
|
7254
|
-
throw new Error(`Map image with offline_id ${
|
|
7126
|
+
throw new Error(`Map image with offline_id ${id} does not exist in the store`);
|
|
7255
7127
|
}
|
|
7256
|
-
this.dispatch(deleteGeoImage(
|
|
7128
|
+
this.dispatch(deleteGeoImage(id));
|
|
7257
7129
|
const promise = this.enqueueRequest({
|
|
7258
7130
|
description: "Delete geo image",
|
|
7259
7131
|
method: HttpMethod.DELETE,
|
|
7260
|
-
url: `/geo-images/${
|
|
7261
|
-
blocks: [
|
|
7262
|
-
blockers: [
|
|
7132
|
+
url: `/geo-images/${id}/`,
|
|
7133
|
+
blocks: [id],
|
|
7134
|
+
blockers: [id]
|
|
7263
7135
|
});
|
|
7264
7136
|
promise.catch(() => {
|
|
7265
7137
|
this.dispatch(setGeoImage(geoImageToDelete));
|
|
@@ -7277,7 +7149,7 @@ class GeoImageService extends BaseUploadService {
|
|
|
7277
7149
|
this.dispatch(initializeGeoImages(result));
|
|
7278
7150
|
}
|
|
7279
7151
|
}
|
|
7280
|
-
class IssueAssociationService extends
|
|
7152
|
+
class IssueAssociationService extends BaseApiService {
|
|
7281
7153
|
add(payload) {
|
|
7282
7154
|
var _a2;
|
|
7283
7155
|
const { store } = this.client;
|
|
@@ -7292,7 +7164,7 @@ class IssueAssociationService extends BaseUploadService {
|
|
|
7292
7164
|
const promise = this.enqueueRequest({
|
|
7293
7165
|
description: "Add issue association",
|
|
7294
7166
|
method: HttpMethod.POST,
|
|
7295
|
-
url: "/
|
|
7167
|
+
url: "/issue-associations/",
|
|
7296
7168
|
payload: {
|
|
7297
7169
|
offline_id: offlineIssueAssociation.offline_id,
|
|
7298
7170
|
submitted_at: submittedAt,
|
|
@@ -7322,7 +7194,7 @@ class IssueAssociationService extends BaseUploadService {
|
|
|
7322
7194
|
const promise = this.enqueueRequest({
|
|
7323
7195
|
description: "Delete issue association",
|
|
7324
7196
|
method: HttpMethod.DELETE,
|
|
7325
|
-
url: `/
|
|
7197
|
+
url: `/issue-associations/${id}/`,
|
|
7326
7198
|
blockers: [id],
|
|
7327
7199
|
blocks: []
|
|
7328
7200
|
});
|
|
@@ -7335,14 +7207,854 @@ class IssueAssociationService extends BaseUploadService {
|
|
|
7335
7207
|
const issueAssociations = await this.enqueueRequest({
|
|
7336
7208
|
description: "Fetch issue associations",
|
|
7337
7209
|
method: HttpMethod.GET,
|
|
7338
|
-
url: "/
|
|
7339
|
-
queryParams: {
|
|
7210
|
+
url: "/issue-associations/",
|
|
7211
|
+
queryParams: { project: projectId.toString() },
|
|
7340
7212
|
blockers: [],
|
|
7341
7213
|
blocks: []
|
|
7342
7214
|
});
|
|
7343
7215
|
this.dispatch(initializeIssueAssociations(issueAssociations));
|
|
7344
7216
|
}
|
|
7345
7217
|
}
|
|
7218
|
+
class FormRevisionAttachmentService extends BaseUploadService {
|
|
7219
|
+
async bulkAdd(payloads) {
|
|
7220
|
+
var _a2;
|
|
7221
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7222
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7223
|
+
const filePayloads = {};
|
|
7224
|
+
const offlineFormRevisionAttachments = [];
|
|
7225
|
+
const attachmentPayloads = [];
|
|
7226
|
+
for (const payload of payloads) {
|
|
7227
|
+
const { revisionId, fieldIdentifier, file } = payload;
|
|
7228
|
+
const filePayload = await this.getFilePayload(file);
|
|
7229
|
+
if (!(filePayload.sha1 in filePayloads))
|
|
7230
|
+
filePayloads[filePayload.sha1] = filePayload;
|
|
7231
|
+
const offlineFormRevisionAttachment = offline({
|
|
7232
|
+
file: URL.createObjectURL(file),
|
|
7233
|
+
file_type: file.type,
|
|
7234
|
+
file_name: file.name,
|
|
7235
|
+
file_sha1: filePayload.sha1,
|
|
7236
|
+
created_by: createdBy,
|
|
7237
|
+
form_revision: revisionId,
|
|
7238
|
+
submitted_at: submittedAt,
|
|
7239
|
+
field_identifier: fieldIdentifier
|
|
7240
|
+
});
|
|
7241
|
+
offlineFormRevisionAttachments.push(offlineFormRevisionAttachment);
|
|
7242
|
+
const attachmentPayload = {
|
|
7243
|
+
offline_id: offlineFormRevisionAttachment.offline_id,
|
|
7244
|
+
file_name: file.name,
|
|
7245
|
+
field_identifier: fieldIdentifier,
|
|
7246
|
+
file_extension: filePayload.extension,
|
|
7247
|
+
file_sha1: filePayload.sha1,
|
|
7248
|
+
form_revision: revisionId
|
|
7249
|
+
};
|
|
7250
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7251
|
+
}
|
|
7252
|
+
this.dispatch(addFormRevisionAttachments(offlineFormRevisionAttachments));
|
|
7253
|
+
const promise = this.enqueueRequest({
|
|
7254
|
+
description: "Attach files to form revision",
|
|
7255
|
+
method: HttpMethod.POST,
|
|
7256
|
+
url: "/form-revision-attachments/bulk/",
|
|
7257
|
+
payload: {
|
|
7258
|
+
submitted_at: submittedAt,
|
|
7259
|
+
attachments: attachmentPayloads,
|
|
7260
|
+
files: Object.values(filePayloads)
|
|
7261
|
+
},
|
|
7262
|
+
blockers: offlineFormRevisionAttachments.map((attachment) => attachment.form_revision),
|
|
7263
|
+
blocks: offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
7264
|
+
});
|
|
7265
|
+
promise.then((result) => {
|
|
7266
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
7267
|
+
this.dispatch(updateFormRevisionAttachments(result.attachments));
|
|
7268
|
+
}).catch(() => {
|
|
7269
|
+
this.dispatch(
|
|
7270
|
+
deleteFormRevisionAttachments(
|
|
7271
|
+
offlineFormRevisionAttachments.map((attachment) => attachment.offline_id)
|
|
7272
|
+
)
|
|
7273
|
+
);
|
|
7274
|
+
});
|
|
7275
|
+
return [offlineFormRevisionAttachments, promise.then(({ attachments }) => attachments)];
|
|
7276
|
+
}
|
|
7277
|
+
async refreshStore(projectId, organizationId) {
|
|
7278
|
+
let attachments = [];
|
|
7279
|
+
const projectFormRevisions = await this.enqueueRequest({
|
|
7280
|
+
description: "Fetch project form revision attachments",
|
|
7281
|
+
method: HttpMethod.GET,
|
|
7282
|
+
url: "/form-revision-attachments/",
|
|
7283
|
+
queryParams: {
|
|
7284
|
+
project: projectId.toString()
|
|
7285
|
+
},
|
|
7286
|
+
blockers: [projectId.toString()],
|
|
7287
|
+
blocks: []
|
|
7288
|
+
});
|
|
7289
|
+
attachments = attachments.concat(projectFormRevisions);
|
|
7290
|
+
const organizationFormRevisions = await this.enqueueRequest({
|
|
7291
|
+
description: "Fetch organization form revision attachments",
|
|
7292
|
+
method: HttpMethod.GET,
|
|
7293
|
+
url: "/form-revision-attachments/",
|
|
7294
|
+
queryParams: {
|
|
7295
|
+
organization: organizationId.toString()
|
|
7296
|
+
},
|
|
7297
|
+
blockers: [organizationId.toString()],
|
|
7298
|
+
blocks: []
|
|
7299
|
+
});
|
|
7300
|
+
attachments = attachments.concat(organizationFormRevisions);
|
|
7301
|
+
this.dispatch(initializeFormRevisionAttachments(attachments));
|
|
7302
|
+
}
|
|
7303
|
+
}
|
|
7304
|
+
class FormSubmissionAttachmentService extends BaseUploadService {
|
|
7305
|
+
async bulkAdd(payloads) {
|
|
7306
|
+
var _a2;
|
|
7307
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7308
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7309
|
+
const filePayloads = {};
|
|
7310
|
+
const offlineFormSubmissionAttachments = [];
|
|
7311
|
+
const attachmentPayloads = [];
|
|
7312
|
+
for (const payload of payloads) {
|
|
7313
|
+
const { submissionId, fieldIdentifier, file } = payload;
|
|
7314
|
+
const filePayload = await this.getFilePayload(file);
|
|
7315
|
+
if (!(filePayload.sha1 in filePayloads))
|
|
7316
|
+
filePayloads[filePayload.sha1] = filePayload;
|
|
7317
|
+
const offlineFormSubmissionAttachment = offline({
|
|
7318
|
+
file: URL.createObjectURL(file),
|
|
7319
|
+
file_type: file.type,
|
|
7320
|
+
file_name: file.name,
|
|
7321
|
+
file_sha1: filePayload.sha1,
|
|
7322
|
+
created_by: createdBy,
|
|
7323
|
+
form_submission: submissionId,
|
|
7324
|
+
submitted_at: submittedAt,
|
|
7325
|
+
field_identifier: fieldIdentifier
|
|
7326
|
+
});
|
|
7327
|
+
offlineFormSubmissionAttachments.push(offlineFormSubmissionAttachment);
|
|
7328
|
+
const attachmentPayload = {
|
|
7329
|
+
offline_id: offlineFormSubmissionAttachment.offline_id,
|
|
7330
|
+
file_name: file.name,
|
|
7331
|
+
file_sha1: filePayload.sha1,
|
|
7332
|
+
file_extension: filePayload.extension,
|
|
7333
|
+
field_identifier: fieldIdentifier,
|
|
7334
|
+
form_submission: submissionId
|
|
7335
|
+
};
|
|
7336
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7337
|
+
}
|
|
7338
|
+
this.dispatch(addFormSubmissionAttachments(offlineFormSubmissionAttachments));
|
|
7339
|
+
const promise = this.enqueueRequest({
|
|
7340
|
+
description: "Attach files to form submission",
|
|
7341
|
+
method: HttpMethod.POST,
|
|
7342
|
+
url: "/form-submission-attachments/bulk/",
|
|
7343
|
+
payload: {
|
|
7344
|
+
submitted_at: submittedAt,
|
|
7345
|
+
attachments: attachmentPayloads,
|
|
7346
|
+
files: Object.values(filePayloads)
|
|
7347
|
+
},
|
|
7348
|
+
blockers: offlineFormSubmissionAttachments.map((attachment) => attachment.form_submission),
|
|
7349
|
+
blocks: offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
7350
|
+
});
|
|
7351
|
+
promise.then((result) => {
|
|
7352
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
7353
|
+
this.dispatch(updateFormSubmissionAttachments(result.attachments));
|
|
7354
|
+
}).catch((error) => {
|
|
7355
|
+
this.dispatch(
|
|
7356
|
+
deleteFormSubmissionAttachments(
|
|
7357
|
+
offlineFormSubmissionAttachments.map((attachment) => attachment.offline_id)
|
|
7358
|
+
)
|
|
7359
|
+
);
|
|
7360
|
+
throw error;
|
|
7361
|
+
});
|
|
7362
|
+
return [offlineFormSubmissionAttachments, promise.then(({ attachments }) => attachments)];
|
|
7363
|
+
}
|
|
7364
|
+
async bulkDelete(attachmentsIds) {
|
|
7365
|
+
const { store } = this.client;
|
|
7366
|
+
const state = store.getState();
|
|
7367
|
+
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
7368
|
+
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
7369
|
+
try {
|
|
7370
|
+
await this.enqueueRequest({
|
|
7371
|
+
description: "Delete form submission attachments",
|
|
7372
|
+
method: HttpMethod.DELETE,
|
|
7373
|
+
url: "/form-submission-attachments/bulk/",
|
|
7374
|
+
payload: { attachment_ids: attachmentsIds },
|
|
7375
|
+
blockers: attachmentsIds,
|
|
7376
|
+
blocks: []
|
|
7377
|
+
});
|
|
7378
|
+
} catch (e) {
|
|
7379
|
+
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7380
|
+
throw e;
|
|
7381
|
+
}
|
|
7382
|
+
}
|
|
7383
|
+
async refreshStore(projectId) {
|
|
7384
|
+
const result = await this.enqueueRequest({
|
|
7385
|
+
description: "Get form submission attachments",
|
|
7386
|
+
method: HttpMethod.GET,
|
|
7387
|
+
url: "/form-submission-attachments/",
|
|
7388
|
+
queryParams: {
|
|
7389
|
+
project: projectId.toString()
|
|
7390
|
+
},
|
|
7391
|
+
blockers: [],
|
|
7392
|
+
blocks: []
|
|
7393
|
+
});
|
|
7394
|
+
this.dispatch(initializeFormSubmissionAttachments(result));
|
|
7395
|
+
}
|
|
7396
|
+
}
|
|
7397
|
+
class AssetTypeFieldsAttachmentService extends BaseUploadService {
|
|
7398
|
+
async bulkAdd(payloads) {
|
|
7399
|
+
var _a2;
|
|
7400
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7401
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7402
|
+
const filePayloads = {};
|
|
7403
|
+
const offlineAssetTypeFieldsAttachments = [];
|
|
7404
|
+
const attachmentPayloads = [];
|
|
7405
|
+
for (const payload of payloads) {
|
|
7406
|
+
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7407
|
+
const filePayload = await this.getFilePayload(file);
|
|
7408
|
+
if (!(filePayload.sha1 in filePayloads))
|
|
7409
|
+
filePayloads[filePayload.sha1] = filePayload;
|
|
7410
|
+
const offlineAssetTypeFieldsAttachment = offline({
|
|
7411
|
+
file: URL.createObjectURL(file),
|
|
7412
|
+
file_type: file.type,
|
|
7413
|
+
file_name: file.name,
|
|
7414
|
+
file_sha1: filePayload.sha1,
|
|
7415
|
+
created_by: createdBy,
|
|
7416
|
+
fields_revision: fieldsRevisionId,
|
|
7417
|
+
submitted_at: submittedAt,
|
|
7418
|
+
field_identifier: fieldIdentifier
|
|
7419
|
+
});
|
|
7420
|
+
offlineAssetTypeFieldsAttachments.push(offlineAssetTypeFieldsAttachment);
|
|
7421
|
+
const attachmentPayload = {
|
|
7422
|
+
offline_id: offlineAssetTypeFieldsAttachment.offline_id,
|
|
7423
|
+
file_name: file.name,
|
|
7424
|
+
field_identifier: fieldIdentifier,
|
|
7425
|
+
file_extension: filePayload.extension,
|
|
7426
|
+
file_sha1: filePayload.sha1,
|
|
7427
|
+
fields_revision: fieldsRevisionId
|
|
7428
|
+
};
|
|
7429
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7430
|
+
}
|
|
7431
|
+
this.dispatch(addAssetTypeFieldsAttachments(offlineAssetTypeFieldsAttachments));
|
|
7432
|
+
const promise = this.enqueueRequest({
|
|
7433
|
+
description: "Add asset type fields attachments",
|
|
7434
|
+
method: HttpMethod.POST,
|
|
7435
|
+
url: "/asset-type-fields-attachments/bulk/",
|
|
7436
|
+
payload: {
|
|
7437
|
+
submitted_at: submittedAt,
|
|
7438
|
+
attachments: attachmentPayloads,
|
|
7439
|
+
files: Object.values(filePayloads)
|
|
7440
|
+
},
|
|
7441
|
+
blockers: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
|
|
7442
|
+
blocks: offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7443
|
+
});
|
|
7444
|
+
promise.then((result) => {
|
|
7445
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
7446
|
+
this.dispatch(updateAssetTypeFieldsAttachments(result.attachments));
|
|
7447
|
+
}).catch(() => {
|
|
7448
|
+
this.dispatch(
|
|
7449
|
+
deleteAssetTypeFieldsAttachments(
|
|
7450
|
+
offlineAssetTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7451
|
+
)
|
|
7452
|
+
);
|
|
7453
|
+
});
|
|
7454
|
+
return [offlineAssetTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
|
|
7455
|
+
}
|
|
7456
|
+
async refreshStore(projectId) {
|
|
7457
|
+
const result = await this.enqueueRequest({
|
|
7458
|
+
description: "get asset type fields attachments",
|
|
7459
|
+
method: HttpMethod.GET,
|
|
7460
|
+
url: "/asset-type-fields-attachments/",
|
|
7461
|
+
queryParams: {
|
|
7462
|
+
project: projectId.toString()
|
|
7463
|
+
},
|
|
7464
|
+
blockers: [projectId.toString()],
|
|
7465
|
+
blocks: []
|
|
7466
|
+
});
|
|
7467
|
+
this.dispatch(initializeAssetTypeFieldsAttachments(result));
|
|
7468
|
+
}
|
|
7469
|
+
}
|
|
7470
|
+
class AssetTypeFieldsService extends BaseApiService {
|
|
7471
|
+
add(payload) {
|
|
7472
|
+
var _a2;
|
|
7473
|
+
const { store } = this.client;
|
|
7474
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7475
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7476
|
+
const offlineAssetTypeFields = offline({
|
|
7477
|
+
...payload,
|
|
7478
|
+
created_by: createdBy,
|
|
7479
|
+
submitted_at: submittedAt
|
|
7480
|
+
});
|
|
7481
|
+
this.dispatch(addAssetTypeFields(offlineAssetTypeFields));
|
|
7482
|
+
const promise = this.enqueueRequest({
|
|
7483
|
+
description: "Add Asset Type Fields",
|
|
7484
|
+
method: HttpMethod.POST,
|
|
7485
|
+
url: "/asset-type-fields/",
|
|
7486
|
+
payload: offlineAssetTypeFields,
|
|
7487
|
+
blockers: [offlineAssetTypeFields.asset_type],
|
|
7488
|
+
blocks: [offlineAssetTypeFields.offline_id]
|
|
7489
|
+
});
|
|
7490
|
+
promise.then((response) => {
|
|
7491
|
+
this.dispatch(updateAssetTypeFields(response));
|
|
7492
|
+
}).catch((error) => {
|
|
7493
|
+
this.dispatch(deleteAssetTypeFields(offlineAssetTypeFields.offline_id));
|
|
7494
|
+
throw error;
|
|
7495
|
+
});
|
|
7496
|
+
return [offlineAssetTypeFields, promise];
|
|
7497
|
+
}
|
|
7498
|
+
async refreshStore(projectId) {
|
|
7499
|
+
const result = await this.enqueueRequest({
|
|
7500
|
+
description: "Get Asset Type Fields",
|
|
7501
|
+
method: HttpMethod.GET,
|
|
7502
|
+
url: "/asset-type-fields/",
|
|
7503
|
+
queryParams: {
|
|
7504
|
+
project: projectId.toString()
|
|
7505
|
+
},
|
|
7506
|
+
blockers: [],
|
|
7507
|
+
blocks: []
|
|
7508
|
+
});
|
|
7509
|
+
this.dispatch(initializeAssetTypeFields(result));
|
|
7510
|
+
}
|
|
7511
|
+
}
|
|
7512
|
+
class AssetTypeFieldValuesService extends BaseApiService {
|
|
7513
|
+
add(payload) {
|
|
7514
|
+
var _a2;
|
|
7515
|
+
const { store } = this.client;
|
|
7516
|
+
const state = store.getState();
|
|
7517
|
+
const { values } = separateFilesFromValues(payload.values);
|
|
7518
|
+
const offlineAssetTypeFieldValues = offline({
|
|
7519
|
+
...payload,
|
|
7520
|
+
values,
|
|
7521
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7522
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7523
|
+
});
|
|
7524
|
+
const promise = this.enqueueRequest({
|
|
7525
|
+
description: "Add asset type field values",
|
|
7526
|
+
method: HttpMethod.POST,
|
|
7527
|
+
url: "/asset-type-field-values/",
|
|
7528
|
+
payload: offlineAssetTypeFieldValues,
|
|
7529
|
+
blockers: [payload.asset, payload.fields_revision],
|
|
7530
|
+
blocks: [offlineAssetTypeFieldValues.offline_id]
|
|
7531
|
+
});
|
|
7532
|
+
this.dispatch(addAssetTypeFieldValues(offlineAssetTypeFieldValues));
|
|
7533
|
+
promise.then((result) => {
|
|
7534
|
+
this.dispatch(updateAssetTypeFieldValues(result));
|
|
7535
|
+
return result;
|
|
7536
|
+
}).catch(() => {
|
|
7537
|
+
this.dispatch(deleteAssetTypeFieldValues(offlineAssetTypeFieldValues.offline_id));
|
|
7538
|
+
});
|
|
7539
|
+
return [offlineAssetTypeFieldValues, promise];
|
|
7540
|
+
}
|
|
7541
|
+
bulkAdd(payload, batchSize) {
|
|
7542
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7543
|
+
const { values } = separateFilesFromValues(payload.values);
|
|
7544
|
+
const payloadsBatches = chunkArray(payload.payloads, batchSize);
|
|
7545
|
+
const bulkAddPayloads = payloadsBatches.map((batch) => {
|
|
7546
|
+
return {
|
|
7547
|
+
submitted_at: submittedAt,
|
|
7548
|
+
values,
|
|
7549
|
+
field_values: batch.map((payload2) => {
|
|
7550
|
+
const { values: values2 } = separateFilesFromValues(payload2.values);
|
|
7551
|
+
return offline({
|
|
7552
|
+
...payload2,
|
|
7553
|
+
values: values2
|
|
7554
|
+
});
|
|
7555
|
+
})
|
|
7556
|
+
};
|
|
7557
|
+
});
|
|
7558
|
+
const promises = [];
|
|
7559
|
+
for (const payload2 of bulkAddPayloads) {
|
|
7560
|
+
const assetIds = payload2.field_values.map((x) => x.asset);
|
|
7561
|
+
const assetTypeFieldsIds = payload2.field_values.map((x) => x.fields_revision);
|
|
7562
|
+
const assetTypeFieldValuesIds = payload2.field_values.map((x) => x.offline_id);
|
|
7563
|
+
const promise = this.enqueueRequest({
|
|
7564
|
+
description: "Bulk add asset type field values",
|
|
7565
|
+
method: HttpMethod.POST,
|
|
7566
|
+
url: "/asset-type-field-values/bulk/",
|
|
7567
|
+
payload: payload2,
|
|
7568
|
+
blockers: [...assetIds, ...assetTypeFieldsIds],
|
|
7569
|
+
blocks: assetTypeFieldValuesIds
|
|
7570
|
+
});
|
|
7571
|
+
promises.push(promise);
|
|
7572
|
+
}
|
|
7573
|
+
void Promise.all(promises).then((results) => {
|
|
7574
|
+
this.dispatch(addAssetTypeFieldValuesMany(results.flat()));
|
|
7575
|
+
});
|
|
7576
|
+
return promises;
|
|
7577
|
+
}
|
|
7578
|
+
update(payload) {
|
|
7579
|
+
const { store } = this.client;
|
|
7580
|
+
const state = store.getState();
|
|
7581
|
+
const assetTypeFieldValues = selectAssetTypeFieldValuesById(payload.offline_id)(state);
|
|
7582
|
+
if (!assetTypeFieldValues) {
|
|
7583
|
+
throw new Error(`Expected AssetTypeFieldValues with offline_id ${payload.offline_id} to exist`);
|
|
7584
|
+
}
|
|
7585
|
+
const { values } = separateFilesFromValues(payload.values ?? {});
|
|
7586
|
+
const updatedAssetTypeFieldValues = {
|
|
7587
|
+
...assetTypeFieldValues,
|
|
7588
|
+
...payload,
|
|
7589
|
+
// values could also have a partial update
|
|
7590
|
+
values: {
|
|
7591
|
+
...assetTypeFieldValues.values,
|
|
7592
|
+
...values
|
|
7593
|
+
}
|
|
7594
|
+
};
|
|
7595
|
+
this.dispatch(updateAssetTypeFieldValues(updatedAssetTypeFieldValues));
|
|
7596
|
+
const promise = this.enqueueRequest({
|
|
7597
|
+
description: "Delete asset type field values",
|
|
7598
|
+
method: HttpMethod.PATCH,
|
|
7599
|
+
url: `/asset-type-field-values/${payload.offline_id}/`,
|
|
7600
|
+
payload,
|
|
7601
|
+
blockers: [
|
|
7602
|
+
updatedAssetTypeFieldValues.offline_id,
|
|
7603
|
+
updatedAssetTypeFieldValues.fields_revision,
|
|
7604
|
+
updatedAssetTypeFieldValues.asset
|
|
7605
|
+
],
|
|
7606
|
+
blocks: [updatedAssetTypeFieldValues.offline_id]
|
|
7607
|
+
});
|
|
7608
|
+
promise.then((result) => {
|
|
7609
|
+
this.dispatch(updateAssetTypeFieldValues(result));
|
|
7610
|
+
}).catch(() => {
|
|
7611
|
+
this.dispatch(updateAssetTypeFieldValues(assetTypeFieldValues));
|
|
7612
|
+
});
|
|
7613
|
+
return [updatedAssetTypeFieldValues, promise];
|
|
7614
|
+
}
|
|
7615
|
+
async delete(id) {
|
|
7616
|
+
const { store } = this.client;
|
|
7617
|
+
const state = store.getState();
|
|
7618
|
+
const assetTypeFieldValues = selectAssetTypeFieldValuesById(id)(state);
|
|
7619
|
+
if (!assetTypeFieldValues) {
|
|
7620
|
+
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
7621
|
+
}
|
|
7622
|
+
const assetTypeFieldValuesAttachments = selectAttachmentsOfAssetTypeFieldValues(id)(state);
|
|
7623
|
+
this.dispatch(deleteAssetTypeFieldValues(id));
|
|
7624
|
+
this.dispatch(deleteAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments.map((x) => x.offline_id)));
|
|
7625
|
+
try {
|
|
7626
|
+
await this.enqueueRequest({
|
|
7627
|
+
description: "Delete asset type field values",
|
|
7628
|
+
method: HttpMethod.DELETE,
|
|
7629
|
+
url: `/asset-type-field-values/${id}/`,
|
|
7630
|
+
blockers: [id],
|
|
7631
|
+
blocks: []
|
|
7632
|
+
});
|
|
7633
|
+
} catch (e) {
|
|
7634
|
+
this.dispatch(addAssetTypeFieldValues(assetTypeFieldValues));
|
|
7635
|
+
this.dispatch(addAssetTypeFieldValuesAttachments(assetTypeFieldValuesAttachments));
|
|
7636
|
+
throw e;
|
|
7637
|
+
}
|
|
7638
|
+
}
|
|
7639
|
+
async refreshStore(projectId) {
|
|
7640
|
+
const result = await this.enqueueRequest({
|
|
7641
|
+
description: "Get asset type field values",
|
|
7642
|
+
method: HttpMethod.GET,
|
|
7643
|
+
url: "/asset-type-field-values/",
|
|
7644
|
+
queryParams: {
|
|
7645
|
+
project: projectId.toString()
|
|
7646
|
+
},
|
|
7647
|
+
blockers: [],
|
|
7648
|
+
blocks: []
|
|
7649
|
+
});
|
|
7650
|
+
this.dispatch(initializeAssetTypeFieldValues(result));
|
|
7651
|
+
}
|
|
7652
|
+
}
|
|
7653
|
+
class AssetTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
7654
|
+
async bulkAdd(payloads) {
|
|
7655
|
+
var _a2;
|
|
7656
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7657
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7658
|
+
const filePayloads = {};
|
|
7659
|
+
const offlineAssetTypeFieldValuesAttachments = [];
|
|
7660
|
+
const attachmentPayloads = [];
|
|
7661
|
+
for (const payload of payloads) {
|
|
7662
|
+
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7663
|
+
const filePayload = await this.getFilePayload(file);
|
|
7664
|
+
if (!(filePayload.sha1 in filePayloads))
|
|
7665
|
+
filePayloads[filePayload.sha1] = filePayload;
|
|
7666
|
+
const offlineAssetTypeFieldValuesAttachment = offline({
|
|
7667
|
+
file: URL.createObjectURL(file),
|
|
7668
|
+
file_type: file.type,
|
|
7669
|
+
file_name: file.name,
|
|
7670
|
+
file_sha1: filePayload.sha1,
|
|
7671
|
+
created_by: createdBy,
|
|
7672
|
+
field_values: fieldValuesId,
|
|
7673
|
+
submitted_at: submittedAt,
|
|
7674
|
+
field_identifier: fieldIdentifier
|
|
7675
|
+
});
|
|
7676
|
+
offlineAssetTypeFieldValuesAttachments.push(offlineAssetTypeFieldValuesAttachment);
|
|
7677
|
+
const attachmentPayload = {
|
|
7678
|
+
offline_id: offlineAssetTypeFieldValuesAttachment.offline_id,
|
|
7679
|
+
file_name: file.name,
|
|
7680
|
+
file_sha1: filePayload.sha1,
|
|
7681
|
+
file_extension: filePayload.extension,
|
|
7682
|
+
field_identifier: fieldIdentifier,
|
|
7683
|
+
field_values: fieldValuesId
|
|
7684
|
+
};
|
|
7685
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7686
|
+
}
|
|
7687
|
+
this.dispatch(addAssetTypeFieldValuesAttachments(offlineAssetTypeFieldValuesAttachments));
|
|
7688
|
+
const promise = this.enqueueRequest({
|
|
7689
|
+
description: "Add asset type field values attachments",
|
|
7690
|
+
method: HttpMethod.POST,
|
|
7691
|
+
url: "/asset-type-field-values-attachments/bulk/",
|
|
7692
|
+
payload: {
|
|
7693
|
+
submitted_at: submittedAt,
|
|
7694
|
+
attachments: attachmentPayloads,
|
|
7695
|
+
files: Object.values(filePayloads)
|
|
7696
|
+
},
|
|
7697
|
+
blockers: offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.field_values),
|
|
7698
|
+
blocks: offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7699
|
+
});
|
|
7700
|
+
promise.then(({ presigned_urls, attachments }) => {
|
|
7701
|
+
this.processPresignedUrls(presigned_urls);
|
|
7702
|
+
this.dispatch(updateAssetTypeFieldValuesAttachments(attachments));
|
|
7703
|
+
}).catch((error) => {
|
|
7704
|
+
this.dispatch(
|
|
7705
|
+
deleteAssetTypeFieldValuesAttachments(
|
|
7706
|
+
offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7707
|
+
)
|
|
7708
|
+
);
|
|
7709
|
+
throw error;
|
|
7710
|
+
});
|
|
7711
|
+
return [offlineAssetTypeFieldValuesAttachments, promise.then(({ attachments }) => attachments)];
|
|
7712
|
+
}
|
|
7713
|
+
async bulkDelete(ids) {
|
|
7714
|
+
const { store } = this.client;
|
|
7715
|
+
const state = store.getState();
|
|
7716
|
+
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(ids)(state);
|
|
7717
|
+
this.dispatch(deleteFormSubmissionAttachments(ids));
|
|
7718
|
+
try {
|
|
7719
|
+
await this.enqueueRequest({
|
|
7720
|
+
description: "Delete asset type field values attachments",
|
|
7721
|
+
method: HttpMethod.DELETE,
|
|
7722
|
+
url: "/asset-type-field-values-attachments/bulk/",
|
|
7723
|
+
payload: { attachment_ids: ids },
|
|
7724
|
+
blockers: ids,
|
|
7725
|
+
blocks: []
|
|
7726
|
+
});
|
|
7727
|
+
} catch (e) {
|
|
7728
|
+
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7729
|
+
throw e;
|
|
7730
|
+
}
|
|
7731
|
+
}
|
|
7732
|
+
async refreshStore(projectId) {
|
|
7733
|
+
const result = await this.enqueueRequest({
|
|
7734
|
+
description: "Gfet asset type field values attachments",
|
|
7735
|
+
method: HttpMethod.GET,
|
|
7736
|
+
url: "/asset-type-field-values-attachments/",
|
|
7737
|
+
queryParams: {
|
|
7738
|
+
project: projectId.toString()
|
|
7739
|
+
},
|
|
7740
|
+
blockers: [],
|
|
7741
|
+
blocks: []
|
|
7742
|
+
});
|
|
7743
|
+
this.dispatch(initializeAssetTypeFieldValuesAttachments(result));
|
|
7744
|
+
}
|
|
7745
|
+
}
|
|
7746
|
+
class IssueTypeFieldsAttachmentService extends BaseUploadService {
|
|
7747
|
+
async bulkAdd(payloads) {
|
|
7748
|
+
var _a2;
|
|
7749
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7750
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7751
|
+
const filePayloads = {};
|
|
7752
|
+
const offlineIssueTypeFieldsAttachments = [];
|
|
7753
|
+
const attachmentPayloads = [];
|
|
7754
|
+
for (const payload of payloads) {
|
|
7755
|
+
const { fieldsRevisionId, fieldIdentifier, file } = payload;
|
|
7756
|
+
const filePayload = await this.getFilePayload(file);
|
|
7757
|
+
if (!(filePayload.sha1 in filePayloads))
|
|
7758
|
+
filePayloads[filePayload.sha1] = filePayload;
|
|
7759
|
+
const offlineIssueTypeFieldsAttachment = offline({
|
|
7760
|
+
file: URL.createObjectURL(file),
|
|
7761
|
+
file_type: file.type,
|
|
7762
|
+
file_name: file.name,
|
|
7763
|
+
file_sha1: filePayload.sha1,
|
|
7764
|
+
created_by: createdBy,
|
|
7765
|
+
fields_revision: fieldsRevisionId,
|
|
7766
|
+
submitted_at: submittedAt,
|
|
7767
|
+
field_identifier: fieldIdentifier
|
|
7768
|
+
});
|
|
7769
|
+
offlineIssueTypeFieldsAttachments.push(offlineIssueTypeFieldsAttachment);
|
|
7770
|
+
const attachmentPayload = {
|
|
7771
|
+
offline_id: offlineIssueTypeFieldsAttachment.offline_id,
|
|
7772
|
+
file_name: file.name,
|
|
7773
|
+
file_extension: filePayload.extension,
|
|
7774
|
+
field_identifier: fieldIdentifier,
|
|
7775
|
+
file_sha1: filePayload.sha1,
|
|
7776
|
+
fields_revision: fieldsRevisionId
|
|
7777
|
+
};
|
|
7778
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7779
|
+
}
|
|
7780
|
+
this.dispatch(addIssueTypeFieldsAttachments(offlineIssueTypeFieldsAttachments));
|
|
7781
|
+
const promise = this.enqueueRequest({
|
|
7782
|
+
description: "Add issue type fields attachments",
|
|
7783
|
+
method: HttpMethod.POST,
|
|
7784
|
+
url: "/issue-type-fields-attachments/bulk/",
|
|
7785
|
+
payload: {
|
|
7786
|
+
submitted_at: submittedAt,
|
|
7787
|
+
attachments: attachmentPayloads,
|
|
7788
|
+
files: Object.values(filePayloads)
|
|
7789
|
+
},
|
|
7790
|
+
blockers: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.fields_revision),
|
|
7791
|
+
blocks: offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7792
|
+
});
|
|
7793
|
+
promise.then((result) => {
|
|
7794
|
+
this.processPresignedUrls(result.presigned_urls);
|
|
7795
|
+
this.dispatch(updateIssueTypeFieldsAttachments(result.attachments));
|
|
7796
|
+
}).catch(() => {
|
|
7797
|
+
this.dispatch(
|
|
7798
|
+
deleteIssueTypeFieldsAttachments(
|
|
7799
|
+
offlineIssueTypeFieldsAttachments.map((attachment) => attachment.offline_id)
|
|
7800
|
+
)
|
|
7801
|
+
);
|
|
7802
|
+
});
|
|
7803
|
+
return [offlineIssueTypeFieldsAttachments, promise.then(({ attachments }) => attachments)];
|
|
7804
|
+
}
|
|
7805
|
+
async refreshStore(organizationId) {
|
|
7806
|
+
const result = await this.enqueueRequest({
|
|
7807
|
+
description: "get issue type fields attachments",
|
|
7808
|
+
method: HttpMethod.GET,
|
|
7809
|
+
url: "/issue-type-fields-attachments/",
|
|
7810
|
+
queryParams: {
|
|
7811
|
+
organization: organizationId.toString()
|
|
7812
|
+
},
|
|
7813
|
+
blockers: [organizationId.toString()],
|
|
7814
|
+
blocks: []
|
|
7815
|
+
});
|
|
7816
|
+
this.dispatch(initializeIssueTypeFieldsAttachments(result));
|
|
7817
|
+
}
|
|
7818
|
+
}
|
|
7819
|
+
class IssueTypeFieldsService extends BaseApiService {
|
|
7820
|
+
add(payload) {
|
|
7821
|
+
var _a2;
|
|
7822
|
+
const { store } = this.client;
|
|
7823
|
+
const createdBy = (_a2 = store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7824
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7825
|
+
const offlineIssueTypeFields = offline({
|
|
7826
|
+
...payload,
|
|
7827
|
+
created_by: createdBy,
|
|
7828
|
+
submitted_at: submittedAt
|
|
7829
|
+
});
|
|
7830
|
+
this.dispatch(addIssueTypeFields(offlineIssueTypeFields));
|
|
7831
|
+
const promise = this.enqueueRequest({
|
|
7832
|
+
description: "Add Issue Type Fields",
|
|
7833
|
+
method: HttpMethod.POST,
|
|
7834
|
+
url: "/issue-type-fields/",
|
|
7835
|
+
payload: offlineIssueTypeFields,
|
|
7836
|
+
blockers: [offlineIssueTypeFields.issue_type],
|
|
7837
|
+
blocks: [offlineIssueTypeFields.offline_id]
|
|
7838
|
+
});
|
|
7839
|
+
promise.then((response) => {
|
|
7840
|
+
this.dispatch(updateIssueTypeFields(response));
|
|
7841
|
+
}).catch((error) => {
|
|
7842
|
+
this.dispatch(deleteIssueTypeFields(offlineIssueTypeFields.offline_id));
|
|
7843
|
+
throw error;
|
|
7844
|
+
});
|
|
7845
|
+
return [offlineIssueTypeFields, promise];
|
|
7846
|
+
}
|
|
7847
|
+
async refreshStore(organizationId) {
|
|
7848
|
+
const result = await this.enqueueRequest({
|
|
7849
|
+
description: "Get Issue Type Fields",
|
|
7850
|
+
method: HttpMethod.GET,
|
|
7851
|
+
url: "/issue-type-fields/",
|
|
7852
|
+
queryParams: {
|
|
7853
|
+
organization: organizationId.toString()
|
|
7854
|
+
},
|
|
7855
|
+
blockers: [],
|
|
7856
|
+
blocks: []
|
|
7857
|
+
});
|
|
7858
|
+
this.dispatch(initializeIssueTypeFields(result));
|
|
7859
|
+
}
|
|
7860
|
+
}
|
|
7861
|
+
class IssueTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
7862
|
+
async bulkAdd(payloads) {
|
|
7863
|
+
var _a2;
|
|
7864
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7865
|
+
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7866
|
+
const filePayloads = {};
|
|
7867
|
+
const offlineIssueTypeFieldValuesAttachments = [];
|
|
7868
|
+
const attachmentPayloads = [];
|
|
7869
|
+
for (const payload of payloads) {
|
|
7870
|
+
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7871
|
+
const filePayload = await this.getFilePayload(file);
|
|
7872
|
+
if (!(filePayload.sha1 in filePayloads))
|
|
7873
|
+
filePayloads[filePayload.sha1] = filePayload;
|
|
7874
|
+
const offlineIssueTypeFieldValuesAttachment = offline({
|
|
7875
|
+
file: URL.createObjectURL(file),
|
|
7876
|
+
file_type: file.type,
|
|
7877
|
+
file_name: file.name,
|
|
7878
|
+
file_sha1: filePayload.sha1,
|
|
7879
|
+
created_by: createdBy,
|
|
7880
|
+
field_values: fieldValuesId,
|
|
7881
|
+
submitted_at: submittedAt,
|
|
7882
|
+
field_identifier: fieldIdentifier
|
|
7883
|
+
});
|
|
7884
|
+
offlineIssueTypeFieldValuesAttachments.push(offlineIssueTypeFieldValuesAttachment);
|
|
7885
|
+
const attachmentPayload = {
|
|
7886
|
+
offline_id: offlineIssueTypeFieldValuesAttachment.offline_id,
|
|
7887
|
+
file_name: file.name,
|
|
7888
|
+
file_sha1: filePayload.sha1,
|
|
7889
|
+
file_extension: filePayload.extension,
|
|
7890
|
+
field_identifier: fieldIdentifier,
|
|
7891
|
+
field_values: fieldValuesId
|
|
7892
|
+
};
|
|
7893
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7894
|
+
}
|
|
7895
|
+
this.dispatch(addIssueTypeFieldValuesAttachments(offlineIssueTypeFieldValuesAttachments));
|
|
7896
|
+
const promise = this.enqueueRequest({
|
|
7897
|
+
description: "Add issue type field values attachments",
|
|
7898
|
+
method: HttpMethod.POST,
|
|
7899
|
+
url: "/issue-type-field-values-attachments/bulk/",
|
|
7900
|
+
payload: {
|
|
7901
|
+
submitted_at: submittedAt,
|
|
7902
|
+
attachments: attachmentPayloads,
|
|
7903
|
+
files: Object.values(filePayloads)
|
|
7904
|
+
},
|
|
7905
|
+
blockers: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.field_values),
|
|
7906
|
+
blocks: offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7907
|
+
});
|
|
7908
|
+
promise.then(({ presigned_urls, attachments }) => {
|
|
7909
|
+
this.processPresignedUrls(presigned_urls);
|
|
7910
|
+
this.dispatch(updateIssueTypeFieldValuesAttachments(attachments));
|
|
7911
|
+
}).catch((error) => {
|
|
7912
|
+
this.dispatch(
|
|
7913
|
+
deleteIssueTypeFieldValuesAttachments(
|
|
7914
|
+
offlineIssueTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7915
|
+
)
|
|
7916
|
+
);
|
|
7917
|
+
throw error;
|
|
7918
|
+
});
|
|
7919
|
+
return [offlineIssueTypeFieldValuesAttachments, promise.then(({ attachments }) => attachments)];
|
|
7920
|
+
}
|
|
7921
|
+
async bulkDelete(attachmentsIds) {
|
|
7922
|
+
const { store } = this.client;
|
|
7923
|
+
const state = store.getState();
|
|
7924
|
+
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
7925
|
+
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
7926
|
+
try {
|
|
7927
|
+
await this.enqueueRequest({
|
|
7928
|
+
description: "Delete issue type field values attachments",
|
|
7929
|
+
method: HttpMethod.DELETE,
|
|
7930
|
+
url: "/issue-type-field-values-attachments/bulk/",
|
|
7931
|
+
payload: { attachment_ids: attachmentsIds },
|
|
7932
|
+
blockers: attachmentsIds,
|
|
7933
|
+
blocks: []
|
|
7934
|
+
});
|
|
7935
|
+
} catch (e) {
|
|
7936
|
+
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7937
|
+
throw e;
|
|
7938
|
+
}
|
|
7939
|
+
}
|
|
7940
|
+
async refreshStore(projectId) {
|
|
7941
|
+
const result = await this.enqueueRequest({
|
|
7942
|
+
description: "Get issue type field values attachments",
|
|
7943
|
+
method: HttpMethod.GET,
|
|
7944
|
+
url: "/issue-type-field-values-attachments/",
|
|
7945
|
+
queryParams: {
|
|
7946
|
+
project: projectId.toString()
|
|
7947
|
+
},
|
|
7948
|
+
blockers: [],
|
|
7949
|
+
blocks: []
|
|
7950
|
+
});
|
|
7951
|
+
this.dispatch(initializeIssueTypeFieldValuesAttachments(result));
|
|
7952
|
+
}
|
|
7953
|
+
}
|
|
7954
|
+
class IssueTypeFieldValuesService extends BaseApiService {
|
|
7955
|
+
add(payload) {
|
|
7956
|
+
var _a2;
|
|
7957
|
+
const { store } = this.client;
|
|
7958
|
+
const state = store.getState();
|
|
7959
|
+
const { values } = separateFilesFromValues(payload.values);
|
|
7960
|
+
const offlineIssueTypeFieldValues = offline({
|
|
7961
|
+
...payload,
|
|
7962
|
+
values,
|
|
7963
|
+
created_by: (_a2 = state.userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7964
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7965
|
+
});
|
|
7966
|
+
const promise = this.enqueueRequest({
|
|
7967
|
+
description: "Add issue type field values",
|
|
7968
|
+
method: HttpMethod.POST,
|
|
7969
|
+
url: "/issue-type-field-values/",
|
|
7970
|
+
payload: offlineIssueTypeFieldValues,
|
|
7971
|
+
blockers: [payload.issue, payload.fields_revision],
|
|
7972
|
+
blocks: [offlineIssueTypeFieldValues.offline_id]
|
|
7973
|
+
});
|
|
7974
|
+
this.dispatch(addIssueTypeFieldValues(offlineIssueTypeFieldValues));
|
|
7975
|
+
promise.then((result) => {
|
|
7976
|
+
this.dispatch(updateIssueTypeFieldValues(result));
|
|
7977
|
+
return result;
|
|
7978
|
+
}).catch(() => {
|
|
7979
|
+
this.dispatch(deleteIssueTypeFieldValues(offlineIssueTypeFieldValues.offline_id));
|
|
7980
|
+
});
|
|
7981
|
+
return [offlineIssueTypeFieldValues, promise];
|
|
7982
|
+
}
|
|
7983
|
+
update(payload) {
|
|
7984
|
+
const { store } = this.client;
|
|
7985
|
+
const state = store.getState();
|
|
7986
|
+
const issueTypeFieldValues = selectIssueTypeFieldValuesById(payload.offline_id)(state);
|
|
7987
|
+
if (!issueTypeFieldValues) {
|
|
7988
|
+
throw new Error(`Expected IssueTypeFieldValues with offline_id ${payload.offline_id} to exist`);
|
|
7989
|
+
}
|
|
7990
|
+
const { values } = separateFilesFromValues(payload.values ?? {});
|
|
7991
|
+
const updatedIssueTypeFieldValues = {
|
|
7992
|
+
...issueTypeFieldValues,
|
|
7993
|
+
...payload,
|
|
7994
|
+
// values could also have a partial update
|
|
7995
|
+
values: {
|
|
7996
|
+
...issueTypeFieldValues.values,
|
|
7997
|
+
...values
|
|
7998
|
+
}
|
|
7999
|
+
};
|
|
8000
|
+
this.dispatch(updateIssueTypeFieldValues(updatedIssueTypeFieldValues));
|
|
8001
|
+
const promise = this.enqueueRequest({
|
|
8002
|
+
description: "Update issue type field values",
|
|
8003
|
+
method: HttpMethod.PATCH,
|
|
8004
|
+
url: `/issue-type-field-values/${payload.offline_id}/`,
|
|
8005
|
+
payload,
|
|
8006
|
+
blockers: [
|
|
8007
|
+
updatedIssueTypeFieldValues.offline_id,
|
|
8008
|
+
updatedIssueTypeFieldValues.fields_revision,
|
|
8009
|
+
updatedIssueTypeFieldValues.issue
|
|
8010
|
+
],
|
|
8011
|
+
blocks: [updatedIssueTypeFieldValues.offline_id]
|
|
8012
|
+
});
|
|
8013
|
+
promise.then((result) => {
|
|
8014
|
+
this.dispatch(updateIssueTypeFieldValues(result));
|
|
8015
|
+
}).catch(() => {
|
|
8016
|
+
this.dispatch(updateIssueTypeFieldValues(issueTypeFieldValues));
|
|
8017
|
+
});
|
|
8018
|
+
return [updatedIssueTypeFieldValues, promise];
|
|
8019
|
+
}
|
|
8020
|
+
async delete(id) {
|
|
8021
|
+
const { store } = this.client;
|
|
8022
|
+
const state = store.getState();
|
|
8023
|
+
const issueTypeFieldValues = selectIssueTypeFieldValuesById(id)(state);
|
|
8024
|
+
if (!issueTypeFieldValues) {
|
|
8025
|
+
throw new Error(`Expected submission with offline_id ${id} to exist`);
|
|
8026
|
+
}
|
|
8027
|
+
const issueTypeFieldValuesAttachments = selectAttachmentsOfIssueTypeFieldValues(id)(state);
|
|
8028
|
+
this.dispatch(deleteIssueTypeFieldValues(id));
|
|
8029
|
+
this.dispatch(deleteIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments.map((x) => x.offline_id)));
|
|
8030
|
+
try {
|
|
8031
|
+
await this.enqueueRequest({
|
|
8032
|
+
description: "Delete issue type field values",
|
|
8033
|
+
method: HttpMethod.DELETE,
|
|
8034
|
+
url: `/issue-type-field-values/${id}/`,
|
|
8035
|
+
blockers: [id],
|
|
8036
|
+
blocks: []
|
|
8037
|
+
});
|
|
8038
|
+
} catch (e) {
|
|
8039
|
+
this.dispatch(addIssueTypeFieldValues(issueTypeFieldValues));
|
|
8040
|
+
this.dispatch(addIssueTypeFieldValuesAttachments(issueTypeFieldValuesAttachments));
|
|
8041
|
+
throw e;
|
|
8042
|
+
}
|
|
8043
|
+
}
|
|
8044
|
+
async refreshStore(projectId) {
|
|
8045
|
+
const result = await this.enqueueRequest({
|
|
8046
|
+
description: "Get issue type field values",
|
|
8047
|
+
method: HttpMethod.GET,
|
|
8048
|
+
url: "/issue-type-field-values/",
|
|
8049
|
+
queryParams: {
|
|
8050
|
+
project: projectId.toString()
|
|
8051
|
+
},
|
|
8052
|
+
blockers: [],
|
|
8053
|
+
blocks: []
|
|
8054
|
+
});
|
|
8055
|
+
this.dispatch(initializeIssueTypeFieldValues(result));
|
|
8056
|
+
}
|
|
8057
|
+
}
|
|
7346
8058
|
var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
|
|
7347
8059
|
VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
|
|
7348
8060
|
VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
|
|
@@ -7360,6 +8072,10 @@ export {
|
|
|
7360
8072
|
AssetStageCompletionService,
|
|
7361
8073
|
AssetStageService,
|
|
7362
8074
|
AssetTypeAttachmentService,
|
|
8075
|
+
AssetTypeFieldValuesAttachmentService,
|
|
8076
|
+
AssetTypeFieldValuesService,
|
|
8077
|
+
AssetTypeFieldsAttachmentService,
|
|
8078
|
+
AssetTypeFieldsService,
|
|
7363
8079
|
AssetTypeService,
|
|
7364
8080
|
AttachmentModel,
|
|
7365
8081
|
BaseApiService,
|
|
@@ -7375,7 +8091,9 @@ export {
|
|
|
7375
8091
|
EmailDomainsService,
|
|
7376
8092
|
EmailVerificationService,
|
|
7377
8093
|
FileService,
|
|
8094
|
+
FormRevisionAttachmentService,
|
|
7378
8095
|
FormService,
|
|
8096
|
+
FormSubmissionAttachmentService,
|
|
7379
8097
|
FormSubmissionService,
|
|
7380
8098
|
GREEN,
|
|
7381
8099
|
GeoImageService,
|
|
@@ -7386,6 +8104,10 @@ export {
|
|
|
7386
8104
|
IssuePriority,
|
|
7387
8105
|
IssueService,
|
|
7388
8106
|
IssueStatus,
|
|
8107
|
+
IssueTypeFieldValuesAttachmentService,
|
|
8108
|
+
IssueTypeFieldValuesService,
|
|
8109
|
+
IssueTypeFieldsAttachmentService,
|
|
8110
|
+
IssueTypeFieldsService,
|
|
7389
8111
|
IssueTypeService,
|
|
7390
8112
|
IssueUpdateChange,
|
|
7391
8113
|
IssueUpdateService,
|
|
@@ -7425,6 +8147,14 @@ export {
|
|
|
7425
8147
|
addAssetType,
|
|
7426
8148
|
addAssetTypeAttachment,
|
|
7427
8149
|
addAssetTypeAttachments,
|
|
8150
|
+
addAssetTypeFieldValues,
|
|
8151
|
+
addAssetTypeFieldValuesAttachment,
|
|
8152
|
+
addAssetTypeFieldValuesAttachments,
|
|
8153
|
+
addAssetTypeFieldValuesMany,
|
|
8154
|
+
addAssetTypeFields,
|
|
8155
|
+
addAssetTypeFieldsAttachment,
|
|
8156
|
+
addAssetTypeFieldsAttachments,
|
|
8157
|
+
addAssetTypeFieldsMany,
|
|
7428
8158
|
addAssetTypes,
|
|
7429
8159
|
addAssets,
|
|
7430
8160
|
addCategory,
|
|
@@ -7453,6 +8183,14 @@ export {
|
|
|
7453
8183
|
addIssueComment,
|
|
7454
8184
|
addIssueComments,
|
|
7455
8185
|
addIssueType,
|
|
8186
|
+
addIssueTypeFieldValues,
|
|
8187
|
+
addIssueTypeFieldValuesAttachment,
|
|
8188
|
+
addIssueTypeFieldValuesAttachments,
|
|
8189
|
+
addIssueTypeFieldValuesMany,
|
|
8190
|
+
addIssueTypeFields,
|
|
8191
|
+
addIssueTypeFieldsAttachment,
|
|
8192
|
+
addIssueTypeFieldsAttachments,
|
|
8193
|
+
addIssueTypeFieldsMany,
|
|
7456
8194
|
addIssueUpdate,
|
|
7457
8195
|
addIssueUpdates,
|
|
7458
8196
|
addIssues,
|
|
@@ -7478,6 +8216,14 @@ export {
|
|
|
7478
8216
|
assetStageSlice,
|
|
7479
8217
|
assetTypeAttachmentReducer,
|
|
7480
8218
|
assetTypeAttachmentSlice,
|
|
8219
|
+
assetTypeFieldValuesAttachmentReducer,
|
|
8220
|
+
assetTypeFieldValuesAttachmentSlice,
|
|
8221
|
+
assetTypeFieldValuesReducer,
|
|
8222
|
+
assetTypeFieldValuesSlice,
|
|
8223
|
+
assetTypeFieldsAttachmentReducer,
|
|
8224
|
+
assetTypeFieldsAttachmentSlice,
|
|
8225
|
+
assetTypeFieldsReducer,
|
|
8226
|
+
assetTypeFieldsSlice,
|
|
7481
8227
|
assetTypeReducer,
|
|
7482
8228
|
assetTypeSlice,
|
|
7483
8229
|
authReducer,
|
|
@@ -7506,6 +8252,14 @@ export {
|
|
|
7506
8252
|
deleteAssetType,
|
|
7507
8253
|
deleteAssetTypeAttachment,
|
|
7508
8254
|
deleteAssetTypeAttachments,
|
|
8255
|
+
deleteAssetTypeFieldValues,
|
|
8256
|
+
deleteAssetTypeFieldValuesAttachment,
|
|
8257
|
+
deleteAssetTypeFieldValuesAttachments,
|
|
8258
|
+
deleteAssetTypeFieldValuesMany,
|
|
8259
|
+
deleteAssetTypeFields,
|
|
8260
|
+
deleteAssetTypeFieldsAttachment,
|
|
8261
|
+
deleteAssetTypeFieldsAttachments,
|
|
8262
|
+
deleteAssetTypeFieldsMany,
|
|
7509
8263
|
deleteAssetTypes,
|
|
7510
8264
|
deleteAssets,
|
|
7511
8265
|
deleteCategory,
|
|
@@ -7530,6 +8284,14 @@ export {
|
|
|
7530
8284
|
deleteIssueAttachments,
|
|
7531
8285
|
deleteIssueComment,
|
|
7532
8286
|
deleteIssueComments,
|
|
8287
|
+
deleteIssueTypeFieldValues,
|
|
8288
|
+
deleteIssueTypeFieldValuesAttachment,
|
|
8289
|
+
deleteIssueTypeFieldValuesAttachments,
|
|
8290
|
+
deleteIssueTypeFieldValuesMany,
|
|
8291
|
+
deleteIssueTypeFields,
|
|
8292
|
+
deleteIssueTypeFieldsAttachment,
|
|
8293
|
+
deleteIssueTypeFieldsAttachments,
|
|
8294
|
+
deleteIssueTypeFieldsMany,
|
|
7533
8295
|
deleteIssueUpdate,
|
|
7534
8296
|
deleteIssueUpdates,
|
|
7535
8297
|
deleteIssues,
|
|
@@ -7586,6 +8348,10 @@ export {
|
|
|
7586
8348
|
initializeAssetStageCompletions,
|
|
7587
8349
|
initializeAssetStages,
|
|
7588
8350
|
initializeAssetTypeAttachments,
|
|
8351
|
+
initializeAssetTypeFieldValues,
|
|
8352
|
+
initializeAssetTypeFieldValuesAttachments,
|
|
8353
|
+
initializeAssetTypeFields,
|
|
8354
|
+
initializeAssetTypeFieldsAttachments,
|
|
7589
8355
|
initializeAssetTypes,
|
|
7590
8356
|
initializeAssets,
|
|
7591
8357
|
initializeCategories,
|
|
@@ -7600,6 +8366,10 @@ export {
|
|
|
7600
8366
|
initializeGeoImages,
|
|
7601
8367
|
initializeIssueAssociations,
|
|
7602
8368
|
initializeIssueAttachments,
|
|
8369
|
+
initializeIssueTypeFieldValues,
|
|
8370
|
+
initializeIssueTypeFieldValuesAttachments,
|
|
8371
|
+
initializeIssueTypeFields,
|
|
8372
|
+
initializeIssueTypeFieldsAttachments,
|
|
7603
8373
|
initializeIssueTypes,
|
|
7604
8374
|
initializeIssueUpdates,
|
|
7605
8375
|
initializeIssues,
|
|
@@ -7618,6 +8388,14 @@ export {
|
|
|
7618
8388
|
issueCommentSlice,
|
|
7619
8389
|
issueReducer,
|
|
7620
8390
|
issueSlice,
|
|
8391
|
+
issueTypeFieldValuesAttachmentReducer,
|
|
8392
|
+
issueTypeFieldValuesAttachmentSlice,
|
|
8393
|
+
issueTypeFieldValuesReducer,
|
|
8394
|
+
issueTypeFieldValuesSlice,
|
|
8395
|
+
issueTypeFieldsAttachmentReducer,
|
|
8396
|
+
issueTypeFieldsAttachmentSlice,
|
|
8397
|
+
issueTypeFieldsReducer,
|
|
8398
|
+
issueTypeFieldsSlice,
|
|
7621
8399
|
issueTypeReducer,
|
|
7622
8400
|
issueTypeSlice,
|
|
7623
8401
|
issueUpdateReducer,
|
|
@@ -7690,6 +8468,20 @@ export {
|
|
|
7690
8468
|
selectAssetTypeAttachmentMapping,
|
|
7691
8469
|
selectAssetTypeAttachments,
|
|
7692
8470
|
selectAssetTypeById,
|
|
8471
|
+
selectAssetTypeFieldValues,
|
|
8472
|
+
selectAssetTypeFieldValuesAttachmentById,
|
|
8473
|
+
selectAssetTypeFieldValuesAttachments,
|
|
8474
|
+
selectAssetTypeFieldValuesAttachmentsMapping,
|
|
8475
|
+
selectAssetTypeFieldValuesById,
|
|
8476
|
+
selectAssetTypeFieldValuesMapping,
|
|
8477
|
+
selectAssetTypeFieldValuesOfAsset,
|
|
8478
|
+
selectAssetTypeFields,
|
|
8479
|
+
selectAssetTypeFieldsAttachmentById,
|
|
8480
|
+
selectAssetTypeFieldsAttachments,
|
|
8481
|
+
selectAssetTypeFieldsAttachmentsMapping,
|
|
8482
|
+
selectAssetTypeFieldsById,
|
|
8483
|
+
selectAssetTypeFieldsMapping,
|
|
8484
|
+
selectAssetTypeFieldsOfAssetType,
|
|
7693
8485
|
selectAssetTypeStagesMapping,
|
|
7694
8486
|
selectAssetTypes,
|
|
7695
8487
|
selectAssetTypesByIds,
|
|
@@ -7698,18 +8490,20 @@ export {
|
|
|
7698
8490
|
selectAssetsByIds,
|
|
7699
8491
|
selectAssetsMapping,
|
|
7700
8492
|
selectAssetsOfAssetType,
|
|
7701
|
-
selectAttachedFormSubmissionsOfAsset,
|
|
7702
|
-
selectAttachedFormSubmissionsOfIssue,
|
|
7703
8493
|
selectAttachmentsOfAsset,
|
|
7704
8494
|
selectAttachmentsOfAssetByType,
|
|
7705
8495
|
selectAttachmentsOfAssetType,
|
|
7706
8496
|
selectAttachmentsOfAssetTypeByType,
|
|
8497
|
+
selectAttachmentsOfAssetTypeFieldValues,
|
|
8498
|
+
selectAttachmentsOfAssetTypeFields,
|
|
7707
8499
|
selectAttachmentsOfDocument,
|
|
7708
8500
|
selectAttachmentsOfDocumentByType,
|
|
7709
8501
|
selectAttachmentsOfFormRevision,
|
|
7710
8502
|
selectAttachmentsOfFormSubmission,
|
|
7711
8503
|
selectAttachmentsOfIssue,
|
|
7712
8504
|
selectAttachmentsOfIssueByType,
|
|
8505
|
+
selectAttachmentsOfIssueTypeFieldValues,
|
|
8506
|
+
selectAttachmentsOfIssueTypeFields,
|
|
7713
8507
|
selectAttachmentsOfProject,
|
|
7714
8508
|
selectAttachmentsOfProjectByType,
|
|
7715
8509
|
selectCategories,
|
|
@@ -7737,8 +8531,6 @@ export {
|
|
|
7737
8531
|
selectFilteredForms,
|
|
7738
8532
|
selectFormById,
|
|
7739
8533
|
selectFormMapping,
|
|
7740
|
-
selectFormOfAssetType,
|
|
7741
|
-
selectFormOfIssueType,
|
|
7742
8534
|
selectFormRevisionAttachmentsMapping,
|
|
7743
8535
|
selectFormRevisionById,
|
|
7744
8536
|
selectFormRevisionMapping,
|
|
@@ -7748,9 +8540,7 @@ export {
|
|
|
7748
8540
|
selectFormSubmissionAttachmentsMapping,
|
|
7749
8541
|
selectFormSubmissionById,
|
|
7750
8542
|
selectFormSubmissions,
|
|
7751
|
-
selectFormSubmissionsByAssets,
|
|
7752
8543
|
selectFormSubmissionsByFormRevisions,
|
|
7753
|
-
selectFormSubmissionsByIssues,
|
|
7754
8544
|
selectFormSubmissionsMapping,
|
|
7755
8545
|
selectFormSubmissionsOfAsset,
|
|
7756
8546
|
selectFormSubmissionsOfForm,
|
|
@@ -7779,6 +8569,20 @@ export {
|
|
|
7779
8569
|
selectIssueCountOfCategory,
|
|
7780
8570
|
selectIssueMapping,
|
|
7781
8571
|
selectIssueTypeById,
|
|
8572
|
+
selectIssueTypeFieldValues,
|
|
8573
|
+
selectIssueTypeFieldValuesAttachmentById,
|
|
8574
|
+
selectIssueTypeFieldValuesAttachments,
|
|
8575
|
+
selectIssueTypeFieldValuesAttachmentsMapping,
|
|
8576
|
+
selectIssueTypeFieldValuesById,
|
|
8577
|
+
selectIssueTypeFieldValuesMapping,
|
|
8578
|
+
selectIssueTypeFieldValuesOfIssue,
|
|
8579
|
+
selectIssueTypeFields,
|
|
8580
|
+
selectIssueTypeFieldsAttachmentById,
|
|
8581
|
+
selectIssueTypeFieldsAttachments,
|
|
8582
|
+
selectIssueTypeFieldsAttachmentsMapping,
|
|
8583
|
+
selectIssueTypeFieldsById,
|
|
8584
|
+
selectIssueTypeFieldsMapping,
|
|
8585
|
+
selectIssueTypeFieldsOfIssueType,
|
|
7782
8586
|
selectIssueTypeMapping,
|
|
7783
8587
|
selectIssueTypes,
|
|
7784
8588
|
selectIssueTypesByIds,
|
|
@@ -7845,6 +8649,8 @@ export {
|
|
|
7845
8649
|
selectWorkspaceById,
|
|
7846
8650
|
selectWorkspaceMapping,
|
|
7847
8651
|
selectWorkspaces,
|
|
8652
|
+
separateFilesFromValues,
|
|
8653
|
+
separateImageFromFields,
|
|
7848
8654
|
setActiveProjectFileId,
|
|
7849
8655
|
setActiveProjectId,
|
|
7850
8656
|
setAsset,
|
|
@@ -7855,6 +8661,14 @@ export {
|
|
|
7855
8661
|
setAssetType,
|
|
7856
8662
|
setAssetTypeAttachment,
|
|
7857
8663
|
setAssetTypeAttachments,
|
|
8664
|
+
setAssetTypeFieldValues,
|
|
8665
|
+
setAssetTypeFieldValuesAttachment,
|
|
8666
|
+
setAssetTypeFieldValuesAttachments,
|
|
8667
|
+
setAssetTypeFieldValuesMany,
|
|
8668
|
+
setAssetTypeFields,
|
|
8669
|
+
setAssetTypeFieldsAttachment,
|
|
8670
|
+
setAssetTypeFieldsAttachments,
|
|
8671
|
+
setAssetTypeFieldsMany,
|
|
7858
8672
|
setAssetTypes,
|
|
7859
8673
|
setAssets,
|
|
7860
8674
|
setConversation,
|
|
@@ -7880,6 +8694,14 @@ export {
|
|
|
7880
8694
|
setIssueComment,
|
|
7881
8695
|
setIssueComments,
|
|
7882
8696
|
setIssueType,
|
|
8697
|
+
setIssueTypeFieldValues,
|
|
8698
|
+
setIssueTypeFieldValuesAttachment,
|
|
8699
|
+
setIssueTypeFieldValuesAttachments,
|
|
8700
|
+
setIssueTypeFieldValuesMany,
|
|
8701
|
+
setIssueTypeFields,
|
|
8702
|
+
setIssueTypeFieldsAttachment,
|
|
8703
|
+
setIssueTypeFieldsAttachments,
|
|
8704
|
+
setIssueTypeFieldsMany,
|
|
7883
8705
|
setIssueUpdate,
|
|
7884
8706
|
setLoggedIn,
|
|
7885
8707
|
setOrganizations,
|
|
@@ -7912,6 +8734,14 @@ export {
|
|
|
7912
8734
|
updateAssetType,
|
|
7913
8735
|
updateAssetTypeAttachment,
|
|
7914
8736
|
updateAssetTypeAttachments,
|
|
8737
|
+
updateAssetTypeFieldValues,
|
|
8738
|
+
updateAssetTypeFieldValuesAttachment,
|
|
8739
|
+
updateAssetTypeFieldValuesAttachments,
|
|
8740
|
+
updateAssetTypeFieldValuesMany,
|
|
8741
|
+
updateAssetTypeFields,
|
|
8742
|
+
updateAssetTypeFieldsAttachment,
|
|
8743
|
+
updateAssetTypeFieldsAttachments,
|
|
8744
|
+
updateAssetTypeFieldsMany,
|
|
7915
8745
|
updateAssetTypes,
|
|
7916
8746
|
updateAssets,
|
|
7917
8747
|
updateCategory,
|
|
@@ -7934,6 +8764,14 @@ export {
|
|
|
7934
8764
|
updateIssueAttachment,
|
|
7935
8765
|
updateIssueAttachments,
|
|
7936
8766
|
updateIssueType,
|
|
8767
|
+
updateIssueTypeFieldValues,
|
|
8768
|
+
updateIssueTypeFieldValuesAttachment,
|
|
8769
|
+
updateIssueTypeFieldValuesAttachments,
|
|
8770
|
+
updateIssueTypeFieldValuesMany,
|
|
8771
|
+
updateIssueTypeFields,
|
|
8772
|
+
updateIssueTypeFieldsAttachment,
|
|
8773
|
+
updateIssueTypeFieldsAttachments,
|
|
8774
|
+
updateIssueTypeFieldsMany,
|
|
7937
8775
|
updateLicense,
|
|
7938
8776
|
updateOrCreateProject,
|
|
7939
8777
|
updateOrganizationAccess,
|