@overmap-ai/core 1.0.55 → 1.0.57-component-asset-renames.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/README.md +4 -4
- package/dist/constants/ui.d.ts +1 -1
- package/dist/enums/ui.d.ts +1 -1
- package/dist/forms/builder/constants.d.ts +1 -1
- package/dist/forms/builder/hooks.d.ts +1 -1
- package/dist/overmap-core.js +565 -615
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +565 -615
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/sdk.d.ts +7 -7
- package/dist/sdk/services/AssetAttachmentService.d.ts +10 -0
- package/dist/sdk/services/AssetService.d.ts +11 -0
- package/dist/sdk/services/AssetStageCompletionService.d.ts +16 -0
- package/dist/sdk/services/AssetStageService.d.ts +11 -0
- package/dist/sdk/services/AssetTypeAttachmentService.d.ts +10 -0
- package/dist/sdk/services/AssetTypeService.d.ts +9 -0
- package/dist/sdk/services/UserFormService.d.ts +2 -2
- package/dist/sdk/services/UserFormSubmissionService.d.ts +1 -1
- package/dist/sdk/services/index.d.ts +6 -6
- package/dist/store/slices/assetSlice.d.ts +63 -0
- package/dist/store/slices/assetStageCompletionSlice.d.ts +15 -0
- package/dist/store/slices/assetStageSlice.d.ts +32 -0
- package/dist/store/slices/assetTypeSlice.d.ts +74 -0
- package/dist/store/slices/categorySlice.d.ts +4 -4
- package/dist/store/slices/documentSlice.d.ts +6 -7
- package/dist/store/slices/formRevisionSlice.d.ts +5 -5
- package/dist/store/slices/formSlice.d.ts +7 -7
- package/dist/store/slices/formSubmissionSlice.d.ts +2 -2
- package/dist/store/slices/index.d.ts +4 -4
- package/dist/store/slices/issueSlice.d.ts +4 -4
- package/dist/store/slices/projectFileSlice.d.ts +4 -4
- package/dist/store/slices/workspaceSlice.d.ts +4 -4
- package/dist/store/store.d.ts +15 -14
- package/dist/typings/models/attachments.d.ts +6 -6
- package/dist/typings/models/components.d.ts +11 -7
- package/dist/typings/models/forms.d.ts +3 -3
- package/dist/utils/colors.d.ts +1 -1
- package/package.json +153 -153
- package/dist/sdk/services/ComponentAttachmentService.d.ts +0 -10
- package/dist/sdk/services/ComponentService.d.ts +0 -11
- package/dist/sdk/services/ComponentStageCompletionService.d.ts +0 -17
- package/dist/sdk/services/ComponentStageService.d.ts +0 -11
- package/dist/sdk/services/ComponentTypeAttachmentService.d.ts +0 -10
- package/dist/sdk/services/ComponentTypeService.d.ts +0 -9
- package/dist/store/slices/ComponentStageCompletionSlice.d.ts +0 -27
- package/dist/store/slices/componentSlice.d.ts +0 -73
- package/dist/store/slices/componentStageSlice.d.ts +0 -42
- package/dist/store/slices/componentTypeSlice.d.ts +0 -75
package/dist/overmap-core.js
CHANGED
|
@@ -1350,7 +1350,7 @@ const ColorsToString = {
|
|
|
1350
1350
|
[mint.mint9]: "mint",
|
|
1351
1351
|
[sky.sky9]: "sky"
|
|
1352
1352
|
};
|
|
1353
|
-
const
|
|
1353
|
+
const AssetStageColors = {
|
|
1354
1354
|
indigo: indigo.indigo9,
|
|
1355
1355
|
red: red.red9,
|
|
1356
1356
|
violet: violet.violet9,
|
|
@@ -1372,7 +1372,7 @@ const generateBadgeColors = (rawColor) => {
|
|
|
1372
1372
|
return { backgroundColor, textColor };
|
|
1373
1373
|
};
|
|
1374
1374
|
function getStageColor(index2) {
|
|
1375
|
-
return Object.values(
|
|
1375
|
+
return Object.values(AssetStageColors)[index2 % Object.keys(AssetStageColors).length];
|
|
1376
1376
|
}
|
|
1377
1377
|
const getLocalDateString = memoize((date) => {
|
|
1378
1378
|
if (!date)
|
|
@@ -1592,122 +1592,115 @@ function removeAttachments(state, action) {
|
|
|
1592
1592
|
}
|
|
1593
1593
|
}
|
|
1594
1594
|
const initialState$q = {
|
|
1595
|
-
|
|
1596
|
-
|
|
1595
|
+
assetTypes: {},
|
|
1596
|
+
hiddenAssetTypeIds: {},
|
|
1597
1597
|
attachments: {}
|
|
1598
1598
|
};
|
|
1599
|
-
const
|
|
1600
|
-
name: "
|
|
1599
|
+
const assetTypeSlice = createSlice({
|
|
1600
|
+
name: "assetTypes",
|
|
1601
1601
|
initialState: initialState$q,
|
|
1602
1602
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1603
1603
|
reducers: {
|
|
1604
|
-
|
|
1605
|
-
state.
|
|
1604
|
+
addAssetType: (state, action) => {
|
|
1605
|
+
state.assetTypes[action.payload.offline_id] = action.payload;
|
|
1606
1606
|
},
|
|
1607
|
-
|
|
1608
|
-
state.
|
|
1607
|
+
setAssetTypes: (state, action) => {
|
|
1608
|
+
state.assetTypes = toOfflineIdRecord(action.payload);
|
|
1609
1609
|
},
|
|
1610
|
-
|
|
1611
|
-
state.
|
|
1610
|
+
toggleAssetTypeVisibility: (state, action) => {
|
|
1611
|
+
state.hiddenAssetTypeIds[action.payload] = !state.hiddenAssetTypeIds[action.payload];
|
|
1612
1612
|
},
|
|
1613
|
-
|
|
1614
|
-
delete state.
|
|
1613
|
+
deleteAssetType: (state, action) => {
|
|
1614
|
+
delete state.assetTypes[action.payload];
|
|
1615
1615
|
},
|
|
1616
1616
|
// Attachments
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1617
|
+
setAssetTypeAttachment: setAttachment,
|
|
1618
|
+
setAssetTypeAttachments: setAttachments,
|
|
1619
|
+
addAssetTypeAttachment: addAttachment,
|
|
1620
|
+
addAssetTypeAttachments: addAttachments,
|
|
1621
|
+
updateAssetTypeAttachment: updateAttachment,
|
|
1622
|
+
updateAssetTypeAttachments: updateAttachments,
|
|
1623
|
+
removeAssetTypeAttachment: removeAttachment,
|
|
1624
|
+
removeAssetTypeAttachments: removeAttachments
|
|
1625
1625
|
}
|
|
1626
1626
|
});
|
|
1627
1627
|
const {
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1628
|
+
addAssetType,
|
|
1629
|
+
setAssetTypes,
|
|
1630
|
+
toggleAssetTypeVisibility,
|
|
1631
|
+
deleteAssetType,
|
|
1632
1632
|
// Attachmet
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
} =
|
|
1642
|
-
const
|
|
1643
|
-
const
|
|
1644
|
-
[
|
|
1633
|
+
setAssetTypeAttachment,
|
|
1634
|
+
setAssetTypeAttachments,
|
|
1635
|
+
addAssetTypeAttachment,
|
|
1636
|
+
addAssetTypeAttachments,
|
|
1637
|
+
updateAssetTypeAttachment,
|
|
1638
|
+
updateAssetTypeAttachments,
|
|
1639
|
+
removeAssetTypeAttachment,
|
|
1640
|
+
removeAssetTypeAttachments
|
|
1641
|
+
} = assetTypeSlice.actions;
|
|
1642
|
+
const selectAssetTypesMapping = (state) => state.assetTypeReducer.assetTypes;
|
|
1643
|
+
const selectAssetTypes = createSelector(
|
|
1644
|
+
[selectAssetTypesMapping],
|
|
1645
1645
|
(mapping) => Object.values(mapping)
|
|
1646
1646
|
);
|
|
1647
|
-
const
|
|
1648
|
-
createSelector(
|
|
1647
|
+
const selectAssetType = restructureCreateSelectorWithArgs(
|
|
1648
|
+
createSelector(
|
|
1649
|
+
[selectAssetTypesMapping, (_state, assetTypeId) => assetTypeId],
|
|
1650
|
+
(mapping, assetTypeId) => mapping[assetTypeId]
|
|
1651
|
+
)
|
|
1649
1652
|
);
|
|
1650
|
-
const
|
|
1653
|
+
const selectNumberOfAssetTypesMatchingCaseInsensitiveName = restructureCreateSelectorWithArgs(
|
|
1651
1654
|
createSelector(
|
|
1652
|
-
[
|
|
1653
|
-
selectComponentTypesMapping,
|
|
1654
|
-
(_state, args) => args
|
|
1655
|
-
],
|
|
1655
|
+
[selectAssetTypesMapping, (_state, args) => args],
|
|
1656
1656
|
(mapping, args) => {
|
|
1657
1657
|
var _a2;
|
|
1658
1658
|
const name = ((_a2 = args.name) == null ? void 0 : _a2.toLowerCase()) ?? null;
|
|
1659
1659
|
return Object.values(mapping).filter(
|
|
1660
|
-
(
|
|
1660
|
+
(assetType) => {
|
|
1661
1661
|
var _a3;
|
|
1662
|
-
return (((_a3 =
|
|
1662
|
+
return (((_a3 = assetType.name) == null ? void 0 : _a3.toLowerCase()) ?? null) === name && assetType.offline_id !== args.assetTypeId;
|
|
1663
1663
|
}
|
|
1664
1664
|
).length;
|
|
1665
1665
|
}
|
|
1666
1666
|
)
|
|
1667
1667
|
);
|
|
1668
|
-
const
|
|
1669
|
-
createSelector(
|
|
1670
|
-
|
|
1671
|
-
(mapping
|
|
1672
|
-
|
|
1673
|
-
return
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
return (((_a2 = componentType.name) == null ? void 0 : _a2.toLowerCase()) ?? null) === name;
|
|
1677
|
-
}
|
|
1678
|
-
);
|
|
1679
|
-
}
|
|
1680
|
-
)
|
|
1668
|
+
const selectAssetTypesByName = restructureCreateSelectorWithArgs(
|
|
1669
|
+
createSelector([selectAssetTypesMapping, (_state, name) => name], (mapping, name) => {
|
|
1670
|
+
name = (name == null ? void 0 : name.toLowerCase()) ?? null;
|
|
1671
|
+
return Object.values(mapping).filter((assetType) => {
|
|
1672
|
+
var _a2;
|
|
1673
|
+
return (((_a2 = assetType.name) == null ? void 0 : _a2.toLowerCase()) ?? null) === name;
|
|
1674
|
+
});
|
|
1675
|
+
})
|
|
1681
1676
|
);
|
|
1682
|
-
const
|
|
1683
|
-
const
|
|
1684
|
-
const
|
|
1685
|
-
[
|
|
1677
|
+
const selectHiddenAssetTypeIds = (state) => state.assetTypeReducer.hiddenAssetTypeIds;
|
|
1678
|
+
const selectAssetTypeAttachmentMapping = (state) => state.assetTypeReducer.attachments;
|
|
1679
|
+
const selectAssetTypeAttachments = createSelector(
|
|
1680
|
+
[selectAssetTypeAttachmentMapping],
|
|
1686
1681
|
(mapping) => Object.values(mapping)
|
|
1687
1682
|
);
|
|
1688
|
-
const
|
|
1689
|
-
return state.
|
|
1683
|
+
const selectAssetTypeAttachment = (attachmentId) => (state) => {
|
|
1684
|
+
return state.assetTypeReducer.attachments[attachmentId];
|
|
1690
1685
|
};
|
|
1691
|
-
const
|
|
1686
|
+
const selectAttachmentsOfAssetType = restructureCreateSelectorWithArgs(
|
|
1692
1687
|
createSelector(
|
|
1693
|
-
[
|
|
1694
|
-
(attachments,
|
|
1695
|
-
return attachments.filter(({
|
|
1688
|
+
[selectAssetTypeAttachments, (_state, assetTypeId) => assetTypeId],
|
|
1689
|
+
(attachments, assetTypeId) => {
|
|
1690
|
+
return attachments.filter(({ asset_type }) => assetTypeId === asset_type);
|
|
1696
1691
|
}
|
|
1697
1692
|
)
|
|
1698
1693
|
);
|
|
1699
|
-
const
|
|
1694
|
+
const selectAttachmentsOfAssetTypeByType = restructureCreateSelectorWithArgs(
|
|
1700
1695
|
createSelector(
|
|
1701
|
-
[
|
|
1702
|
-
(attachments,
|
|
1703
|
-
const
|
|
1704
|
-
|
|
1705
|
-
);
|
|
1706
|
-
const fileAttachments = attachmentsOfComponent.filter(
|
|
1696
|
+
[selectAssetTypeAttachments, (_state, assetTypeId) => assetTypeId],
|
|
1697
|
+
(attachments, assetTypeId) => {
|
|
1698
|
+
const attachmentsOfAssetType = attachments.filter(({ asset_type }) => asset_type === assetTypeId);
|
|
1699
|
+
const fileAttachments = attachmentsOfAssetType.filter(
|
|
1707
1700
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1708
1701
|
({ file_type }) => !file_type || !file_type.startsWith("image/")
|
|
1709
1702
|
);
|
|
1710
|
-
const imageAttachments =
|
|
1703
|
+
const imageAttachments = attachmentsOfAssetType.filter(
|
|
1711
1704
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1712
1705
|
({ file_type }) => file_type && file_type.startsWith("image/")
|
|
1713
1706
|
);
|
|
@@ -1715,173 +1708,157 @@ const selectAttachmentsOfComponentTypeByType = restructureCreateSelectorWithArgs
|
|
|
1715
1708
|
}
|
|
1716
1709
|
)
|
|
1717
1710
|
);
|
|
1718
|
-
const
|
|
1711
|
+
const assetTypeReducer = assetTypeSlice.reducer;
|
|
1719
1712
|
const initialState$p = {
|
|
1720
|
-
|
|
1713
|
+
assets: {},
|
|
1721
1714
|
attachments: {}
|
|
1722
1715
|
};
|
|
1723
|
-
const
|
|
1724
|
-
name: "
|
|
1716
|
+
const assetSlice = createSlice({
|
|
1717
|
+
name: "assets",
|
|
1725
1718
|
initialState: initialState$p,
|
|
1726
1719
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
|
|
1727
1720
|
reducers: {
|
|
1728
|
-
|
|
1729
|
-
state.
|
|
1730
|
-
|
|
1721
|
+
addAsset: (state, action) => {
|
|
1722
|
+
state.assets[action.payload.offline_id] = action.payload;
|
|
1723
|
+
prevAssets = null;
|
|
1731
1724
|
},
|
|
1732
|
-
|
|
1733
|
-
Object.assign(state.
|
|
1734
|
-
|
|
1725
|
+
addAssetsInBatches: (state, action) => {
|
|
1726
|
+
Object.assign(state.assets, toOfflineIdRecord(action.payload));
|
|
1727
|
+
prevAssets = null;
|
|
1735
1728
|
},
|
|
1736
|
-
|
|
1737
|
-
state.
|
|
1738
|
-
|
|
1729
|
+
setAssets: (state, action) => {
|
|
1730
|
+
state.assets = toOfflineIdRecord(action.payload);
|
|
1731
|
+
prevAssets = null;
|
|
1739
1732
|
},
|
|
1740
|
-
|
|
1741
|
-
if (action.payload.offline_id in state.
|
|
1742
|
-
state.
|
|
1733
|
+
updateAsset: (state, action) => {
|
|
1734
|
+
if (action.payload.offline_id in state.assets) {
|
|
1735
|
+
state.assets[action.payload.offline_id] = action.payload;
|
|
1743
1736
|
} else {
|
|
1744
|
-
throw new Error(`Tried to update
|
|
1737
|
+
throw new Error(`Tried to update asset with ID that doesn't exist: ${action.payload.offline_id}`);
|
|
1745
1738
|
}
|
|
1746
|
-
|
|
1739
|
+
prevAssets = null;
|
|
1747
1740
|
},
|
|
1748
|
-
|
|
1749
|
-
if (action.payload in state.
|
|
1750
|
-
delete state.
|
|
1741
|
+
removeAsset: (state, action) => {
|
|
1742
|
+
if (action.payload in state.assets) {
|
|
1743
|
+
delete state.assets[action.payload];
|
|
1751
1744
|
} else {
|
|
1752
|
-
throw new Error(`Failed to remove
|
|
1745
|
+
throw new Error(`Failed to remove asset because ID doesn't exist: ${action.payload}`);
|
|
1753
1746
|
}
|
|
1754
|
-
|
|
1747
|
+
prevAssets = null;
|
|
1755
1748
|
},
|
|
1756
|
-
|
|
1749
|
+
removeAllAssetsOfType: (state, action) => {
|
|
1757
1750
|
var _a2;
|
|
1758
|
-
for (const componentId in state.
|
|
1759
|
-
if (((_a2 = state.
|
|
1760
|
-
delete state.
|
|
1751
|
+
for (const componentId in state.assets) {
|
|
1752
|
+
if (((_a2 = state.assets[componentId]) == null ? void 0 : _a2.asset_type) === action.payload) {
|
|
1753
|
+
delete state.assets[componentId];
|
|
1761
1754
|
}
|
|
1762
1755
|
}
|
|
1763
|
-
|
|
1756
|
+
prevAssets = null;
|
|
1764
1757
|
},
|
|
1765
1758
|
// Attachments
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1759
|
+
setAssetAttachment: setAttachment,
|
|
1760
|
+
setAssetAttachments: setAttachments,
|
|
1761
|
+
addAssetAttachment: addAttachment,
|
|
1762
|
+
addAssetAttachments: addAttachments,
|
|
1763
|
+
updateAssetAttachment: updateAttachment,
|
|
1764
|
+
updateAssetAttachments: updateAttachments,
|
|
1765
|
+
removeAssetAttachment: removeAttachment,
|
|
1766
|
+
removeAssetAttachments: removeAttachments
|
|
1774
1767
|
}
|
|
1775
1768
|
});
|
|
1776
1769
|
const {
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1770
|
+
addAsset,
|
|
1771
|
+
updateAsset,
|
|
1772
|
+
removeAsset,
|
|
1773
|
+
addAssetsInBatches,
|
|
1774
|
+
setAssets,
|
|
1775
|
+
removeAllAssetsOfType,
|
|
1783
1776
|
// Attachments
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
} =
|
|
1793
|
-
let
|
|
1794
|
-
const
|
|
1795
|
-
if (!
|
|
1796
|
-
|
|
1797
|
-
}
|
|
1798
|
-
return
|
|
1777
|
+
setAssetAttachment,
|
|
1778
|
+
setAssetAttachments,
|
|
1779
|
+
addAssetAttachment,
|
|
1780
|
+
addAssetAttachments,
|
|
1781
|
+
updateAssetAttachment,
|
|
1782
|
+
updateAssetAttachments,
|
|
1783
|
+
removeAssetAttachment,
|
|
1784
|
+
removeAssetAttachments
|
|
1785
|
+
} = assetSlice.actions;
|
|
1786
|
+
let prevAssets = null;
|
|
1787
|
+
const selectAssets = (state) => {
|
|
1788
|
+
if (!prevAssets) {
|
|
1789
|
+
prevAssets = Object.values(state.assetReducer.assets);
|
|
1790
|
+
}
|
|
1791
|
+
return prevAssets;
|
|
1799
1792
|
};
|
|
1800
|
-
const
|
|
1801
|
-
const
|
|
1802
|
-
createSelector(
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
if (!componentTypeId)
|
|
1806
|
-
return [];
|
|
1807
|
-
return components.filter((component) => component.component_type === componentTypeId);
|
|
1808
|
-
}
|
|
1809
|
-
)
|
|
1793
|
+
const selectAssetsMapping = (state) => state.assetReducer.assets;
|
|
1794
|
+
const selectAssetsOfAssetType = restructureCreateSelectorWithArgs(
|
|
1795
|
+
createSelector([selectAssets, (_state, assetTypeId) => assetTypeId], (components, assetTypeId) => {
|
|
1796
|
+
return components.filter((asset) => asset.asset_type === assetTypeId);
|
|
1797
|
+
})
|
|
1810
1798
|
);
|
|
1811
|
-
const
|
|
1812
|
-
return state.
|
|
1813
|
-
};
|
|
1814
|
-
const selectComponentTypeFromComponent = (componentTypeId) => (state) => {
|
|
1815
|
-
return state.componentTypeReducer.componentTypes[componentTypeId];
|
|
1799
|
+
const selectAsset = (assetId) => (state) => {
|
|
1800
|
+
return state.assetReducer.assets[assetId];
|
|
1816
1801
|
};
|
|
1817
|
-
const
|
|
1818
|
-
[
|
|
1819
|
-
(
|
|
1802
|
+
const selectAssetToAssetTypeMapping = createSelector(
|
|
1803
|
+
[selectAssets, selectAssetTypesMapping],
|
|
1804
|
+
(assets, assetTypeMapping) => {
|
|
1820
1805
|
const ret = {};
|
|
1821
|
-
for (const
|
|
1822
|
-
const
|
|
1823
|
-
if (!
|
|
1806
|
+
for (const asset of assets) {
|
|
1807
|
+
const assetType = assetTypeMapping[asset.asset_type];
|
|
1808
|
+
if (!assetType) {
|
|
1824
1809
|
console.error(
|
|
1825
|
-
`
|
|
1826
|
-
Expected all referenced
|
|
1810
|
+
`Asset type with ID ${asset.asset_type} not found.
|
|
1811
|
+
Expected all referenced asset types to be populated.
|
|
1827
1812
|
Returning empty object to avoid fatal errors.`
|
|
1828
1813
|
);
|
|
1829
1814
|
return {};
|
|
1830
1815
|
}
|
|
1831
|
-
ret[
|
|
1816
|
+
ret[asset.offline_id] = assetType;
|
|
1832
1817
|
}
|
|
1833
1818
|
return ret;
|
|
1834
1819
|
}
|
|
1835
1820
|
);
|
|
1836
|
-
const
|
|
1837
|
-
createSelector(
|
|
1838
|
-
[selectComponents, (_state, componentTypeId) => componentTypeId],
|
|
1839
|
-
(components, componentTypeId) => {
|
|
1840
|
-
return components.filter((component) => component.component_type === componentTypeId);
|
|
1841
|
-
}
|
|
1842
|
-
)
|
|
1843
|
-
);
|
|
1844
|
-
const selectNumberOfComponentsOfComponentType = (componentTypeId) => (state) => {
|
|
1821
|
+
const selectNumberOfAssetsOfAssetType = (assetTypeId) => (state) => {
|
|
1845
1822
|
var _a2;
|
|
1846
|
-
if (!
|
|
1823
|
+
if (!assetTypeId)
|
|
1847
1824
|
return 0;
|
|
1848
|
-
return (_a2 =
|
|
1825
|
+
return (_a2 = selectAssetsOfAssetType(assetTypeId)(state)) == null ? void 0 : _a2.length;
|
|
1849
1826
|
};
|
|
1850
|
-
const
|
|
1851
|
-
return
|
|
1852
|
-
const
|
|
1853
|
-
if (
|
|
1854
|
-
acc.push(
|
|
1827
|
+
const selectAssetTypesFromIds = (assetTypeIds) => (state) => {
|
|
1828
|
+
return assetTypeIds.reduce((acc, assetTypeId) => {
|
|
1829
|
+
const assetType = state.assetTypeReducer.assetTypes[assetTypeId];
|
|
1830
|
+
if (assetType) {
|
|
1831
|
+
acc.push(assetType);
|
|
1855
1832
|
}
|
|
1856
1833
|
return acc;
|
|
1857
1834
|
}, []);
|
|
1858
1835
|
};
|
|
1859
|
-
const
|
|
1860
|
-
const
|
|
1861
|
-
[
|
|
1836
|
+
const selectAssetAttachmentMapping = (state) => state.assetReducer.attachments;
|
|
1837
|
+
const selectAssetAttachments = createSelector(
|
|
1838
|
+
[selectAssetAttachmentMapping],
|
|
1862
1839
|
(mapping) => Object.values(mapping)
|
|
1863
1840
|
);
|
|
1864
|
-
const
|
|
1865
|
-
return state.
|
|
1841
|
+
const selectAssetAttachment = (attachmentId) => (state) => {
|
|
1842
|
+
return state.assetReducer.attachments[attachmentId];
|
|
1866
1843
|
};
|
|
1867
|
-
const
|
|
1844
|
+
const selectAttachmentsOfAsset = restructureCreateSelectorWithArgs(
|
|
1868
1845
|
createSelector(
|
|
1869
|
-
[
|
|
1870
|
-
(attachments,
|
|
1871
|
-
return attachments.filter(({
|
|
1846
|
+
[selectAssetAttachments, (_state, assetId) => assetId],
|
|
1847
|
+
(attachments, assetId) => {
|
|
1848
|
+
return attachments.filter(({ asset }) => assetId === asset);
|
|
1872
1849
|
}
|
|
1873
1850
|
)
|
|
1874
1851
|
);
|
|
1875
|
-
const
|
|
1852
|
+
const selectAttachmentsOfAssetByType = restructureCreateSelectorWithArgs(
|
|
1876
1853
|
createSelector(
|
|
1877
|
-
[
|
|
1878
|
-
(attachments,
|
|
1879
|
-
const
|
|
1880
|
-
const fileAttachments =
|
|
1854
|
+
[selectAssetAttachments, (_state, assetId) => assetId],
|
|
1855
|
+
(attachments, assetId) => {
|
|
1856
|
+
const attachmentsOfAsset = attachments.filter(({ asset }) => assetId === asset);
|
|
1857
|
+
const fileAttachments = attachmentsOfAsset.filter(
|
|
1881
1858
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1882
1859
|
({ file_type }) => !file_type || !file_type.startsWith("image/")
|
|
1883
1860
|
);
|
|
1884
|
-
const imageAttachments =
|
|
1861
|
+
const imageAttachments = attachmentsOfAsset.filter(
|
|
1885
1862
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1886
1863
|
({ file_type }) => file_type && file_type.startsWith("image/")
|
|
1887
1864
|
);
|
|
@@ -1889,69 +1866,67 @@ const selectAttachmentsOfComponentByType = restructureCreateSelectorWithArgs(
|
|
|
1889
1866
|
}
|
|
1890
1867
|
)
|
|
1891
1868
|
);
|
|
1892
|
-
const
|
|
1869
|
+
const assetReducer = assetSlice.reducer;
|
|
1893
1870
|
const initialState$o = {
|
|
1894
|
-
|
|
1871
|
+
completionsByAssetId: {}
|
|
1895
1872
|
};
|
|
1896
|
-
const
|
|
1897
|
-
name: "
|
|
1873
|
+
const assetStageCompletionSlice = createSlice({
|
|
1874
|
+
name: "assetStageCompletions",
|
|
1898
1875
|
initialState: initialState$o,
|
|
1899
1876
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1900
1877
|
reducers: {
|
|
1901
1878
|
addStageCompletion: (state, action) => {
|
|
1902
|
-
let stageToCompletionDateMapping = state.
|
|
1879
|
+
let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
|
|
1903
1880
|
if (!stageToCompletionDateMapping) {
|
|
1904
1881
|
stageToCompletionDateMapping = {};
|
|
1905
|
-
state.
|
|
1882
|
+
state.completionsByAssetId[action.payload.asset] = stageToCompletionDateMapping;
|
|
1906
1883
|
}
|
|
1907
1884
|
stageToCompletionDateMapping[action.payload.stage] = (/* @__PURE__ */ new Date()).toISOString();
|
|
1908
1885
|
},
|
|
1909
1886
|
addStageCompletions: (state, action) => {
|
|
1910
|
-
for (const [
|
|
1887
|
+
for (const [assetId, stageIdToCompletionDateMapping] of Object.entries(action.payload)) {
|
|
1911
1888
|
if (Object.keys(stageIdToCompletionDateMapping).length === 0)
|
|
1912
|
-
throw new Error(
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
if (thisComponentCompletions === void 0) {
|
|
1917
|
-
thisComponentCompletions = {};
|
|
1889
|
+
throw new Error(`Encountered empty stageIdToCompletionDateMapping argument for asset ${assetId}`);
|
|
1890
|
+
let thisAssetCompletions = state.completionsByAssetId[assetId];
|
|
1891
|
+
if (thisAssetCompletions === void 0) {
|
|
1892
|
+
thisAssetCompletions = {};
|
|
1918
1893
|
}
|
|
1919
1894
|
for (const [stageId, completionDate] of Object.entries(stageIdToCompletionDateMapping)) {
|
|
1920
|
-
|
|
1895
|
+
thisAssetCompletions[stageId] = completionDate;
|
|
1921
1896
|
}
|
|
1922
|
-
state.
|
|
1897
|
+
state.completionsByAssetId[assetId] = thisAssetCompletions;
|
|
1923
1898
|
}
|
|
1924
1899
|
},
|
|
1925
1900
|
removeStageCompletions: (state, action) => {
|
|
1926
1901
|
for (const completion of action.payload) {
|
|
1927
|
-
const
|
|
1928
|
-
if (!
|
|
1902
|
+
const thisAssetCompletions = state.completionsByAssetId[completion.asset];
|
|
1903
|
+
if (!thisAssetCompletions || !(completion.stage in thisAssetCompletions)) {
|
|
1929
1904
|
console.warn(
|
|
1930
1905
|
"Skipping removal of uncompleted stage. This message indicates completion objects are created unnecessarily."
|
|
1931
1906
|
);
|
|
1932
1907
|
continue;
|
|
1933
1908
|
}
|
|
1934
|
-
delete
|
|
1909
|
+
delete thisAssetCompletions[completion.stage];
|
|
1935
1910
|
}
|
|
1936
1911
|
},
|
|
1937
1912
|
setStageCompletions: (state, action) => {
|
|
1938
|
-
state.
|
|
1913
|
+
state.completionsByAssetId = action.payload;
|
|
1939
1914
|
}
|
|
1940
1915
|
}
|
|
1941
1916
|
});
|
|
1942
|
-
const { addStageCompletion, addStageCompletions, removeStageCompletions, setStageCompletions } =
|
|
1917
|
+
const { addStageCompletion, addStageCompletions, removeStageCompletions, setStageCompletions } = assetStageCompletionSlice.actions;
|
|
1943
1918
|
const selectCompletedStages = (state) => {
|
|
1944
|
-
return state.
|
|
1919
|
+
return state.assetStageCompletionReducer.completionsByAssetId;
|
|
1945
1920
|
};
|
|
1946
|
-
const
|
|
1947
|
-
return Object.keys(state.
|
|
1921
|
+
const selectCompletedStageIdsForAsset = (asset) => (state) => {
|
|
1922
|
+
return Object.keys(state.assetStageCompletionReducer.completionsByAssetId[asset.offline_id] ?? {});
|
|
1948
1923
|
};
|
|
1949
|
-
const
|
|
1924
|
+
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1950
1925
|
const initialState$n = {
|
|
1951
1926
|
stages: {}
|
|
1952
1927
|
};
|
|
1953
|
-
const
|
|
1954
|
-
name: "
|
|
1928
|
+
const assetStageSlice = createSlice({
|
|
1929
|
+
name: "assetStages",
|
|
1955
1930
|
initialState: initialState$n,
|
|
1956
1931
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
1957
1932
|
reducers: {
|
|
@@ -1986,60 +1961,48 @@ const componentStageSlice = createSlice({
|
|
|
1986
1961
|
}
|
|
1987
1962
|
}
|
|
1988
1963
|
});
|
|
1989
|
-
const selectStageMapping = (state) => state.
|
|
1964
|
+
const selectStageMapping = (state) => state.assetStageReducer.stages;
|
|
1990
1965
|
const selectStage = restructureCreateSelectorWithArgs(
|
|
1991
1966
|
createSelector([selectStageMapping, (_state, stageId) => stageId], (stageMapping, stageId) => {
|
|
1992
1967
|
return stageMapping[stageId];
|
|
1993
1968
|
})
|
|
1994
1969
|
);
|
|
1995
|
-
const selectStages = createSelector(
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
);
|
|
2001
|
-
const
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
const ret = {};
|
|
2007
|
-
for (const stage of stages) {
|
|
2008
|
-
if (componentTypeIdsSet.has(stage.component_type)) {
|
|
2009
|
-
if (!ret[stage.component_type]) {
|
|
2010
|
-
ret[stage.component_type] = [];
|
|
2011
|
-
}
|
|
2012
|
-
ret[stage.component_type].push(stage);
|
|
1970
|
+
const selectStages = createSelector([selectStageMapping], (stageMapping) => {
|
|
1971
|
+
return Object.values(stageMapping);
|
|
1972
|
+
});
|
|
1973
|
+
const selectStagesFromAssetTypeIds = restructureCreateSelectorWithArgs(
|
|
1974
|
+
createSelector([selectStages, (_state, assetTypeIds) => assetTypeIds], (stages, assetTypeIds) => {
|
|
1975
|
+
const assetTypeIdsSet = new Set(assetTypeIds);
|
|
1976
|
+
const ret = {};
|
|
1977
|
+
for (const stage of stages) {
|
|
1978
|
+
if (assetTypeIdsSet.has(stage.asset_type)) {
|
|
1979
|
+
if (!ret[stage.asset_type]) {
|
|
1980
|
+
ret[stage.asset_type] = [];
|
|
2013
1981
|
}
|
|
1982
|
+
ret[stage.asset_type].push(stage);
|
|
2014
1983
|
}
|
|
2015
|
-
for (const key in ret) {
|
|
2016
|
-
ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
|
|
2017
|
-
}
|
|
2018
|
-
return ret;
|
|
2019
1984
|
}
|
|
2020
|
-
|
|
1985
|
+
for (const key in ret) {
|
|
1986
|
+
ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
|
|
1987
|
+
}
|
|
1988
|
+
return ret;
|
|
1989
|
+
})
|
|
2021
1990
|
);
|
|
2022
|
-
const
|
|
2023
|
-
createSelector(
|
|
2024
|
-
|
|
2025
|
-
(
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
if (stage.component_type === componentTypeId) {
|
|
2029
|
-
componentTypeStagesMapping[stageId] = stage;
|
|
2030
|
-
}
|
|
1991
|
+
const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
|
|
1992
|
+
createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
|
|
1993
|
+
const assetTypeStagesMapping = {};
|
|
1994
|
+
for (const [stageId, stage] of Object.entries(stagesMapping)) {
|
|
1995
|
+
if (stage.asset_type === assetTypeId) {
|
|
1996
|
+
assetTypeStagesMapping[stageId] = stage;
|
|
2031
1997
|
}
|
|
2032
|
-
return componentTypeStagesMapping;
|
|
2033
1998
|
}
|
|
2034
|
-
|
|
1999
|
+
return assetTypeStagesMapping;
|
|
2000
|
+
})
|
|
2035
2001
|
);
|
|
2036
|
-
const
|
|
2037
|
-
createSelector(
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
return stages.filter((stage) => stage.component_type === componentTypeId).sort((a, b) => a.priority - b.priority);
|
|
2041
|
-
}
|
|
2042
|
-
)
|
|
2002
|
+
const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
|
|
2003
|
+
createSelector([selectStages, (_state, assetTypeId) => assetTypeId], (stages, assetTypeId) => {
|
|
2004
|
+
return stages.filter((stage) => stage.asset_type === assetTypeId).sort((a, b) => a.priority - b.priority);
|
|
2005
|
+
})
|
|
2043
2006
|
);
|
|
2044
2007
|
const selectStagesFromStageIds = restructureCreateSelectorWithArgs(
|
|
2045
2008
|
createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
|
|
@@ -2061,8 +2024,8 @@ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
|
2061
2024
|
return ret;
|
|
2062
2025
|
})
|
|
2063
2026
|
);
|
|
2064
|
-
const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } =
|
|
2065
|
-
const
|
|
2027
|
+
const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = assetStageSlice.actions;
|
|
2028
|
+
const assetStageReducer = assetStageSlice.reducer;
|
|
2066
2029
|
const initialState$m = {
|
|
2067
2030
|
workspaces: {},
|
|
2068
2031
|
activeWorkspaceId: null
|
|
@@ -2721,8 +2684,8 @@ var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
|
|
|
2721
2684
|
})(OrganizationAccessLevel || {});
|
|
2722
2685
|
var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
|
|
2723
2686
|
AttachmentModel2["Issue"] = "issue";
|
|
2724
|
-
AttachmentModel2["
|
|
2725
|
-
AttachmentModel2["
|
|
2687
|
+
AttachmentModel2["Asset"] = "asset";
|
|
2688
|
+
AttachmentModel2["AssetType"] = "asset_type";
|
|
2726
2689
|
AttachmentModel2["Project"] = "project";
|
|
2727
2690
|
AttachmentModel2["Document"] = "document";
|
|
2728
2691
|
return AttachmentModel2;
|
|
@@ -3535,6 +3498,7 @@ const initialState$8 = {
|
|
|
3535
3498
|
placementMode: false,
|
|
3536
3499
|
enableClustering: false,
|
|
3537
3500
|
svgLayout: false,
|
|
3501
|
+
// TODO: this is no longer used
|
|
3538
3502
|
expandedSections: {
|
|
3539
3503
|
Issues: true,
|
|
3540
3504
|
"Map Layers": false,
|
|
@@ -3745,27 +3709,27 @@ const selectFormRevisionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
3745
3709
|
});
|
|
3746
3710
|
})
|
|
3747
3711
|
);
|
|
3748
|
-
const
|
|
3712
|
+
const selectLatestFormRevisionsOfAssetTypes = restructureCreateSelectorWithArgs(
|
|
3749
3713
|
createSelector(
|
|
3750
3714
|
[
|
|
3751
3715
|
(state) => state.formReducer.forms,
|
|
3752
3716
|
selectFormRevisionMapping,
|
|
3753
|
-
(_state,
|
|
3717
|
+
(_state, assetTypeIds) => assetTypeIds
|
|
3754
3718
|
],
|
|
3755
|
-
(userForms, revisions,
|
|
3756
|
-
const
|
|
3757
|
-
const
|
|
3719
|
+
(userForms, revisions, assetTypeIds) => {
|
|
3720
|
+
const assetTypeIdsSet = new Set(assetTypeIds);
|
|
3721
|
+
const formsOfAssetTypes = {};
|
|
3758
3722
|
const ret = {};
|
|
3759
3723
|
for (const form of Object.values(userForms)) {
|
|
3760
|
-
if (form.
|
|
3761
|
-
|
|
3724
|
+
if (form.asset_type && assetTypeIdsSet.has(form.asset_type)) {
|
|
3725
|
+
formsOfAssetTypes[form.offline_id] = form;
|
|
3762
3726
|
}
|
|
3763
3727
|
}
|
|
3764
3728
|
for (const revision of Object.values(revisions)) {
|
|
3765
|
-
const form =
|
|
3766
|
-
if (!form || !form.
|
|
3729
|
+
const form = formsOfAssetTypes[revision.form];
|
|
3730
|
+
if (!form || !form.asset_type || ret[form.asset_type] && formRevisionSortFn(ret[form.asset_type], revision) > 0)
|
|
3767
3731
|
continue;
|
|
3768
|
-
ret[form.
|
|
3732
|
+
ret[form.asset_type] = revision;
|
|
3769
3733
|
}
|
|
3770
3734
|
return ret;
|
|
3771
3735
|
}
|
|
@@ -3882,11 +3846,11 @@ const selectForm = (formId2) => (state) => {
|
|
|
3882
3846
|
const selectFormMapping = (state) => {
|
|
3883
3847
|
return state.formReducer.forms;
|
|
3884
3848
|
};
|
|
3885
|
-
const
|
|
3849
|
+
const selectFormOfAssetType = restructureCreateSelectorWithArgs(
|
|
3886
3850
|
createSelector(
|
|
3887
|
-
[selectFormMapping, (_state,
|
|
3888
|
-
(userForms,
|
|
3889
|
-
return Object.values(userForms).find((userForm) => userForm.
|
|
3851
|
+
[selectFormMapping, (_state, assetTypeId) => assetTypeId],
|
|
3852
|
+
(userForms, assetTypeId) => {
|
|
3853
|
+
return Object.values(userForms).find((userForm) => userForm.asset_type === assetTypeId);
|
|
3890
3854
|
}
|
|
3891
3855
|
)
|
|
3892
3856
|
);
|
|
@@ -3902,7 +3866,7 @@ const selectFormsCount = createSelector([selectFormMapping], (userForms) => {
|
|
|
3902
3866
|
return Object.keys(userForms).length;
|
|
3903
3867
|
});
|
|
3904
3868
|
const selectGeneralFormCount = createSelector([selectFormMapping], (userForms) => {
|
|
3905
|
-
return Object.values(userForms).filter((form) => !form.
|
|
3869
|
+
return Object.values(userForms).filter((form) => !form.asset_type).length;
|
|
3906
3870
|
});
|
|
3907
3871
|
const formReducer = formSlice.reducer;
|
|
3908
3872
|
const initialState$5 = {
|
|
@@ -4110,31 +4074,31 @@ const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
|
4110
4074
|
}
|
|
4111
4075
|
)
|
|
4112
4076
|
);
|
|
4113
|
-
const
|
|
4077
|
+
const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
4114
4078
|
createSelector(
|
|
4115
|
-
[selectFormSubmissions, (_state,
|
|
4116
|
-
(submissions,
|
|
4079
|
+
[selectFormSubmissions, (_state, assetId) => assetId],
|
|
4080
|
+
(submissions, assetId) => {
|
|
4117
4081
|
return submissions.filter((submission) => {
|
|
4118
|
-
return submission.
|
|
4082
|
+
return submission.asset === assetId;
|
|
4119
4083
|
});
|
|
4120
4084
|
}
|
|
4121
4085
|
)
|
|
4122
4086
|
);
|
|
4123
|
-
const
|
|
4124
|
-
[selectFormSubmissionsMapping,
|
|
4125
|
-
(submissions,
|
|
4087
|
+
const selectFormSubmissionsByAssets = createSelector(
|
|
4088
|
+
[selectFormSubmissionsMapping, selectAssetsMapping],
|
|
4089
|
+
(submissions, assets) => {
|
|
4126
4090
|
var _a2;
|
|
4127
|
-
const
|
|
4128
|
-
for (const
|
|
4129
|
-
|
|
4091
|
+
const assetSubmissionMapping = {};
|
|
4092
|
+
for (const assetId in assets) {
|
|
4093
|
+
assetSubmissionMapping[assetId] = [];
|
|
4130
4094
|
}
|
|
4131
4095
|
for (const submissionId in submissions) {
|
|
4132
4096
|
const submission = submissions[submissionId];
|
|
4133
|
-
if (submission.
|
|
4134
|
-
(_a2 =
|
|
4097
|
+
if (submission.asset) {
|
|
4098
|
+
(_a2 = assetSubmissionMapping[submission.asset]) == null ? void 0 : _a2.push(submission);
|
|
4135
4099
|
}
|
|
4136
4100
|
}
|
|
4137
|
-
return
|
|
4101
|
+
return assetSubmissionMapping;
|
|
4138
4102
|
}
|
|
4139
4103
|
);
|
|
4140
4104
|
const selectFormSubmissionAttachmentsMapping = (state) => {
|
|
@@ -4533,7 +4497,7 @@ const versioningSlice = createSlice({
|
|
|
4533
4497
|
reducers: {}
|
|
4534
4498
|
});
|
|
4535
4499
|
const versioningReducer = versioningSlice.reducer;
|
|
4536
|
-
const
|
|
4500
|
+
const fullAssetMarkerSize = 45;
|
|
4537
4501
|
const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
|
|
4538
4502
|
const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
|
|
4539
4503
|
const OUTBOX_RETRY_DELAY = 5e3;
|
|
@@ -4551,10 +4515,10 @@ const overmapReducers = {
|
|
|
4551
4515
|
fileReducer,
|
|
4552
4516
|
authReducer,
|
|
4553
4517
|
categoryReducer,
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4518
|
+
assetReducer,
|
|
4519
|
+
assetStageCompletionReducer,
|
|
4520
|
+
assetStageReducer,
|
|
4521
|
+
assetTypeReducer,
|
|
4558
4522
|
issueReducer,
|
|
4559
4523
|
issueTypeReducer,
|
|
4560
4524
|
mapReducer,
|
|
@@ -5396,110 +5360,108 @@ class CategoryService extends BaseApiService {
|
|
|
5396
5360
|
store.dispatch(setCategories(result));
|
|
5397
5361
|
}
|
|
5398
5362
|
}
|
|
5399
|
-
class
|
|
5363
|
+
class AssetService extends BaseApiService {
|
|
5400
5364
|
// Basic CRUD functions
|
|
5401
|
-
add(
|
|
5402
|
-
const
|
|
5403
|
-
this.client.store.dispatch(
|
|
5365
|
+
add(asset, workspaceId) {
|
|
5366
|
+
const offlineAsset = offline(asset);
|
|
5367
|
+
this.client.store.dispatch(addAsset(offlineAsset));
|
|
5404
5368
|
const promise = this.client.enqueueRequest({
|
|
5405
|
-
description: "Create
|
|
5369
|
+
description: "Create asset",
|
|
5406
5370
|
method: HttpMethod.POST,
|
|
5407
|
-
url: `/
|
|
5371
|
+
url: `/assets/types/${offlineAsset.asset_type}/add-assets/`,
|
|
5408
5372
|
queryParams: {
|
|
5409
5373
|
workspace_id: workspaceId.toString()
|
|
5410
5374
|
},
|
|
5411
|
-
payload: {
|
|
5375
|
+
payload: { assets: [offlineAsset] },
|
|
5412
5376
|
blockers: [],
|
|
5413
|
-
blocks: [
|
|
5377
|
+
blocks: [offlineAsset.offline_id]
|
|
5414
5378
|
});
|
|
5415
|
-
return [
|
|
5379
|
+
return [offlineAsset, promise];
|
|
5416
5380
|
}
|
|
5417
|
-
update(
|
|
5418
|
-
this.client.store.dispatch(
|
|
5381
|
+
update(asset, workspaceId) {
|
|
5382
|
+
this.client.store.dispatch(updateAsset(asset));
|
|
5419
5383
|
const promise = this.client.enqueueRequest({
|
|
5420
|
-
description: "Edit
|
|
5384
|
+
description: "Edit asset",
|
|
5421
5385
|
method: HttpMethod.PATCH,
|
|
5422
|
-
url: `/
|
|
5386
|
+
url: `/assets/${asset.offline_id}/`,
|
|
5423
5387
|
queryParams: {
|
|
5424
5388
|
workspace_id: workspaceId.toString()
|
|
5425
5389
|
},
|
|
5426
|
-
payload:
|
|
5427
|
-
blockers: [
|
|
5428
|
-
blocks: [
|
|
5390
|
+
payload: asset,
|
|
5391
|
+
blockers: [asset.offline_id],
|
|
5392
|
+
blocks: [asset.offline_id]
|
|
5429
5393
|
});
|
|
5430
|
-
return [
|
|
5394
|
+
return [asset, promise];
|
|
5431
5395
|
}
|
|
5432
|
-
async remove(
|
|
5396
|
+
async remove(assetId) {
|
|
5433
5397
|
const { store } = this.client;
|
|
5434
|
-
const
|
|
5435
|
-
if (!
|
|
5436
|
-
throw new Error(`No
|
|
5437
|
-
const
|
|
5438
|
-
store.dispatch(
|
|
5439
|
-
if (
|
|
5440
|
-
const
|
|
5441
|
-
store.dispatch(
|
|
5398
|
+
const assetToBeDeleted = selectAsset(assetId)(store.getState());
|
|
5399
|
+
if (!assetToBeDeleted)
|
|
5400
|
+
throw new Error(`No asset with id ${assetId} found in the store`);
|
|
5401
|
+
const attachmentsOfAssets = selectAttachmentsOfAsset(assetId)(store.getState());
|
|
5402
|
+
store.dispatch(removeAsset(assetId));
|
|
5403
|
+
if (attachmentsOfAssets.length > 0) {
|
|
5404
|
+
const attachmentsOfAssetIds = attachmentsOfAssets.map(({ offline_id }) => offline_id);
|
|
5405
|
+
store.dispatch(removeAssetAttachments(attachmentsOfAssetIds));
|
|
5442
5406
|
}
|
|
5443
5407
|
return this.client.enqueueRequest({
|
|
5444
|
-
description: "Delete
|
|
5408
|
+
description: "Delete asset",
|
|
5445
5409
|
method: HttpMethod.DELETE,
|
|
5446
|
-
url: `/
|
|
5447
|
-
blockers: [
|
|
5410
|
+
url: `/assets/${assetId}/`,
|
|
5411
|
+
blockers: [assetId],
|
|
5448
5412
|
blocks: []
|
|
5449
5413
|
}).catch((err) => {
|
|
5450
|
-
store.dispatch(
|
|
5451
|
-
store.dispatch(
|
|
5414
|
+
store.dispatch(addAsset(assetToBeDeleted));
|
|
5415
|
+
store.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
5452
5416
|
throw err;
|
|
5453
5417
|
});
|
|
5454
5418
|
}
|
|
5455
|
-
async
|
|
5456
|
-
const clientStore2 = this.client.store;
|
|
5457
|
-
const allComponentsOfType = selectComponentsFromComponentType(componentTypeId)(clientStore2.getState());
|
|
5458
|
-
const affectedComponentIds = (allComponentsOfType || []).map((c) => c.offline_id);
|
|
5459
|
-
const affectedOfflineIds = [componentTypeId, ...affectedComponentIds];
|
|
5419
|
+
async deleteAllAssetsOfAssetType(assetTypeId) {
|
|
5460
5420
|
const { store } = this.client;
|
|
5461
5421
|
const state = store.getState();
|
|
5462
|
-
const
|
|
5463
|
-
|
|
5422
|
+
const allAssetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
|
|
5423
|
+
const allAssetsOfAssetTypeIds = (allAssetsOfAssetType || []).map((c) => c.offline_id);
|
|
5424
|
+
const affectedOfflineIds = [assetTypeId, ...allAssetsOfAssetTypeIds];
|
|
5425
|
+
store.dispatch(removeAllAssetsOfType(assetTypeId));
|
|
5464
5426
|
return this.client.enqueueRequest({
|
|
5465
|
-
description: "
|
|
5427
|
+
description: "Delete all assets of asset type",
|
|
5466
5428
|
method: HttpMethod.DELETE,
|
|
5467
|
-
url: `/
|
|
5429
|
+
url: `/assets/types/${assetTypeId}/delete-all-of-type/`,
|
|
5468
5430
|
blockers: affectedOfflineIds,
|
|
5469
5431
|
blocks: affectedOfflineIds
|
|
5470
5432
|
}).catch((err) => {
|
|
5471
|
-
if (
|
|
5472
|
-
store.dispatch(
|
|
5433
|
+
if (allAssetsOfAssetType) {
|
|
5434
|
+
store.dispatch(addAssetsInBatches(allAssetsOfAssetType));
|
|
5473
5435
|
}
|
|
5474
5436
|
throw err;
|
|
5475
5437
|
});
|
|
5476
5438
|
}
|
|
5477
|
-
async addBatch(
|
|
5478
|
-
const
|
|
5479
|
-
return { ...offline(
|
|
5439
|
+
async addBatch(assetsToCreate, workspaceId, assetTypeId) {
|
|
5440
|
+
const fullAssets = assetsToCreate.map((asset) => {
|
|
5441
|
+
return { ...offline(asset), submitted_at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
5480
5442
|
});
|
|
5481
5443
|
const { store } = this.client;
|
|
5482
|
-
store.dispatch(
|
|
5444
|
+
store.dispatch(addAssetsInBatches(fullAssets));
|
|
5483
5445
|
const promise = this.client.enqueueRequest({
|
|
5484
|
-
description: "Batch create
|
|
5446
|
+
description: "Batch create assets",
|
|
5485
5447
|
method: HttpMethod.POST,
|
|
5486
|
-
url: `/
|
|
5448
|
+
url: `/assets/types/${assetTypeId}/add-assets/`,
|
|
5487
5449
|
queryParams: {
|
|
5488
5450
|
workspace_id: workspaceId.toString()
|
|
5489
5451
|
},
|
|
5490
5452
|
payload: {
|
|
5491
|
-
|
|
5453
|
+
assets: fullAssets
|
|
5492
5454
|
},
|
|
5493
|
-
blockers: [
|
|
5494
|
-
blocks:
|
|
5455
|
+
blockers: [assetTypeId],
|
|
5456
|
+
blocks: fullAssets.map((c) => c.offline_id)
|
|
5495
5457
|
});
|
|
5496
5458
|
void promise.then((result) => {
|
|
5497
|
-
for (const
|
|
5498
|
-
store.dispatch(
|
|
5459
|
+
for (const assets of Object.values(result)) {
|
|
5460
|
+
store.dispatch(updateAsset(assets));
|
|
5499
5461
|
}
|
|
5500
5462
|
}).catch((e) => {
|
|
5501
|
-
for (const
|
|
5502
|
-
store.dispatch(
|
|
5463
|
+
for (const asset of fullAssets) {
|
|
5464
|
+
store.dispatch(removeAsset(asset.offline_id));
|
|
5503
5465
|
}
|
|
5504
5466
|
throw e;
|
|
5505
5467
|
});
|
|
@@ -5508,128 +5470,124 @@ class ComponentService extends BaseApiService {
|
|
|
5508
5470
|
async refreshStore() {
|
|
5509
5471
|
const { store } = this.client;
|
|
5510
5472
|
const result = await this.client.enqueueRequest({
|
|
5511
|
-
description: "Get
|
|
5473
|
+
description: "Get assets",
|
|
5512
5474
|
method: HttpMethod.GET,
|
|
5513
|
-
url: `/projects/${store.getState().projectReducer.activeProjectId}/
|
|
5475
|
+
url: `/projects/${store.getState().projectReducer.activeProjectId}/assets/`,
|
|
5514
5476
|
blockers: [],
|
|
5515
5477
|
blocks: []
|
|
5516
5478
|
});
|
|
5517
|
-
store.dispatch(
|
|
5479
|
+
store.dispatch(setAssets(result));
|
|
5518
5480
|
}
|
|
5519
5481
|
}
|
|
5520
|
-
class
|
|
5521
|
-
add(
|
|
5482
|
+
class AssetStageCompletionService extends BaseApiService {
|
|
5483
|
+
add(assetId, stageId) {
|
|
5522
5484
|
var _a2;
|
|
5523
5485
|
const { store } = this.client;
|
|
5524
|
-
const
|
|
5525
|
-
if (!
|
|
5526
|
-
throw new Error(`
|
|
5486
|
+
const assetTypeId = (_a2 = store.getState().assetReducer.assets[assetId]) == null ? void 0 : _a2.asset_type;
|
|
5487
|
+
if (!assetTypeId) {
|
|
5488
|
+
throw new Error(`Asset with offline_id ${assetId} not found`);
|
|
5527
5489
|
}
|
|
5528
|
-
const
|
|
5529
|
-
|
|
5490
|
+
const offlineStageCompletion = offline({
|
|
5491
|
+
asset: assetId,
|
|
5530
5492
|
stage: stageId
|
|
5531
5493
|
});
|
|
5532
|
-
store.dispatch(addStageCompletion(
|
|
5494
|
+
store.dispatch(addStageCompletion(offlineStageCompletion));
|
|
5533
5495
|
const promise = this.client.enqueueRequest({
|
|
5534
|
-
description: "
|
|
5496
|
+
description: "Complete stage",
|
|
5535
5497
|
method: HttpMethod.POST,
|
|
5536
|
-
url: `/
|
|
5498
|
+
url: `/assets/types/${assetTypeId}/complete-stages/`,
|
|
5537
5499
|
// TODO: Add submitted_at to model
|
|
5538
|
-
payload: { completions: [{ ...
|
|
5539
|
-
blockers: [
|
|
5540
|
-
blocks: [
|
|
5500
|
+
payload: { completions: [{ ...offlineStageCompletion, submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3 }] },
|
|
5501
|
+
blockers: [assetId, stageId],
|
|
5502
|
+
blocks: [offlineStageCompletion.offline_id]
|
|
5541
5503
|
});
|
|
5542
|
-
return [
|
|
5504
|
+
return [offlineStageCompletion, promise];
|
|
5543
5505
|
}
|
|
5544
5506
|
async refreshStore() {
|
|
5545
5507
|
const { store } = this.client;
|
|
5546
5508
|
const result = await this.client.enqueueRequest({
|
|
5547
|
-
description: "Get
|
|
5509
|
+
description: "Get stage completions",
|
|
5548
5510
|
method: HttpMethod.GET,
|
|
5549
|
-
url: `/projects/${store.getState().projectReducer.activeProjectId}/
|
|
5511
|
+
url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-stage-completions/`,
|
|
5550
5512
|
blockers: [],
|
|
5551
5513
|
blocks: []
|
|
5552
5514
|
});
|
|
5553
5515
|
store.dispatch(addStageCompletions(result));
|
|
5554
5516
|
}
|
|
5555
5517
|
/**
|
|
5556
|
-
* Creates a collection of
|
|
5557
|
-
*
|
|
5558
|
-
* @param
|
|
5559
|
-
* stages for one
|
|
5518
|
+
* Creates a collection of AssetStageCompletions, marking the referenced stages as completed for the referenced
|
|
5519
|
+
* assets. It's REQUIRED that all assets referenced all have the SAME asset type.
|
|
5520
|
+
* @param assetTypeId The ID of the asset type for which we are completing stages (we can only complete
|
|
5521
|
+
* stages for one asset type at a time)
|
|
5560
5522
|
* @param stageCompletions
|
|
5561
5523
|
*/
|
|
5562
|
-
async bulkAdd(
|
|
5563
|
-
const
|
|
5524
|
+
async bulkAdd(assetTypeId, stageCompletions) {
|
|
5525
|
+
const offlineStageCompletions = stageCompletions.map((completion) => {
|
|
5564
5526
|
return offline(completion);
|
|
5565
5527
|
});
|
|
5566
5528
|
const asMapping = {};
|
|
5567
5529
|
for (const completion of stageCompletions) {
|
|
5568
|
-
const stageToCompletionDateMapping = asMapping[completion.
|
|
5530
|
+
const stageToCompletionDateMapping = asMapping[completion.asset] || {};
|
|
5569
5531
|
stageToCompletionDateMapping[completion.stage] = (/* @__PURE__ */ new Date()).toISOString();
|
|
5570
|
-
asMapping[completion.
|
|
5532
|
+
asMapping[completion.asset] = stageToCompletionDateMapping;
|
|
5571
5533
|
}
|
|
5572
5534
|
this.client.store.dispatch(addStageCompletions(asMapping));
|
|
5573
5535
|
await this.client.enqueueRequest({
|
|
5574
|
-
description: "
|
|
5536
|
+
description: "Bulk complete stages",
|
|
5575
5537
|
method: HttpMethod.POST,
|
|
5576
|
-
url: `/
|
|
5538
|
+
url: `/assets/types/${assetTypeId}/complete-stages/`,
|
|
5577
5539
|
payload: {
|
|
5578
|
-
completions:
|
|
5540
|
+
completions: offlineStageCompletions
|
|
5579
5541
|
},
|
|
5580
|
-
blockers: [
|
|
5581
|
-
|
|
5582
|
-
...stageCompletions.map((c) => c.component),
|
|
5583
|
-
...stageCompletions.map((c) => c.stage)
|
|
5584
|
-
],
|
|
5585
|
-
blocks: offlineStagesCompletions.map((c) => c.offline_id)
|
|
5542
|
+
blockers: [assetTypeId, ...stageCompletions.map((c) => c.asset), ...stageCompletions.map((c) => c.stage)],
|
|
5543
|
+
blocks: offlineStageCompletions.map((c) => c.offline_id)
|
|
5586
5544
|
});
|
|
5587
5545
|
}
|
|
5588
|
-
bulkDelete(stageId,
|
|
5589
|
-
const
|
|
5546
|
+
bulkDelete(stageId, assetIds) {
|
|
5547
|
+
const stageCompletionsToRemove = assetIds.map((assetId) => {
|
|
5590
5548
|
return {
|
|
5591
|
-
|
|
5549
|
+
asset: assetId,
|
|
5592
5550
|
stage: stageId
|
|
5593
5551
|
};
|
|
5594
5552
|
});
|
|
5595
|
-
this.client.store.dispatch(removeStageCompletions(
|
|
5553
|
+
this.client.store.dispatch(removeStageCompletions(stageCompletionsToRemove));
|
|
5596
5554
|
return this.client.enqueueRequest({
|
|
5597
|
-
description: `Undo stage for ${
|
|
5555
|
+
description: `Undo stage for ${assetIds.length} assets(s)`,
|
|
5598
5556
|
// TODO: Rename to setCompletedStages
|
|
5599
5557
|
method: HttpMethod.DELETE,
|
|
5600
|
-
url: `/
|
|
5558
|
+
url: `/assets/stages/${stageId}/undo-stages/`,
|
|
5601
5559
|
payload: {
|
|
5602
|
-
|
|
5560
|
+
assets: assetIds
|
|
5603
5561
|
},
|
|
5604
|
-
blockers: [stageId, ...
|
|
5562
|
+
blockers: [stageId, ...assetIds],
|
|
5605
5563
|
blocks: []
|
|
5606
5564
|
});
|
|
5607
5565
|
}
|
|
5608
5566
|
}
|
|
5609
|
-
class
|
|
5610
|
-
async bulkCreateStages(stagesToSubmit,
|
|
5567
|
+
class AssetStageService extends BaseApiService {
|
|
5568
|
+
async bulkCreateStages(stagesToSubmit, assetTypeId, workspaceId) {
|
|
5611
5569
|
const payload = stagesToSubmit.map((stage) => {
|
|
5612
5570
|
return offline(stage);
|
|
5613
5571
|
});
|
|
5614
5572
|
const fullStages = payload.map((stage) => {
|
|
5615
|
-
return { ...stage,
|
|
5573
|
+
return { ...stage, asset_type: assetTypeId };
|
|
5616
5574
|
});
|
|
5617
5575
|
this.client.store.dispatch(addStages(fullStages));
|
|
5618
5576
|
return this.client.enqueueRequest({
|
|
5619
|
-
description: "Add
|
|
5577
|
+
description: "Add asset stages",
|
|
5620
5578
|
method: HttpMethod.POST,
|
|
5621
|
-
url: `/
|
|
5579
|
+
url: `/assets/types/${assetTypeId}/add-stages/`,
|
|
5622
5580
|
payload: {
|
|
5623
5581
|
stages: payload
|
|
5624
5582
|
},
|
|
5625
5583
|
queryParams: {
|
|
5626
5584
|
workspace_id: workspaceId.toString()
|
|
5627
5585
|
},
|
|
5628
|
-
blockers: [
|
|
5586
|
+
blockers: [assetTypeId, workspaceId],
|
|
5629
5587
|
blocks: payload.map(({ offline_id }) => offline_id)
|
|
5630
5588
|
});
|
|
5631
5589
|
}
|
|
5632
|
-
async bulkUpdateStages(stagesToUpdate,
|
|
5590
|
+
async bulkUpdateStages(stagesToUpdate, assetTypeId) {
|
|
5633
5591
|
const store = this.client.store;
|
|
5634
5592
|
const state = store.getState();
|
|
5635
5593
|
const prevStages = selectStagesFromStageIds(
|
|
@@ -5640,13 +5598,13 @@ class ComponentStageService extends BaseApiService {
|
|
|
5640
5598
|
}
|
|
5641
5599
|
store.dispatch(updateStages(stagesToUpdate));
|
|
5642
5600
|
return this.client.enqueueRequest({
|
|
5643
|
-
description: "Edit
|
|
5601
|
+
description: "Edit asset stages",
|
|
5644
5602
|
method: HttpMethod.PATCH,
|
|
5645
|
-
url: `/
|
|
5603
|
+
url: `/assets/types/${assetTypeId}/bulk-update-stages/`,
|
|
5646
5604
|
payload: {
|
|
5647
5605
|
stages: stagesToUpdate
|
|
5648
5606
|
},
|
|
5649
|
-
blockers: [
|
|
5607
|
+
blockers: [assetTypeId],
|
|
5650
5608
|
blocks: stagesToUpdate.map(({ offline_id }) => offline_id)
|
|
5651
5609
|
}).catch((e) => {
|
|
5652
5610
|
store.dispatch(updateStages(prevStages));
|
|
@@ -5656,9 +5614,9 @@ class ComponentStageService extends BaseApiService {
|
|
|
5656
5614
|
async bulkDelete(idsToDelete) {
|
|
5657
5615
|
this.client.store.dispatch(removeStages(idsToDelete));
|
|
5658
5616
|
return this.client.enqueueRequest({
|
|
5659
|
-
description: "Delete
|
|
5617
|
+
description: "Delete asset stages",
|
|
5660
5618
|
method: HttpMethod.DELETE,
|
|
5661
|
-
url: "/
|
|
5619
|
+
url: "/assets/stages/bulk-delete/",
|
|
5662
5620
|
payload: {
|
|
5663
5621
|
stage_ids: idsToDelete
|
|
5664
5622
|
},
|
|
@@ -5666,15 +5624,15 @@ class ComponentStageService extends BaseApiService {
|
|
|
5666
5624
|
blocks: []
|
|
5667
5625
|
});
|
|
5668
5626
|
}
|
|
5669
|
-
async update(
|
|
5670
|
-
this.client.store.dispatch(addStages([
|
|
5627
|
+
async update(assetStage) {
|
|
5628
|
+
this.client.store.dispatch(addStages([assetStage]));
|
|
5671
5629
|
return this.client.enqueueRequest({
|
|
5672
|
-
description: "Update
|
|
5630
|
+
description: "Update asset stage",
|
|
5673
5631
|
method: HttpMethod.PATCH,
|
|
5674
|
-
url: `/
|
|
5675
|
-
payload:
|
|
5676
|
-
blockers: [
|
|
5677
|
-
blocks: [
|
|
5632
|
+
url: `/assets/stages/${assetStage.offline_id}/`,
|
|
5633
|
+
payload: assetStage,
|
|
5634
|
+
blockers: [assetStage.offline_id],
|
|
5635
|
+
blocks: [assetStage.offline_id]
|
|
5678
5636
|
});
|
|
5679
5637
|
}
|
|
5680
5638
|
async linkForm(stageId, formId2) {
|
|
@@ -5682,9 +5640,9 @@ class ComponentStageService extends BaseApiService {
|
|
|
5682
5640
|
store.dispatch(linkStageToForm({ stageId, formId: formId2 }));
|
|
5683
5641
|
try {
|
|
5684
5642
|
await this.client.enqueueRequest({
|
|
5685
|
-
description: "Link
|
|
5643
|
+
description: "Link asset stage to form",
|
|
5686
5644
|
method: HttpMethod.POST,
|
|
5687
|
-
url: `/
|
|
5645
|
+
url: `/assets/stages/${stageId}/associate-with-form/`,
|
|
5688
5646
|
payload: { user_form: formId2 },
|
|
5689
5647
|
blockers: [stageId, formId2],
|
|
5690
5648
|
blocks: [stageId]
|
|
@@ -5699,9 +5657,9 @@ class ComponentStageService extends BaseApiService {
|
|
|
5699
5657
|
store.dispatch(unlinkStageToForm({ stageId }));
|
|
5700
5658
|
try {
|
|
5701
5659
|
await this.client.enqueueRequest({
|
|
5702
|
-
description: "Unlink
|
|
5660
|
+
description: "Unlink asset stage from form",
|
|
5703
5661
|
method: HttpMethod.DELETE,
|
|
5704
|
-
url: `/
|
|
5662
|
+
url: `/assets/stages/${stageId}/associate-with-form/`,
|
|
5705
5663
|
blockers: [stageId, formId2],
|
|
5706
5664
|
blocks: [stageId]
|
|
5707
5665
|
});
|
|
@@ -5713,9 +5671,9 @@ class ComponentStageService extends BaseApiService {
|
|
|
5713
5671
|
async refreshStore() {
|
|
5714
5672
|
const { store } = this.client;
|
|
5715
5673
|
const result = await this.client.enqueueRequest({
|
|
5716
|
-
description: "Get
|
|
5674
|
+
description: "Get asset stages",
|
|
5717
5675
|
method: HttpMethod.GET,
|
|
5718
|
-
url: `/projects/${store.getState().projectReducer.activeProjectId}/
|
|
5676
|
+
url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-stages/`,
|
|
5719
5677
|
blockers: [],
|
|
5720
5678
|
blocks: []
|
|
5721
5679
|
});
|
|
@@ -5729,20 +5687,20 @@ const AttachmentModelMeta = {
|
|
|
5729
5687
|
deleteUrlPrefix: "/issues",
|
|
5730
5688
|
fetchUrlPostfix: "/issue-attachments"
|
|
5731
5689
|
},
|
|
5732
|
-
[AttachmentModel.
|
|
5733
|
-
name: "
|
|
5734
|
-
attachUrlPrefix: "/
|
|
5735
|
-
deleteUrlPrefix: "/
|
|
5736
|
-
fetchUrlPostfix: "/
|
|
5690
|
+
[AttachmentModel.Asset]: {
|
|
5691
|
+
name: "asset",
|
|
5692
|
+
attachUrlPrefix: "/assets",
|
|
5693
|
+
deleteUrlPrefix: "/assets",
|
|
5694
|
+
fetchUrlPostfix: "/asset-attachments"
|
|
5737
5695
|
},
|
|
5738
|
-
[AttachmentModel.
|
|
5739
|
-
name: "
|
|
5740
|
-
attachUrlPrefix: "/
|
|
5741
|
-
deleteUrlPrefix: "/
|
|
5742
|
-
fetchUrlPostfix: "/
|
|
5696
|
+
[AttachmentModel.AssetType]: {
|
|
5697
|
+
name: "asset type",
|
|
5698
|
+
attachUrlPrefix: "/assets/types",
|
|
5699
|
+
deleteUrlPrefix: "/assets/types",
|
|
5700
|
+
fetchUrlPostfix: "/asset-type-attachments"
|
|
5743
5701
|
},
|
|
5744
5702
|
[AttachmentModel.Project]: {
|
|
5745
|
-
name: "
|
|
5703
|
+
name: "project",
|
|
5746
5704
|
attachUrlPrefix: "/projects",
|
|
5747
5705
|
deleteUrlPrefix: "/projects",
|
|
5748
5706
|
fetchUrlPostfix: "/attachments"
|
|
@@ -5758,8 +5716,8 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5758
5716
|
getNumberOfAttachmentsWithSha1(sha1) {
|
|
5759
5717
|
const {
|
|
5760
5718
|
issueReducer: issueReducer2,
|
|
5761
|
-
|
|
5762
|
-
|
|
5719
|
+
assetReducer: assetReducer2,
|
|
5720
|
+
assetTypeReducer: assetTypeReducer2,
|
|
5763
5721
|
documentsReducer: documentsReducer2,
|
|
5764
5722
|
projectReducer: projectReducer2,
|
|
5765
5723
|
formSubmissionReducer: formSubmissionReducer2,
|
|
@@ -5767,8 +5725,8 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5767
5725
|
} = this.client.store.getState();
|
|
5768
5726
|
const objectsWithSha1 = [].concat(
|
|
5769
5727
|
Object.values(issueReducer2.attachments),
|
|
5770
|
-
Object.values(
|
|
5771
|
-
Object.values(
|
|
5728
|
+
Object.values(assetReducer2.attachments),
|
|
5729
|
+
Object.values(assetTypeReducer2.attachments),
|
|
5772
5730
|
Object.values(documentsReducer2.attachments),
|
|
5773
5731
|
Object.values(projectReducer2.attachments),
|
|
5774
5732
|
Object.values(formRevisionReducer2.attachments),
|
|
@@ -5890,10 +5848,10 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5890
5848
|
return promise;
|
|
5891
5849
|
}
|
|
5892
5850
|
}
|
|
5893
|
-
class
|
|
5851
|
+
class AssetAttachmentService extends BaseAttachmentService {
|
|
5894
5852
|
constructor() {
|
|
5895
5853
|
super(...arguments);
|
|
5896
|
-
__publicField(this, "attachmentModel", AttachmentModel.
|
|
5854
|
+
__publicField(this, "attachmentModel", AttachmentModel.Asset);
|
|
5897
5855
|
}
|
|
5898
5856
|
buildOfflineAttachment(data) {
|
|
5899
5857
|
return offline({
|
|
@@ -5904,115 +5862,108 @@ class ComponentAttachmentService extends BaseAttachmentService {
|
|
|
5904
5862
|
file_type: data.file.type,
|
|
5905
5863
|
submitted_at: data.submittedAt,
|
|
5906
5864
|
description: data.description,
|
|
5907
|
-
|
|
5865
|
+
asset: data.modelId
|
|
5908
5866
|
});
|
|
5909
5867
|
}
|
|
5910
|
-
async
|
|
5911
|
-
return this.attachFiles(
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
addAttachments: addComponentAttachments,
|
|
5917
|
-
updateAttachments: updateComponentAttachments,
|
|
5918
|
-
removeAttachments: removeComponentAttachments
|
|
5919
|
-
}
|
|
5920
|
-
);
|
|
5868
|
+
async attachFilesToAsset(files, assetId) {
|
|
5869
|
+
return this.attachFiles(files, assetId, this.buildOfflineAttachment.bind(this), {
|
|
5870
|
+
addAttachments: addAssetAttachments,
|
|
5871
|
+
updateAttachments: updateAssetAttachments,
|
|
5872
|
+
removeAttachments: removeAssetAttachments
|
|
5873
|
+
});
|
|
5921
5874
|
}
|
|
5922
|
-
|
|
5875
|
+
deleteAssetAttachment(attachmentId) {
|
|
5923
5876
|
return this.deleteAttachment(
|
|
5924
5877
|
attachmentId,
|
|
5925
5878
|
{
|
|
5926
|
-
setAttachment:
|
|
5927
|
-
removeAttachment:
|
|
5879
|
+
setAttachment: setAssetAttachment,
|
|
5880
|
+
removeAttachment: removeAssetAttachment
|
|
5928
5881
|
},
|
|
5929
5882
|
{
|
|
5930
|
-
selectAttachment:
|
|
5883
|
+
selectAttachment: selectAssetAttachment
|
|
5931
5884
|
}
|
|
5932
5885
|
);
|
|
5933
5886
|
}
|
|
5934
5887
|
async refreshStore() {
|
|
5935
5888
|
return this.getAttachments({
|
|
5936
|
-
setAttachments:
|
|
5889
|
+
setAttachments: setAssetAttachments
|
|
5937
5890
|
});
|
|
5938
5891
|
}
|
|
5939
5892
|
}
|
|
5940
|
-
class
|
|
5941
|
-
add(
|
|
5942
|
-
const
|
|
5893
|
+
class AssetTypeService extends BaseApiService {
|
|
5894
|
+
add(assetType) {
|
|
5895
|
+
const offlineAssetType = offline(assetType);
|
|
5943
5896
|
const { store } = this.client;
|
|
5944
5897
|
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
5945
|
-
store.dispatch(
|
|
5898
|
+
store.dispatch(addAssetType(offlineAssetType));
|
|
5946
5899
|
const promise = this.client.enqueueRequest({
|
|
5947
|
-
description: "Create
|
|
5900
|
+
description: "Create asset type",
|
|
5948
5901
|
method: HttpMethod.POST,
|
|
5949
|
-
url: `/projects/${activeProjectId}/
|
|
5950
|
-
payload: { ...
|
|
5902
|
+
url: `/projects/${activeProjectId}/asset-types/`,
|
|
5903
|
+
payload: { ...offlineAssetType },
|
|
5951
5904
|
blockers: [],
|
|
5952
|
-
blocks: [
|
|
5905
|
+
blocks: [offlineAssetType.offline_id]
|
|
5953
5906
|
});
|
|
5954
|
-
return [
|
|
5907
|
+
return [offlineAssetType, promise];
|
|
5955
5908
|
}
|
|
5956
|
-
update(
|
|
5957
|
-
this.client.store.dispatch(
|
|
5909
|
+
update(assetType) {
|
|
5910
|
+
this.client.store.dispatch(addAssetType(assetType));
|
|
5958
5911
|
return this.client.enqueueRequest({
|
|
5959
|
-
description: "Update
|
|
5912
|
+
description: "Update asset type",
|
|
5960
5913
|
method: HttpMethod.PATCH,
|
|
5961
|
-
url: `/
|
|
5962
|
-
payload:
|
|
5963
|
-
blockers: [
|
|
5964
|
-
blocks: [
|
|
5914
|
+
url: `/assets/types/${assetType.offline_id}/`,
|
|
5915
|
+
payload: assetType,
|
|
5916
|
+
blockers: [assetType.offline_id],
|
|
5917
|
+
blocks: [assetType.offline_id]
|
|
5965
5918
|
});
|
|
5966
5919
|
}
|
|
5967
|
-
async delete(
|
|
5920
|
+
async delete(assetTypeId) {
|
|
5968
5921
|
const { store } = this.client;
|
|
5969
5922
|
const state = store.getState();
|
|
5970
|
-
const
|
|
5971
|
-
if (!
|
|
5972
|
-
throw new Error(
|
|
5973
|
-
}
|
|
5974
|
-
const
|
|
5975
|
-
const
|
|
5976
|
-
store.dispatch(
|
|
5977
|
-
if (
|
|
5978
|
-
const
|
|
5979
|
-
|
|
5980
|
-
);
|
|
5981
|
-
store.dispatch(removeStages(stagesOfComponentTypeIds));
|
|
5923
|
+
const assetType = selectAssetType(assetTypeId)(state);
|
|
5924
|
+
if (!assetType) {
|
|
5925
|
+
throw new Error(`Expected asset type with offline_id ${assetTypeId} to exist`);
|
|
5926
|
+
}
|
|
5927
|
+
const stagesOfAssetType = selectStagesOfAssetType(assetTypeId)(state) ?? [];
|
|
5928
|
+
const attachmentsOfAssetType = selectAttachmentsOfAssetType(assetTypeId)(state);
|
|
5929
|
+
store.dispatch(deleteAssetType(assetTypeId));
|
|
5930
|
+
if (stagesOfAssetType.length > 0) {
|
|
5931
|
+
const stagesOfAssetTypeIds = stagesOfAssetType.map((assetStage) => assetStage.offline_id);
|
|
5932
|
+
store.dispatch(removeStages(stagesOfAssetTypeIds));
|
|
5982
5933
|
}
|
|
5983
|
-
if (
|
|
5984
|
-
const
|
|
5985
|
-
store.dispatch(
|
|
5934
|
+
if (attachmentsOfAssetType.length > 0) {
|
|
5935
|
+
const attachmentsOfAssetTypeIds = attachmentsOfAssetType.map(({ offline_id }) => offline_id);
|
|
5936
|
+
store.dispatch(removeAssetTypeAttachments(attachmentsOfAssetTypeIds));
|
|
5986
5937
|
}
|
|
5987
5938
|
return this.client.enqueueRequest({
|
|
5988
|
-
description: "Delete
|
|
5939
|
+
description: "Delete asset type",
|
|
5989
5940
|
method: HttpMethod.DELETE,
|
|
5990
|
-
url: `/
|
|
5991
|
-
blockers: [
|
|
5941
|
+
url: `/assets/types/${assetTypeId}/`,
|
|
5942
|
+
blockers: [assetTypeId],
|
|
5992
5943
|
blocks: []
|
|
5993
5944
|
}).catch((e) => {
|
|
5994
|
-
store.dispatch(
|
|
5995
|
-
store.dispatch(addStages(
|
|
5996
|
-
store.dispatch(
|
|
5945
|
+
store.dispatch(addAssetType(assetType));
|
|
5946
|
+
store.dispatch(addStages(stagesOfAssetType));
|
|
5947
|
+
store.dispatch(addAssetTypeAttachments(attachmentsOfAssetType));
|
|
5997
5948
|
throw e;
|
|
5998
5949
|
});
|
|
5999
5950
|
}
|
|
6000
5951
|
async refreshStore() {
|
|
6001
5952
|
const { store } = this.client;
|
|
6002
5953
|
const result = await this.client.enqueueRequest({
|
|
6003
|
-
description: "Get
|
|
5954
|
+
description: "Get asset types",
|
|
6004
5955
|
method: HttpMethod.GET,
|
|
6005
|
-
url: `/projects/${store.getState().projectReducer.activeProjectId}/
|
|
5956
|
+
url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-types/`,
|
|
6006
5957
|
blockers: [],
|
|
6007
5958
|
blocks: []
|
|
6008
5959
|
});
|
|
6009
|
-
store.dispatch(
|
|
5960
|
+
store.dispatch(setAssetTypes(result));
|
|
6010
5961
|
}
|
|
6011
5962
|
}
|
|
6012
|
-
class
|
|
5963
|
+
class AssetTypeAttachmentService extends BaseAttachmentService {
|
|
6013
5964
|
constructor() {
|
|
6014
5965
|
super(...arguments);
|
|
6015
|
-
__publicField(this, "attachmentModel", AttachmentModel.
|
|
5966
|
+
__publicField(this, "attachmentModel", AttachmentModel.AssetType);
|
|
6016
5967
|
}
|
|
6017
5968
|
buildOfflineAttachment(data) {
|
|
6018
5969
|
return offline({
|
|
@@ -6023,36 +5974,36 @@ class ComponentTypeAttachmentService extends BaseAttachmentService {
|
|
|
6023
5974
|
file_type: data.file.type,
|
|
6024
5975
|
submitted_at: data.submittedAt,
|
|
6025
5976
|
description: data.description,
|
|
6026
|
-
|
|
5977
|
+
asset_type: data.modelId
|
|
6027
5978
|
});
|
|
6028
5979
|
}
|
|
6029
|
-
async
|
|
5980
|
+
async attachFilesToAssetType(files, assetTypeId) {
|
|
6030
5981
|
return this.attachFiles(
|
|
6031
5982
|
files,
|
|
6032
|
-
|
|
5983
|
+
assetTypeId,
|
|
6033
5984
|
this.buildOfflineAttachment.bind(this),
|
|
6034
5985
|
{
|
|
6035
|
-
addAttachments:
|
|
6036
|
-
updateAttachments:
|
|
6037
|
-
removeAttachments:
|
|
5986
|
+
addAttachments: addAssetTypeAttachments,
|
|
5987
|
+
updateAttachments: updateAssetTypeAttachments,
|
|
5988
|
+
removeAttachments: removeAssetTypeAttachments
|
|
6038
5989
|
}
|
|
6039
5990
|
);
|
|
6040
5991
|
}
|
|
6041
|
-
|
|
5992
|
+
deleteAssetTypeAttachment(attachmentId) {
|
|
6042
5993
|
return this.deleteAttachment(
|
|
6043
5994
|
attachmentId,
|
|
6044
5995
|
{
|
|
6045
|
-
setAttachment:
|
|
6046
|
-
removeAttachment:
|
|
5996
|
+
setAttachment: setAssetTypeAttachment,
|
|
5997
|
+
removeAttachment: removeAssetTypeAttachment
|
|
6047
5998
|
},
|
|
6048
5999
|
{
|
|
6049
|
-
selectAttachment:
|
|
6000
|
+
selectAttachment: selectAssetTypeAttachment
|
|
6050
6001
|
}
|
|
6051
6002
|
);
|
|
6052
6003
|
}
|
|
6053
6004
|
async refreshStore() {
|
|
6054
6005
|
return this.getAttachments({
|
|
6055
|
-
setAttachments:
|
|
6006
|
+
setAttachments: setAssetTypeAttachments
|
|
6056
6007
|
});
|
|
6057
6008
|
}
|
|
6058
6009
|
}
|
|
@@ -6550,8 +6501,8 @@ class MainService extends BaseApiService {
|
|
|
6550
6501
|
});
|
|
6551
6502
|
}
|
|
6552
6503
|
// TODO:
|
|
6553
|
-
// Don't accept updateStore in
|
|
6554
|
-
// overwrite, use
|
|
6504
|
+
// Don't accept updateStore in AssetService.list. Just return the offline objects and promise. Here, if
|
|
6505
|
+
// overwrite, use setAssets. Otherwise, use bulkAddAssets.
|
|
6555
6506
|
// TODO: This needs major cleanup. Send less in the initial data: Only the basic project info and anything needed
|
|
6556
6507
|
// literally immediately.
|
|
6557
6508
|
async _processInitialData(data, overwrite) {
|
|
@@ -6656,10 +6607,10 @@ class MainService extends BaseApiService {
|
|
|
6656
6607
|
} finally {
|
|
6657
6608
|
store.dispatch(setIsFetchingInitialData(false));
|
|
6658
6609
|
}
|
|
6659
|
-
void this.client.
|
|
6660
|
-
void this.client.
|
|
6661
|
-
void this.client.
|
|
6662
|
-
void this.client.
|
|
6610
|
+
void this.client.assetTypes.refreshStore();
|
|
6611
|
+
void this.client.assetStages.refreshStore();
|
|
6612
|
+
void this.client.assets.refreshStore();
|
|
6613
|
+
void this.client.assetStageCompletions.refreshStore();
|
|
6663
6614
|
void this.client.categories.refreshStore();
|
|
6664
6615
|
void this.client.issueTypes.refreshStore();
|
|
6665
6616
|
void this.client.issues.refreshStore();
|
|
@@ -6674,8 +6625,8 @@ class MainService extends BaseApiService {
|
|
|
6674
6625
|
void this.client.issueUpdates.refreshStore();
|
|
6675
6626
|
void this.client.projectAccesses.refreshStore();
|
|
6676
6627
|
void this.client.projectAttachments.refreshStore();
|
|
6677
|
-
void this.client.
|
|
6678
|
-
void this.client.
|
|
6628
|
+
void this.client.assetTypeAttachments.refreshStore();
|
|
6629
|
+
void this.client.assetAttachments.refreshStore();
|
|
6679
6630
|
}
|
|
6680
6631
|
void this.client.teams.refreshStore();
|
|
6681
6632
|
}
|
|
@@ -7071,7 +7022,7 @@ class UserFormService extends BaseApiService {
|
|
|
7071
7022
|
});
|
|
7072
7023
|
});
|
|
7073
7024
|
}
|
|
7074
|
-
async add(state, initialRevision, url, ownerUser, ownerOrganization,
|
|
7025
|
+
async add(state, initialRevision, url, ownerUser, ownerOrganization, assetTypeId, issueTypeId) {
|
|
7075
7026
|
if (!!ownerUser === !!ownerOrganization) {
|
|
7076
7027
|
throw new Error("Exactly one of ownerUser and ownerOrganization must be defined.");
|
|
7077
7028
|
}
|
|
@@ -7090,7 +7041,7 @@ class UserFormService extends BaseApiService {
|
|
|
7090
7041
|
favorite: true,
|
|
7091
7042
|
submitted_at: submittedAt,
|
|
7092
7043
|
created_by: currentUser.id,
|
|
7093
|
-
...
|
|
7044
|
+
...assetTypeId && { asset_type: assetTypeId },
|
|
7094
7045
|
...issueTypeId && { issue_type: issueTypeId },
|
|
7095
7046
|
...ownerAttrs
|
|
7096
7047
|
};
|
|
@@ -7114,11 +7065,11 @@ class UserFormService extends BaseApiService {
|
|
|
7114
7065
|
} : void 0,
|
|
7115
7066
|
payload: {
|
|
7116
7067
|
...offlineFormPayload,
|
|
7117
|
-
...
|
|
7068
|
+
...assetTypeId && { asset_type: assetTypeId },
|
|
7118
7069
|
...issueTypeId && { issue_type: issueTypeId },
|
|
7119
7070
|
initial_revision: payloadWithoutImage
|
|
7120
7071
|
},
|
|
7121
|
-
blockers:
|
|
7072
|
+
blockers: assetTypeId ? [assetTypeId] : issueTypeId ? [issueTypeId] : [],
|
|
7122
7073
|
blocks: [offlineFormPayload.offline_id, payloadWithoutImage.offline_id]
|
|
7123
7074
|
});
|
|
7124
7075
|
const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
|
|
@@ -7142,7 +7093,7 @@ class UserFormService extends BaseApiService {
|
|
|
7142
7093
|
`/forms/in-organization/${activeOrganizationId}/`,
|
|
7143
7094
|
void 0,
|
|
7144
7095
|
activeOrganizationId,
|
|
7145
|
-
attachedTo && "
|
|
7096
|
+
attachedTo && "assetTypeId" in attachedTo ? attachedTo.assetTypeId : void 0,
|
|
7146
7097
|
attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
|
|
7147
7098
|
);
|
|
7148
7099
|
}
|
|
@@ -7155,7 +7106,7 @@ class UserFormService extends BaseApiService {
|
|
|
7155
7106
|
"/forms/my-forms/",
|
|
7156
7107
|
currentUser.id,
|
|
7157
7108
|
void 0,
|
|
7158
|
-
attachedTo && "
|
|
7109
|
+
attachedTo && "assetTypeId" in attachedTo ? attachedTo.assetTypeId : void 0,
|
|
7159
7110
|
attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
|
|
7160
7111
|
);
|
|
7161
7112
|
}
|
|
@@ -7323,8 +7274,8 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7323
7274
|
url: `/forms/submission/${submission.offline_id}/attachments/`,
|
|
7324
7275
|
payload: submissionAttachmentPayload,
|
|
7325
7276
|
blockers: [
|
|
7326
|
-
submission.
|
|
7327
|
-
submission.
|
|
7277
|
+
submission.asset,
|
|
7278
|
+
submission.asset_stage,
|
|
7328
7279
|
submission.issue,
|
|
7329
7280
|
submission.form_revision
|
|
7330
7281
|
].filter((x) => x !== void 0),
|
|
@@ -7360,7 +7311,7 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7360
7311
|
method: HttpMethod.POST,
|
|
7361
7312
|
url: `/forms/revisions/${payload.form_revision}/respond/`,
|
|
7362
7313
|
payload: { ...offlineSubmission, project: activeProjectId },
|
|
7363
|
-
blockers: [payload.issue, payload.
|
|
7314
|
+
blockers: [payload.issue, payload.asset, payload.asset_stage, "add-form-entry"].filter(
|
|
7364
7315
|
(x) => x !== void 0
|
|
7365
7316
|
),
|
|
7366
7317
|
blocks: [payload.offline_id]
|
|
@@ -7378,10 +7329,10 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7378
7329
|
const settledPromise = Promise.all([promise, ...attachFilesPromises]).then(() => promise);
|
|
7379
7330
|
return [offlineSubmission, settledPromise];
|
|
7380
7331
|
}
|
|
7381
|
-
// Note currently the bulkAdd method is specific to form submissions for
|
|
7332
|
+
// Note currently the bulkAdd method is specific to form submissions for assets
|
|
7382
7333
|
// TODO: adapt the support bulk adding to any model type
|
|
7383
7334
|
async bulkAdd(args) {
|
|
7384
|
-
const { formRevision, values: argsValues,
|
|
7335
|
+
const { formRevision, values: argsValues, assetOfflineIds } = args;
|
|
7385
7336
|
const { store } = this.client;
|
|
7386
7337
|
const offlineSubmissions = [];
|
|
7387
7338
|
const offlineAttachments = [];
|
|
@@ -7391,16 +7342,16 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7391
7342
|
const { values, files } = separateFilesFromValues(argsValues);
|
|
7392
7343
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7393
7344
|
const createdBy = store.getState().userReducer.currentUser.id;
|
|
7394
|
-
for (const
|
|
7345
|
+
for (const assetId of assetOfflineIds) {
|
|
7395
7346
|
const submission = offline({
|
|
7396
7347
|
form_revision: formRevision,
|
|
7397
7348
|
values,
|
|
7398
7349
|
created_by: createdBy,
|
|
7399
7350
|
submitted_at: submittedAt,
|
|
7400
|
-
|
|
7351
|
+
asset: assetId
|
|
7401
7352
|
});
|
|
7402
7353
|
submissionOfflineIds.push(submission.offline_id);
|
|
7403
|
-
submissionsPayload.push({ offline_id: submission.offline_id,
|
|
7354
|
+
submissionsPayload.push({ offline_id: submission.offline_id, asset_id: assetId });
|
|
7404
7355
|
offlineSubmissions.push(submission);
|
|
7405
7356
|
for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
|
|
7406
7357
|
for (const file of fileArray) {
|
|
@@ -7447,7 +7398,7 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7447
7398
|
attachments: attachmentsPayload,
|
|
7448
7399
|
files: Object.values(filesRecord)
|
|
7449
7400
|
},
|
|
7450
|
-
blockers:
|
|
7401
|
+
blockers: assetOfflineIds,
|
|
7451
7402
|
blocks: submissionOfflineIds
|
|
7452
7403
|
});
|
|
7453
7404
|
promise.then(({ submissions, attachments, presigned_urls }) => {
|
|
@@ -7490,7 +7441,7 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7490
7441
|
method: HttpMethod.PATCH,
|
|
7491
7442
|
url: `/forms/submissions/${submission.offline_id}/`,
|
|
7492
7443
|
payload: offlineSubmission,
|
|
7493
|
-
blockers: [offlineSubmission.issue, offlineSubmission.
|
|
7444
|
+
blockers: [offlineSubmission.issue, offlineSubmission.asset, offlineSubmission.asset_stage].filter(
|
|
7494
7445
|
(x) => x !== void 0
|
|
7495
7446
|
),
|
|
7496
7447
|
blocks: [offlineSubmission.offline_id]
|
|
@@ -8576,12 +8527,12 @@ class OvermapSDK {
|
|
|
8576
8527
|
__publicField(this, "issueAttachments", new IssueAttachmentService(this));
|
|
8577
8528
|
__publicField(this, "workspaces", new WorkspaceService(this));
|
|
8578
8529
|
__publicField(this, "main", new MainService(this));
|
|
8579
|
-
__publicField(this, "
|
|
8580
|
-
__publicField(this, "
|
|
8581
|
-
__publicField(this, "
|
|
8582
|
-
__publicField(this, "
|
|
8583
|
-
__publicField(this, "
|
|
8584
|
-
__publicField(this, "
|
|
8530
|
+
__publicField(this, "assets", new AssetService(this));
|
|
8531
|
+
__publicField(this, "assetAttachments", new AssetAttachmentService(this));
|
|
8532
|
+
__publicField(this, "assetTypes", new AssetTypeService(this));
|
|
8533
|
+
__publicField(this, "assetTypeAttachments", new AssetTypeAttachmentService(this));
|
|
8534
|
+
__publicField(this, "assetStages", new AssetStageService(this));
|
|
8535
|
+
__publicField(this, "assetStageCompletions", new AssetStageCompletionService(this));
|
|
8585
8536
|
__publicField(this, "userForms", new UserFormService(this));
|
|
8586
8537
|
__publicField(this, "userFormSubmissions", new UserFormSubmissionService(this));
|
|
8587
8538
|
__publicField(this, "projects", new ProjectService(this));
|
|
@@ -15293,9 +15244,9 @@ const FormBrowser = memo(
|
|
|
15293
15244
|
}, [filter, maxResults, ownerFilter]);
|
|
15294
15245
|
const userForms = useAppSelector(selectFilteredForms(ownerFilterOptions)) ?? [];
|
|
15295
15246
|
const userFormMapping = useAppSelector(selectFormMapping);
|
|
15296
|
-
const attachableUserForms = userForms.filter((form) => !form.
|
|
15247
|
+
const attachableUserForms = userForms.filter((form) => !form.asset_type && !form.issue_type);
|
|
15297
15248
|
const attachableUserFormMapping = Object.values(userFormMapping).filter(
|
|
15298
|
-
(form) => !form.
|
|
15249
|
+
(form) => !form.asset_type
|
|
15299
15250
|
);
|
|
15300
15251
|
const handleToggleFavorite = useCallback(
|
|
15301
15252
|
(form) => {
|
|
@@ -15727,7 +15678,7 @@ const styles = {
|
|
|
15727
15678
|
const formId = "form-builder";
|
|
15728
15679
|
const fieldsToChoose = [
|
|
15729
15680
|
["string", "text"],
|
|
15730
|
-
["select", "multi-select", "upload"],
|
|
15681
|
+
["select", "multi-select", "upload", "qr"],
|
|
15731
15682
|
["boolean", "date", "number", "multi-string"]
|
|
15732
15683
|
];
|
|
15733
15684
|
const CompleteFieldTypeToClsMapping = {
|
|
@@ -16700,6 +16651,13 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
16700
16651
|
export {
|
|
16701
16652
|
APIError,
|
|
16702
16653
|
AgentService,
|
|
16654
|
+
AssetAttachmentService,
|
|
16655
|
+
AssetService,
|
|
16656
|
+
AssetStageColors,
|
|
16657
|
+
AssetStageCompletionService,
|
|
16658
|
+
AssetStageService,
|
|
16659
|
+
AssetTypeAttachmentService,
|
|
16660
|
+
AssetTypeService,
|
|
16703
16661
|
AttachmentModel,
|
|
16704
16662
|
AuthService,
|
|
16705
16663
|
BaseApiService,
|
|
@@ -16711,13 +16669,6 @@ export {
|
|
|
16711
16669
|
ColorPicker,
|
|
16712
16670
|
Colors,
|
|
16713
16671
|
ColorsToString,
|
|
16714
|
-
ComponentAttachmentService,
|
|
16715
|
-
ComponentService,
|
|
16716
|
-
ComponentStageColors,
|
|
16717
|
-
ComponentStageCompletionService,
|
|
16718
|
-
ComponentStageService,
|
|
16719
|
-
ComponentTypeAttachmentService,
|
|
16720
|
-
ComponentTypeService,
|
|
16721
16672
|
DEFAULT_ISSUE_PRIORITY,
|
|
16722
16673
|
DEFAULT_ISSUE_STATUS,
|
|
16723
16674
|
DateField,
|
|
@@ -16809,14 +16760,14 @@ export {
|
|
|
16809
16760
|
acceptProjectInvite,
|
|
16810
16761
|
addActiveProjectFormSubmissionsCount,
|
|
16811
16762
|
addActiveProjectIssuesCount,
|
|
16763
|
+
addAsset,
|
|
16764
|
+
addAssetAttachment,
|
|
16765
|
+
addAssetAttachments,
|
|
16766
|
+
addAssetType,
|
|
16767
|
+
addAssetTypeAttachment,
|
|
16768
|
+
addAssetTypeAttachments,
|
|
16769
|
+
addAssetsInBatches,
|
|
16812
16770
|
addCategory,
|
|
16813
|
-
addComponent,
|
|
16814
|
-
addComponentAttachment,
|
|
16815
|
-
addComponentAttachments,
|
|
16816
|
-
addComponentType,
|
|
16817
|
-
addComponentTypeAttachment,
|
|
16818
|
-
addComponentTypeAttachments,
|
|
16819
|
-
addComponentsInBatches,
|
|
16820
16771
|
addConversation,
|
|
16821
16772
|
addDocumentAttachment,
|
|
16822
16773
|
addDocumentAttachments,
|
|
@@ -16861,6 +16812,14 @@ export {
|
|
|
16861
16812
|
agentsReducer,
|
|
16862
16813
|
agentsSlice,
|
|
16863
16814
|
areArraysEqual,
|
|
16815
|
+
assetReducer,
|
|
16816
|
+
assetSlice,
|
|
16817
|
+
assetStageCompletionReducer,
|
|
16818
|
+
assetStageCompletionSlice,
|
|
16819
|
+
assetStageReducer,
|
|
16820
|
+
assetStageSlice,
|
|
16821
|
+
assetTypeReducer,
|
|
16822
|
+
assetTypeSlice,
|
|
16864
16823
|
authReducer,
|
|
16865
16824
|
authSlice,
|
|
16866
16825
|
blobToBase64,
|
|
@@ -16870,14 +16829,6 @@ export {
|
|
|
16870
16829
|
classNames$1 as classNames,
|
|
16871
16830
|
cleanRecentIssues,
|
|
16872
16831
|
clearTokens,
|
|
16873
|
-
componentReducer,
|
|
16874
|
-
componentSlice,
|
|
16875
|
-
componentStageCompletionReducer,
|
|
16876
|
-
componentStageCompletionSlice,
|
|
16877
|
-
componentStageReducer,
|
|
16878
|
-
componentStageSlice,
|
|
16879
|
-
componentTypeReducer,
|
|
16880
|
-
componentTypeSlice,
|
|
16881
16832
|
constructUploadedFilePayloads,
|
|
16882
16833
|
coordinatesAreEqual,
|
|
16883
16834
|
coordinatesToLiteral,
|
|
@@ -16888,7 +16839,7 @@ export {
|
|
|
16888
16839
|
createPointMarker,
|
|
16889
16840
|
defaultBadgeColor,
|
|
16890
16841
|
defaultStore,
|
|
16891
|
-
|
|
16842
|
+
deleteAssetType,
|
|
16892
16843
|
deleteForm,
|
|
16893
16844
|
deleteFormRevision,
|
|
16894
16845
|
deleteFormRevisionAttachment,
|
|
@@ -16937,7 +16888,7 @@ export {
|
|
|
16937
16888
|
formSubmissionReducer,
|
|
16938
16889
|
formSubmissionSlice,
|
|
16939
16890
|
index as forms,
|
|
16940
|
-
|
|
16891
|
+
fullAssetMarkerSize,
|
|
16941
16892
|
generateBadgeColors,
|
|
16942
16893
|
genericMemo,
|
|
16943
16894
|
getFileIdentifier,
|
|
@@ -16945,6 +16896,7 @@ export {
|
|
|
16945
16896
|
getLocalDateString,
|
|
16946
16897
|
getLocalRelativeDateString,
|
|
16947
16898
|
getMarkerCoordinates,
|
|
16899
|
+
getOutboxCoordinator,
|
|
16948
16900
|
getRenamedFile,
|
|
16949
16901
|
getStageColor,
|
|
16950
16902
|
hashFile,
|
|
@@ -16997,15 +16949,15 @@ export {
|
|
|
16997
16949
|
projectSlice,
|
|
16998
16950
|
rehydratedReducer,
|
|
16999
16951
|
rehydratedSlice,
|
|
17000
|
-
|
|
16952
|
+
removeAllAssetsOfType,
|
|
16953
|
+
removeAsset,
|
|
16954
|
+
removeAssetAttachment,
|
|
16955
|
+
removeAssetAttachments,
|
|
16956
|
+
removeAssetTypeAttachment,
|
|
16957
|
+
removeAssetTypeAttachments,
|
|
17001
16958
|
removeAttachmentsOfIssue,
|
|
17002
16959
|
removeCategory,
|
|
17003
16960
|
removeColor,
|
|
17004
|
-
removeComponent,
|
|
17005
|
-
removeComponentAttachment,
|
|
17006
|
-
removeComponentAttachments,
|
|
17007
|
-
removeComponentTypeAttachment,
|
|
17008
|
-
removeComponentTypeAttachments,
|
|
17009
16961
|
removeDocumentAttachment,
|
|
17010
16962
|
removeDocumentAttachments,
|
|
17011
16963
|
removeDocuments,
|
|
@@ -17056,16 +17008,31 @@ export {
|
|
|
17056
17008
|
selectActiveWorkspace,
|
|
17057
17009
|
selectActiveWorkspaceId,
|
|
17058
17010
|
selectAllAttachments,
|
|
17059
|
-
selectAllComponentAttachments,
|
|
17060
|
-
selectAllComponentTypeAttachments,
|
|
17061
17011
|
selectAllDocumentAttachments,
|
|
17062
17012
|
selectAllProjectAttachments,
|
|
17063
17013
|
selectAncestorIdsOfDocument,
|
|
17064
17014
|
selectAppearance,
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17015
|
+
selectAsset,
|
|
17016
|
+
selectAssetAttachment,
|
|
17017
|
+
selectAssetAttachmentMapping,
|
|
17018
|
+
selectAssetAttachments,
|
|
17019
|
+
selectAssetToAssetTypeMapping,
|
|
17020
|
+
selectAssetType,
|
|
17021
|
+
selectAssetTypeAttachment,
|
|
17022
|
+
selectAssetTypeAttachmentMapping,
|
|
17023
|
+
selectAssetTypeAttachments,
|
|
17024
|
+
selectAssetTypeStagesMapping,
|
|
17025
|
+
selectAssetTypes,
|
|
17026
|
+
selectAssetTypesByName,
|
|
17027
|
+
selectAssetTypesFromIds,
|
|
17028
|
+
selectAssetTypesMapping,
|
|
17029
|
+
selectAssets,
|
|
17030
|
+
selectAssetsMapping,
|
|
17031
|
+
selectAssetsOfAssetType,
|
|
17032
|
+
selectAttachmentsOfAsset,
|
|
17033
|
+
selectAttachmentsOfAssetByType,
|
|
17034
|
+
selectAttachmentsOfAssetType,
|
|
17035
|
+
selectAttachmentsOfAssetTypeByType,
|
|
17069
17036
|
selectAttachmentsOfDocument,
|
|
17070
17037
|
selectAttachmentsOfDocumentByType,
|
|
17071
17038
|
selectAttachmentsOfFormRevision,
|
|
@@ -17082,25 +17049,8 @@ export {
|
|
|
17082
17049
|
selectCenterMapToProject,
|
|
17083
17050
|
selectCommentMapping,
|
|
17084
17051
|
selectCommentsOfIssue,
|
|
17085
|
-
|
|
17052
|
+
selectCompletedStageIdsForAsset,
|
|
17086
17053
|
selectCompletedStages,
|
|
17087
|
-
selectComponent,
|
|
17088
|
-
selectComponentAttachment,
|
|
17089
|
-
selectComponentAttachmentMapping,
|
|
17090
|
-
selectComponentType,
|
|
17091
|
-
selectComponentTypeAttachment,
|
|
17092
|
-
selectComponentTypeAttachmentMapping,
|
|
17093
|
-
selectComponentTypeFromComponent,
|
|
17094
|
-
selectComponentTypeFromComponents,
|
|
17095
|
-
selectComponentTypeStagesMapping,
|
|
17096
|
-
selectComponentTypes,
|
|
17097
|
-
selectComponentTypesByName,
|
|
17098
|
-
selectComponentTypesFromIds,
|
|
17099
|
-
selectComponentTypesMapping,
|
|
17100
|
-
selectComponents,
|
|
17101
|
-
selectComponentsByType,
|
|
17102
|
-
selectComponentsFromComponentType,
|
|
17103
|
-
selectComponentsMapping,
|
|
17104
17054
|
selectConversation,
|
|
17105
17055
|
selectConversationMapping,
|
|
17106
17056
|
selectConversations,
|
|
@@ -17125,7 +17075,7 @@ export {
|
|
|
17125
17075
|
selectFilteredForms,
|
|
17126
17076
|
selectForm,
|
|
17127
17077
|
selectFormMapping,
|
|
17128
|
-
|
|
17078
|
+
selectFormOfAssetType,
|
|
17129
17079
|
selectFormOfIssueType,
|
|
17130
17080
|
selectFormRevision,
|
|
17131
17081
|
selectFormRevisionMapping,
|
|
@@ -17134,16 +17084,16 @@ export {
|
|
|
17134
17084
|
selectFormSubmission,
|
|
17135
17085
|
selectFormSubmissionAttachmentsMapping,
|
|
17136
17086
|
selectFormSubmissions,
|
|
17137
|
-
|
|
17087
|
+
selectFormSubmissionsByAssets,
|
|
17138
17088
|
selectFormSubmissionsByFormRevisions,
|
|
17139
17089
|
selectFormSubmissionsMapping,
|
|
17140
|
-
|
|
17090
|
+
selectFormSubmissionsOfAsset,
|
|
17141
17091
|
selectFormSubmissionsOfForm,
|
|
17142
17092
|
selectFormSubmissionsOfIssue,
|
|
17143
17093
|
selectFormsCount,
|
|
17144
17094
|
selectGeneralFormCount,
|
|
17095
|
+
selectHiddenAssetTypeIds,
|
|
17145
17096
|
selectHiddenCategoryCount,
|
|
17146
|
-
selectHiddenComponentTypeIds,
|
|
17147
17097
|
selectIsFetchingInitialData,
|
|
17148
17098
|
selectIsImportingProjectFile,
|
|
17149
17099
|
selectIsLoading,
|
|
@@ -17165,7 +17115,7 @@ export {
|
|
|
17165
17115
|
selectIssuesOfIssueTypeCount,
|
|
17166
17116
|
selectLatestFormRevisionByForm,
|
|
17167
17117
|
selectLatestFormRevisionOfForm,
|
|
17168
|
-
|
|
17118
|
+
selectLatestFormRevisionsOfAssetTypes,
|
|
17169
17119
|
selectLatestRetryTime,
|
|
17170
17120
|
selectLicense,
|
|
17171
17121
|
selectLicenseForProject,
|
|
@@ -17173,8 +17123,8 @@ export {
|
|
|
17173
17123
|
selectLicensesForProjectsMapping,
|
|
17174
17124
|
selectMainWorkspace,
|
|
17175
17125
|
selectMapStyle,
|
|
17176
|
-
|
|
17177
|
-
|
|
17126
|
+
selectNumberOfAssetTypesMatchingCaseInsensitiveName,
|
|
17127
|
+
selectNumberOfAssetsOfAssetType,
|
|
17178
17128
|
selectOrganization,
|
|
17179
17129
|
selectOrganizationAccess,
|
|
17180
17130
|
selectOrganizationAccessForUser,
|
|
@@ -17215,9 +17165,9 @@ export {
|
|
|
17215
17165
|
selectStageFormIdsFromStageIds,
|
|
17216
17166
|
selectStageMapping,
|
|
17217
17167
|
selectStages,
|
|
17218
|
-
|
|
17219
|
-
selectStagesFromComponentTypeIds,
|
|
17168
|
+
selectStagesFromAssetTypeIds,
|
|
17220
17169
|
selectStagesFromStageIds,
|
|
17170
|
+
selectStagesOfAssetType,
|
|
17221
17171
|
selectTeam,
|
|
17222
17172
|
selectTeams,
|
|
17223
17173
|
selectTeamsMapping,
|
|
@@ -17239,14 +17189,14 @@ export {
|
|
|
17239
17189
|
setActiveProjectId,
|
|
17240
17190
|
setActiveWorkspaceId,
|
|
17241
17191
|
setAppearance,
|
|
17192
|
+
setAssetAttachment,
|
|
17193
|
+
setAssetAttachments,
|
|
17194
|
+
setAssetTypeAttachment,
|
|
17195
|
+
setAssetTypeAttachments,
|
|
17196
|
+
setAssetTypes,
|
|
17197
|
+
setAssets,
|
|
17242
17198
|
setCategories,
|
|
17243
17199
|
setCenterMapToProject,
|
|
17244
|
-
setComponentAttachment,
|
|
17245
|
-
setComponentAttachments,
|
|
17246
|
-
setComponentTypeAttachment,
|
|
17247
|
-
setComponentTypeAttachments,
|
|
17248
|
-
setComponentTypes,
|
|
17249
|
-
setComponents,
|
|
17250
17200
|
setConversation,
|
|
17251
17201
|
setConversations,
|
|
17252
17202
|
setCreateProjectType,
|
|
@@ -17309,18 +17259,18 @@ export {
|
|
|
17309
17259
|
teamSlice,
|
|
17310
17260
|
toFileNameSafeString,
|
|
17311
17261
|
toOfflineIdRecord,
|
|
17312
|
-
|
|
17262
|
+
toggleAssetTypeVisibility,
|
|
17313
17263
|
truncate,
|
|
17314
17264
|
unfavoriteForm,
|
|
17315
17265
|
unhideAllCategories,
|
|
17316
17266
|
unhideCategory,
|
|
17317
17267
|
unlinkStageToForm,
|
|
17318
17268
|
updateActiveOrganization,
|
|
17319
|
-
|
|
17320
|
-
|
|
17321
|
-
|
|
17322
|
-
|
|
17323
|
-
|
|
17269
|
+
updateAsset,
|
|
17270
|
+
updateAssetAttachment,
|
|
17271
|
+
updateAssetAttachments,
|
|
17272
|
+
updateAssetTypeAttachment,
|
|
17273
|
+
updateAssetTypeAttachments,
|
|
17324
17274
|
updateConversation,
|
|
17325
17275
|
updateDocumentAttachment,
|
|
17326
17276
|
updateDocumentAttachments,
|