@overmap-ai/core 1.0.71-fields.13 → 1.0.71-fields.3
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 +151 -145
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +151 -145
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/AssetTypeFieldValuesAttachmentService.d.ts +3 -2
- package/dist/sdk/services/AssetTypeFieldValuesService.d.ts +2 -2
- package/dist/sdk/services/FormService.d.ts +2 -2
- package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +1 -2
- package/dist/store/slices/formRevisionSlice.d.ts +2 -1
- package/dist/store/slices/formSlice.d.ts +3 -1
- package/dist/store/slices/formSubmissionSlice.d.ts +2 -0
- package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +1 -2
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -2104,6 +2104,17 @@ const selectFormRevisionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
2104
2104
|
}
|
|
2105
2105
|
)
|
|
2106
2106
|
);
|
|
2107
|
+
const selectLatestFormRevisionByForm = createSelector([selectFormRevisionMapping], (revisions) => {
|
|
2108
|
+
const latestRevisions = {};
|
|
2109
|
+
for (const revision of Object.values(revisions)) {
|
|
2110
|
+
const formId = revision.form;
|
|
2111
|
+
const currentLatestRevision = latestRevisions[formId];
|
|
2112
|
+
if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
|
|
2113
|
+
latestRevisions[formId] = revision;
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
return latestRevisions;
|
|
2117
|
+
});
|
|
2107
2118
|
const formRevisionReducer = formRevisionsSlice.reducer;
|
|
2108
2119
|
const formAdapter = createModelAdapter((form) => form.offline_id);
|
|
2109
2120
|
const initialState$n = formAdapter.getInitialState({});
|
|
@@ -2128,9 +2139,6 @@ const selectFormMapping = (state) => {
|
|
|
2128
2139
|
const selectForms = createSelector([selectFormMapping], (formsMapping) => {
|
|
2129
2140
|
return Object.values(formsMapping);
|
|
2130
2141
|
});
|
|
2131
|
-
const selectFormById = (formId) => (state) => {
|
|
2132
|
-
return state.formReducer.instances[formId];
|
|
2133
|
-
};
|
|
2134
2142
|
const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
2135
2143
|
createSelector(
|
|
2136
2144
|
[
|
|
@@ -2156,6 +2164,15 @@ const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
|
2156
2164
|
{ memoizeOptions: { equalityCheck: shallowEqual } }
|
|
2157
2165
|
)
|
|
2158
2166
|
);
|
|
2167
|
+
const selectFormById = (formId) => (state) => {
|
|
2168
|
+
return state.formReducer.instances[formId];
|
|
2169
|
+
};
|
|
2170
|
+
const selectFormsCount = createSelector([selectFormMapping], (formsMapping) => {
|
|
2171
|
+
return Object.keys(formsMapping).length;
|
|
2172
|
+
});
|
|
2173
|
+
const selectGeneralFormCount = createSelector([selectFormMapping], (formsMapping) => {
|
|
2174
|
+
return Object.values(formsMapping).length;
|
|
2175
|
+
});
|
|
2159
2176
|
const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
|
|
2160
2177
|
const initialState$m = submissionAdapter.getInitialState({});
|
|
2161
2178
|
const formSubmissionSlice = createSlice({
|
|
@@ -2217,6 +2234,43 @@ const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
2217
2234
|
}
|
|
2218
2235
|
)
|
|
2219
2236
|
);
|
|
2237
|
+
const selectFormSubmissionsByFormRevisions = createSelector([selectFormRevisionMapping, selectFormSubmissions], (revisions, submissions) => {
|
|
2238
|
+
var _a2;
|
|
2239
|
+
const submissionMapping = {};
|
|
2240
|
+
for (const revisionId in revisions) {
|
|
2241
|
+
submissionMapping[revisionId] = [];
|
|
2242
|
+
}
|
|
2243
|
+
for (const submission of submissions) {
|
|
2244
|
+
(_a2 = submissionMapping[submission.form_revision]) == null ? void 0 : _a2.push(submission);
|
|
2245
|
+
}
|
|
2246
|
+
return submissionMapping;
|
|
2247
|
+
});
|
|
2248
|
+
const selectSortedFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
2249
|
+
createSelector(
|
|
2250
|
+
[
|
|
2251
|
+
selectFormRevisionMapping,
|
|
2252
|
+
selectFormSubmissionsByFormRevisions,
|
|
2253
|
+
(_state, formId) => formId
|
|
2254
|
+
],
|
|
2255
|
+
(revisionsMapping, submissionsByRevision, formId) => {
|
|
2256
|
+
const submissionsByFormRevisions = {};
|
|
2257
|
+
for (const revisionId in revisionsMapping) {
|
|
2258
|
+
const revision = revisionsMapping[revisionId];
|
|
2259
|
+
const submissionsOfRevision = submissionsByRevision[revisionId];
|
|
2260
|
+
if (revision && submissionsOfRevision && revision.form === formId) {
|
|
2261
|
+
submissionsByFormRevisions[revisionId] = submissionsOfRevision.sort(
|
|
2262
|
+
(a, b) => a.submitted_at < b.submitted_at ? -1 : 1
|
|
2263
|
+
);
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
return Object.entries(submissionsByFormRevisions).sort((a, b) => {
|
|
2267
|
+
const aRevision = revisionsMapping[a[0]];
|
|
2268
|
+
const bRevision = revisionsMapping[b[0]];
|
|
2269
|
+
return formRevisionSortFn(aRevision, bRevision);
|
|
2270
|
+
}).map(([_revisionId, submissions]) => submissions).flat();
|
|
2271
|
+
}
|
|
2272
|
+
)
|
|
2273
|
+
);
|
|
2220
2274
|
const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
2221
2275
|
createSelector(
|
|
2222
2276
|
[selectFormSubmissions, (_state, issueId) => issueId],
|
|
@@ -3068,7 +3122,7 @@ const selectIssueTypeFieldsOfIssueType = restructureCreateSelectorWithArgs(
|
|
|
3068
3122
|
);
|
|
3069
3123
|
const selectLatestIssueTypeFieldsOfIssueType = restructureCreateSelectorWithArgs(
|
|
3070
3124
|
createSelector([selectIssueTypeFields, (_state, id) => id], (fields, id) => {
|
|
3071
|
-
return fields.filter((field) => field.issue_type === id).sort((a, b) => a.submitted_at
|
|
3125
|
+
return fields.filter((field) => field.issue_type === id).sort((a, b) => a.submitted_at < b.submitted_at ? -1 : 1)[0];
|
|
3072
3126
|
})
|
|
3073
3127
|
);
|
|
3074
3128
|
const selectIssueTypeValuesOfIssueType = restructureCreateSelectorWithArgs(
|
|
@@ -3176,20 +3230,6 @@ const selectIssueTypeFieldValuesAttachments = createSelector(
|
|
|
3176
3230
|
return Object.values(attachmentsMapping);
|
|
3177
3231
|
}
|
|
3178
3232
|
);
|
|
3179
|
-
const selectIssueTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3180
|
-
return state.issueTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3181
|
-
};
|
|
3182
|
-
const selectIssueTypeFieldValuesAttachmentsByIds = restructureCreateSelectorWithArgs(
|
|
3183
|
-
createSelector(
|
|
3184
|
-
[selectIssueTypeFieldValuesAttachmentsMapping, (_, attachmentIds) => attachmentIds],
|
|
3185
|
-
(mapping, attachmentIds) => {
|
|
3186
|
-
const attachmentIdsSet = new Set(attachmentIds);
|
|
3187
|
-
return fallbackToEmptyArray(
|
|
3188
|
-
Object.values(mapping).filter((attachment) => attachmentIdsSet.has(attachment.offline_id))
|
|
3189
|
-
);
|
|
3190
|
-
}
|
|
3191
|
-
)
|
|
3192
|
-
);
|
|
3193
3233
|
const selectAttachmentsOfIssueTypeFieldValues = restructureCreateSelectorWithArgs(
|
|
3194
3234
|
createSelector(
|
|
3195
3235
|
[selectIssueTypeFieldValuesAttachments, (_state, fieldValuesId) => fieldValuesId],
|
|
@@ -3198,6 +3238,9 @@ const selectAttachmentsOfIssueTypeFieldValues = restructureCreateSelectorWithArg
|
|
|
3198
3238
|
}
|
|
3199
3239
|
)
|
|
3200
3240
|
);
|
|
3241
|
+
const selectIssueTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3242
|
+
return state.issueTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3243
|
+
};
|
|
3201
3244
|
const issueTypeFieldValuesAttachmentReducer = issueTypeFieldValuesAttachmentSlice.reducer;
|
|
3202
3245
|
const assetTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
|
|
3203
3246
|
const initialState$3 = assetTypeFieldsAdapter.getInitialState({});
|
|
@@ -3239,7 +3282,7 @@ const selectAssetTypeFieldsOfAssetType = restructureCreateSelectorWithArgs(
|
|
|
3239
3282
|
);
|
|
3240
3283
|
const selectLatestAssetTypeFieldsOfAssetType = restructureCreateSelectorWithArgs(
|
|
3241
3284
|
createSelector([selectAssetTypeFields, (_state, id) => id], (fields, id) => {
|
|
3242
|
-
return fields.filter((field) => field.asset_type === id).sort((a, b) => a.submitted_at
|
|
3285
|
+
return fields.filter((field) => field.asset_type === id).sort((a, b) => a.submitted_at < b.submitted_at ? -1 : 1)[0];
|
|
3243
3286
|
})
|
|
3244
3287
|
);
|
|
3245
3288
|
const selectAssetTypeFieldsById = (fieldsId) => (state) => {
|
|
@@ -3386,25 +3429,14 @@ const selectAssetTypeFieldValuesAttachments = createSelector(
|
|
|
3386
3429
|
return Object.values(attachmentsMapping);
|
|
3387
3430
|
}
|
|
3388
3431
|
);
|
|
3389
|
-
const selectAssetTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3390
|
-
return state.assetTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3391
|
-
};
|
|
3392
|
-
const selectAssetTypeFieldValuesAttachmentsByIds = restructureCreateSelectorWithArgs(
|
|
3393
|
-
createSelector(
|
|
3394
|
-
[selectAssetTypeFieldValuesAttachmentsMapping, (_, attachmentIds) => attachmentIds],
|
|
3395
|
-
(mapping, attachmentIds) => {
|
|
3396
|
-
const attachmentIdsSet = new Set(attachmentIds);
|
|
3397
|
-
return fallbackToEmptyArray(
|
|
3398
|
-
Object.values(mapping).filter((attachment) => attachmentIdsSet.has(attachment.offline_id))
|
|
3399
|
-
);
|
|
3400
|
-
}
|
|
3401
|
-
)
|
|
3402
|
-
);
|
|
3403
3432
|
const selectAttachmentsOfAssetTypeFieldValues = restructureCreateSelectorWithArgs(
|
|
3404
3433
|
createSelector([selectAssetTypeFieldValuesAttachments, (_state, id) => id], (attachments, id) => {
|
|
3405
3434
|
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === id));
|
|
3406
3435
|
})
|
|
3407
3436
|
);
|
|
3437
|
+
const selectAssetTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3438
|
+
return state.assetTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3439
|
+
};
|
|
3408
3440
|
const assetTypeFieldValuesAttachmentReducer = assetTypeFieldValuesAttachmentSlice.reducer;
|
|
3409
3441
|
let clientStore;
|
|
3410
3442
|
function setClientStore(store) {
|
|
@@ -5299,7 +5331,15 @@ class IssueTypeService extends BaseApiService {
|
|
|
5299
5331
|
const promise = this.enqueueRequest({
|
|
5300
5332
|
method: HttpMethod.POST,
|
|
5301
5333
|
url: "/issue-types/",
|
|
5302
|
-
|
|
5334
|
+
// Sending only whats needed here
|
|
5335
|
+
payload: {
|
|
5336
|
+
offline_id: offlineIssueType.offline_id,
|
|
5337
|
+
submitted_at: offlineIssueType.submitted_at,
|
|
5338
|
+
icon: offlineIssueType.icon,
|
|
5339
|
+
color: offlineIssueType.color,
|
|
5340
|
+
name: offlineIssueType.name,
|
|
5341
|
+
description: offlineIssueType.description
|
|
5342
|
+
},
|
|
5303
5343
|
blockers: [],
|
|
5304
5344
|
blocks: [offlineIssueType.offline_id]
|
|
5305
5345
|
});
|
|
@@ -5719,7 +5759,9 @@ class FormService extends BaseUploadService {
|
|
|
5719
5759
|
method: HttpMethod.POST,
|
|
5720
5760
|
url: "/forms/",
|
|
5721
5761
|
payload: {
|
|
5722
|
-
|
|
5762
|
+
// Sending exactly what is currently needed for the endpoint
|
|
5763
|
+
offline_id: offlineForm.offline_id,
|
|
5764
|
+
submitted_at: offlineForm.submitted_at,
|
|
5723
5765
|
initial_revision: {
|
|
5724
5766
|
offline_id: offlineFormRevision.offline_id,
|
|
5725
5767
|
submitted_at: offlineFormRevision.submitted_at,
|
|
@@ -5728,7 +5770,10 @@ class FormService extends BaseUploadService {
|
|
|
5728
5770
|
fields: offlineFormRevision.fields
|
|
5729
5771
|
}
|
|
5730
5772
|
},
|
|
5731
|
-
blockers: [
|
|
5773
|
+
blockers: [
|
|
5774
|
+
...payload.project ? [payload.project.toString()] : [],
|
|
5775
|
+
...payload.organization ? [payload.organization.toString()] : []
|
|
5776
|
+
],
|
|
5732
5777
|
blocks: [offlineForm.offline_id, offlineFormRevision.offline_id]
|
|
5733
5778
|
});
|
|
5734
5779
|
void formPromise.catch((e) => {
|
|
@@ -6682,8 +6727,7 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
6682
6727
|
file_name: offlineAttachment.file_name,
|
|
6683
6728
|
file_sha1: offlineAttachment.file_sha1,
|
|
6684
6729
|
file_extension: filePayload.extension,
|
|
6685
|
-
description: offlineAttachment.description
|
|
6686
|
-
document: documentId
|
|
6730
|
+
description: offlineAttachment.description
|
|
6687
6731
|
});
|
|
6688
6732
|
sha1ToAttachmentIds[filePayload.sha1].push(offlineAttachment.offline_id);
|
|
6689
6733
|
}
|
|
@@ -7582,39 +7626,24 @@ class AssetTypeFieldValuesService extends BaseApiService {
|
|
|
7582
7626
|
return [offlineAssetTypeFieldValues, promise];
|
|
7583
7627
|
}
|
|
7584
7628
|
bulkAdd(payload, batchSize) {
|
|
7585
|
-
var _a2;
|
|
7586
7629
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7587
7630
|
const { values } = separateFilesFromValues(payload.values);
|
|
7588
|
-
const
|
|
7589
|
-
const
|
|
7590
|
-
|
|
7591
|
-
for (const batch of batches) {
|
|
7592
|
-
const assetTypeFieldValuesPayloads = [];
|
|
7593
|
-
for (const payload2 of batch) {
|
|
7594
|
-
const offlineAssetTypeFieldValues = offline({
|
|
7595
|
-
...payload2,
|
|
7596
|
-
values: separateFilesFromValues(payload2.values).values,
|
|
7597
|
-
created_by: (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7598
|
-
submitted_at: submittedAt
|
|
7599
|
-
});
|
|
7600
|
-
offlineAssetTypeFieldValuesMany.push(offlineAssetTypeFieldValues);
|
|
7601
|
-
assetTypeFieldValuesPayloads.push({
|
|
7602
|
-
offline_id: offlineAssetTypeFieldValues.offline_id,
|
|
7603
|
-
asset: payload2.asset,
|
|
7604
|
-
fields_revision: payload2.fields_revision,
|
|
7605
|
-
published_at: payload2.published_at,
|
|
7606
|
-
values: offlineAssetTypeFieldValues.values
|
|
7607
|
-
});
|
|
7608
|
-
}
|
|
7609
|
-
batchPayloads.push({
|
|
7631
|
+
const payloadsBatches = chunkArray(payload.payloads, batchSize);
|
|
7632
|
+
const bulkAddPayloads = payloadsBatches.map((batch) => {
|
|
7633
|
+
return {
|
|
7610
7634
|
submitted_at: submittedAt,
|
|
7611
7635
|
values,
|
|
7612
|
-
field_values:
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7636
|
+
field_values: batch.map((payload2) => {
|
|
7637
|
+
const { values: values2 } = separateFilesFromValues(payload2.values);
|
|
7638
|
+
return offline({
|
|
7639
|
+
...payload2,
|
|
7640
|
+
values: values2
|
|
7641
|
+
});
|
|
7642
|
+
})
|
|
7643
|
+
};
|
|
7644
|
+
});
|
|
7616
7645
|
const promises = [];
|
|
7617
|
-
for (const payload2 of
|
|
7646
|
+
for (const payload2 of bulkAddPayloads) {
|
|
7618
7647
|
const assetIds = payload2.field_values.map((x) => x.asset);
|
|
7619
7648
|
const assetTypeFieldsIds = payload2.field_values.map((x) => x.fields_revision);
|
|
7620
7649
|
const assetTypeFieldValuesIds = payload2.field_values.map((x) => x.offline_id);
|
|
@@ -7629,11 +7658,9 @@ class AssetTypeFieldValuesService extends BaseApiService {
|
|
|
7629
7658
|
promises.push(promise);
|
|
7630
7659
|
}
|
|
7631
7660
|
void Promise.all(promises).then((results) => {
|
|
7632
|
-
this.dispatch(
|
|
7633
|
-
}).catch(() => {
|
|
7634
|
-
this.dispatch(deleteAssetTypeFieldValuesMany(offlineAssetTypeFieldValuesMany.map((x) => x.offline_id)));
|
|
7661
|
+
this.dispatch(addAssetTypeFieldValuesMany(results.flat()));
|
|
7635
7662
|
});
|
|
7636
|
-
return
|
|
7663
|
+
return promises;
|
|
7637
7664
|
}
|
|
7638
7665
|
update(payload) {
|
|
7639
7666
|
const { store } = this.client;
|
|
@@ -7657,13 +7684,7 @@ class AssetTypeFieldValuesService extends BaseApiService {
|
|
|
7657
7684
|
description: "Delete asset type field values",
|
|
7658
7685
|
method: HttpMethod.PATCH,
|
|
7659
7686
|
url: `/asset-type-field-values/${payload.offline_id}/`,
|
|
7660
|
-
payload
|
|
7661
|
-
...payload,
|
|
7662
|
-
values: {
|
|
7663
|
-
...assetTypeFieldValues.values,
|
|
7664
|
-
...values
|
|
7665
|
-
}
|
|
7666
|
-
},
|
|
7687
|
+
payload,
|
|
7667
7688
|
blockers: [
|
|
7668
7689
|
updatedAssetTypeFieldValues.offline_id,
|
|
7669
7690
|
updatedAssetTypeFieldValues.fields_revision,
|
|
@@ -7717,63 +7738,54 @@ class AssetTypeFieldValuesService extends BaseApiService {
|
|
|
7717
7738
|
}
|
|
7718
7739
|
}
|
|
7719
7740
|
class AssetTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
7720
|
-
async bulkAdd(payloads
|
|
7741
|
+
async bulkAdd(payloads) {
|
|
7721
7742
|
var _a2;
|
|
7722
7743
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7723
7744
|
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7724
|
-
const
|
|
7745
|
+
const filePayloads = {};
|
|
7725
7746
|
const offlineAssetTypeFieldValuesAttachments = [];
|
|
7726
|
-
const
|
|
7727
|
-
for (const
|
|
7728
|
-
const
|
|
7729
|
-
const
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
file_sha1: filePayload.sha1,
|
|
7740
|
-
created_by: createdBy,
|
|
7741
|
-
field_values: fieldValuesId,
|
|
7742
|
-
submitted_at: submittedAt,
|
|
7743
|
-
field_identifier: fieldIdentifier
|
|
7744
|
-
});
|
|
7745
|
-
offlineAssetTypeFieldValuesAttachments.push(offlineAssetTypeFieldValuesAttachment);
|
|
7746
|
-
const attachmentPayload = {
|
|
7747
|
-
offline_id: offlineAssetTypeFieldValuesAttachment.offline_id,
|
|
7748
|
-
file_name: file.name,
|
|
7749
|
-
file_sha1: filePayload.sha1,
|
|
7750
|
-
file_extension: filePayload.extension,
|
|
7751
|
-
field_identifier: fieldIdentifier,
|
|
7752
|
-
field_values: fieldValuesId
|
|
7753
|
-
};
|
|
7754
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7755
|
-
}
|
|
7756
|
-
batchPayloads.push({
|
|
7747
|
+
const attachmentPayloads = [];
|
|
7748
|
+
for (const payload of payloads) {
|
|
7749
|
+
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7750
|
+
const filePayload = await this.getFilePayload(file);
|
|
7751
|
+
if (!(filePayload.sha1 in filePayloads))
|
|
7752
|
+
filePayloads[filePayload.sha1] = filePayload;
|
|
7753
|
+
const offlineAssetTypeFieldValuesAttachment = offline({
|
|
7754
|
+
file: URL.createObjectURL(file),
|
|
7755
|
+
file_type: file.type,
|
|
7756
|
+
file_name: file.name,
|
|
7757
|
+
file_sha1: filePayload.sha1,
|
|
7758
|
+
created_by: createdBy,
|
|
7759
|
+
field_values: fieldValuesId,
|
|
7757
7760
|
submitted_at: submittedAt,
|
|
7758
|
-
|
|
7759
|
-
files: Object.values(filePayloads)
|
|
7761
|
+
field_identifier: fieldIdentifier
|
|
7760
7762
|
});
|
|
7763
|
+
offlineAssetTypeFieldValuesAttachments.push(offlineAssetTypeFieldValuesAttachment);
|
|
7764
|
+
const attachmentPayload = {
|
|
7765
|
+
offline_id: offlineAssetTypeFieldValuesAttachment.offline_id,
|
|
7766
|
+
file_name: file.name,
|
|
7767
|
+
file_sha1: filePayload.sha1,
|
|
7768
|
+
file_extension: filePayload.extension,
|
|
7769
|
+
field_identifier: fieldIdentifier,
|
|
7770
|
+
field_values: fieldValuesId
|
|
7771
|
+
};
|
|
7772
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7761
7773
|
}
|
|
7762
7774
|
this.dispatch(addAssetTypeFieldValuesAttachments(offlineAssetTypeFieldValuesAttachments));
|
|
7763
|
-
const
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
}
|
|
7775
|
+
const promise = this.enqueueRequest({
|
|
7776
|
+
description: "Add asset type field values attachments",
|
|
7777
|
+
method: HttpMethod.POST,
|
|
7778
|
+
url: "/asset-type-field-values-attachments/bulk/",
|
|
7779
|
+
payload: {
|
|
7780
|
+
submitted_at: submittedAt,
|
|
7781
|
+
attachments: attachmentPayloads,
|
|
7782
|
+
files: Object.values(filePayloads)
|
|
7783
|
+
},
|
|
7784
|
+
blockers: offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.field_values),
|
|
7785
|
+
blocks: offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7772
7786
|
});
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
this.processPresignedUrls(res.presigned_urls);
|
|
7776
|
-
const attachments = result.flatMap((res) => res.attachments);
|
|
7787
|
+
promise.then(({ presigned_urls, attachments }) => {
|
|
7788
|
+
this.processPresignedUrls(presigned_urls);
|
|
7777
7789
|
this.dispatch(updateAssetTypeFieldValuesAttachments(attachments));
|
|
7778
7790
|
}).catch((error) => {
|
|
7779
7791
|
this.dispatch(
|
|
@@ -7783,16 +7795,13 @@ class AssetTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
|
7783
7795
|
);
|
|
7784
7796
|
throw error;
|
|
7785
7797
|
});
|
|
7786
|
-
return [
|
|
7787
|
-
offlineAssetTypeFieldValuesAttachments,
|
|
7788
|
-
promises.map((promise) => promise.then(({ attachments }) => attachments))
|
|
7789
|
-
];
|
|
7798
|
+
return [offlineAssetTypeFieldValuesAttachments, promise.then(({ attachments }) => attachments)];
|
|
7790
7799
|
}
|
|
7791
7800
|
async bulkDelete(ids) {
|
|
7792
7801
|
const { store } = this.client;
|
|
7793
7802
|
const state = store.getState();
|
|
7794
|
-
const
|
|
7795
|
-
this.dispatch(
|
|
7803
|
+
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(ids)(state);
|
|
7804
|
+
this.dispatch(deleteFormSubmissionAttachments(ids));
|
|
7796
7805
|
try {
|
|
7797
7806
|
await this.enqueueRequest({
|
|
7798
7807
|
description: "Delete asset type field values attachments",
|
|
@@ -7803,13 +7812,13 @@ class AssetTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
|
7803
7812
|
blocks: []
|
|
7804
7813
|
});
|
|
7805
7814
|
} catch (e) {
|
|
7806
|
-
this.dispatch(
|
|
7815
|
+
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7807
7816
|
throw e;
|
|
7808
7817
|
}
|
|
7809
7818
|
}
|
|
7810
7819
|
async refreshStore(projectId) {
|
|
7811
7820
|
const result = await this.enqueueRequest({
|
|
7812
|
-
description: "
|
|
7821
|
+
description: "Gfet asset type field values attachments",
|
|
7813
7822
|
method: HttpMethod.GET,
|
|
7814
7823
|
url: "/asset-type-field-values-attachments/",
|
|
7815
7824
|
queryParams: {
|
|
@@ -7999,8 +8008,8 @@ class IssueTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
|
7999
8008
|
async bulkDelete(attachmentsIds) {
|
|
8000
8009
|
const { store } = this.client;
|
|
8001
8010
|
const state = store.getState();
|
|
8002
|
-
const
|
|
8003
|
-
this.dispatch(
|
|
8011
|
+
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
8012
|
+
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
8004
8013
|
try {
|
|
8005
8014
|
await this.enqueueRequest({
|
|
8006
8015
|
description: "Delete issue type field values attachments",
|
|
@@ -8011,7 +8020,7 @@ class IssueTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
|
8011
8020
|
blocks: []
|
|
8012
8021
|
});
|
|
8013
8022
|
} catch (e) {
|
|
8014
|
-
this.dispatch(
|
|
8023
|
+
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
8015
8024
|
throw e;
|
|
8016
8025
|
}
|
|
8017
8026
|
}
|
|
@@ -8080,13 +8089,7 @@ class IssueTypeFieldValuesService extends BaseApiService {
|
|
|
8080
8089
|
description: "Update issue type field values",
|
|
8081
8090
|
method: HttpMethod.PATCH,
|
|
8082
8091
|
url: `/issue-type-field-values/${payload.offline_id}/`,
|
|
8083
|
-
payload
|
|
8084
|
-
...payload,
|
|
8085
|
-
values: {
|
|
8086
|
-
...issueTypeFieldValues.values,
|
|
8087
|
-
...values
|
|
8088
|
-
}
|
|
8089
|
-
},
|
|
8092
|
+
payload,
|
|
8090
8093
|
blockers: [
|
|
8091
8094
|
updatedIssueTypeFieldValues.offline_id,
|
|
8092
8095
|
updatedIssueTypeFieldValues.fields_revision,
|
|
@@ -8556,7 +8559,6 @@ export {
|
|
|
8556
8559
|
selectAssetTypeFieldValues,
|
|
8557
8560
|
selectAssetTypeFieldValuesAttachmentById,
|
|
8558
8561
|
selectAssetTypeFieldValuesAttachments,
|
|
8559
|
-
selectAssetTypeFieldValuesAttachmentsByIds,
|
|
8560
8562
|
selectAssetTypeFieldValuesAttachmentsMapping,
|
|
8561
8563
|
selectAssetTypeFieldValuesById,
|
|
8562
8564
|
selectAssetTypeFieldValuesMapping,
|
|
@@ -8627,11 +8629,14 @@ export {
|
|
|
8627
8629
|
selectFormSubmissionAttachmentsMapping,
|
|
8628
8630
|
selectFormSubmissionById,
|
|
8629
8631
|
selectFormSubmissions,
|
|
8632
|
+
selectFormSubmissionsByFormRevisions,
|
|
8630
8633
|
selectFormSubmissionsMapping,
|
|
8631
8634
|
selectFormSubmissionsOfAsset,
|
|
8632
8635
|
selectFormSubmissionsOfForm,
|
|
8633
8636
|
selectFormSubmissionsOfIssue,
|
|
8634
8637
|
selectForms,
|
|
8638
|
+
selectFormsCount,
|
|
8639
|
+
selectGeneralFormCount,
|
|
8635
8640
|
selectGeoImageById,
|
|
8636
8641
|
selectGeoImageMapping,
|
|
8637
8642
|
selectGeoImages,
|
|
@@ -8656,7 +8661,6 @@ export {
|
|
|
8656
8661
|
selectIssueTypeFieldValues,
|
|
8657
8662
|
selectIssueTypeFieldValuesAttachmentById,
|
|
8658
8663
|
selectIssueTypeFieldValuesAttachments,
|
|
8659
|
-
selectIssueTypeFieldValuesAttachmentsByIds,
|
|
8660
8664
|
selectIssueTypeFieldValuesAttachmentsMapping,
|
|
8661
8665
|
selectIssueTypeFieldValuesById,
|
|
8662
8666
|
selectIssueTypeFieldValuesMapping,
|
|
@@ -8679,6 +8683,7 @@ export {
|
|
|
8679
8683
|
selectIssuesOfIssueType,
|
|
8680
8684
|
selectIssuesOfIssueTypeCount,
|
|
8681
8685
|
selectLatestAssetTypeFieldsOfAssetType,
|
|
8686
|
+
selectLatestFormRevisionByForm,
|
|
8682
8687
|
selectLatestFormRevisionOfForm,
|
|
8683
8688
|
selectLatestIssueTypeFieldsOfIssueType,
|
|
8684
8689
|
selectLatestRetryTime,
|
|
@@ -8717,6 +8722,7 @@ export {
|
|
|
8717
8722
|
selectProjectsOfOrganization,
|
|
8718
8723
|
selectRehydrated,
|
|
8719
8724
|
selectRootDocuments,
|
|
8725
|
+
selectSortedFormSubmissionsOfForm,
|
|
8720
8726
|
selectSortedOrganizationUsers,
|
|
8721
8727
|
selectSortedProjectUsers,
|
|
8722
8728
|
selectStageFormIdsFromStageIds,
|