@ironcode/vas-lib 0.0.38 → 0.0.40
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/cjs/lib/control-value/vas-camera-control-value.model.d.ts +1 -0
- package/cjs/lib/control-value/vas-camera-control-value.model.d.ts.map +1 -1
- package/cjs/lib/control-value/vas-camera-control-value.model.js +9 -0
- package/cjs/lib/control-value/vas-camera-control-value.model.js.map +1 -1
- package/cjs/lib/entity/vas-file.dto.d.ts.map +1 -1
- package/cjs/lib/entity/vas-file.dto.js +2 -1
- package/cjs/lib/entity/vas-file.dto.js.map +1 -1
- package/cjs/lib/entity/vas-job.model.d.ts +11 -1
- package/cjs/lib/entity/vas-job.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-job.model.js +48 -1
- package/cjs/lib/entity/vas-job.model.js.map +1 -1
- package/cjs/lib/utils/is-array-string.d.ts +2 -0
- package/cjs/lib/utils/is-array-string.d.ts.map +1 -0
- package/cjs/lib/utils/is-array-string.js +8 -0
- package/cjs/lib/utils/is-array-string.js.map +1 -0
- package/esm2020/lib/control-value/vas-camera-control-value.model.mjs +8 -2
- package/esm2020/lib/entity/vas-file.dto.mjs +3 -2
- package/esm2020/lib/entity/vas-job.model.mjs +49 -2
- package/esm2020/lib/utils/is-array-string.mjs +4 -0
- package/fesm2015/ironcode-vas-lib.mjs +60 -3
- package/fesm2015/ironcode-vas-lib.mjs.map +1 -1
- package/fesm2020/ironcode-vas-lib.mjs +60 -3
- package/fesm2020/ironcode-vas-lib.mjs.map +1 -1
- package/lib/control-value/vas-camera-control-value.model.d.ts +1 -0
- package/lib/entity/vas-job.model.d.ts +11 -1
- package/lib/utils/is-array-string.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,6 +2,14 @@ import moment from 'moment/moment';
|
|
|
2
2
|
import { UUID } from 'angular2-uuid';
|
|
3
3
|
import moment$1 from 'moment';
|
|
4
4
|
|
|
5
|
+
function isCameraControlValueV1(object) {
|
|
6
|
+
return object instanceof Object
|
|
7
|
+
&& 'webPath' in object
|
|
8
|
+
&& 'path' in object
|
|
9
|
+
&& 'url' in object
|
|
10
|
+
&& 'id' in object;
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
var VasControlConfigDirection;
|
|
6
14
|
(function (VasControlConfigDirection) {
|
|
7
15
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
@@ -638,7 +646,8 @@ class VasFieldModel extends VasJobDataModel {
|
|
|
638
646
|
}
|
|
639
647
|
|
|
640
648
|
function isFileDto(object) {
|
|
641
|
-
return
|
|
649
|
+
return object instanceof Object
|
|
650
|
+
&& 'url' in object
|
|
642
651
|
&& 'uri' in object
|
|
643
652
|
&& 'message' in object
|
|
644
653
|
&& 'status' in object
|
|
@@ -1171,6 +1180,10 @@ const getEmptyGeoLocation = () => ({
|
|
|
1171
1180
|
timestamp: ''
|
|
1172
1181
|
});
|
|
1173
1182
|
|
|
1183
|
+
const isArrayString = (value) => {
|
|
1184
|
+
return Array.isArray(value) && value.every(i => typeof i === 'string');
|
|
1185
|
+
};
|
|
1186
|
+
|
|
1174
1187
|
/**
|
|
1175
1188
|
* JobModel
|
|
1176
1189
|
*/
|
|
@@ -1311,6 +1324,51 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
1311
1324
|
}, {});
|
|
1312
1325
|
return fields;
|
|
1313
1326
|
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Returns an object describing how many attachments were added to this job
|
|
1329
|
+
* (camera controls and files), and how many have not been uploaded yet.
|
|
1330
|
+
*
|
|
1331
|
+
* @param formModel instance of {@link VasFormModel} that was used when the
|
|
1332
|
+
* job was created
|
|
1333
|
+
*/
|
|
1334
|
+
getFilesUploadStatus(formModel) {
|
|
1335
|
+
const pathsWithValue = formModel
|
|
1336
|
+
.getCameraControlPaths()
|
|
1337
|
+
.map(path => {
|
|
1338
|
+
const value = this.getValueByPath(path);
|
|
1339
|
+
if (value && !!value.id) {
|
|
1340
|
+
return path;
|
|
1341
|
+
}
|
|
1342
|
+
return null;
|
|
1343
|
+
})
|
|
1344
|
+
.filter(path => path !== null ? path : null)
|
|
1345
|
+
.filter(isArrayString);
|
|
1346
|
+
let total = pathsWithValue.length;
|
|
1347
|
+
total += this.files.length;
|
|
1348
|
+
// calculate the number of camera images still to upload
|
|
1349
|
+
let pending = pathsWithValue
|
|
1350
|
+
.map(path => this.getValueByPath(path))
|
|
1351
|
+
.map((value) => {
|
|
1352
|
+
if (isFileDto(value)) {
|
|
1353
|
+
return value.id && value.status !== 'COMPLETE';
|
|
1354
|
+
}
|
|
1355
|
+
else if (isCameraControlValueV1(value)) {
|
|
1356
|
+
// if url is not set, it hasn't been uploaded
|
|
1357
|
+
return value.id && !value.url;
|
|
1358
|
+
}
|
|
1359
|
+
return false;
|
|
1360
|
+
})
|
|
1361
|
+
.filter(hasUploaded => hasUploaded)
|
|
1362
|
+
.length;
|
|
1363
|
+
// add total from files that are pending
|
|
1364
|
+
pending += this.files
|
|
1365
|
+
.filter(value => value.status !== 'COMPLETED')
|
|
1366
|
+
.length;
|
|
1367
|
+
return {
|
|
1368
|
+
pending,
|
|
1369
|
+
total
|
|
1370
|
+
};
|
|
1371
|
+
}
|
|
1314
1372
|
/**
|
|
1315
1373
|
* This method will hydrate the `fields` property of the model. The reason for
|
|
1316
1374
|
* this is that we have different ways to store the field data. One way, is
|
|
@@ -1420,7 +1478,6 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
1420
1478
|
this.fields = fields;
|
|
1421
1479
|
}
|
|
1422
1480
|
/**
|
|
1423
|
-
|
|
1424
1481
|
* @param {string[]} path path segments
|
|
1425
1482
|
* @return {void}
|
|
1426
1483
|
*/
|
|
@@ -1796,5 +1853,5 @@ class VasReportRequestModel extends VasAccountObjectModel {
|
|
|
1796
1853
|
* Generated bundle index. Do not edit.
|
|
1797
1854
|
*/
|
|
1798
1855
|
|
|
1799
|
-
export { VasAccountIndexingMode, VasAccountObjectModel, VasBaseModel, VasBranchModel, VasContactModel, VasControlConfigDirection, VasControlModel, VasControlTypeModel, VasFieldModel, VasFileModel, VasFireUserModel, VasFormModel, VasGroupModel, VasInvitationModel, VasJobDataModel, VasJobModel, VasMembershipModel, VasReportLayoutModel, VasReportModel, VasReportRequestModel, VasRestrictedAccountObjectModel, VasUserModel, getEmptyGeoLocation, isFileDto };
|
|
1856
|
+
export { VasAccountIndexingMode, VasAccountObjectModel, VasBaseModel, VasBranchModel, VasContactModel, VasControlConfigDirection, VasControlModel, VasControlTypeModel, VasFieldModel, VasFileModel, VasFireUserModel, VasFormModel, VasGroupModel, VasInvitationModel, VasJobDataModel, VasJobModel, VasMembershipModel, VasReportLayoutModel, VasReportModel, VasReportRequestModel, VasRestrictedAccountObjectModel, VasUserModel, getEmptyGeoLocation, isCameraControlValueV1, isFileDto };
|
|
1800
1857
|
//# sourceMappingURL=ironcode-vas-lib.mjs.map
|