@overmap-ai/core 1.0.53-attachment-creation-flows.1 → 1.0.53-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/dist/constants/ui.d.ts +1 -1
- package/dist/enums/ui.d.ts +1 -1
- package/dist/overmap-core.js +849 -801
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +849 -801
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/sdk.d.ts +7 -7
- package/dist/sdk/services/AgentService.d.ts +6 -32
- 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/MainService.d.ts +4 -11
- 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/agentsSlice.d.ts +16 -0
- 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 +5 -4
- package/dist/store/slices/documentSlice.d.ts +7 -7
- package/dist/store/slices/formRevisionSlice.d.ts +6 -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 +5 -4
- package/dist/store/slices/issueSlice.d.ts +5 -4
- package/dist/store/slices/projectFileSlice.d.ts +5 -4
- package/dist/store/slices/workspaceSlice.d.ts +5 -4
- package/dist/store/store.d.ts +16 -13
- package/dist/typings/models/agents.d.ts +40 -0
- 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/typings/models/index.d.ts +1 -0
- package/dist/utils/colors.d.ts +1 -1
- package/package.json +1 -1
- 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
|
@@ -678,15 +678,15 @@ const wrapMigration = (migrator) => (state) => {
|
|
|
678
678
|
};
|
|
679
679
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
680
680
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
681
|
-
const initialState$
|
|
681
|
+
const initialState$s = {
|
|
682
682
|
accessToken: "",
|
|
683
683
|
refreshToken: "",
|
|
684
684
|
isLoggedIn: false
|
|
685
685
|
};
|
|
686
686
|
const authSlice = createSlice({
|
|
687
687
|
name: "auth",
|
|
688
|
-
initialState: initialState$
|
|
689
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
688
|
+
initialState: initialState$s,
|
|
689
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$s)),
|
|
690
690
|
reducers: {
|
|
691
691
|
setTokens: (state, action) => {
|
|
692
692
|
state.accessToken = action.payload.accessToken;
|
|
@@ -1384,7 +1384,7 @@ const ColorsToString = {
|
|
|
1384
1384
|
[mint.mint9]: "mint",
|
|
1385
1385
|
[sky.sky9]: "sky"
|
|
1386
1386
|
};
|
|
1387
|
-
const
|
|
1387
|
+
const AssetStageColors = {
|
|
1388
1388
|
indigo: indigo.indigo9,
|
|
1389
1389
|
red: red.red9,
|
|
1390
1390
|
violet: violet.violet9,
|
|
@@ -1406,7 +1406,7 @@ const generateBadgeColors = (rawColor) => {
|
|
|
1406
1406
|
return { backgroundColor, textColor };
|
|
1407
1407
|
};
|
|
1408
1408
|
function getStageColor(index2) {
|
|
1409
|
-
return Object.values(
|
|
1409
|
+
return Object.values(AssetStageColors)[index2 % Object.keys(AssetStageColors).length];
|
|
1410
1410
|
}
|
|
1411
1411
|
const getLocalDateString = memoize((date) => {
|
|
1412
1412
|
if (!date)
|
|
@@ -1430,7 +1430,7 @@ const getLocalRelativeDateString = memoize((date, min, max) => {
|
|
|
1430
1430
|
return getLocalDateString(date);
|
|
1431
1431
|
return relative.format(days, "days");
|
|
1432
1432
|
});
|
|
1433
|
-
const initialState$
|
|
1433
|
+
const initialState$r = {
|
|
1434
1434
|
categories: {},
|
|
1435
1435
|
usedCategoryColors: [],
|
|
1436
1436
|
categoryVisibility: {
|
|
@@ -1440,8 +1440,8 @@ const initialState$q = {
|
|
|
1440
1440
|
};
|
|
1441
1441
|
const categorySlice = createSlice({
|
|
1442
1442
|
name: "categories",
|
|
1443
|
-
initialState: initialState$
|
|
1444
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1443
|
+
initialState: initialState$r,
|
|
1444
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
|
|
1445
1445
|
reducers: {
|
|
1446
1446
|
setCategories: (state, action) => {
|
|
1447
1447
|
if (!Array.isArray(action.payload))
|
|
@@ -1625,167 +1625,274 @@ function removeAttachments(state, action) {
|
|
|
1625
1625
|
delete state.attachments[attachmentId];
|
|
1626
1626
|
}
|
|
1627
1627
|
}
|
|
1628
|
+
const initialState$q = {
|
|
1629
|
+
assetTypes: {},
|
|
1630
|
+
hiddenAssetTypeIds: {},
|
|
1631
|
+
attachments: {}
|
|
1632
|
+
};
|
|
1633
|
+
const assetTypeSlice = createSlice({
|
|
1634
|
+
name: "assetTypes",
|
|
1635
|
+
initialState: initialState$q,
|
|
1636
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1637
|
+
reducers: {
|
|
1638
|
+
addAssetType: (state, action) => {
|
|
1639
|
+
state.assetTypes[action.payload.offline_id] = action.payload;
|
|
1640
|
+
},
|
|
1641
|
+
setAssetTypes: (state, action) => {
|
|
1642
|
+
state.assetTypes = toOfflineIdRecord(action.payload);
|
|
1643
|
+
},
|
|
1644
|
+
toggleAssetTypeVisibility: (state, action) => {
|
|
1645
|
+
state.hiddenAssetTypeIds[action.payload] = !state.hiddenAssetTypeIds[action.payload];
|
|
1646
|
+
},
|
|
1647
|
+
deleteAssetType: (state, action) => {
|
|
1648
|
+
delete state.assetTypes[action.payload];
|
|
1649
|
+
},
|
|
1650
|
+
// Attachments
|
|
1651
|
+
setAssetTypeAttachment: setAttachment,
|
|
1652
|
+
setAssetTypeAttachments: setAttachments,
|
|
1653
|
+
addAssetTypeAttachment: addAttachment,
|
|
1654
|
+
addAssetTypeAttachments: addAttachments,
|
|
1655
|
+
updateAssetTypeAttachment: updateAttachment,
|
|
1656
|
+
updateAssetTypeAttachments: updateAttachments,
|
|
1657
|
+
removeAssetTypeAttachment: removeAttachment,
|
|
1658
|
+
removeAssetTypeAttachments: removeAttachments
|
|
1659
|
+
}
|
|
1660
|
+
});
|
|
1661
|
+
const {
|
|
1662
|
+
addAssetType,
|
|
1663
|
+
setAssetTypes,
|
|
1664
|
+
toggleAssetTypeVisibility,
|
|
1665
|
+
deleteAssetType,
|
|
1666
|
+
// Attachmet
|
|
1667
|
+
setAssetTypeAttachment,
|
|
1668
|
+
setAssetTypeAttachments,
|
|
1669
|
+
addAssetTypeAttachment,
|
|
1670
|
+
addAssetTypeAttachments,
|
|
1671
|
+
updateAssetTypeAttachment,
|
|
1672
|
+
updateAssetTypeAttachments,
|
|
1673
|
+
removeAssetTypeAttachment,
|
|
1674
|
+
removeAssetTypeAttachments
|
|
1675
|
+
} = assetTypeSlice.actions;
|
|
1676
|
+
const selectAssetTypesMapping = (state) => state.assetTypeReducer.assetTypes;
|
|
1677
|
+
const selectAssetTypes = createSelector(
|
|
1678
|
+
[selectAssetTypesMapping],
|
|
1679
|
+
(mapping) => Object.values(mapping)
|
|
1680
|
+
);
|
|
1681
|
+
const selectAssetType = restructureCreateSelectorWithArgs(
|
|
1682
|
+
createSelector(
|
|
1683
|
+
[selectAssetTypesMapping, (_state, assetTypeId) => assetTypeId],
|
|
1684
|
+
(mapping, assetTypeId) => mapping[assetTypeId]
|
|
1685
|
+
)
|
|
1686
|
+
);
|
|
1687
|
+
const selectNumberOfAssetTypesMatchingCaseInsensitiveName = restructureCreateSelectorWithArgs(
|
|
1688
|
+
createSelector(
|
|
1689
|
+
[selectAssetTypesMapping, (_state, args) => args],
|
|
1690
|
+
(mapping, args) => {
|
|
1691
|
+
var _a2;
|
|
1692
|
+
const name = ((_a2 = args.name) == null ? void 0 : _a2.toLowerCase()) ?? null;
|
|
1693
|
+
return Object.values(mapping).filter(
|
|
1694
|
+
(assetType) => {
|
|
1695
|
+
var _a3;
|
|
1696
|
+
return (((_a3 = assetType.name) == null ? void 0 : _a3.toLowerCase()) ?? null) === name && assetType.offline_id !== args.assetTypeId;
|
|
1697
|
+
}
|
|
1698
|
+
).length;
|
|
1699
|
+
}
|
|
1700
|
+
)
|
|
1701
|
+
);
|
|
1702
|
+
const selectAssetTypesByName = restructureCreateSelectorWithArgs(
|
|
1703
|
+
createSelector([selectAssetTypesMapping, (_state, name) => name], (mapping, name) => {
|
|
1704
|
+
name = (name == null ? void 0 : name.toLowerCase()) ?? null;
|
|
1705
|
+
return Object.values(mapping).filter((assetType) => {
|
|
1706
|
+
var _a2;
|
|
1707
|
+
return (((_a2 = assetType.name) == null ? void 0 : _a2.toLowerCase()) ?? null) === name;
|
|
1708
|
+
});
|
|
1709
|
+
})
|
|
1710
|
+
);
|
|
1711
|
+
const selectHiddenAssetTypeIds = (state) => state.assetTypeReducer.hiddenAssetTypeIds;
|
|
1712
|
+
const selectAssetTypeAttachmentMapping = (state) => state.assetTypeReducer.attachments;
|
|
1713
|
+
const selectAssetTypeAttachments = createSelector(
|
|
1714
|
+
[selectAssetTypeAttachmentMapping],
|
|
1715
|
+
(mapping) => Object.values(mapping)
|
|
1716
|
+
);
|
|
1717
|
+
const selectAssetTypeAttachment = (attachmentId) => (state) => {
|
|
1718
|
+
return state.assetTypeReducer.attachments[attachmentId];
|
|
1719
|
+
};
|
|
1720
|
+
const selectAttachmentsOfAssetType = restructureCreateSelectorWithArgs(
|
|
1721
|
+
createSelector(
|
|
1722
|
+
[selectAssetTypeAttachments, (_state, assetTypeId) => assetTypeId],
|
|
1723
|
+
(attachments, assetTypeId) => {
|
|
1724
|
+
return attachments.filter(({ asset_type }) => assetTypeId === asset_type);
|
|
1725
|
+
}
|
|
1726
|
+
)
|
|
1727
|
+
);
|
|
1728
|
+
const selectAttachmentsOfAssetTypeByType = restructureCreateSelectorWithArgs(
|
|
1729
|
+
createSelector(
|
|
1730
|
+
[selectAssetTypeAttachments, (_state, assetTypeId) => assetTypeId],
|
|
1731
|
+
(attachments, assetTypeId) => {
|
|
1732
|
+
const attachmentsOfAssetType = attachments.filter(({ asset_type }) => asset_type === assetTypeId);
|
|
1733
|
+
const fileAttachments = attachmentsOfAssetType.filter(
|
|
1734
|
+
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1735
|
+
({ file_type }) => !file_type || !file_type.startsWith("image/")
|
|
1736
|
+
);
|
|
1737
|
+
const imageAttachments = attachmentsOfAssetType.filter(
|
|
1738
|
+
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1739
|
+
({ file_type }) => file_type && file_type.startsWith("image/")
|
|
1740
|
+
);
|
|
1741
|
+
return { fileAttachments, imageAttachments };
|
|
1742
|
+
}
|
|
1743
|
+
)
|
|
1744
|
+
);
|
|
1745
|
+
const assetTypeReducer = assetTypeSlice.reducer;
|
|
1628
1746
|
const initialState$p = {
|
|
1629
|
-
|
|
1747
|
+
assets: {},
|
|
1630
1748
|
attachments: {}
|
|
1631
1749
|
};
|
|
1632
|
-
const
|
|
1633
|
-
name: "
|
|
1750
|
+
const assetSlice = createSlice({
|
|
1751
|
+
name: "assets",
|
|
1634
1752
|
initialState: initialState$p,
|
|
1635
1753
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
|
|
1636
1754
|
reducers: {
|
|
1637
|
-
|
|
1638
|
-
state.
|
|
1639
|
-
|
|
1755
|
+
addAsset: (state, action) => {
|
|
1756
|
+
state.assets[action.payload.offline_id] = action.payload;
|
|
1757
|
+
prevAssets = null;
|
|
1640
1758
|
},
|
|
1641
|
-
|
|
1642
|
-
Object.assign(state.
|
|
1643
|
-
|
|
1759
|
+
addAssetsInBatches: (state, action) => {
|
|
1760
|
+
Object.assign(state.assets, toOfflineIdRecord(action.payload));
|
|
1761
|
+
prevAssets = null;
|
|
1644
1762
|
},
|
|
1645
|
-
|
|
1646
|
-
state.
|
|
1647
|
-
|
|
1763
|
+
setAssets: (state, action) => {
|
|
1764
|
+
state.assets = toOfflineIdRecord(action.payload);
|
|
1765
|
+
prevAssets = null;
|
|
1648
1766
|
},
|
|
1649
|
-
|
|
1650
|
-
if (action.payload.offline_id in state.
|
|
1651
|
-
state.
|
|
1767
|
+
updateAsset: (state, action) => {
|
|
1768
|
+
if (action.payload.offline_id in state.assets) {
|
|
1769
|
+
state.assets[action.payload.offline_id] = action.payload;
|
|
1652
1770
|
} else {
|
|
1653
|
-
throw new Error(`Tried to update
|
|
1771
|
+
throw new Error(`Tried to update asset with ID that doesn't exist: ${action.payload.offline_id}`);
|
|
1654
1772
|
}
|
|
1655
|
-
|
|
1773
|
+
prevAssets = null;
|
|
1656
1774
|
},
|
|
1657
|
-
|
|
1658
|
-
if (action.payload in state.
|
|
1659
|
-
delete state.
|
|
1775
|
+
removeAsset: (state, action) => {
|
|
1776
|
+
if (action.payload in state.assets) {
|
|
1777
|
+
delete state.assets[action.payload];
|
|
1660
1778
|
} else {
|
|
1661
|
-
throw new Error(`Failed to remove
|
|
1779
|
+
throw new Error(`Failed to remove asset because ID doesn't exist: ${action.payload}`);
|
|
1662
1780
|
}
|
|
1663
|
-
|
|
1781
|
+
prevAssets = null;
|
|
1664
1782
|
},
|
|
1665
|
-
|
|
1783
|
+
removeAllAssetsOfType: (state, action) => {
|
|
1666
1784
|
var _a2;
|
|
1667
|
-
for (const componentId in state.
|
|
1668
|
-
if (((_a2 = state.
|
|
1669
|
-
delete state.
|
|
1785
|
+
for (const componentId in state.assets) {
|
|
1786
|
+
if (((_a2 = state.assets[componentId]) == null ? void 0 : _a2.asset_type) === action.payload) {
|
|
1787
|
+
delete state.assets[componentId];
|
|
1670
1788
|
}
|
|
1671
1789
|
}
|
|
1672
|
-
|
|
1790
|
+
prevAssets = null;
|
|
1673
1791
|
},
|
|
1674
1792
|
// Attachments
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1793
|
+
setAssetAttachment: setAttachment,
|
|
1794
|
+
setAssetAttachments: setAttachments,
|
|
1795
|
+
addAssetAttachment: addAttachment,
|
|
1796
|
+
addAssetAttachments: addAttachments,
|
|
1797
|
+
updateAssetAttachment: updateAttachment,
|
|
1798
|
+
updateAssetAttachments: updateAttachments,
|
|
1799
|
+
removeAssetAttachment: removeAttachment,
|
|
1800
|
+
removeAssetAttachments: removeAttachments
|
|
1683
1801
|
}
|
|
1684
1802
|
});
|
|
1685
1803
|
const {
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1804
|
+
addAsset,
|
|
1805
|
+
updateAsset,
|
|
1806
|
+
removeAsset,
|
|
1807
|
+
addAssetsInBatches,
|
|
1808
|
+
setAssets,
|
|
1809
|
+
removeAllAssetsOfType,
|
|
1692
1810
|
// Attachments
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
} =
|
|
1702
|
-
let
|
|
1703
|
-
const
|
|
1704
|
-
if (!
|
|
1705
|
-
|
|
1706
|
-
}
|
|
1707
|
-
return
|
|
1811
|
+
setAssetAttachment,
|
|
1812
|
+
setAssetAttachments,
|
|
1813
|
+
addAssetAttachment,
|
|
1814
|
+
addAssetAttachments,
|
|
1815
|
+
updateAssetAttachment,
|
|
1816
|
+
updateAssetAttachments,
|
|
1817
|
+
removeAssetAttachment,
|
|
1818
|
+
removeAssetAttachments
|
|
1819
|
+
} = assetSlice.actions;
|
|
1820
|
+
let prevAssets = null;
|
|
1821
|
+
const selectAssets = (state) => {
|
|
1822
|
+
if (!prevAssets) {
|
|
1823
|
+
prevAssets = Object.values(state.assetReducer.assets);
|
|
1824
|
+
}
|
|
1825
|
+
return prevAssets;
|
|
1708
1826
|
};
|
|
1709
|
-
const
|
|
1710
|
-
const
|
|
1711
|
-
|
|
1712
|
-
return
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
return state.componentReducer.components[componentId];
|
|
1718
|
-
};
|
|
1719
|
-
const selectComponentTypeFromComponent = (componentTypeId) => (state) => {
|
|
1720
|
-
return state.componentTypeReducer.componentTypes[componentTypeId];
|
|
1827
|
+
const selectAssetsMapping = (state) => state.assetReducer.assets;
|
|
1828
|
+
const selectAssetsOfAssetType = restructureCreateSelectorWithArgs(
|
|
1829
|
+
createSelector([selectAssets, (_state, assetTypeId) => assetTypeId], (components, assetTypeId) => {
|
|
1830
|
+
return components.filter((asset) => asset.asset_type === assetTypeId);
|
|
1831
|
+
})
|
|
1832
|
+
);
|
|
1833
|
+
const selectAsset = (assetId) => (state) => {
|
|
1834
|
+
return state.assetReducer.assets[assetId];
|
|
1721
1835
|
};
|
|
1722
|
-
const
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
Expected all referenced
|
|
1836
|
+
const selectAssetToAssetTypeMapping = createSelector(
|
|
1837
|
+
[selectAssets, selectAssetTypesMapping],
|
|
1838
|
+
(assets, assetTypeMapping) => {
|
|
1839
|
+
const ret = {};
|
|
1840
|
+
for (const asset of assets) {
|
|
1841
|
+
const assetType = assetTypeMapping[asset.asset_type];
|
|
1842
|
+
if (!assetType) {
|
|
1843
|
+
console.error(
|
|
1844
|
+
`Asset type with ID ${asset.asset_type} not found.
|
|
1845
|
+
Expected all referenced asset types to be populated.
|
|
1732
1846
|
Returning empty object to avoid fatal errors.`
|
|
1733
|
-
|
|
1734
|
-
|
|
1847
|
+
);
|
|
1848
|
+
return {};
|
|
1849
|
+
}
|
|
1850
|
+
ret[asset.offline_id] = assetType;
|
|
1735
1851
|
}
|
|
1736
|
-
ret
|
|
1852
|
+
return ret;
|
|
1737
1853
|
}
|
|
1738
|
-
return ret;
|
|
1739
|
-
};
|
|
1740
|
-
const selectComponentsByType = restructureCreateSelectorWithArgs(
|
|
1741
|
-
createSelector(
|
|
1742
|
-
[selectComponents, (_state, componentTypeId) => componentTypeId],
|
|
1743
|
-
(components, componentTypeId) => {
|
|
1744
|
-
return components.filter((component) => component.component_type === componentTypeId);
|
|
1745
|
-
}
|
|
1746
|
-
)
|
|
1747
1854
|
);
|
|
1748
|
-
const
|
|
1855
|
+
const selectNumberOfAssetsOfAssetType = (assetTypeId) => (state) => {
|
|
1749
1856
|
var _a2;
|
|
1750
|
-
if (!
|
|
1857
|
+
if (!assetTypeId)
|
|
1751
1858
|
return 0;
|
|
1752
|
-
return (_a2 =
|
|
1859
|
+
return (_a2 = selectAssetsOfAssetType(assetTypeId)(state)) == null ? void 0 : _a2.length;
|
|
1753
1860
|
};
|
|
1754
|
-
const
|
|
1755
|
-
return
|
|
1756
|
-
const
|
|
1757
|
-
if (
|
|
1758
|
-
acc.push(
|
|
1861
|
+
const selectAssetTypesFromIds = (assetTypeIds) => (state) => {
|
|
1862
|
+
return assetTypeIds.reduce((acc, assetTypeId) => {
|
|
1863
|
+
const assetType = state.assetTypeReducer.assetTypes[assetTypeId];
|
|
1864
|
+
if (assetType) {
|
|
1865
|
+
acc.push(assetType);
|
|
1759
1866
|
}
|
|
1760
1867
|
return acc;
|
|
1761
1868
|
}, []);
|
|
1762
1869
|
};
|
|
1763
|
-
const
|
|
1764
|
-
const
|
|
1765
|
-
[
|
|
1870
|
+
const selectAssetAttachmentMapping = (state) => state.assetReducer.attachments;
|
|
1871
|
+
const selectAssetAttachments = createSelector(
|
|
1872
|
+
[selectAssetAttachmentMapping],
|
|
1766
1873
|
(mapping) => Object.values(mapping)
|
|
1767
1874
|
);
|
|
1768
|
-
const
|
|
1769
|
-
return state.
|
|
1875
|
+
const selectAssetAttachment = (attachmentId) => (state) => {
|
|
1876
|
+
return state.assetReducer.attachments[attachmentId];
|
|
1770
1877
|
};
|
|
1771
|
-
const
|
|
1878
|
+
const selectAttachmentsOfAsset = restructureCreateSelectorWithArgs(
|
|
1772
1879
|
createSelector(
|
|
1773
|
-
[
|
|
1774
|
-
(attachments,
|
|
1775
|
-
return attachments.filter(({
|
|
1880
|
+
[selectAssetAttachments, (_state, assetId) => assetId],
|
|
1881
|
+
(attachments, assetId) => {
|
|
1882
|
+
return attachments.filter(({ asset }) => assetId === asset);
|
|
1776
1883
|
}
|
|
1777
1884
|
)
|
|
1778
1885
|
);
|
|
1779
|
-
const
|
|
1886
|
+
const selectAttachmentsOfAssetsByType = restructureCreateSelectorWithArgs(
|
|
1780
1887
|
createSelector(
|
|
1781
|
-
[
|
|
1782
|
-
(attachments,
|
|
1783
|
-
const
|
|
1784
|
-
const fileAttachments =
|
|
1888
|
+
[selectAssetAttachments, (_state, assetId) => assetId],
|
|
1889
|
+
(attachments, assetId) => {
|
|
1890
|
+
const attachmentsOfAsset = attachments.filter(({ asset }) => assetId === asset);
|
|
1891
|
+
const fileAttachments = attachmentsOfAsset.filter(
|
|
1785
1892
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1786
1893
|
({ file_type }) => !file_type || !file_type.startsWith("image/")
|
|
1787
1894
|
);
|
|
1788
|
-
const imageAttachments =
|
|
1895
|
+
const imageAttachments = attachmentsOfAsset.filter(
|
|
1789
1896
|
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
1790
1897
|
({ file_type }) => file_type && file_type.startsWith("image/")
|
|
1791
1898
|
);
|
|
@@ -1793,69 +1900,67 @@ const selectAttachmentsOfComponentByType = restructureCreateSelectorWithArgs(
|
|
|
1793
1900
|
}
|
|
1794
1901
|
)
|
|
1795
1902
|
);
|
|
1796
|
-
const
|
|
1903
|
+
const assetReducer = assetSlice.reducer;
|
|
1797
1904
|
const initialState$o = {
|
|
1798
|
-
|
|
1905
|
+
completionsByAssetId: {}
|
|
1799
1906
|
};
|
|
1800
|
-
const
|
|
1801
|
-
name: "
|
|
1907
|
+
const assetStageCompletionSlice = createSlice({
|
|
1908
|
+
name: "assetStageCompletions",
|
|
1802
1909
|
initialState: initialState$o,
|
|
1803
1910
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1804
1911
|
reducers: {
|
|
1805
1912
|
addStageCompletion: (state, action) => {
|
|
1806
|
-
let stageToCompletionDateMapping = state.
|
|
1913
|
+
let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
|
|
1807
1914
|
if (!stageToCompletionDateMapping) {
|
|
1808
1915
|
stageToCompletionDateMapping = {};
|
|
1809
|
-
state.
|
|
1916
|
+
state.completionsByAssetId[action.payload.asset] = stageToCompletionDateMapping;
|
|
1810
1917
|
}
|
|
1811
1918
|
stageToCompletionDateMapping[action.payload.stage] = (/* @__PURE__ */ new Date()).toISOString();
|
|
1812
1919
|
},
|
|
1813
1920
|
addStageCompletions: (state, action) => {
|
|
1814
|
-
for (const [
|
|
1921
|
+
for (const [assetId, stageIdToCompletionDateMapping] of Object.entries(action.payload)) {
|
|
1815
1922
|
if (Object.keys(stageIdToCompletionDateMapping).length === 0)
|
|
1816
|
-
throw new Error(
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
if (thisComponentCompletions === void 0) {
|
|
1821
|
-
thisComponentCompletions = {};
|
|
1923
|
+
throw new Error(`Encountered empty stageIdToCompletionDateMapping argument for asset ${assetId}`);
|
|
1924
|
+
let thisAssetCompletions = state.completionsByAssetId[assetId];
|
|
1925
|
+
if (thisAssetCompletions === void 0) {
|
|
1926
|
+
thisAssetCompletions = {};
|
|
1822
1927
|
}
|
|
1823
1928
|
for (const [stageId, completionDate] of Object.entries(stageIdToCompletionDateMapping)) {
|
|
1824
|
-
|
|
1929
|
+
thisAssetCompletions[stageId] = completionDate;
|
|
1825
1930
|
}
|
|
1826
|
-
state.
|
|
1931
|
+
state.completionsByAssetId[assetId] = thisAssetCompletions;
|
|
1827
1932
|
}
|
|
1828
1933
|
},
|
|
1829
1934
|
removeStageCompletions: (state, action) => {
|
|
1830
1935
|
for (const completion of action.payload) {
|
|
1831
|
-
const
|
|
1832
|
-
if (!
|
|
1936
|
+
const thisAssetCompletions = state.completionsByAssetId[completion.asset];
|
|
1937
|
+
if (!thisAssetCompletions || !(completion.stage in thisAssetCompletions)) {
|
|
1833
1938
|
console.warn(
|
|
1834
1939
|
"Skipping removal of uncompleted stage. This message indicates completion objects are created unnecessarily."
|
|
1835
1940
|
);
|
|
1836
1941
|
continue;
|
|
1837
1942
|
}
|
|
1838
|
-
delete
|
|
1943
|
+
delete thisAssetCompletions[completion.stage];
|
|
1839
1944
|
}
|
|
1840
1945
|
},
|
|
1841
1946
|
setStageCompletions: (state, action) => {
|
|
1842
|
-
state.
|
|
1947
|
+
state.completionsByAssetId = action.payload;
|
|
1843
1948
|
}
|
|
1844
1949
|
}
|
|
1845
1950
|
});
|
|
1846
|
-
const { addStageCompletion, addStageCompletions, removeStageCompletions, setStageCompletions } =
|
|
1951
|
+
const { addStageCompletion, addStageCompletions, removeStageCompletions, setStageCompletions } = assetStageCompletionSlice.actions;
|
|
1847
1952
|
const selectCompletedStages = (state) => {
|
|
1848
|
-
return state.
|
|
1953
|
+
return state.assetStageCompletionReducer.completionsByAssetId;
|
|
1849
1954
|
};
|
|
1850
|
-
const
|
|
1851
|
-
return Object.keys(state.
|
|
1955
|
+
const selectCompletedStageIdsForAsset = (asset) => (state) => {
|
|
1956
|
+
return Object.keys(state.assetStageCompletionReducer.completionsByAssetId[asset.offline_id] ?? {});
|
|
1852
1957
|
};
|
|
1853
|
-
const
|
|
1958
|
+
const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
|
|
1854
1959
|
const initialState$n = {
|
|
1855
1960
|
stages: {}
|
|
1856
1961
|
};
|
|
1857
|
-
const
|
|
1858
|
-
name: "
|
|
1962
|
+
const assetStageSlice = createSlice({
|
|
1963
|
+
name: "assetStages",
|
|
1859
1964
|
initialState: initialState$n,
|
|
1860
1965
|
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
1861
1966
|
reducers: {
|
|
@@ -1890,60 +1995,48 @@ const componentStageSlice = createSlice({
|
|
|
1890
1995
|
}
|
|
1891
1996
|
}
|
|
1892
1997
|
});
|
|
1893
|
-
const selectStageMapping = (state) => state.
|
|
1998
|
+
const selectStageMapping = (state) => state.assetStageReducer.stages;
|
|
1894
1999
|
const selectStage = restructureCreateSelectorWithArgs(
|
|
1895
2000
|
createSelector([selectStageMapping, (_state, stageId) => stageId], (stageMapping, stageId) => {
|
|
1896
2001
|
return stageMapping[stageId];
|
|
1897
2002
|
})
|
|
1898
2003
|
);
|
|
1899
|
-
const selectStages = createSelector(
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
);
|
|
1905
|
-
const
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
const ret = {};
|
|
1911
|
-
for (const stage of stages) {
|
|
1912
|
-
if (componentTypeIdsSet.has(stage.component_type)) {
|
|
1913
|
-
if (!ret[stage.component_type]) {
|
|
1914
|
-
ret[stage.component_type] = [];
|
|
1915
|
-
}
|
|
1916
|
-
ret[stage.component_type].push(stage);
|
|
2004
|
+
const selectStages = createSelector([selectStageMapping], (stageMapping) => {
|
|
2005
|
+
return Object.values(stageMapping);
|
|
2006
|
+
});
|
|
2007
|
+
const selectStagesFromAssetTypeIds = restructureCreateSelectorWithArgs(
|
|
2008
|
+
createSelector([selectStages, (_state, assetTypeIds) => assetTypeIds], (stages, assetTypeIds) => {
|
|
2009
|
+
const assetTypeIdsSet = new Set(assetTypeIds);
|
|
2010
|
+
const ret = {};
|
|
2011
|
+
for (const stage of stages) {
|
|
2012
|
+
if (assetTypeIdsSet.has(stage.asset_type)) {
|
|
2013
|
+
if (!ret[stage.asset_type]) {
|
|
2014
|
+
ret[stage.asset_type] = [];
|
|
1917
2015
|
}
|
|
2016
|
+
ret[stage.asset_type].push(stage);
|
|
1918
2017
|
}
|
|
1919
|
-
for (const key in ret) {
|
|
1920
|
-
ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
|
|
1921
|
-
}
|
|
1922
|
-
return ret;
|
|
1923
2018
|
}
|
|
1924
|
-
|
|
2019
|
+
for (const key in ret) {
|
|
2020
|
+
ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
|
|
2021
|
+
}
|
|
2022
|
+
return ret;
|
|
2023
|
+
})
|
|
1925
2024
|
);
|
|
1926
|
-
const
|
|
1927
|
-
createSelector(
|
|
1928
|
-
|
|
1929
|
-
(
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
if (stage.component_type === componentTypeId) {
|
|
1933
|
-
componentTypeStagesMapping[stageId] = stage;
|
|
1934
|
-
}
|
|
2025
|
+
const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
|
|
2026
|
+
createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
|
|
2027
|
+
const assetTypeStagesMapping = {};
|
|
2028
|
+
for (const [stageId, stage] of Object.entries(stagesMapping)) {
|
|
2029
|
+
if (stage.asset_type === assetTypeId) {
|
|
2030
|
+
assetTypeStagesMapping[stageId] = stage;
|
|
1935
2031
|
}
|
|
1936
|
-
return componentTypeStagesMapping;
|
|
1937
2032
|
}
|
|
1938
|
-
|
|
2033
|
+
return assetTypeStagesMapping;
|
|
2034
|
+
})
|
|
1939
2035
|
);
|
|
1940
|
-
const
|
|
1941
|
-
createSelector(
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
return stages.filter((stage) => stage.component_type === componentTypeId).sort((a, b) => a.priority - b.priority);
|
|
1945
|
-
}
|
|
1946
|
-
)
|
|
2036
|
+
const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
|
|
2037
|
+
createSelector([selectStages, (_state, assetTypeId) => assetTypeId], (stages, assetTypeId) => {
|
|
2038
|
+
return stages.filter((stage) => stage.asset_type === assetTypeId).sort((a, b) => a.priority - b.priority);
|
|
2039
|
+
})
|
|
1947
2040
|
);
|
|
1948
2041
|
const selectStagesFromStageIds = restructureCreateSelectorWithArgs(
|
|
1949
2042
|
createSelector([selectStageMapping, (_state, stageIds) => stageIds], (stageMapping, stageIds) => {
|
|
@@ -1965,140 +2058,15 @@ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
|
1965
2058
|
return ret;
|
|
1966
2059
|
})
|
|
1967
2060
|
);
|
|
1968
|
-
const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } =
|
|
1969
|
-
const
|
|
2061
|
+
const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = assetStageSlice.actions;
|
|
2062
|
+
const assetStageReducer = assetStageSlice.reducer;
|
|
1970
2063
|
const initialState$m = {
|
|
1971
|
-
componentTypes: {},
|
|
1972
|
-
hiddenComponentTypeIds: {},
|
|
1973
|
-
attachments: {}
|
|
1974
|
-
};
|
|
1975
|
-
const componentTypeSlice = createSlice({
|
|
1976
|
-
name: "componentTypes",
|
|
1977
|
-
initialState: initialState$m,
|
|
1978
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
|
|
1979
|
-
reducers: {
|
|
1980
|
-
addComponentType: (state, action) => {
|
|
1981
|
-
state.componentTypes[action.payload.offline_id] = action.payload;
|
|
1982
|
-
},
|
|
1983
|
-
setComponentTypes: (state, action) => {
|
|
1984
|
-
state.componentTypes = toOfflineIdRecord(action.payload);
|
|
1985
|
-
},
|
|
1986
|
-
toggleComponentTypeVisibility: (state, action) => {
|
|
1987
|
-
state.hiddenComponentTypeIds[action.payload] = !state.hiddenComponentTypeIds[action.payload];
|
|
1988
|
-
},
|
|
1989
|
-
deleteComponentType: (state, action) => {
|
|
1990
|
-
delete state.componentTypes[action.payload];
|
|
1991
|
-
},
|
|
1992
|
-
// Attachments
|
|
1993
|
-
setComponentTypeAttachment: setAttachment,
|
|
1994
|
-
setComponentTypeAttachments: setAttachments,
|
|
1995
|
-
addComponentTypeAttachment: addAttachment,
|
|
1996
|
-
addComponentTypeAttachments: addAttachments,
|
|
1997
|
-
updateComponentTypeAttachment: updateAttachment,
|
|
1998
|
-
updateComponentTypeAttachments: updateAttachments,
|
|
1999
|
-
removeComponentTypeAttachment: removeAttachment,
|
|
2000
|
-
removeComponentTypeAttachments: removeAttachments
|
|
2001
|
-
}
|
|
2002
|
-
});
|
|
2003
|
-
const {
|
|
2004
|
-
addComponentType,
|
|
2005
|
-
setComponentTypes,
|
|
2006
|
-
toggleComponentTypeVisibility,
|
|
2007
|
-
deleteComponentType,
|
|
2008
|
-
// Attachmet
|
|
2009
|
-
setComponentTypeAttachment,
|
|
2010
|
-
setComponentTypeAttachments,
|
|
2011
|
-
addComponentTypeAttachment,
|
|
2012
|
-
addComponentTypeAttachments,
|
|
2013
|
-
updateComponentTypeAttachment,
|
|
2014
|
-
updateComponentTypeAttachments,
|
|
2015
|
-
removeComponentTypeAttachment,
|
|
2016
|
-
removeComponentTypeAttachments
|
|
2017
|
-
} = componentTypeSlice.actions;
|
|
2018
|
-
const selectComponentTypesMapping = (state) => state.componentTypeReducer.componentTypes;
|
|
2019
|
-
const selectComponentTypes = createSelector(
|
|
2020
|
-
[selectComponentTypesMapping],
|
|
2021
|
-
(mapping) => Object.values(mapping)
|
|
2022
|
-
);
|
|
2023
|
-
const selectComponentType = restructureCreateSelectorWithArgs(
|
|
2024
|
-
createSelector([selectComponentTypesMapping, (_state, id) => id], (mapping, id) => mapping[id])
|
|
2025
|
-
);
|
|
2026
|
-
const selectNumberOfComponentTypesMatchingCaseInsensitiveName = restructureCreateSelectorWithArgs(
|
|
2027
|
-
createSelector(
|
|
2028
|
-
[
|
|
2029
|
-
selectComponentTypesMapping,
|
|
2030
|
-
(_state, args) => args
|
|
2031
|
-
],
|
|
2032
|
-
(mapping, args) => {
|
|
2033
|
-
var _a2;
|
|
2034
|
-
const name = ((_a2 = args.name) == null ? void 0 : _a2.toLowerCase()) ?? null;
|
|
2035
|
-
return Object.values(mapping).filter(
|
|
2036
|
-
(componentType) => {
|
|
2037
|
-
var _a3;
|
|
2038
|
-
return (((_a3 = componentType.name) == null ? void 0 : _a3.toLowerCase()) ?? null) === name && componentType.offline_id !== args.componentTypeId;
|
|
2039
|
-
}
|
|
2040
|
-
).length;
|
|
2041
|
-
}
|
|
2042
|
-
)
|
|
2043
|
-
);
|
|
2044
|
-
const selectComponentTypesByName = restructureCreateSelectorWithArgs(
|
|
2045
|
-
createSelector(
|
|
2046
|
-
[selectComponentTypesMapping, (_state, name) => name],
|
|
2047
|
-
(mapping, name) => {
|
|
2048
|
-
name = (name == null ? void 0 : name.toLowerCase()) ?? null;
|
|
2049
|
-
return Object.values(mapping).filter(
|
|
2050
|
-
(componentType) => {
|
|
2051
|
-
var _a2;
|
|
2052
|
-
return (((_a2 = componentType.name) == null ? void 0 : _a2.toLowerCase()) ?? null) === name;
|
|
2053
|
-
}
|
|
2054
|
-
);
|
|
2055
|
-
}
|
|
2056
|
-
)
|
|
2057
|
-
);
|
|
2058
|
-
const selectHiddenComponentTypeIds = (state) => state.componentTypeReducer.hiddenComponentTypeIds;
|
|
2059
|
-
const selectComponentTypeAttachmentMapping = (state) => state.componentTypeReducer.attachments;
|
|
2060
|
-
const selectAllComponentTypeAttachments = createSelector(
|
|
2061
|
-
[selectComponentTypeAttachmentMapping],
|
|
2062
|
-
(mapping) => Object.values(mapping)
|
|
2063
|
-
);
|
|
2064
|
-
const selectComponentTypeAttachment = (attachmentId) => (state) => {
|
|
2065
|
-
return state.componentTypeReducer.attachments[attachmentId];
|
|
2066
|
-
};
|
|
2067
|
-
const selectAttachmentsOfComponentType = restructureCreateSelectorWithArgs(
|
|
2068
|
-
createSelector(
|
|
2069
|
-
[selectAllComponentTypeAttachments, (_state, componentTypeId) => componentTypeId],
|
|
2070
|
-
(attachments, componentTypeId) => {
|
|
2071
|
-
return attachments.filter(({ component_type }) => componentTypeId === component_type);
|
|
2072
|
-
}
|
|
2073
|
-
)
|
|
2074
|
-
);
|
|
2075
|
-
const selectAttachmentsOfComponentTypeByType = restructureCreateSelectorWithArgs(
|
|
2076
|
-
createSelector(
|
|
2077
|
-
[selectAllComponentTypeAttachments, (_state, componentTypeId) => componentTypeId],
|
|
2078
|
-
(attachments, componentTypeId) => {
|
|
2079
|
-
const attachmentsOfComponent = attachments.filter(
|
|
2080
|
-
({ component_type }) => component_type === componentTypeId
|
|
2081
|
-
);
|
|
2082
|
-
const fileAttachments = attachmentsOfComponent.filter(
|
|
2083
|
-
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2084
|
-
({ file_type }) => !file_type || !file_type.startsWith("image/")
|
|
2085
|
-
);
|
|
2086
|
-
const imageAttachments = attachmentsOfComponent.filter(
|
|
2087
|
-
// this null check here is necessary, there are cases where file_type is null or undefined
|
|
2088
|
-
({ file_type }) => file_type && file_type.startsWith("image/")
|
|
2089
|
-
);
|
|
2090
|
-
return { fileAttachments, imageAttachments };
|
|
2091
|
-
}
|
|
2092
|
-
)
|
|
2093
|
-
);
|
|
2094
|
-
const componentTypeReducer = componentTypeSlice.reducer;
|
|
2095
|
-
const initialState$l = {
|
|
2096
2064
|
workspaces: {},
|
|
2097
2065
|
activeWorkspaceId: null
|
|
2098
2066
|
};
|
|
2099
2067
|
const workspaceSlice = createSlice({
|
|
2100
2068
|
name: "workspace",
|
|
2101
|
-
initialState: initialState$
|
|
2069
|
+
initialState: initialState$m,
|
|
2102
2070
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
2103
2071
|
reducers: {
|
|
2104
2072
|
setWorkspaces: (state, action) => {
|
|
@@ -2155,7 +2123,7 @@ const selectPermittedWorkspaceIds = createSelector(
|
|
|
2155
2123
|
);
|
|
2156
2124
|
const workspaceReducer = workspaceSlice.reducer;
|
|
2157
2125
|
const maxRecentIssues = 10;
|
|
2158
|
-
const initialState$
|
|
2126
|
+
const initialState$l = {
|
|
2159
2127
|
issues: {},
|
|
2160
2128
|
attachments: {},
|
|
2161
2129
|
comments: {},
|
|
@@ -2167,9 +2135,9 @@ const initialState$k = {
|
|
|
2167
2135
|
};
|
|
2168
2136
|
const issueSlice = createSlice({
|
|
2169
2137
|
name: "issues",
|
|
2170
|
-
initialState: initialState$
|
|
2138
|
+
initialState: initialState$l,
|
|
2171
2139
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2172
|
-
Object.assign(state, initialState$
|
|
2140
|
+
Object.assign(state, initialState$l);
|
|
2173
2141
|
}),
|
|
2174
2142
|
reducers: {
|
|
2175
2143
|
setIssues: (state, action) => {
|
|
@@ -2602,14 +2570,14 @@ const selectRecentIssuesAsSearchResults = createSelector(
|
|
|
2602
2570
|
}
|
|
2603
2571
|
);
|
|
2604
2572
|
const issueReducer = issueSlice.reducer;
|
|
2605
|
-
const initialState$
|
|
2573
|
+
const initialState$k = {
|
|
2606
2574
|
issueTypes: {}
|
|
2607
2575
|
};
|
|
2608
2576
|
const issueTypeSlice = createSlice({
|
|
2609
2577
|
name: "issueTypes",
|
|
2610
|
-
initialState: initialState$
|
|
2578
|
+
initialState: initialState$k,
|
|
2611
2579
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2612
|
-
Object.assign(state, initialState$
|
|
2580
|
+
Object.assign(state, initialState$k);
|
|
2613
2581
|
}),
|
|
2614
2582
|
reducers: {
|
|
2615
2583
|
setIssueTypes: (state, action) => {
|
|
@@ -2676,15 +2644,15 @@ const selectIssuesOfIssueTypeCount = (issueTypeId) => (state) => {
|
|
|
2676
2644
|
return ((_a2 = selectIssuesOfIssueType(issueTypeId)(state)) == null ? void 0 : _a2.length) ?? 0;
|
|
2677
2645
|
};
|
|
2678
2646
|
const issueTypeReducer = issueTypeSlice.reducer;
|
|
2679
|
-
const initialState$
|
|
2647
|
+
const initialState$j = {
|
|
2680
2648
|
s3Urls: {}
|
|
2681
2649
|
};
|
|
2682
2650
|
const msPerHour = 1e3 * 60 * 60;
|
|
2683
2651
|
const msPerWeek = msPerHour * 24 * 7;
|
|
2684
2652
|
const fileSlice = createSlice({
|
|
2685
2653
|
name: "file",
|
|
2686
|
-
initialState: initialState$
|
|
2687
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2654
|
+
initialState: initialState$j,
|
|
2655
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
|
|
2688
2656
|
reducers: {
|
|
2689
2657
|
setUploadUrl: (state, action) => {
|
|
2690
2658
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -2711,7 +2679,7 @@ const selectUploadUrl = (sha1) => (state) => {
|
|
|
2711
2679
|
return url;
|
|
2712
2680
|
};
|
|
2713
2681
|
const fileReducer = fileSlice.reducer;
|
|
2714
|
-
const initialState$
|
|
2682
|
+
const initialState$i = {
|
|
2715
2683
|
// TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
|
|
2716
2684
|
mapStyle: MapStyle.SATELLITE,
|
|
2717
2685
|
showTooltips: false,
|
|
@@ -2719,8 +2687,8 @@ const initialState$h = {
|
|
|
2719
2687
|
};
|
|
2720
2688
|
const mapSlice = createSlice({
|
|
2721
2689
|
name: "map",
|
|
2722
|
-
initialState: initialState$
|
|
2723
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2690
|
+
initialState: initialState$i,
|
|
2691
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
|
|
2724
2692
|
reducers: {
|
|
2725
2693
|
setMapStyle: (state, action) => {
|
|
2726
2694
|
state.mapStyle = action.payload;
|
|
@@ -2750,8 +2718,8 @@ var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
|
|
|
2750
2718
|
})(OrganizationAccessLevel || {});
|
|
2751
2719
|
var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
|
|
2752
2720
|
AttachmentModel2["Issue"] = "issue";
|
|
2753
|
-
AttachmentModel2["
|
|
2754
|
-
AttachmentModel2["
|
|
2721
|
+
AttachmentModel2["Asset"] = "asset";
|
|
2722
|
+
AttachmentModel2["AssetType"] = "asset_type";
|
|
2755
2723
|
AttachmentModel2["Project"] = "project";
|
|
2756
2724
|
AttachmentModel2["Document"] = "document";
|
|
2757
2725
|
return AttachmentModel2;
|
|
@@ -2797,7 +2765,7 @@ var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
|
2797
2765
|
LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
|
|
2798
2766
|
return LicenseStatus2;
|
|
2799
2767
|
})(LicenseStatus || {});
|
|
2800
|
-
const initialState$
|
|
2768
|
+
const initialState$h = {
|
|
2801
2769
|
users: {},
|
|
2802
2770
|
currentUser: {
|
|
2803
2771
|
id: 0,
|
|
@@ -2808,8 +2776,8 @@ const initialState$g = {
|
|
|
2808
2776
|
};
|
|
2809
2777
|
const userSlice = createSlice({
|
|
2810
2778
|
name: "users",
|
|
2811
|
-
initialState: initialState$
|
|
2812
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2779
|
+
initialState: initialState$h,
|
|
2780
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
|
|
2813
2781
|
reducers: {
|
|
2814
2782
|
setUsers: (state, action) => {
|
|
2815
2783
|
const usersMapping = {};
|
|
@@ -2871,13 +2839,13 @@ const selectUser = (userId) => (state) => {
|
|
|
2871
2839
|
const selectUsersAsMapping = (state) => state.userReducer.users;
|
|
2872
2840
|
const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
|
|
2873
2841
|
const userReducer = userSlice.reducer;
|
|
2874
|
-
const initialState$
|
|
2842
|
+
const initialState$g = {
|
|
2875
2843
|
organizationAccesses: {}
|
|
2876
2844
|
};
|
|
2877
2845
|
const organizationAccessSlice = createSlice({
|
|
2878
2846
|
name: "organizationAccess",
|
|
2879
|
-
initialState: initialState$
|
|
2880
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2847
|
+
initialState: initialState$g,
|
|
2848
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
2881
2849
|
reducers: {
|
|
2882
2850
|
setOrganizationAccesses: (state, action) => {
|
|
2883
2851
|
if (!Array.isArray(action.payload))
|
|
@@ -2940,13 +2908,13 @@ const selectOrganizationAccessUserMapping = (state) => {
|
|
|
2940
2908
|
return organizationAccesses;
|
|
2941
2909
|
};
|
|
2942
2910
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
2943
|
-
const initialState$
|
|
2911
|
+
const initialState$f = {
|
|
2944
2912
|
licenses: {}
|
|
2945
2913
|
};
|
|
2946
2914
|
const licenseSlice = createSlice({
|
|
2947
2915
|
name: "license",
|
|
2948
|
-
initialState: initialState$
|
|
2949
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2916
|
+
initialState: initialState$f,
|
|
2917
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
|
|
2950
2918
|
reducers: {
|
|
2951
2919
|
setLicenses: (state, action) => {
|
|
2952
2920
|
if (!Array.isArray(action.payload))
|
|
@@ -2991,13 +2959,13 @@ const selectLicensesForProjectsMapping = createSelector(
|
|
|
2991
2959
|
(licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
|
|
2992
2960
|
);
|
|
2993
2961
|
const licenseReducer = licenseSlice.reducer;
|
|
2994
|
-
const initialState$
|
|
2962
|
+
const initialState$e = {
|
|
2995
2963
|
projectAccesses: {}
|
|
2996
2964
|
};
|
|
2997
2965
|
const projectAccessSlice = createSlice({
|
|
2998
2966
|
name: "projectAccess",
|
|
2999
|
-
initialState: initialState$
|
|
3000
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2967
|
+
initialState: initialState$e,
|
|
2968
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
|
|
3001
2969
|
reducers: {
|
|
3002
2970
|
setProjectAccesses: (state, action) => {
|
|
3003
2971
|
if (!Array.isArray(action.payload))
|
|
@@ -3065,7 +3033,7 @@ const selectProjectAccessUserMapping = (state) => {
|
|
|
3065
3033
|
return projectAccesses;
|
|
3066
3034
|
};
|
|
3067
3035
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
3068
|
-
const initialState$
|
|
3036
|
+
const initialState$d = {
|
|
3069
3037
|
projects: {},
|
|
3070
3038
|
activeProjectId: null,
|
|
3071
3039
|
recentProjectIds: [],
|
|
@@ -3075,7 +3043,7 @@ const initialState$c = {
|
|
|
3075
3043
|
};
|
|
3076
3044
|
const projectSlice = createSlice({
|
|
3077
3045
|
name: "projects",
|
|
3078
|
-
initialState: initialState$
|
|
3046
|
+
initialState: initialState$d,
|
|
3079
3047
|
reducers: {
|
|
3080
3048
|
setProjects: (state, action) => {
|
|
3081
3049
|
const projectsMap = {};
|
|
@@ -3269,14 +3237,14 @@ const selectAttachmentsOfProjectByType = restructureCreateSelectorWithArgs(
|
|
|
3269
3237
|
}
|
|
3270
3238
|
)
|
|
3271
3239
|
);
|
|
3272
|
-
const initialState$
|
|
3240
|
+
const initialState$c = {
|
|
3273
3241
|
organizations: {},
|
|
3274
3242
|
activeOrganizationId: null
|
|
3275
3243
|
};
|
|
3276
3244
|
const organizationSlice = createSlice({
|
|
3277
3245
|
name: "organizations",
|
|
3278
|
-
initialState: initialState$
|
|
3279
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3246
|
+
initialState: initialState$c,
|
|
3247
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
|
|
3280
3248
|
reducers: {
|
|
3281
3249
|
setOrganizations: (state, action) => {
|
|
3282
3250
|
for (const org of action.payload) {
|
|
@@ -3395,14 +3363,14 @@ const createOfflineAction = (request2, baseUrl) => {
|
|
|
3395
3363
|
}
|
|
3396
3364
|
};
|
|
3397
3365
|
};
|
|
3398
|
-
const initialState$
|
|
3366
|
+
const initialState$b = {
|
|
3399
3367
|
deletedRequests: [],
|
|
3400
3368
|
latestRetryTime: 0
|
|
3401
3369
|
};
|
|
3402
3370
|
const outboxSlice = createSlice({
|
|
3403
3371
|
name: "outbox",
|
|
3404
|
-
initialState: initialState$
|
|
3405
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3372
|
+
initialState: initialState$b,
|
|
3373
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
|
|
3406
3374
|
reducers: {
|
|
3407
3375
|
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
3408
3376
|
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
@@ -3434,7 +3402,7 @@ const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
|
|
|
3434
3402
|
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
3435
3403
|
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
3436
3404
|
const outboxReducer = outboxSlice.reducer;
|
|
3437
|
-
const initialState$
|
|
3405
|
+
const initialState$a = {
|
|
3438
3406
|
projectFiles: {},
|
|
3439
3407
|
activeProjectFileId: null,
|
|
3440
3408
|
isImportingProjectFile: false,
|
|
@@ -3442,8 +3410,8 @@ const initialState$9 = {
|
|
|
3442
3410
|
};
|
|
3443
3411
|
const projectFileSlice = createSlice({
|
|
3444
3412
|
name: "projectFiles",
|
|
3445
|
-
initialState: initialState$
|
|
3446
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3413
|
+
initialState: initialState$a,
|
|
3414
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
|
|
3447
3415
|
reducers: {
|
|
3448
3416
|
addOrReplaceProjectFiles: (state, action) => {
|
|
3449
3417
|
for (let fileObj of action.payload) {
|
|
@@ -3544,12 +3512,12 @@ const selectProjectFiles = createSelector(
|
|
|
3544
3512
|
const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
|
|
3545
3513
|
const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
|
|
3546
3514
|
const projectFileReducer = projectFileSlice.reducer;
|
|
3547
|
-
const initialState$
|
|
3515
|
+
const initialState$9 = {
|
|
3548
3516
|
isRehydrated: false
|
|
3549
3517
|
};
|
|
3550
3518
|
const rehydratedSlice = createSlice({
|
|
3551
3519
|
name: "rehydrated",
|
|
3552
|
-
initialState: initialState$
|
|
3520
|
+
initialState: initialState$9,
|
|
3553
3521
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
3554
3522
|
reducers: {
|
|
3555
3523
|
setRehydrated: (state, action) => {
|
|
@@ -3559,11 +3527,12 @@ const rehydratedSlice = createSlice({
|
|
|
3559
3527
|
});
|
|
3560
3528
|
const selectRehydrated = (state) => state.rehydratedReducer.isRehydrated;
|
|
3561
3529
|
const rehydratedReducer = rehydratedSlice.reducer;
|
|
3562
|
-
const initialState$
|
|
3530
|
+
const initialState$8 = {
|
|
3563
3531
|
useIssueTemplate: false,
|
|
3564
3532
|
placementMode: false,
|
|
3565
3533
|
enableClustering: false,
|
|
3566
3534
|
svgLayout: false,
|
|
3535
|
+
// TODO: this is no longer used
|
|
3567
3536
|
expandedSections: {
|
|
3568
3537
|
Issues: true,
|
|
3569
3538
|
"Map Layers": false,
|
|
@@ -3576,8 +3545,8 @@ const initialState$7 = {
|
|
|
3576
3545
|
};
|
|
3577
3546
|
const settingSlice = createSlice({
|
|
3578
3547
|
name: "settings",
|
|
3579
|
-
initialState: initialState$
|
|
3580
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3548
|
+
initialState: initialState$8,
|
|
3549
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
3581
3550
|
reducers: {
|
|
3582
3551
|
setEnableDuplicateIssues: (state, action) => {
|
|
3583
3552
|
state.useIssueTemplate = action.payload;
|
|
@@ -3636,14 +3605,14 @@ const formRevisionSortFn = (formRevisionA, formRevisionB) => {
|
|
|
3636
3605
|
return revisionA < revisionB ? -1 : 1;
|
|
3637
3606
|
}
|
|
3638
3607
|
};
|
|
3639
|
-
const initialState$
|
|
3608
|
+
const initialState$7 = {
|
|
3640
3609
|
formRevisions: {},
|
|
3641
3610
|
attachments: {}
|
|
3642
3611
|
};
|
|
3643
3612
|
const formRevisionsSlice = createSlice({
|
|
3644
3613
|
name: "formRevisions",
|
|
3645
|
-
initialState: initialState$
|
|
3646
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3614
|
+
initialState: initialState$7,
|
|
3615
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
3647
3616
|
reducers: {
|
|
3648
3617
|
// revision related actions
|
|
3649
3618
|
setFormRevision: (state, action) => {
|
|
@@ -3774,27 +3743,27 @@ const selectFormRevisionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
3774
3743
|
});
|
|
3775
3744
|
})
|
|
3776
3745
|
);
|
|
3777
|
-
const
|
|
3746
|
+
const selectLatestFormRevisionsOfAssetTypes = restructureCreateSelectorWithArgs(
|
|
3778
3747
|
createSelector(
|
|
3779
3748
|
[
|
|
3780
3749
|
(state) => state.formReducer.forms,
|
|
3781
3750
|
selectFormRevisionMapping,
|
|
3782
|
-
(_state,
|
|
3751
|
+
(_state, assetTypeIds) => assetTypeIds
|
|
3783
3752
|
],
|
|
3784
|
-
(userForms, revisions,
|
|
3785
|
-
const
|
|
3786
|
-
const
|
|
3753
|
+
(userForms, revisions, assetTypeIds) => {
|
|
3754
|
+
const assetTypeIdsSet = new Set(assetTypeIds);
|
|
3755
|
+
const formsOfAssetTypes = {};
|
|
3787
3756
|
const ret = {};
|
|
3788
3757
|
for (const form of Object.values(userForms)) {
|
|
3789
|
-
if (form.
|
|
3790
|
-
|
|
3758
|
+
if (form.asset_type && assetTypeIdsSet.has(form.asset_type)) {
|
|
3759
|
+
formsOfAssetTypes[form.offline_id] = form;
|
|
3791
3760
|
}
|
|
3792
3761
|
}
|
|
3793
3762
|
for (const revision of Object.values(revisions)) {
|
|
3794
|
-
const form =
|
|
3795
|
-
if (!form || !form.
|
|
3763
|
+
const form = formsOfAssetTypes[revision.form];
|
|
3764
|
+
if (!form || !form.asset_type || ret[form.asset_type] && formRevisionSortFn(ret[form.asset_type], revision) > 0)
|
|
3796
3765
|
continue;
|
|
3797
|
-
ret[form.
|
|
3766
|
+
ret[form.asset_type] = revision;
|
|
3798
3767
|
}
|
|
3799
3768
|
return ret;
|
|
3800
3769
|
}
|
|
@@ -3823,13 +3792,13 @@ const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
|
|
|
3823
3792
|
)
|
|
3824
3793
|
);
|
|
3825
3794
|
const formRevisionReducer = formRevisionsSlice.reducer;
|
|
3826
|
-
const initialState$
|
|
3795
|
+
const initialState$6 = {
|
|
3827
3796
|
forms: {}
|
|
3828
3797
|
};
|
|
3829
3798
|
const formSlice = createSlice({
|
|
3830
3799
|
name: "forms",
|
|
3831
|
-
initialState: initialState$
|
|
3832
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3800
|
+
initialState: initialState$6,
|
|
3801
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
3833
3802
|
reducers: {
|
|
3834
3803
|
setForms: (state, action) => {
|
|
3835
3804
|
state.forms = {};
|
|
@@ -3911,11 +3880,11 @@ const selectForm = (formId2) => (state) => {
|
|
|
3911
3880
|
const selectFormMapping = (state) => {
|
|
3912
3881
|
return state.formReducer.forms;
|
|
3913
3882
|
};
|
|
3914
|
-
const
|
|
3883
|
+
const selectFormOfAssetType = restructureCreateSelectorWithArgs(
|
|
3915
3884
|
createSelector(
|
|
3916
|
-
[selectFormMapping, (_state,
|
|
3917
|
-
(userForms,
|
|
3918
|
-
return Object.values(userForms).find((userForm) => userForm.
|
|
3885
|
+
[selectFormMapping, (_state, assetTypeId) => assetTypeId],
|
|
3886
|
+
(userForms, assetTypeId) => {
|
|
3887
|
+
return Object.values(userForms).find((userForm) => userForm.asset_type === assetTypeId);
|
|
3919
3888
|
}
|
|
3920
3889
|
)
|
|
3921
3890
|
);
|
|
@@ -3931,17 +3900,17 @@ const selectFormsCount = createSelector([selectFormMapping], (userForms) => {
|
|
|
3931
3900
|
return Object.keys(userForms).length;
|
|
3932
3901
|
});
|
|
3933
3902
|
const selectGeneralFormCount = createSelector([selectFormMapping], (userForms) => {
|
|
3934
|
-
return Object.values(userForms).filter((form) => !form.
|
|
3903
|
+
return Object.values(userForms).filter((form) => !form.asset_type).length;
|
|
3935
3904
|
});
|
|
3936
3905
|
const formReducer = formSlice.reducer;
|
|
3937
|
-
const initialState$
|
|
3906
|
+
const initialState$5 = {
|
|
3938
3907
|
formSubmissions: {},
|
|
3939
3908
|
attachments: {}
|
|
3940
3909
|
};
|
|
3941
3910
|
const formSubmissionSlice = createSlice({
|
|
3942
3911
|
name: "formSubmissions",
|
|
3943
|
-
initialState: initialState$
|
|
3944
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
3912
|
+
initialState: initialState$5,
|
|
3913
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
3945
3914
|
reducers: {
|
|
3946
3915
|
setFormSubmission: (state, action) => {
|
|
3947
3916
|
state.formSubmissions[action.payload.offline_id] = action.payload;
|
|
@@ -4139,31 +4108,31 @@ const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
|
4139
4108
|
}
|
|
4140
4109
|
)
|
|
4141
4110
|
);
|
|
4142
|
-
const
|
|
4111
|
+
const selectFormSubmissionsOfAsset = restructureCreateSelectorWithArgs(
|
|
4143
4112
|
createSelector(
|
|
4144
|
-
[selectFormSubmissions, (_state,
|
|
4145
|
-
(submissions,
|
|
4113
|
+
[selectFormSubmissions, (_state, assetId) => assetId],
|
|
4114
|
+
(submissions, assetId) => {
|
|
4146
4115
|
return submissions.filter((submission) => {
|
|
4147
|
-
return submission.
|
|
4116
|
+
return submission.asset === assetId;
|
|
4148
4117
|
});
|
|
4149
4118
|
}
|
|
4150
4119
|
)
|
|
4151
4120
|
);
|
|
4152
|
-
const
|
|
4153
|
-
[selectFormSubmissionsMapping,
|
|
4154
|
-
(submissions,
|
|
4121
|
+
const selectFormSubmissionsByAssets = createSelector(
|
|
4122
|
+
[selectFormSubmissionsMapping, selectAssetsMapping],
|
|
4123
|
+
(submissions, assets) => {
|
|
4155
4124
|
var _a2;
|
|
4156
|
-
const
|
|
4157
|
-
for (const
|
|
4158
|
-
|
|
4125
|
+
const assetSubmissionMapping = {};
|
|
4126
|
+
for (const assetId in assets) {
|
|
4127
|
+
assetSubmissionMapping[assetId] = [];
|
|
4159
4128
|
}
|
|
4160
4129
|
for (const submissionId in submissions) {
|
|
4161
4130
|
const submission = submissions[submissionId];
|
|
4162
|
-
if (submission.
|
|
4163
|
-
(_a2 =
|
|
4131
|
+
if (submission.asset) {
|
|
4132
|
+
(_a2 = assetSubmissionMapping[submission.asset]) == null ? void 0 : _a2.push(submission);
|
|
4164
4133
|
}
|
|
4165
4134
|
}
|
|
4166
|
-
return
|
|
4135
|
+
return assetSubmissionMapping;
|
|
4167
4136
|
}
|
|
4168
4137
|
);
|
|
4169
4138
|
const selectFormSubmissionAttachmentsMapping = (state) => {
|
|
@@ -4178,12 +4147,12 @@ const selectAttachmentsOfFormSubmission = restructureCreateSelectorWithArgs(
|
|
|
4178
4147
|
)
|
|
4179
4148
|
);
|
|
4180
4149
|
const formSubmissionReducer = formSubmissionSlice.reducer;
|
|
4181
|
-
const initialState$
|
|
4150
|
+
const initialState$4 = {
|
|
4182
4151
|
emailDomains: {}
|
|
4183
4152
|
};
|
|
4184
4153
|
const emailDomainsSlice = createSlice({
|
|
4185
4154
|
name: "emailDomains",
|
|
4186
|
-
initialState: initialState$
|
|
4155
|
+
initialState: initialState$4,
|
|
4187
4156
|
reducers: {
|
|
4188
4157
|
setEmailDomains: (state, action) => {
|
|
4189
4158
|
const emailDomains = {};
|
|
@@ -4210,15 +4179,15 @@ const selectSortedEmailDomains = (state) => Object.values(state.emailDomainsRedu
|
|
|
4210
4179
|
(ed1, ed2) => ed1.domain.localeCompare(ed2.domain)
|
|
4211
4180
|
);
|
|
4212
4181
|
const emailDomainsReducer = emailDomainsSlice.reducer;
|
|
4213
|
-
const initialState$
|
|
4182
|
+
const initialState$3 = {
|
|
4214
4183
|
documents: {},
|
|
4215
4184
|
attachments: {}
|
|
4216
4185
|
};
|
|
4217
4186
|
const documentSlice = createSlice({
|
|
4218
4187
|
name: "documents",
|
|
4219
|
-
initialState: initialState$
|
|
4188
|
+
initialState: initialState$3,
|
|
4220
4189
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
4221
|
-
Object.assign(state, initialState$
|
|
4190
|
+
Object.assign(state, initialState$3);
|
|
4222
4191
|
}),
|
|
4223
4192
|
reducers: {
|
|
4224
4193
|
setDocuments: (state, action) => {
|
|
@@ -4449,13 +4418,13 @@ const selectAttachmentsOfDocumentByType = restructureCreateSelectorWithArgs(
|
|
|
4449
4418
|
)
|
|
4450
4419
|
);
|
|
4451
4420
|
const documentsReducer = documentSlice.reducer;
|
|
4452
|
-
const initialState$
|
|
4421
|
+
const initialState$2 = {
|
|
4453
4422
|
teams: {}
|
|
4454
4423
|
};
|
|
4455
4424
|
const teamSlice = createSlice({
|
|
4456
4425
|
name: "teams",
|
|
4457
|
-
initialState: initialState$
|
|
4458
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
4426
|
+
initialState: initialState$2,
|
|
4427
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
|
|
4459
4428
|
reducers: {
|
|
4460
4429
|
setTeam: (state, action) => {
|
|
4461
4430
|
state.teams[action.payload.offline_id] = action.payload;
|
|
@@ -4505,6 +4474,54 @@ const selectTeamsOfUser = restructureCreateSelectorWithArgs(
|
|
|
4505
4474
|
})
|
|
4506
4475
|
);
|
|
4507
4476
|
const teamReducer = teamSlice.reducer;
|
|
4477
|
+
const initialState$1 = {
|
|
4478
|
+
conversations: {}
|
|
4479
|
+
};
|
|
4480
|
+
const agentsSlice = createSlice({
|
|
4481
|
+
name: "agents",
|
|
4482
|
+
initialState: initialState$1,
|
|
4483
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
|
|
4484
|
+
reducers: {
|
|
4485
|
+
setConversations: (state, action) => {
|
|
4486
|
+
state.conversations = {};
|
|
4487
|
+
for (const conversation of action.payload) {
|
|
4488
|
+
state.conversations[conversation.offline_id] = conversation;
|
|
4489
|
+
}
|
|
4490
|
+
},
|
|
4491
|
+
addConversation: (state, action) => {
|
|
4492
|
+
if (action.payload.offline_id in state.conversations) {
|
|
4493
|
+
throw new Error("Conversation already exists in history");
|
|
4494
|
+
}
|
|
4495
|
+
state.conversations[action.payload.offline_id] = action.payload;
|
|
4496
|
+
},
|
|
4497
|
+
setConversation: (state, action) => {
|
|
4498
|
+
if (!(action.payload.offline_id in state.conversations)) {
|
|
4499
|
+
throw new Error("Conversation does not exist in history");
|
|
4500
|
+
}
|
|
4501
|
+
state.conversations[action.payload.offline_id] = action.payload;
|
|
4502
|
+
},
|
|
4503
|
+
updateConversation: (state, action) => {
|
|
4504
|
+
const existing = state.conversations[action.payload.offline_id];
|
|
4505
|
+
if (!existing) {
|
|
4506
|
+
throw new Error("Conversation does not exist in history");
|
|
4507
|
+
}
|
|
4508
|
+
state.conversations[action.payload.offline_id] = { ...existing, ...action.payload };
|
|
4509
|
+
}
|
|
4510
|
+
}
|
|
4511
|
+
});
|
|
4512
|
+
const { setConversations, addConversation, setConversation, updateConversation } = agentsSlice.actions;
|
|
4513
|
+
const selectConversationMapping = (state) => state.agentsReducer.conversations;
|
|
4514
|
+
const selectConversations = createSelector(
|
|
4515
|
+
[selectConversationMapping],
|
|
4516
|
+
(conversationMapping) => Object.values(conversationMapping)
|
|
4517
|
+
);
|
|
4518
|
+
const selectConversation = restructureCreateSelectorWithArgs(
|
|
4519
|
+
createSelector(
|
|
4520
|
+
[selectConversationMapping, (_state, conversationId) => conversationId],
|
|
4521
|
+
(conversationMapping, conversationId) => conversationMapping[conversationId]
|
|
4522
|
+
)
|
|
4523
|
+
);
|
|
4524
|
+
const agentsReducer = agentsSlice.reducer;
|
|
4508
4525
|
const initialState = {
|
|
4509
4526
|
version: 0
|
|
4510
4527
|
};
|
|
@@ -4514,7 +4531,7 @@ const versioningSlice = createSlice({
|
|
|
4514
4531
|
reducers: {}
|
|
4515
4532
|
});
|
|
4516
4533
|
const versioningReducer = versioningSlice.reducer;
|
|
4517
|
-
const
|
|
4534
|
+
const fullAssetMarkerSize = 45;
|
|
4518
4535
|
const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
|
|
4519
4536
|
const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
|
|
4520
4537
|
const OUTBOX_RETRY_DELAY = 5e3;
|
|
@@ -4532,10 +4549,10 @@ const overmapReducers = {
|
|
|
4532
4549
|
fileReducer,
|
|
4533
4550
|
authReducer,
|
|
4534
4551
|
categoryReducer,
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4552
|
+
assetReducer,
|
|
4553
|
+
assetStageCompletionReducer,
|
|
4554
|
+
assetStageReducer,
|
|
4555
|
+
assetTypeReducer,
|
|
4539
4556
|
issueReducer,
|
|
4540
4557
|
issueTypeReducer,
|
|
4541
4558
|
mapReducer,
|
|
@@ -4555,7 +4572,8 @@ const overmapReducers = {
|
|
|
4555
4572
|
emailDomainsReducer,
|
|
4556
4573
|
licenseReducer,
|
|
4557
4574
|
documentsReducer,
|
|
4558
|
-
teamReducer
|
|
4575
|
+
teamReducer,
|
|
4576
|
+
agentsReducer
|
|
4559
4577
|
};
|
|
4560
4578
|
const overmapReducer = combineReducers(overmapReducers);
|
|
4561
4579
|
const resetStore = "RESET";
|
|
@@ -5315,6 +5333,9 @@ class AuthService extends BaseApiService {
|
|
|
5315
5333
|
}
|
|
5316
5334
|
async setTourStep(stepIndex) {
|
|
5317
5335
|
this.client.store.dispatch(setTourStep(stepIndex));
|
|
5336
|
+
const currentStep = this.client.store.getState().userReducer.currentUser.profile.tour_step;
|
|
5337
|
+
if (currentStep === stepIndex)
|
|
5338
|
+
return Promise.resolve(void 0);
|
|
5318
5339
|
return this.enqueueRequest({
|
|
5319
5340
|
description: "Set tour step",
|
|
5320
5341
|
method: HttpMethod.PATCH,
|
|
@@ -5433,244 +5454,234 @@ class CategoryService extends BaseApiService {
|
|
|
5433
5454
|
store.dispatch(setCategories(result));
|
|
5434
5455
|
}
|
|
5435
5456
|
}
|
|
5436
|
-
class
|
|
5457
|
+
class AssetService extends BaseApiService {
|
|
5437
5458
|
// Basic CRUD functions
|
|
5438
|
-
add(
|
|
5439
|
-
const
|
|
5440
|
-
this.client.store.dispatch(
|
|
5459
|
+
add(asset, workspaceId) {
|
|
5460
|
+
const offlineAsset = offline(asset);
|
|
5461
|
+
this.client.store.dispatch(addAsset(offlineAsset));
|
|
5441
5462
|
const promise = this.enqueueRequest({
|
|
5442
|
-
description: "Create
|
|
5463
|
+
description: "Create asset",
|
|
5443
5464
|
method: HttpMethod.POST,
|
|
5444
|
-
url: `/
|
|
5465
|
+
url: `/assets/types/${offlineAsset.asset_type}/add-assets/`,
|
|
5445
5466
|
queryParams: {
|
|
5446
5467
|
workspace_id: workspaceId.toString()
|
|
5447
5468
|
},
|
|
5448
|
-
payload: {
|
|
5469
|
+
payload: { assets: [offlineAsset] },
|
|
5449
5470
|
blockers: [],
|
|
5450
|
-
blocks: [
|
|
5471
|
+
blocks: [offlineAsset.offline_id]
|
|
5451
5472
|
});
|
|
5452
|
-
return [
|
|
5473
|
+
return [offlineAsset, promise];
|
|
5453
5474
|
}
|
|
5454
|
-
update(
|
|
5455
|
-
this.client.store.dispatch(
|
|
5475
|
+
update(asset, workspaceId) {
|
|
5476
|
+
this.client.store.dispatch(updateAsset(asset));
|
|
5456
5477
|
const promise = this.enqueueRequest({
|
|
5457
|
-
description: "Edit
|
|
5478
|
+
description: "Edit asset",
|
|
5458
5479
|
method: HttpMethod.PATCH,
|
|
5459
|
-
url: `/
|
|
5480
|
+
url: `/assets/${asset.offline_id}/`,
|
|
5460
5481
|
queryParams: {
|
|
5461
5482
|
workspace_id: workspaceId.toString()
|
|
5462
5483
|
},
|
|
5463
|
-
payload:
|
|
5464
|
-
blockers: [
|
|
5465
|
-
blocks: [
|
|
5484
|
+
payload: asset,
|
|
5485
|
+
blockers: [asset.offline_id],
|
|
5486
|
+
blocks: [asset.offline_id]
|
|
5466
5487
|
});
|
|
5467
|
-
return [
|
|
5488
|
+
return [asset, promise];
|
|
5468
5489
|
}
|
|
5469
|
-
async remove(
|
|
5490
|
+
async remove(assetId) {
|
|
5470
5491
|
const { store } = this.client;
|
|
5471
|
-
const
|
|
5472
|
-
if (!
|
|
5473
|
-
throw new Error(`No
|
|
5474
|
-
const
|
|
5475
|
-
store.dispatch(
|
|
5476
|
-
if (
|
|
5477
|
-
const
|
|
5478
|
-
store.dispatch(
|
|
5492
|
+
const assetToBeDeleted = selectAsset(assetId)(store.getState());
|
|
5493
|
+
if (!assetToBeDeleted)
|
|
5494
|
+
throw new Error(`No asset with id ${assetId} found in the store`);
|
|
5495
|
+
const attachmentsOfAssets = selectAttachmentsOfAsset(assetId)(store.getState());
|
|
5496
|
+
store.dispatch(removeAsset(assetId));
|
|
5497
|
+
if (attachmentsOfAssets.length > 0) {
|
|
5498
|
+
const attachmentsOfAssetIds = attachmentsOfAssets.map(({ offline_id }) => offline_id);
|
|
5499
|
+
store.dispatch(removeAssetAttachments(attachmentsOfAssetIds));
|
|
5479
5500
|
}
|
|
5480
5501
|
return this.enqueueRequest({
|
|
5481
|
-
description: "Delete
|
|
5502
|
+
description: "Delete asset",
|
|
5482
5503
|
method: HttpMethod.DELETE,
|
|
5483
|
-
url: `/
|
|
5484
|
-
blockers: [
|
|
5504
|
+
url: `/assets/${assetId}/`,
|
|
5505
|
+
blockers: [assetId],
|
|
5485
5506
|
blocks: []
|
|
5486
5507
|
}).catch((err) => {
|
|
5487
|
-
store.dispatch(
|
|
5488
|
-
store.dispatch(
|
|
5508
|
+
store.dispatch(addAsset(assetToBeDeleted));
|
|
5509
|
+
store.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
5489
5510
|
throw err;
|
|
5490
5511
|
});
|
|
5491
5512
|
}
|
|
5492
|
-
async
|
|
5493
|
-
const clientStore2 = this.client.store;
|
|
5494
|
-
const allComponentsOfType = selectComponentsFromComponentType(componentTypeId)(clientStore2.getState());
|
|
5495
|
-
const affectedComponentIds = (allComponentsOfType || []).map((c) => c.offline_id);
|
|
5496
|
-
const affectedOfflineIds = [componentTypeId, ...affectedComponentIds];
|
|
5513
|
+
async deleteAllAssetsOfAssetType(assetTypeId) {
|
|
5497
5514
|
const { store } = this.client;
|
|
5498
5515
|
const state = store.getState();
|
|
5499
|
-
const
|
|
5500
|
-
|
|
5516
|
+
const allAssetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
|
|
5517
|
+
const allAssetsOfAssetTypeIds = (allAssetsOfAssetType || []).map((c) => c.offline_id);
|
|
5518
|
+
const affectedOfflineIds = [assetTypeId, ...allAssetsOfAssetTypeIds];
|
|
5519
|
+
store.dispatch(removeAllAssetsOfType(assetTypeId));
|
|
5501
5520
|
return this.enqueueRequest({
|
|
5502
|
-
description: "
|
|
5521
|
+
description: "Delete all assets of asset type",
|
|
5503
5522
|
method: HttpMethod.DELETE,
|
|
5504
|
-
url: `/
|
|
5523
|
+
url: `/assets/types/${assetTypeId}/delete-all-of-type/`,
|
|
5505
5524
|
blockers: affectedOfflineIds,
|
|
5506
5525
|
blocks: affectedOfflineIds
|
|
5507
5526
|
}).catch((err) => {
|
|
5508
|
-
if (
|
|
5509
|
-
store.dispatch(
|
|
5527
|
+
if (allAssetsOfAssetType) {
|
|
5528
|
+
store.dispatch(addAssetsInBatches(allAssetsOfAssetType));
|
|
5510
5529
|
}
|
|
5511
5530
|
throw err;
|
|
5512
5531
|
});
|
|
5513
5532
|
}
|
|
5514
|
-
async addBatch(
|
|
5515
|
-
const
|
|
5516
|
-
return { ...offline(
|
|
5533
|
+
async addBatch(assetsToCreate, workspaceId, assetTypeId) {
|
|
5534
|
+
const fullAssets = assetsToCreate.map((asset) => {
|
|
5535
|
+
return { ...offline(asset), submitted_at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
5517
5536
|
});
|
|
5518
5537
|
const { store } = this.client;
|
|
5519
|
-
store.dispatch(
|
|
5538
|
+
store.dispatch(addAssetsInBatches(fullAssets));
|
|
5520
5539
|
const promise = this.enqueueRequest({
|
|
5521
|
-
description: "Batch create
|
|
5540
|
+
description: "Batch create assets",
|
|
5522
5541
|
method: HttpMethod.POST,
|
|
5523
|
-
url: `/
|
|
5542
|
+
url: `/assets/types/${assetTypeId}/add-assets/`,
|
|
5524
5543
|
queryParams: {
|
|
5525
5544
|
workspace_id: workspaceId.toString()
|
|
5526
5545
|
},
|
|
5527
5546
|
payload: {
|
|
5528
|
-
|
|
5547
|
+
assets: fullAssets
|
|
5529
5548
|
},
|
|
5530
|
-
blockers: [
|
|
5531
|
-
blocks:
|
|
5549
|
+
blockers: [assetTypeId],
|
|
5550
|
+
blocks: fullAssets.map((c) => c.offline_id)
|
|
5532
5551
|
});
|
|
5533
5552
|
void promise.then((result) => {
|
|
5534
|
-
for (const
|
|
5535
|
-
store.dispatch(
|
|
5553
|
+
for (const assets of Object.values(result)) {
|
|
5554
|
+
store.dispatch(updateAsset(assets));
|
|
5536
5555
|
}
|
|
5537
5556
|
}).catch((e) => {
|
|
5538
|
-
for (const
|
|
5539
|
-
store.dispatch(
|
|
5557
|
+
for (const asset of fullAssets) {
|
|
5558
|
+
store.dispatch(removeAsset(asset.offline_id));
|
|
5540
5559
|
}
|
|
5541
5560
|
throw e;
|
|
5542
5561
|
});
|
|
5543
5562
|
return promise;
|
|
5544
5563
|
}
|
|
5545
|
-
async refreshStore(
|
|
5564
|
+
async refreshStore() {
|
|
5546
5565
|
const { store } = this.client;
|
|
5547
5566
|
const result = await this.enqueueRequest({
|
|
5548
|
-
description: "Get
|
|
5567
|
+
description: "Get assets",
|
|
5549
5568
|
method: HttpMethod.GET,
|
|
5550
|
-
url: `/projects/${store.getState().projectReducer.activeProjectId}/
|
|
5569
|
+
url: `/projects/${store.getState().projectReducer.activeProjectId}/assets/`,
|
|
5551
5570
|
blockers: [],
|
|
5552
5571
|
blocks: []
|
|
5553
5572
|
});
|
|
5554
|
-
|
|
5555
|
-
store.dispatch(setComponents(result));
|
|
5556
|
-
} else {
|
|
5557
|
-
store.dispatch(addComponentsInBatches(result));
|
|
5558
|
-
}
|
|
5573
|
+
store.dispatch(setAssets(result));
|
|
5559
5574
|
}
|
|
5560
5575
|
}
|
|
5561
|
-
class
|
|
5562
|
-
add(
|
|
5576
|
+
class AssetStageCompletionService extends BaseApiService {
|
|
5577
|
+
add(assetId, stageId) {
|
|
5563
5578
|
var _a2;
|
|
5564
5579
|
const { store } = this.client;
|
|
5565
|
-
const
|
|
5566
|
-
if (!
|
|
5567
|
-
throw new Error(`
|
|
5580
|
+
const assetTypeId = (_a2 = store.getState().assetReducer.assets[assetId]) == null ? void 0 : _a2.asset_type;
|
|
5581
|
+
if (!assetTypeId) {
|
|
5582
|
+
throw new Error(`Asset with offline_id ${assetId} not found`);
|
|
5568
5583
|
}
|
|
5569
|
-
const
|
|
5570
|
-
|
|
5584
|
+
const offlineStageCompletion = offline({
|
|
5585
|
+
asset: assetId,
|
|
5571
5586
|
stage: stageId
|
|
5572
5587
|
});
|
|
5573
|
-
store.dispatch(addStageCompletion(
|
|
5588
|
+
store.dispatch(addStageCompletion(offlineStageCompletion));
|
|
5574
5589
|
const promise = this.enqueueRequest({
|
|
5575
|
-
description: "
|
|
5590
|
+
description: "Complete stage",
|
|
5576
5591
|
method: HttpMethod.POST,
|
|
5577
|
-
url: `/
|
|
5592
|
+
url: `/assets/types/${assetTypeId}/complete-stages/`,
|
|
5578
5593
|
// TODO: Add submitted_at to model
|
|
5579
|
-
payload: { completions: [{ ...
|
|
5580
|
-
blockers: [
|
|
5581
|
-
blocks: [
|
|
5594
|
+
payload: { completions: [{ ...offlineStageCompletion, submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3 }] },
|
|
5595
|
+
blockers: [assetId, stageId],
|
|
5596
|
+
blocks: [offlineStageCompletion.offline_id]
|
|
5582
5597
|
});
|
|
5583
|
-
return [
|
|
5598
|
+
return [offlineStageCompletion, promise];
|
|
5584
5599
|
}
|
|
5585
5600
|
async refreshStore() {
|
|
5586
5601
|
const { store } = this.client;
|
|
5587
5602
|
const result = await this.enqueueRequest({
|
|
5588
|
-
description: "Get
|
|
5603
|
+
description: "Get stage completions",
|
|
5589
5604
|
method: HttpMethod.GET,
|
|
5590
|
-
url: `/projects/${store.getState().projectReducer.activeProjectId}/
|
|
5605
|
+
url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-stage-completions/`,
|
|
5591
5606
|
blockers: [],
|
|
5592
5607
|
blocks: []
|
|
5593
5608
|
});
|
|
5594
5609
|
store.dispatch(addStageCompletions(result));
|
|
5595
5610
|
}
|
|
5596
5611
|
/**
|
|
5597
|
-
* Creates a collection of
|
|
5598
|
-
*
|
|
5599
|
-
* @param
|
|
5600
|
-
* stages for one
|
|
5612
|
+
* Creates a collection of AssetStageCompletions, marking the referenced stages as completed for the referenced
|
|
5613
|
+
* assets. It's REQUIRED that all assets referenced all have the SAME asset type.
|
|
5614
|
+
* @param assetTypeId The ID of the asset type for which we are completing stages (we can only complete
|
|
5615
|
+
* stages for one asset type at a time)
|
|
5601
5616
|
* @param stageCompletions
|
|
5602
5617
|
*/
|
|
5603
|
-
async bulkAdd(
|
|
5604
|
-
const
|
|
5618
|
+
async bulkAdd(assetTypeId, stageCompletions) {
|
|
5619
|
+
const offlineStageCompletions = stageCompletions.map((completion) => {
|
|
5605
5620
|
return offline(completion);
|
|
5606
5621
|
});
|
|
5607
5622
|
const asMapping = {};
|
|
5608
5623
|
for (const completion of stageCompletions) {
|
|
5609
|
-
const stageToCompletionDateMapping = asMapping[completion.
|
|
5624
|
+
const stageToCompletionDateMapping = asMapping[completion.asset] || {};
|
|
5610
5625
|
stageToCompletionDateMapping[completion.stage] = (/* @__PURE__ */ new Date()).toISOString();
|
|
5611
|
-
asMapping[completion.
|
|
5626
|
+
asMapping[completion.asset] = stageToCompletionDateMapping;
|
|
5612
5627
|
}
|
|
5613
5628
|
this.client.store.dispatch(addStageCompletions(asMapping));
|
|
5614
5629
|
await this.enqueueRequest({
|
|
5615
|
-
description: "
|
|
5630
|
+
description: "Bulk complete stages",
|
|
5616
5631
|
method: HttpMethod.POST,
|
|
5617
|
-
url: `/
|
|
5632
|
+
url: `/assets/types/${assetTypeId}/complete-stages/`,
|
|
5618
5633
|
payload: {
|
|
5619
|
-
completions:
|
|
5634
|
+
completions: offlineStageCompletions
|
|
5620
5635
|
},
|
|
5621
|
-
blockers: [
|
|
5622
|
-
|
|
5623
|
-
...stageCompletions.map((c) => c.component),
|
|
5624
|
-
...stageCompletions.map((c) => c.stage)
|
|
5625
|
-
],
|
|
5626
|
-
blocks: offlineStagesCompletions.map((c) => c.offline_id)
|
|
5636
|
+
blockers: [assetTypeId, ...stageCompletions.map((c) => c.asset), ...stageCompletions.map((c) => c.stage)],
|
|
5637
|
+
blocks: offlineStageCompletions.map((c) => c.offline_id)
|
|
5627
5638
|
});
|
|
5628
5639
|
}
|
|
5629
|
-
bulkDelete(stageId,
|
|
5630
|
-
const
|
|
5640
|
+
bulkDelete(stageId, assetIds) {
|
|
5641
|
+
const stageCompletionsToRemove = assetIds.map((assetId) => {
|
|
5631
5642
|
return {
|
|
5632
|
-
|
|
5643
|
+
asset: assetId,
|
|
5633
5644
|
stage: stageId
|
|
5634
5645
|
};
|
|
5635
5646
|
});
|
|
5636
|
-
this.client.store.dispatch(removeStageCompletions(
|
|
5647
|
+
this.client.store.dispatch(removeStageCompletions(stageCompletionsToRemove));
|
|
5637
5648
|
return this.enqueueRequest({
|
|
5638
|
-
description: `Undo stage for ${
|
|
5649
|
+
description: `Undo stage for ${assetIds.length} assets(s)`,
|
|
5639
5650
|
// TODO: Rename to setCompletedStages
|
|
5640
5651
|
method: HttpMethod.DELETE,
|
|
5641
|
-
url: `/
|
|
5652
|
+
url: `/assets/stages/${stageId}/undo-stages/`,
|
|
5642
5653
|
payload: {
|
|
5643
|
-
|
|
5654
|
+
assets: assetIds
|
|
5644
5655
|
},
|
|
5645
|
-
blockers: [stageId, ...
|
|
5656
|
+
blockers: [stageId, ...assetIds],
|
|
5646
5657
|
blocks: []
|
|
5647
5658
|
});
|
|
5648
5659
|
}
|
|
5649
5660
|
}
|
|
5650
|
-
class
|
|
5651
|
-
async bulkCreateStages(stagesToSubmit,
|
|
5661
|
+
class AssetStageService extends BaseApiService {
|
|
5662
|
+
async bulkCreateStages(stagesToSubmit, assetTypeId, workspaceId) {
|
|
5652
5663
|
const payload = stagesToSubmit.map((stage) => {
|
|
5653
5664
|
return offline(stage);
|
|
5654
5665
|
});
|
|
5655
5666
|
const fullStages = payload.map((stage) => {
|
|
5656
|
-
return { ...stage,
|
|
5667
|
+
return { ...stage, asset_type: assetTypeId };
|
|
5657
5668
|
});
|
|
5658
5669
|
this.client.store.dispatch(addStages(fullStages));
|
|
5659
5670
|
return this.enqueueRequest({
|
|
5660
|
-
description: "Add
|
|
5671
|
+
description: "Add asset stages",
|
|
5661
5672
|
method: HttpMethod.POST,
|
|
5662
|
-
url: `/
|
|
5673
|
+
url: `/assets/types/${assetTypeId}/add-stages/`,
|
|
5663
5674
|
payload: {
|
|
5664
5675
|
stages: payload
|
|
5665
5676
|
},
|
|
5666
5677
|
queryParams: {
|
|
5667
5678
|
workspace_id: workspaceId.toString()
|
|
5668
5679
|
},
|
|
5669
|
-
blockers: [
|
|
5680
|
+
blockers: [assetTypeId, workspaceId],
|
|
5670
5681
|
blocks: payload.map(({ offline_id }) => offline_id)
|
|
5671
5682
|
});
|
|
5672
5683
|
}
|
|
5673
|
-
async bulkUpdateStages(stagesToUpdate,
|
|
5684
|
+
async bulkUpdateStages(stagesToUpdate, assetTypeId) {
|
|
5674
5685
|
const store = this.client.store;
|
|
5675
5686
|
const state = store.getState();
|
|
5676
5687
|
const prevStages = selectStagesFromStageIds(
|
|
@@ -5681,13 +5692,13 @@ class ComponentStageService extends BaseApiService {
|
|
|
5681
5692
|
}
|
|
5682
5693
|
store.dispatch(updateStages(stagesToUpdate));
|
|
5683
5694
|
return this.enqueueRequest({
|
|
5684
|
-
description: "Edit
|
|
5695
|
+
description: "Edit asset stages",
|
|
5685
5696
|
method: HttpMethod.PATCH,
|
|
5686
|
-
url: `/
|
|
5697
|
+
url: `/assets/types/${assetTypeId}/bulk-update-stages/`,
|
|
5687
5698
|
payload: {
|
|
5688
5699
|
stages: stagesToUpdate
|
|
5689
5700
|
},
|
|
5690
|
-
blockers: [
|
|
5701
|
+
blockers: [assetTypeId],
|
|
5691
5702
|
blocks: stagesToUpdate.map(({ offline_id }) => offline_id)
|
|
5692
5703
|
}).catch((e) => {
|
|
5693
5704
|
store.dispatch(updateStages(prevStages));
|
|
@@ -5697,9 +5708,9 @@ class ComponentStageService extends BaseApiService {
|
|
|
5697
5708
|
async bulkDelete(idsToDelete) {
|
|
5698
5709
|
this.client.store.dispatch(removeStages(idsToDelete));
|
|
5699
5710
|
return this.enqueueRequest({
|
|
5700
|
-
description: "Delete
|
|
5711
|
+
description: "Delete asset stages",
|
|
5701
5712
|
method: HttpMethod.DELETE,
|
|
5702
|
-
url: "/
|
|
5713
|
+
url: "/assets/stages/bulk-delete/",
|
|
5703
5714
|
payload: {
|
|
5704
5715
|
stage_ids: idsToDelete
|
|
5705
5716
|
},
|
|
@@ -5707,15 +5718,15 @@ class ComponentStageService extends BaseApiService {
|
|
|
5707
5718
|
blocks: []
|
|
5708
5719
|
});
|
|
5709
5720
|
}
|
|
5710
|
-
async update(
|
|
5711
|
-
this.client.store.dispatch(addStages([
|
|
5721
|
+
async update(assetStage) {
|
|
5722
|
+
this.client.store.dispatch(addStages([assetStage]));
|
|
5712
5723
|
return this.enqueueRequest({
|
|
5713
|
-
description: "Update
|
|
5724
|
+
description: "Update asset stage",
|
|
5714
5725
|
method: HttpMethod.PATCH,
|
|
5715
|
-
url: `/
|
|
5716
|
-
payload:
|
|
5717
|
-
blockers: [
|
|
5718
|
-
blocks: [
|
|
5726
|
+
url: `/assets/stages/${assetStage.offline_id}/`,
|
|
5727
|
+
payload: assetStage,
|
|
5728
|
+
blockers: [assetStage.offline_id],
|
|
5729
|
+
blocks: [assetStage.offline_id]
|
|
5719
5730
|
});
|
|
5720
5731
|
}
|
|
5721
5732
|
async linkForm(stageId, formId2) {
|
|
@@ -5723,9 +5734,9 @@ class ComponentStageService extends BaseApiService {
|
|
|
5723
5734
|
store.dispatch(linkStageToForm({ stageId, formId: formId2 }));
|
|
5724
5735
|
try {
|
|
5725
5736
|
await this.enqueueRequest({
|
|
5726
|
-
description: "Link
|
|
5737
|
+
description: "Link asset stage to form",
|
|
5727
5738
|
method: HttpMethod.POST,
|
|
5728
|
-
url: `/
|
|
5739
|
+
url: `/assets/stages/${stageId}/associate-with-form/`,
|
|
5729
5740
|
payload: { user_form: formId2 },
|
|
5730
5741
|
blockers: [stageId, formId2],
|
|
5731
5742
|
blocks: [stageId]
|
|
@@ -5740,9 +5751,9 @@ class ComponentStageService extends BaseApiService {
|
|
|
5740
5751
|
store.dispatch(unlinkStageToForm({ stageId }));
|
|
5741
5752
|
try {
|
|
5742
5753
|
await this.enqueueRequest({
|
|
5743
|
-
description: "Unlink
|
|
5754
|
+
description: "Unlink asset stage from form",
|
|
5744
5755
|
method: HttpMethod.DELETE,
|
|
5745
|
-
url: `/
|
|
5756
|
+
url: `/assets/stages/${stageId}/associate-with-form/`,
|
|
5746
5757
|
blockers: [stageId, formId2],
|
|
5747
5758
|
blocks: [stageId]
|
|
5748
5759
|
});
|
|
@@ -5754,9 +5765,9 @@ class ComponentStageService extends BaseApiService {
|
|
|
5754
5765
|
async refreshStore() {
|
|
5755
5766
|
const { store } = this.client;
|
|
5756
5767
|
const result = await this.enqueueRequest({
|
|
5757
|
-
description: "Get
|
|
5768
|
+
description: "Get asset stages",
|
|
5758
5769
|
method: HttpMethod.GET,
|
|
5759
|
-
url: `/projects/${store.getState().projectReducer.activeProjectId}/
|
|
5770
|
+
url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-stages/`,
|
|
5760
5771
|
blockers: [],
|
|
5761
5772
|
blocks: []
|
|
5762
5773
|
});
|
|
@@ -5770,20 +5781,20 @@ const AttachmentModelMeta = {
|
|
|
5770
5781
|
deleteUrlPrefix: "/issues",
|
|
5771
5782
|
fetchUrlPostfix: "/issue-attachments"
|
|
5772
5783
|
},
|
|
5773
|
-
[AttachmentModel.
|
|
5774
|
-
name: "
|
|
5775
|
-
attachUrlPrefix: "/
|
|
5776
|
-
deleteUrlPrefix: "/
|
|
5777
|
-
fetchUrlPostfix: "/
|
|
5784
|
+
[AttachmentModel.Asset]: {
|
|
5785
|
+
name: "asset",
|
|
5786
|
+
attachUrlPrefix: "/assets",
|
|
5787
|
+
deleteUrlPrefix: "/assets",
|
|
5788
|
+
fetchUrlPostfix: "/asset-attachments"
|
|
5778
5789
|
},
|
|
5779
|
-
[AttachmentModel.
|
|
5780
|
-
name: "
|
|
5781
|
-
attachUrlPrefix: "/
|
|
5782
|
-
deleteUrlPrefix: "/
|
|
5783
|
-
fetchUrlPostfix: "/
|
|
5790
|
+
[AttachmentModel.AssetType]: {
|
|
5791
|
+
name: "asset type",
|
|
5792
|
+
attachUrlPrefix: "/assets/types",
|
|
5793
|
+
deleteUrlPrefix: "/assets/types",
|
|
5794
|
+
fetchUrlPostfix: "/asset-type-attachments"
|
|
5784
5795
|
},
|
|
5785
5796
|
[AttachmentModel.Project]: {
|
|
5786
|
-
name: "
|
|
5797
|
+
name: "project",
|
|
5787
5798
|
attachUrlPrefix: "/projects",
|
|
5788
5799
|
deleteUrlPrefix: "/projects",
|
|
5789
5800
|
fetchUrlPostfix: "/attachments"
|
|
@@ -5799,8 +5810,8 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5799
5810
|
getNumberOfAttachmentsWithSha1(sha1) {
|
|
5800
5811
|
const {
|
|
5801
5812
|
issueReducer: issueReducer2,
|
|
5802
|
-
|
|
5803
|
-
|
|
5813
|
+
assetReducer: assetReducer2,
|
|
5814
|
+
assetTypeReducer: assetTypeReducer2,
|
|
5804
5815
|
documentsReducer: documentsReducer2,
|
|
5805
5816
|
projectReducer: projectReducer2,
|
|
5806
5817
|
formSubmissionReducer: formSubmissionReducer2,
|
|
@@ -5808,8 +5819,8 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5808
5819
|
} = this.client.store.getState();
|
|
5809
5820
|
const objectsWithSha1 = [].concat(
|
|
5810
5821
|
Object.values(issueReducer2.attachments),
|
|
5811
|
-
Object.values(
|
|
5812
|
-
Object.values(
|
|
5822
|
+
Object.values(assetReducer2.attachments),
|
|
5823
|
+
Object.values(assetTypeReducer2.attachments),
|
|
5813
5824
|
Object.values(documentsReducer2.attachments),
|
|
5814
5825
|
Object.values(projectReducer2.attachments),
|
|
5815
5826
|
Object.values(formRevisionReducer2.attachments),
|
|
@@ -5931,10 +5942,10 @@ class BaseAttachmentService extends BaseApiService {
|
|
|
5931
5942
|
return promise;
|
|
5932
5943
|
}
|
|
5933
5944
|
}
|
|
5934
|
-
class
|
|
5945
|
+
class AssetAttachmentService extends BaseAttachmentService {
|
|
5935
5946
|
constructor() {
|
|
5936
5947
|
super(...arguments);
|
|
5937
|
-
__publicField(this, "attachmentModel", AttachmentModel.
|
|
5948
|
+
__publicField(this, "attachmentModel", AttachmentModel.Asset);
|
|
5938
5949
|
}
|
|
5939
5950
|
buildOfflineAttachment(data) {
|
|
5940
5951
|
return offline({
|
|
@@ -5945,115 +5956,108 @@ class ComponentAttachmentService extends BaseAttachmentService {
|
|
|
5945
5956
|
file_type: data.file.type,
|
|
5946
5957
|
submitted_at: data.submittedAt,
|
|
5947
5958
|
description: data.description,
|
|
5948
|
-
|
|
5959
|
+
asset: data.modelId
|
|
5949
5960
|
});
|
|
5950
5961
|
}
|
|
5951
|
-
async
|
|
5952
|
-
return this.attachFiles(
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
addAttachments: addComponentAttachments,
|
|
5958
|
-
updateAttachments: updateComponentAttachments,
|
|
5959
|
-
removeAttachments: removeComponentAttachments
|
|
5960
|
-
}
|
|
5961
|
-
);
|
|
5962
|
+
async attachFilesToAsset(files, assetId) {
|
|
5963
|
+
return this.attachFiles(files, assetId, this.buildOfflineAttachment.bind(this), {
|
|
5964
|
+
addAttachments: addAssetAttachments,
|
|
5965
|
+
updateAttachments: updateAssetAttachments,
|
|
5966
|
+
removeAttachments: removeAssetAttachments
|
|
5967
|
+
});
|
|
5962
5968
|
}
|
|
5963
|
-
|
|
5969
|
+
deleteAssetAttachment(attachmentId) {
|
|
5964
5970
|
return this.deleteAttachment(
|
|
5965
5971
|
attachmentId,
|
|
5966
5972
|
{
|
|
5967
|
-
setAttachment:
|
|
5968
|
-
removeAttachment:
|
|
5973
|
+
setAttachment: setAssetAttachment,
|
|
5974
|
+
removeAttachment: removeAssetAttachment
|
|
5969
5975
|
},
|
|
5970
5976
|
{
|
|
5971
|
-
selectAttachment:
|
|
5977
|
+
selectAttachment: selectAssetAttachment
|
|
5972
5978
|
}
|
|
5973
5979
|
);
|
|
5974
5980
|
}
|
|
5975
5981
|
async refreshStore() {
|
|
5976
5982
|
return this.getAttachments({
|
|
5977
|
-
setAttachments:
|
|
5983
|
+
setAttachments: setAssetAttachments
|
|
5978
5984
|
});
|
|
5979
5985
|
}
|
|
5980
5986
|
}
|
|
5981
|
-
class
|
|
5982
|
-
add(
|
|
5983
|
-
const
|
|
5987
|
+
class AssetTypeService extends BaseApiService {
|
|
5988
|
+
add(assetType) {
|
|
5989
|
+
const offlineAssetType = offline(assetType);
|
|
5984
5990
|
const { store } = this.client;
|
|
5985
5991
|
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
5986
|
-
store.dispatch(
|
|
5992
|
+
store.dispatch(addAssetType(offlineAssetType));
|
|
5987
5993
|
const promise = this.enqueueRequest({
|
|
5988
|
-
description: "Create
|
|
5994
|
+
description: "Create asset type",
|
|
5989
5995
|
method: HttpMethod.POST,
|
|
5990
|
-
url: `/projects/${activeProjectId}/
|
|
5991
|
-
payload: { ...
|
|
5996
|
+
url: `/projects/${activeProjectId}/asset-types/`,
|
|
5997
|
+
payload: { ...offlineAssetType },
|
|
5992
5998
|
blockers: [],
|
|
5993
|
-
blocks: [
|
|
5999
|
+
blocks: [offlineAssetType.offline_id]
|
|
5994
6000
|
});
|
|
5995
|
-
return [
|
|
6001
|
+
return [offlineAssetType, promise];
|
|
5996
6002
|
}
|
|
5997
|
-
update(
|
|
5998
|
-
this.client.store.dispatch(
|
|
6003
|
+
update(assetType) {
|
|
6004
|
+
this.client.store.dispatch(addAssetType(assetType));
|
|
5999
6005
|
return this.enqueueRequest({
|
|
6000
|
-
description: "Update
|
|
6006
|
+
description: "Update asset type",
|
|
6001
6007
|
method: HttpMethod.PATCH,
|
|
6002
|
-
url: `/
|
|
6003
|
-
payload:
|
|
6004
|
-
blockers: [
|
|
6005
|
-
blocks: [
|
|
6008
|
+
url: `/assets/types/${assetType.offline_id}/`,
|
|
6009
|
+
payload: assetType,
|
|
6010
|
+
blockers: [assetType.offline_id],
|
|
6011
|
+
blocks: [assetType.offline_id]
|
|
6006
6012
|
});
|
|
6007
6013
|
}
|
|
6008
|
-
async delete(
|
|
6014
|
+
async delete(assetTypeId) {
|
|
6009
6015
|
const { store } = this.client;
|
|
6010
6016
|
const state = store.getState();
|
|
6011
|
-
const
|
|
6012
|
-
if (!
|
|
6013
|
-
throw new Error(
|
|
6014
|
-
}
|
|
6015
|
-
const stagesOfComponentType = selectStagesFromComponentType(componentTypeId)(state) ?? [];
|
|
6016
|
-
const attachmentsOfComponentType = selectAttachmentsOfComponentType(componentTypeId)(state);
|
|
6017
|
-
store.dispatch(deleteComponentType(componentTypeId));
|
|
6018
|
-
if (stagesOfComponentType.length > 0) {
|
|
6019
|
-
const stagesOfComponentTypeIds = stagesOfComponentType.map(
|
|
6020
|
-
(componentTypeStage) => componentTypeStage.offline_id
|
|
6021
|
-
);
|
|
6022
|
-
store.dispatch(removeStages(stagesOfComponentTypeIds));
|
|
6017
|
+
const assetType = selectAssetType(assetTypeId)(state);
|
|
6018
|
+
if (!assetType) {
|
|
6019
|
+
throw new Error(`Expected asset type with offline_id ${assetTypeId} to exist`);
|
|
6023
6020
|
}
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6021
|
+
const stagesOfAssetType = selectStagesOfAssetType(assetTypeId)(state) ?? [];
|
|
6022
|
+
const attachmentsOfAssetType = selectAttachmentsOfAssetType(assetTypeId)(state);
|
|
6023
|
+
store.dispatch(deleteAssetType(assetTypeId));
|
|
6024
|
+
if (stagesOfAssetType.length > 0) {
|
|
6025
|
+
const stagesOfAssetTypeIds = stagesOfAssetType.map((assetStage) => assetStage.offline_id);
|
|
6026
|
+
store.dispatch(removeStages(stagesOfAssetTypeIds));
|
|
6027
|
+
}
|
|
6028
|
+
if (attachmentsOfAssetType.length > 0) {
|
|
6029
|
+
const attachmentsOfAssetTypeIds = attachmentsOfAssetType.map(({ offline_id }) => offline_id);
|
|
6030
|
+
store.dispatch(removeAssetTypeAttachments(attachmentsOfAssetTypeIds));
|
|
6027
6031
|
}
|
|
6028
6032
|
return this.enqueueRequest({
|
|
6029
|
-
description: "Delete
|
|
6033
|
+
description: "Delete asset type",
|
|
6030
6034
|
method: HttpMethod.DELETE,
|
|
6031
|
-
url: `/
|
|
6032
|
-
blockers: [
|
|
6035
|
+
url: `/assets/types/${assetTypeId}/`,
|
|
6036
|
+
blockers: [assetTypeId],
|
|
6033
6037
|
blocks: []
|
|
6034
6038
|
}).catch((e) => {
|
|
6035
|
-
store.dispatch(
|
|
6036
|
-
store.dispatch(addStages(
|
|
6037
|
-
store.dispatch(
|
|
6039
|
+
store.dispatch(addAssetType(assetType));
|
|
6040
|
+
store.dispatch(addStages(stagesOfAssetType));
|
|
6041
|
+
store.dispatch(addAssetTypeAttachments(attachmentsOfAssetType));
|
|
6038
6042
|
throw e;
|
|
6039
6043
|
});
|
|
6040
6044
|
}
|
|
6041
6045
|
async refreshStore() {
|
|
6042
6046
|
const { store } = this.client;
|
|
6043
6047
|
const result = await this.enqueueRequest({
|
|
6044
|
-
description: "Get
|
|
6048
|
+
description: "Get asset types",
|
|
6045
6049
|
method: HttpMethod.GET,
|
|
6046
|
-
url: `/projects/${store.getState().projectReducer.activeProjectId}/
|
|
6050
|
+
url: `/projects/${store.getState().projectReducer.activeProjectId}/asset-types/`,
|
|
6047
6051
|
blockers: [],
|
|
6048
6052
|
blocks: []
|
|
6049
6053
|
});
|
|
6050
|
-
store.dispatch(
|
|
6054
|
+
store.dispatch(setAssetTypes(result));
|
|
6051
6055
|
}
|
|
6052
6056
|
}
|
|
6053
|
-
class
|
|
6057
|
+
class AssetTypeAttachmentService extends BaseAttachmentService {
|
|
6054
6058
|
constructor() {
|
|
6055
6059
|
super(...arguments);
|
|
6056
|
-
__publicField(this, "attachmentModel", AttachmentModel.
|
|
6060
|
+
__publicField(this, "attachmentModel", AttachmentModel.AssetType);
|
|
6057
6061
|
}
|
|
6058
6062
|
buildOfflineAttachment(data) {
|
|
6059
6063
|
return offline({
|
|
@@ -6064,36 +6068,36 @@ class ComponentTypeAttachmentService extends BaseAttachmentService {
|
|
|
6064
6068
|
file_type: data.file.type,
|
|
6065
6069
|
submitted_at: data.submittedAt,
|
|
6066
6070
|
description: data.description,
|
|
6067
|
-
|
|
6071
|
+
asset_type: data.modelId
|
|
6068
6072
|
});
|
|
6069
6073
|
}
|
|
6070
|
-
async
|
|
6074
|
+
async attachFilesToAssetType(files, assetTypeId) {
|
|
6071
6075
|
return this.attachFiles(
|
|
6072
6076
|
files,
|
|
6073
|
-
|
|
6077
|
+
assetTypeId,
|
|
6074
6078
|
this.buildOfflineAttachment.bind(this),
|
|
6075
6079
|
{
|
|
6076
|
-
addAttachments:
|
|
6077
|
-
updateAttachments:
|
|
6078
|
-
removeAttachments:
|
|
6080
|
+
addAttachments: addAssetTypeAttachments,
|
|
6081
|
+
updateAttachments: updateAssetTypeAttachments,
|
|
6082
|
+
removeAttachments: removeAssetTypeAttachments
|
|
6079
6083
|
}
|
|
6080
6084
|
);
|
|
6081
6085
|
}
|
|
6082
|
-
|
|
6086
|
+
deleteAssetTypeAttachment(attachmentId) {
|
|
6083
6087
|
return this.deleteAttachment(
|
|
6084
6088
|
attachmentId,
|
|
6085
6089
|
{
|
|
6086
|
-
setAttachment:
|
|
6087
|
-
removeAttachment:
|
|
6090
|
+
setAttachment: setAssetTypeAttachment,
|
|
6091
|
+
removeAttachment: removeAssetTypeAttachment
|
|
6088
6092
|
},
|
|
6089
6093
|
{
|
|
6090
|
-
selectAttachment:
|
|
6094
|
+
selectAttachment: selectAssetTypeAttachment
|
|
6091
6095
|
}
|
|
6092
6096
|
);
|
|
6093
6097
|
}
|
|
6094
6098
|
async refreshStore() {
|
|
6095
6099
|
return this.getAttachments({
|
|
6096
|
-
setAttachments:
|
|
6100
|
+
setAttachments: setAssetTypeAttachments
|
|
6097
6101
|
});
|
|
6098
6102
|
}
|
|
6099
6103
|
}
|
|
@@ -6284,7 +6288,8 @@ class IssueService extends BaseApiService {
|
|
|
6284
6288
|
if (error2 instanceof APIError) {
|
|
6285
6289
|
(_a2 = unsafeShowToast) == null ? void 0 : _a2({
|
|
6286
6290
|
title: "Could not create issue",
|
|
6287
|
-
description:
|
|
6291
|
+
description: error2.message,
|
|
6292
|
+
severity: "danger"
|
|
6288
6293
|
});
|
|
6289
6294
|
}
|
|
6290
6295
|
store.dispatch(removeIssue(issuePayload.offline_id));
|
|
@@ -6555,7 +6560,7 @@ class MainService extends BaseApiService {
|
|
|
6555
6560
|
if (replaceExisting) {
|
|
6556
6561
|
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
6557
6562
|
}
|
|
6558
|
-
|
|
6563
|
+
const result = await this.enqueueRequest({
|
|
6559
6564
|
uuid,
|
|
6560
6565
|
description: "Get initial data",
|
|
6561
6566
|
method: HttpMethod.GET,
|
|
@@ -6564,18 +6569,20 @@ class MainService extends BaseApiService {
|
|
|
6564
6569
|
isAuthNeeded: true,
|
|
6565
6570
|
blockers: [],
|
|
6566
6571
|
blocks: []
|
|
6567
|
-
}).then((result) => {
|
|
6568
|
-
void this._processInitialData(result, replaceExisting);
|
|
6569
|
-
return result;
|
|
6570
6572
|
});
|
|
6573
|
+
void this._processInitialData(result, replaceExisting);
|
|
6571
6574
|
}
|
|
6572
|
-
async fetchProjectUsers(
|
|
6575
|
+
async fetchProjectUsers() {
|
|
6576
|
+
const projectId = this.client.store.getState().projectReducer.activeProjectId;
|
|
6573
6577
|
return this.enqueueRequest({
|
|
6574
6578
|
description: "Fetch users",
|
|
6575
6579
|
method: HttpMethod.GET,
|
|
6576
6580
|
url: `/projects/${projectId}/users/`,
|
|
6577
6581
|
blockers: [],
|
|
6578
6582
|
blocks: []
|
|
6583
|
+
}).then((users) => {
|
|
6584
|
+
this.client.store.dispatch(addUsers(users));
|
|
6585
|
+
return users;
|
|
6579
6586
|
});
|
|
6580
6587
|
}
|
|
6581
6588
|
async fetchOrganizationUsers(orgId) {
|
|
@@ -6588,13 +6595,14 @@ class MainService extends BaseApiService {
|
|
|
6588
6595
|
});
|
|
6589
6596
|
}
|
|
6590
6597
|
// TODO:
|
|
6591
|
-
// Don't accept updateStore in
|
|
6592
|
-
// overwrite, use
|
|
6598
|
+
// Don't accept updateStore in AssetService.list. Just return the offline objects and promise. Here, if
|
|
6599
|
+
// overwrite, use setAssets. Otherwise, use bulkAddAssets.
|
|
6600
|
+
// TODO: This needs major cleanup. Send less in the initial data: Only the basic project info and anything needed
|
|
6601
|
+
// literally immediately.
|
|
6593
6602
|
async _processInitialData(data, overwrite) {
|
|
6594
6603
|
var _a2, _b, _c;
|
|
6595
6604
|
const workspaces = {};
|
|
6596
6605
|
const projects = [];
|
|
6597
|
-
const categories = [];
|
|
6598
6606
|
const projectsData = data.projects;
|
|
6599
6607
|
const { store } = this.client;
|
|
6600
6608
|
const oldProjectId = (_a2 = projectsData.find(
|
|
@@ -6618,18 +6626,11 @@ class MainService extends BaseApiService {
|
|
|
6618
6626
|
isProjectIdValid = true;
|
|
6619
6627
|
for (const workspaceData of projectData.workspaces) {
|
|
6620
6628
|
const workspace = { ...workspaceData, project: projectData.id };
|
|
6621
|
-
if (workspace.categories) {
|
|
6622
|
-
for (const category of workspace.categories) {
|
|
6623
|
-
categories.push(category);
|
|
6624
|
-
}
|
|
6625
|
-
}
|
|
6626
|
-
delete workspace.categories;
|
|
6627
6629
|
workspaces[workspace.offline_id] = workspace;
|
|
6628
6630
|
}
|
|
6629
6631
|
}
|
|
6630
6632
|
}
|
|
6631
6633
|
store.dispatch(setCurrentUser(data.user));
|
|
6632
|
-
store.dispatch(addUsers(data.project_owners));
|
|
6633
6634
|
store.dispatch(setLicenses(data.licenses));
|
|
6634
6635
|
const organizationsData = data.organizations;
|
|
6635
6636
|
store.dispatch(setOrganizations(organizationsData));
|
|
@@ -6650,8 +6651,11 @@ class MainService extends BaseApiService {
|
|
|
6650
6651
|
currentOrgId = firstOrg.id;
|
|
6651
6652
|
}
|
|
6652
6653
|
if (currentOrgId) {
|
|
6653
|
-
await this.client.organizations.fetchInitialOrganizationData(currentOrgId, false);
|
|
6654
|
-
|
|
6654
|
+
const initialOrgData = await this.client.organizations.fetchInitialOrganizationData(currentOrgId, false);
|
|
6655
|
+
currentOrgId = initialOrgData.organization.id;
|
|
6656
|
+
}
|
|
6657
|
+
if (!currentOrgId) {
|
|
6658
|
+
throw new Error("No organization found");
|
|
6655
6659
|
}
|
|
6656
6660
|
if (!isProjectIdValid) {
|
|
6657
6661
|
if (validProjects.length !== 0) {
|
|
@@ -6661,12 +6665,6 @@ class MainService extends BaseApiService {
|
|
|
6661
6665
|
if (projectData) {
|
|
6662
6666
|
for (const workspaceData of projectData.workspaces) {
|
|
6663
6667
|
const workspace = { ...workspaceData, project: projectData.id };
|
|
6664
|
-
if (workspace.categories) {
|
|
6665
|
-
for (const category of workspace.categories) {
|
|
6666
|
-
categories.push(category);
|
|
6667
|
-
}
|
|
6668
|
-
}
|
|
6669
|
-
delete workspace.categories;
|
|
6670
6668
|
workspaces[workspace.offline_id] = workspace;
|
|
6671
6669
|
}
|
|
6672
6670
|
}
|
|
@@ -6675,14 +6673,6 @@ class MainService extends BaseApiService {
|
|
|
6675
6673
|
store.dispatch(setActiveProjectId(currentProjectId));
|
|
6676
6674
|
}
|
|
6677
6675
|
}
|
|
6678
|
-
if (currentProjectId) {
|
|
6679
|
-
const usersResultPromise = this.fetchProjectUsers(currentProjectId);
|
|
6680
|
-
const projectAccessRefreshPromise = this.client.projectAccesses.refreshStore();
|
|
6681
|
-
const usersResult = await usersResultPromise;
|
|
6682
|
-
await projectAccessRefreshPromise;
|
|
6683
|
-
store.dispatch(addUsers(usersResult));
|
|
6684
|
-
void this.client.projectAttachments.refreshStore();
|
|
6685
|
-
}
|
|
6686
6676
|
let currentWorkspaceId;
|
|
6687
6677
|
const oldWorkspaceId = this.client.store.getState().workspaceReducer.activeWorkspaceId;
|
|
6688
6678
|
if (overwrite || !oldWorkspaceId) {
|
|
@@ -6690,51 +6680,49 @@ class MainService extends BaseApiService {
|
|
|
6690
6680
|
} else {
|
|
6691
6681
|
currentWorkspaceId = oldWorkspaceId;
|
|
6692
6682
|
}
|
|
6693
|
-
if (currentWorkspaceId
|
|
6683
|
+
if (currentWorkspaceId) {
|
|
6694
6684
|
store.dispatch(setActiveWorkspaceId(currentWorkspaceId));
|
|
6695
|
-
void this.client.categories.refreshStore().then(() => {
|
|
6696
|
-
void this.client.issues.refreshStore().then(() => {
|
|
6697
|
-
void this.client.issueAttachments.refreshStore().then();
|
|
6698
|
-
void this.client.issueComments.refreshStore().then();
|
|
6699
|
-
void this.client.issueUpdates.refreshStore().then();
|
|
6700
|
-
});
|
|
6701
|
-
});
|
|
6702
|
-
void this.client.projectFiles.refreshStore().then();
|
|
6703
|
-
void this.client.componentTypes.refreshStore().then(() => {
|
|
6704
|
-
void this.client.componentTypeAttachments.refreshStore().then(() => {
|
|
6705
|
-
void this.client.componentStages.refreshStore().then(() => {
|
|
6706
|
-
void this.client.components.refreshStore(overwrite).then(() => {
|
|
6707
|
-
void this.client.componentAttachments.refreshStore().then();
|
|
6708
|
-
});
|
|
6709
|
-
});
|
|
6710
|
-
void this.client.componentStageCompletions.refreshStore().then();
|
|
6711
|
-
});
|
|
6712
|
-
});
|
|
6713
|
-
void this.client.userForms.refreshStore().then(() => {
|
|
6714
|
-
void this.client.userFormSubmissions.refreshStore().then();
|
|
6715
|
-
});
|
|
6716
|
-
}
|
|
6717
|
-
if (currentProjectId) {
|
|
6718
|
-
void this.client.documents.refreshStore().then(() => {
|
|
6719
|
-
void this.client.documentAttachments.refreshStore().then();
|
|
6720
|
-
});
|
|
6721
|
-
void this.client.documents.refreshStore();
|
|
6722
|
-
void this.client.issueUpdates.refreshStore();
|
|
6723
|
-
void this.client.issueTypes.refreshStore();
|
|
6724
6685
|
}
|
|
6725
|
-
store.dispatch(setIsFetchingInitialData(false));
|
|
6726
6686
|
if (overwrite) {
|
|
6727
6687
|
console.log("Overwriting data");
|
|
6728
6688
|
store.dispatch(setProjects(projects));
|
|
6729
6689
|
store.dispatch(setWorkspaces(workspaces));
|
|
6730
|
-
store.dispatch(setCategories(categories));
|
|
6731
6690
|
store.dispatch(resetRecentIssues());
|
|
6732
6691
|
} else {
|
|
6733
6692
|
console.log("Updating data (collisions will be replaced)");
|
|
6734
6693
|
store.dispatch(addOrReplaceProjects(projects));
|
|
6735
6694
|
store.dispatch(addOrReplaceWorkspaces(workspaces));
|
|
6736
|
-
store.dispatch(addOrReplaceCategories(categories));
|
|
6737
6695
|
}
|
|
6696
|
+
if (!currentProjectId) {
|
|
6697
|
+
store.dispatch(setIsFetchingInitialData(false));
|
|
6698
|
+
} else {
|
|
6699
|
+
try {
|
|
6700
|
+
await this.client.projectFiles.refreshStore();
|
|
6701
|
+
} finally {
|
|
6702
|
+
store.dispatch(setIsFetchingInitialData(false));
|
|
6703
|
+
}
|
|
6704
|
+
void this.client.assetTypes.refreshStore();
|
|
6705
|
+
void this.client.assetStages.refreshStore();
|
|
6706
|
+
void this.client.assets.refreshStore();
|
|
6707
|
+
void this.client.assetStageCompletions.refreshStore();
|
|
6708
|
+
void this.client.categories.refreshStore();
|
|
6709
|
+
void this.client.issueTypes.refreshStore();
|
|
6710
|
+
void this.client.issues.refreshStore();
|
|
6711
|
+
void this.fetchProjectUsers();
|
|
6712
|
+
void this.client.documents.refreshStore();
|
|
6713
|
+
void this.client.userForms.refreshStore();
|
|
6714
|
+
void this.client.documentAttachments.refreshStore();
|
|
6715
|
+
void this.client.userFormSubmissions.refreshStore();
|
|
6716
|
+
void this.client.agent.refreshStore();
|
|
6717
|
+
void this.client.issueAttachments.refreshStore();
|
|
6718
|
+
void this.client.issueComments.refreshStore();
|
|
6719
|
+
void this.client.issueUpdates.refreshStore();
|
|
6720
|
+
void this.client.projectAccesses.refreshStore();
|
|
6721
|
+
void this.client.projectAttachments.refreshStore();
|
|
6722
|
+
void this.client.assetTypeAttachments.refreshStore();
|
|
6723
|
+
void this.client.assetAttachments.refreshStore();
|
|
6724
|
+
}
|
|
6725
|
+
void this.client.teams.refreshStore();
|
|
6738
6726
|
}
|
|
6739
6727
|
}
|
|
6740
6728
|
class ProjectAccessService extends BaseApiService {
|
|
@@ -6774,16 +6762,11 @@ class ProjectAccessService extends BaseApiService {
|
|
|
6774
6762
|
const { store } = this.client;
|
|
6775
6763
|
const state = store.getState();
|
|
6776
6764
|
const projectId = state.projectReducer.activeProjectId;
|
|
6777
|
-
const currentUser = state.userReducer.currentUser;
|
|
6778
6765
|
if (!projectId) {
|
|
6779
6766
|
throw new Error("No active project");
|
|
6780
6767
|
}
|
|
6781
6768
|
const promise = this.fetchAll(projectId);
|
|
6782
6769
|
const result = await promise;
|
|
6783
|
-
const activeProjectAccess = result.find((projectAccess) => projectAccess.user === currentUser.id);
|
|
6784
|
-
if (!activeProjectAccess) {
|
|
6785
|
-
throw new Error("Current user does not have a project access instance");
|
|
6786
|
-
}
|
|
6787
6770
|
store.dispatch(setProjectAccesses(result));
|
|
6788
6771
|
}
|
|
6789
6772
|
}
|
|
@@ -7133,7 +7116,7 @@ class UserFormService extends BaseApiService {
|
|
|
7133
7116
|
});
|
|
7134
7117
|
});
|
|
7135
7118
|
}
|
|
7136
|
-
async add(state, initialRevision, url, ownerUser, ownerOrganization,
|
|
7119
|
+
async add(state, initialRevision, url, ownerUser, ownerOrganization, assetTypeId, issueTypeId) {
|
|
7137
7120
|
if (!!ownerUser === !!ownerOrganization) {
|
|
7138
7121
|
throw new Error("Exactly one of ownerUser and ownerOrganization must be defined.");
|
|
7139
7122
|
}
|
|
@@ -7152,7 +7135,7 @@ class UserFormService extends BaseApiService {
|
|
|
7152
7135
|
favorite: true,
|
|
7153
7136
|
submitted_at: submittedAt,
|
|
7154
7137
|
created_by: currentUser.id,
|
|
7155
|
-
...
|
|
7138
|
+
...assetTypeId && { asset_type: assetTypeId },
|
|
7156
7139
|
...issueTypeId && { issue_type: issueTypeId },
|
|
7157
7140
|
...ownerAttrs
|
|
7158
7141
|
};
|
|
@@ -7176,11 +7159,11 @@ class UserFormService extends BaseApiService {
|
|
|
7176
7159
|
} : void 0,
|
|
7177
7160
|
payload: {
|
|
7178
7161
|
...offlineFormPayload,
|
|
7179
|
-
...
|
|
7162
|
+
...assetTypeId && { asset_type: assetTypeId },
|
|
7180
7163
|
...issueTypeId && { issue_type: issueTypeId },
|
|
7181
7164
|
initial_revision: payloadWithoutImage
|
|
7182
7165
|
},
|
|
7183
|
-
blockers:
|
|
7166
|
+
blockers: assetTypeId ? [assetTypeId] : issueTypeId ? [issueTypeId] : [],
|
|
7184
7167
|
blocks: [offlineFormPayload.offline_id, payloadWithoutImage.offline_id]
|
|
7185
7168
|
});
|
|
7186
7169
|
const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
|
|
@@ -7204,7 +7187,7 @@ class UserFormService extends BaseApiService {
|
|
|
7204
7187
|
`/forms/in-organization/${activeOrganizationId}/`,
|
|
7205
7188
|
void 0,
|
|
7206
7189
|
activeOrganizationId,
|
|
7207
|
-
attachedTo && "
|
|
7190
|
+
attachedTo && "assetTypeId" in attachedTo ? attachedTo.assetTypeId : void 0,
|
|
7208
7191
|
attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
|
|
7209
7192
|
);
|
|
7210
7193
|
}
|
|
@@ -7217,7 +7200,7 @@ class UserFormService extends BaseApiService {
|
|
|
7217
7200
|
"/forms/my-forms/",
|
|
7218
7201
|
currentUser.id,
|
|
7219
7202
|
void 0,
|
|
7220
|
-
attachedTo && "
|
|
7203
|
+
attachedTo && "assetTypeId" in attachedTo ? attachedTo.assetTypeId : void 0,
|
|
7221
7204
|
attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
|
|
7222
7205
|
);
|
|
7223
7206
|
}
|
|
@@ -7385,8 +7368,8 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7385
7368
|
url: `/forms/submission/${submission.offline_id}/attachments/`,
|
|
7386
7369
|
payload: submissionAttachmentPayload,
|
|
7387
7370
|
blockers: [
|
|
7388
|
-
submission.
|
|
7389
|
-
submission.
|
|
7371
|
+
submission.asset,
|
|
7372
|
+
submission.asset_stage,
|
|
7390
7373
|
submission.issue,
|
|
7391
7374
|
submission.form_revision
|
|
7392
7375
|
].filter((x) => x !== void 0),
|
|
@@ -7422,7 +7405,7 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7422
7405
|
method: HttpMethod.POST,
|
|
7423
7406
|
url: `/forms/revisions/${payload.form_revision}/respond/`,
|
|
7424
7407
|
payload: { ...offlineSubmission, project: activeProjectId },
|
|
7425
|
-
blockers: [payload.issue, payload.
|
|
7408
|
+
blockers: [payload.issue, payload.asset, payload.asset_stage, "add-form-entry"].filter(
|
|
7426
7409
|
(x) => x !== void 0
|
|
7427
7410
|
),
|
|
7428
7411
|
blocks: [payload.offline_id]
|
|
@@ -7440,10 +7423,10 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7440
7423
|
const settledPromise = Promise.all([promise, ...attachFilesPromises]).then(() => promise);
|
|
7441
7424
|
return [offlineSubmission, settledPromise];
|
|
7442
7425
|
}
|
|
7443
|
-
// Note currently the bulkAdd method is specific to form submissions for
|
|
7426
|
+
// Note currently the bulkAdd method is specific to form submissions for assets
|
|
7444
7427
|
// TODO: adapt the support bulk adding to any model type
|
|
7445
7428
|
async bulkAdd(args) {
|
|
7446
|
-
const { formRevision, values: argsValues,
|
|
7429
|
+
const { formRevision, values: argsValues, assetOfflineIds } = args;
|
|
7447
7430
|
const { store } = this.client;
|
|
7448
7431
|
const offlineSubmissions = [];
|
|
7449
7432
|
const offlineAttachments = [];
|
|
@@ -7453,16 +7436,16 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7453
7436
|
const { values, files } = separateFilesFromValues(argsValues);
|
|
7454
7437
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7455
7438
|
const createdBy = store.getState().userReducer.currentUser.id;
|
|
7456
|
-
for (const
|
|
7439
|
+
for (const assetId of assetOfflineIds) {
|
|
7457
7440
|
const submission = offline({
|
|
7458
7441
|
form_revision: formRevision,
|
|
7459
7442
|
values,
|
|
7460
7443
|
created_by: createdBy,
|
|
7461
7444
|
submitted_at: submittedAt,
|
|
7462
|
-
|
|
7445
|
+
asset: assetId
|
|
7463
7446
|
});
|
|
7464
7447
|
submissionOfflineIds.push(submission.offline_id);
|
|
7465
|
-
submissionsPayload.push({ offline_id: submission.offline_id,
|
|
7448
|
+
submissionsPayload.push({ offline_id: submission.offline_id, asset_id: assetId });
|
|
7466
7449
|
offlineSubmissions.push(submission);
|
|
7467
7450
|
for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
|
|
7468
7451
|
for (const file of fileArray) {
|
|
@@ -7509,7 +7492,7 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7509
7492
|
attachments: attachmentsPayload,
|
|
7510
7493
|
files: Object.values(filesRecord)
|
|
7511
7494
|
},
|
|
7512
|
-
blockers:
|
|
7495
|
+
blockers: assetOfflineIds,
|
|
7513
7496
|
blocks: submissionOfflineIds
|
|
7514
7497
|
});
|
|
7515
7498
|
promise.then(({ submissions, attachments, presigned_urls }) => {
|
|
@@ -7552,7 +7535,7 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7552
7535
|
method: HttpMethod.PATCH,
|
|
7553
7536
|
url: `/forms/submissions/${submission.offline_id}/`,
|
|
7554
7537
|
payload: offlineSubmission,
|
|
7555
|
-
blockers: [offlineSubmission.issue, offlineSubmission.
|
|
7538
|
+
blockers: [offlineSubmission.issue, offlineSubmission.asset, offlineSubmission.asset_stage].filter(
|
|
7556
7539
|
(x) => x !== void 0
|
|
7557
7540
|
),
|
|
7558
7541
|
blocks: [offlineSubmission.offline_id]
|
|
@@ -8361,24 +8344,70 @@ class DocumentAttachmentService extends BaseAttachmentService {
|
|
|
8361
8344
|
}
|
|
8362
8345
|
}
|
|
8363
8346
|
class AgentService extends BaseApiService {
|
|
8347
|
+
async startConversation(prompt) {
|
|
8348
|
+
const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
|
|
8349
|
+
return this.enqueueRequest({
|
|
8350
|
+
description: "Start agent conversation",
|
|
8351
|
+
method: HttpMethod.POST,
|
|
8352
|
+
url: "/agents/prompt/",
|
|
8353
|
+
payload: {
|
|
8354
|
+
prompt,
|
|
8355
|
+
active_project: activeProjectId
|
|
8356
|
+
},
|
|
8357
|
+
blockers: ["prompt"],
|
|
8358
|
+
blocks: ["prompt"]
|
|
8359
|
+
}).then((response) => {
|
|
8360
|
+
if (response.conversation) {
|
|
8361
|
+
this.client.store.dispatch(addConversation(response.conversation));
|
|
8362
|
+
return response.conversation;
|
|
8363
|
+
}
|
|
8364
|
+
throw new Error("Unexpected response from agent");
|
|
8365
|
+
});
|
|
8366
|
+
}
|
|
8364
8367
|
/**
|
|
8365
8368
|
* Prompt the agent with a message.
|
|
8366
|
-
* @param
|
|
8369
|
+
* @param prompt The message to prompt the agent with.
|
|
8367
8370
|
* @param conversationId If continuing an existing message, the UUID of that conversation.
|
|
8368
8371
|
*/
|
|
8369
|
-
async prompt
|
|
8370
|
-
const
|
|
8372
|
+
async continueConversation(prompt, conversationId) {
|
|
8373
|
+
const { store } = this.client;
|
|
8374
|
+
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
8371
8375
|
return this.enqueueRequest({
|
|
8372
8376
|
description: "Prompt agent",
|
|
8373
8377
|
method: HttpMethod.POST,
|
|
8374
8378
|
url: "/agents/prompt/",
|
|
8375
8379
|
payload: {
|
|
8376
|
-
prompt
|
|
8380
|
+
prompt,
|
|
8377
8381
|
active_project: activeProjectId
|
|
8378
8382
|
},
|
|
8379
8383
|
blockers: ["prompt"],
|
|
8380
8384
|
blocks: ["prompt"],
|
|
8381
|
-
queryParams:
|
|
8385
|
+
queryParams: { conversation_id: conversationId }
|
|
8386
|
+
}).then((response) => {
|
|
8387
|
+
if (response.response) {
|
|
8388
|
+
const conversation = store.getState().agentsReducer.conversations[conversationId];
|
|
8389
|
+
if (!conversation) {
|
|
8390
|
+
throw new Error("Conversation not found");
|
|
8391
|
+
}
|
|
8392
|
+
store.dispatch(
|
|
8393
|
+
updateConversation({
|
|
8394
|
+
offline_id: conversationId,
|
|
8395
|
+
tiptap_content: [...conversation.tiptap_content || [], response.response]
|
|
8396
|
+
})
|
|
8397
|
+
);
|
|
8398
|
+
}
|
|
8399
|
+
throw new Error("Unexpected response from agent");
|
|
8400
|
+
});
|
|
8401
|
+
}
|
|
8402
|
+
async fetchDetails(conversationId) {
|
|
8403
|
+
return this.enqueueRequest({
|
|
8404
|
+
description: "Get agent conversation",
|
|
8405
|
+
method: HttpMethod.GET,
|
|
8406
|
+
url: `/agents/conversations/${conversationId}/`,
|
|
8407
|
+
blockers: ["conversation"],
|
|
8408
|
+
blocks: ["conversation"]
|
|
8409
|
+
}).then((response) => {
|
|
8410
|
+
this.client.store.dispatch(setConversation(response));
|
|
8382
8411
|
});
|
|
8383
8412
|
}
|
|
8384
8413
|
async rate(responseId, rating) {
|
|
@@ -8391,6 +8420,18 @@ class AgentService extends BaseApiService {
|
|
|
8391
8420
|
blocks: ["rate"]
|
|
8392
8421
|
});
|
|
8393
8422
|
}
|
|
8423
|
+
async refreshStore() {
|
|
8424
|
+
const { store } = this.client;
|
|
8425
|
+
const activeProject = store.getState().projectReducer.activeProjectId;
|
|
8426
|
+
const result = await this.enqueueRequest({
|
|
8427
|
+
description: "Get agent conversation history",
|
|
8428
|
+
method: HttpMethod.GET,
|
|
8429
|
+
url: `/projects/${activeProject}/agent-conversations/`,
|
|
8430
|
+
blockers: ["agent-conversations"],
|
|
8431
|
+
blocks: ["agent-conversations"]
|
|
8432
|
+
});
|
|
8433
|
+
store.dispatch(setConversations(result));
|
|
8434
|
+
}
|
|
8394
8435
|
}
|
|
8395
8436
|
class TeamService extends BaseApiService {
|
|
8396
8437
|
add(teamPayload) {
|
|
@@ -8546,12 +8587,12 @@ class OvermapSDK {
|
|
|
8546
8587
|
__publicField(this, "issueAttachments", new IssueAttachmentService(this));
|
|
8547
8588
|
__publicField(this, "workspaces", new WorkspaceService(this));
|
|
8548
8589
|
__publicField(this, "main", new MainService(this));
|
|
8549
|
-
__publicField(this, "
|
|
8550
|
-
__publicField(this, "
|
|
8551
|
-
__publicField(this, "
|
|
8552
|
-
__publicField(this, "
|
|
8553
|
-
__publicField(this, "
|
|
8554
|
-
__publicField(this, "
|
|
8590
|
+
__publicField(this, "assets", new AssetService(this));
|
|
8591
|
+
__publicField(this, "assetAttachments", new AssetAttachmentService(this));
|
|
8592
|
+
__publicField(this, "assetTypes", new AssetTypeService(this));
|
|
8593
|
+
__publicField(this, "assetTypeAttachments", new AssetTypeAttachmentService(this));
|
|
8594
|
+
__publicField(this, "assetStages", new AssetStageService(this));
|
|
8595
|
+
__publicField(this, "assetStageCompletions", new AssetStageCompletionService(this));
|
|
8555
8596
|
__publicField(this, "userForms", new UserFormService(this));
|
|
8556
8597
|
__publicField(this, "userFormSubmissions", new UserFormSubmissionService(this));
|
|
8557
8598
|
__publicField(this, "projects", new ProjectService(this));
|
|
@@ -15182,9 +15223,9 @@ const FormBrowser = memo(
|
|
|
15182
15223
|
}, [filter, maxResults, ownerFilter]);
|
|
15183
15224
|
const userForms = useAppSelector(selectFilteredForms(ownerFilterOptions)) ?? [];
|
|
15184
15225
|
const userFormMapping = useAppSelector(selectFormMapping);
|
|
15185
|
-
const attachableUserForms = userForms.filter((form) => !form.
|
|
15226
|
+
const attachableUserForms = userForms.filter((form) => !form.asset_type && !form.issue_type);
|
|
15186
15227
|
const attachableUserFormMapping = Object.values(userFormMapping).filter(
|
|
15187
|
-
(form) => !form.
|
|
15228
|
+
(form) => !form.asset_type
|
|
15188
15229
|
);
|
|
15189
15230
|
const handleToggleFavorite = useCallback(
|
|
15190
15231
|
(form) => {
|
|
@@ -16589,6 +16630,13 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
16589
16630
|
export {
|
|
16590
16631
|
APIError,
|
|
16591
16632
|
AgentService,
|
|
16633
|
+
AssetAttachmentService,
|
|
16634
|
+
AssetService,
|
|
16635
|
+
AssetStageColors,
|
|
16636
|
+
AssetStageCompletionService,
|
|
16637
|
+
AssetStageService,
|
|
16638
|
+
AssetTypeAttachmentService,
|
|
16639
|
+
AssetTypeService,
|
|
16592
16640
|
AttachmentModel,
|
|
16593
16641
|
AuthService,
|
|
16594
16642
|
BaseApiService,
|
|
@@ -16600,13 +16648,6 @@ export {
|
|
|
16600
16648
|
ColorPicker,
|
|
16601
16649
|
Colors,
|
|
16602
16650
|
ColorsToString,
|
|
16603
|
-
ComponentAttachmentService,
|
|
16604
|
-
ComponentService,
|
|
16605
|
-
ComponentStageColors,
|
|
16606
|
-
ComponentStageCompletionService,
|
|
16607
|
-
ComponentStageService,
|
|
16608
|
-
ComponentTypeAttachmentService,
|
|
16609
|
-
ComponentTypeService,
|
|
16610
16651
|
DEFAULT_ISSUE_PRIORITY,
|
|
16611
16652
|
DEFAULT_ISSUE_STATUS,
|
|
16612
16653
|
DateField,
|
|
@@ -16698,14 +16739,15 @@ export {
|
|
|
16698
16739
|
acceptProjectInvite,
|
|
16699
16740
|
addActiveProjectFormSubmissionsCount,
|
|
16700
16741
|
addActiveProjectIssuesCount,
|
|
16742
|
+
addAsset,
|
|
16743
|
+
addAssetAttachment,
|
|
16744
|
+
addAssetAttachments,
|
|
16745
|
+
addAssetType,
|
|
16746
|
+
addAssetTypeAttachment,
|
|
16747
|
+
addAssetTypeAttachments,
|
|
16748
|
+
addAssetsInBatches,
|
|
16701
16749
|
addCategory,
|
|
16702
|
-
|
|
16703
|
-
addComponentAttachment,
|
|
16704
|
-
addComponentAttachments,
|
|
16705
|
-
addComponentType,
|
|
16706
|
-
addComponentTypeAttachment,
|
|
16707
|
-
addComponentTypeAttachments,
|
|
16708
|
-
addComponentsInBatches,
|
|
16750
|
+
addConversation,
|
|
16709
16751
|
addDocumentAttachment,
|
|
16710
16752
|
addDocumentAttachments,
|
|
16711
16753
|
addDocuments,
|
|
@@ -16746,7 +16788,17 @@ export {
|
|
|
16746
16788
|
addToRecentIssues,
|
|
16747
16789
|
addUsers,
|
|
16748
16790
|
addWorkspace,
|
|
16791
|
+
agentsReducer,
|
|
16792
|
+
agentsSlice,
|
|
16749
16793
|
areArraysEqual,
|
|
16794
|
+
assetReducer,
|
|
16795
|
+
assetSlice,
|
|
16796
|
+
assetStageCompletionReducer,
|
|
16797
|
+
assetStageCompletionSlice,
|
|
16798
|
+
assetStageReducer,
|
|
16799
|
+
assetStageSlice,
|
|
16800
|
+
assetTypeReducer,
|
|
16801
|
+
assetTypeSlice,
|
|
16750
16802
|
authReducer,
|
|
16751
16803
|
authSlice,
|
|
16752
16804
|
blobToBase64,
|
|
@@ -16756,14 +16808,6 @@ export {
|
|
|
16756
16808
|
classNames$1 as classNames,
|
|
16757
16809
|
cleanRecentIssues,
|
|
16758
16810
|
clearTokens,
|
|
16759
|
-
componentReducer,
|
|
16760
|
-
componentSlice,
|
|
16761
|
-
componentStageCompletionReducer,
|
|
16762
|
-
componentStageCompletionSlice,
|
|
16763
|
-
componentStageReducer,
|
|
16764
|
-
componentStageSlice,
|
|
16765
|
-
componentTypeReducer,
|
|
16766
|
-
componentTypeSlice,
|
|
16767
16811
|
constructUploadedFilePayloads,
|
|
16768
16812
|
coordinatesAreEqual,
|
|
16769
16813
|
coordinatesToLiteral,
|
|
@@ -16774,7 +16818,7 @@ export {
|
|
|
16774
16818
|
createPointMarker,
|
|
16775
16819
|
defaultBadgeColor,
|
|
16776
16820
|
defaultStore,
|
|
16777
|
-
|
|
16821
|
+
deleteAssetType,
|
|
16778
16822
|
deleteForm,
|
|
16779
16823
|
deleteFormRevision,
|
|
16780
16824
|
deleteFormRevisionAttachment,
|
|
@@ -16823,7 +16867,7 @@ export {
|
|
|
16823
16867
|
formSubmissionReducer,
|
|
16824
16868
|
formSubmissionSlice,
|
|
16825
16869
|
index as forms,
|
|
16826
|
-
|
|
16870
|
+
fullAssetMarkerSize,
|
|
16827
16871
|
generateBadgeColors,
|
|
16828
16872
|
genericMemo,
|
|
16829
16873
|
getFileIdentifier,
|
|
@@ -16883,15 +16927,15 @@ export {
|
|
|
16883
16927
|
projectSlice,
|
|
16884
16928
|
rehydratedReducer,
|
|
16885
16929
|
rehydratedSlice,
|
|
16886
|
-
|
|
16930
|
+
removeAllAssetsOfType,
|
|
16931
|
+
removeAsset,
|
|
16932
|
+
removeAssetAttachment,
|
|
16933
|
+
removeAssetAttachments,
|
|
16934
|
+
removeAssetTypeAttachment,
|
|
16935
|
+
removeAssetTypeAttachments,
|
|
16887
16936
|
removeAttachmentsOfIssue,
|
|
16888
16937
|
removeCategory,
|
|
16889
16938
|
removeColor,
|
|
16890
|
-
removeComponent,
|
|
16891
|
-
removeComponentAttachment,
|
|
16892
|
-
removeComponentAttachments,
|
|
16893
|
-
removeComponentTypeAttachment,
|
|
16894
|
-
removeComponentTypeAttachments,
|
|
16895
16939
|
removeDocumentAttachment,
|
|
16896
16940
|
removeDocumentAttachments,
|
|
16897
16941
|
removeDocuments,
|
|
@@ -16942,16 +16986,31 @@ export {
|
|
|
16942
16986
|
selectActiveWorkspace,
|
|
16943
16987
|
selectActiveWorkspaceId,
|
|
16944
16988
|
selectAllAttachments,
|
|
16945
|
-
selectAllComponentAttachments,
|
|
16946
|
-
selectAllComponentTypeAttachments,
|
|
16947
16989
|
selectAllDocumentAttachments,
|
|
16948
16990
|
selectAllProjectAttachments,
|
|
16949
16991
|
selectAncestorIdsOfDocument,
|
|
16950
16992
|
selectAppearance,
|
|
16951
|
-
|
|
16952
|
-
|
|
16953
|
-
|
|
16954
|
-
|
|
16993
|
+
selectAsset,
|
|
16994
|
+
selectAssetAttachment,
|
|
16995
|
+
selectAssetAttachmentMapping,
|
|
16996
|
+
selectAssetAttachments,
|
|
16997
|
+
selectAssetToAssetTypeMapping,
|
|
16998
|
+
selectAssetType,
|
|
16999
|
+
selectAssetTypeAttachment,
|
|
17000
|
+
selectAssetTypeAttachmentMapping,
|
|
17001
|
+
selectAssetTypeAttachments,
|
|
17002
|
+
selectAssetTypeStagesMapping,
|
|
17003
|
+
selectAssetTypes,
|
|
17004
|
+
selectAssetTypesByName,
|
|
17005
|
+
selectAssetTypesFromIds,
|
|
17006
|
+
selectAssetTypesMapping,
|
|
17007
|
+
selectAssets,
|
|
17008
|
+
selectAssetsMapping,
|
|
17009
|
+
selectAssetsOfAssetType,
|
|
17010
|
+
selectAttachmentsOfAsset,
|
|
17011
|
+
selectAttachmentsOfAssetType,
|
|
17012
|
+
selectAttachmentsOfAssetTypeByType,
|
|
17013
|
+
selectAttachmentsOfAssetsByType,
|
|
16955
17014
|
selectAttachmentsOfDocument,
|
|
16956
17015
|
selectAttachmentsOfDocumentByType,
|
|
16957
17016
|
selectAttachmentsOfFormRevision,
|
|
@@ -16968,25 +17027,11 @@ export {
|
|
|
16968
17027
|
selectCenterMapToProject,
|
|
16969
17028
|
selectCommentMapping,
|
|
16970
17029
|
selectCommentsOfIssue,
|
|
16971
|
-
|
|
17030
|
+
selectCompletedStageIdsForAsset,
|
|
16972
17031
|
selectCompletedStages,
|
|
16973
|
-
|
|
16974
|
-
|
|
16975
|
-
|
|
16976
|
-
selectComponentType,
|
|
16977
|
-
selectComponentTypeAttachment,
|
|
16978
|
-
selectComponentTypeAttachmentMapping,
|
|
16979
|
-
selectComponentTypeFromComponent,
|
|
16980
|
-
selectComponentTypeFromComponents,
|
|
16981
|
-
selectComponentTypeStagesMapping,
|
|
16982
|
-
selectComponentTypes,
|
|
16983
|
-
selectComponentTypesByName,
|
|
16984
|
-
selectComponentTypesFromIds,
|
|
16985
|
-
selectComponentTypesMapping,
|
|
16986
|
-
selectComponents,
|
|
16987
|
-
selectComponentsByType,
|
|
16988
|
-
selectComponentsFromComponentType,
|
|
16989
|
-
selectComponentsMapping,
|
|
17032
|
+
selectConversation,
|
|
17033
|
+
selectConversationMapping,
|
|
17034
|
+
selectConversations,
|
|
16990
17035
|
selectCreateProjectType,
|
|
16991
17036
|
selectCurrentUser,
|
|
16992
17037
|
selectDeletedRequests,
|
|
@@ -17008,7 +17053,7 @@ export {
|
|
|
17008
17053
|
selectFilteredForms,
|
|
17009
17054
|
selectForm,
|
|
17010
17055
|
selectFormMapping,
|
|
17011
|
-
|
|
17056
|
+
selectFormOfAssetType,
|
|
17012
17057
|
selectFormOfIssueType,
|
|
17013
17058
|
selectFormRevision,
|
|
17014
17059
|
selectFormRevisionMapping,
|
|
@@ -17017,16 +17062,16 @@ export {
|
|
|
17017
17062
|
selectFormSubmission,
|
|
17018
17063
|
selectFormSubmissionAttachmentsMapping,
|
|
17019
17064
|
selectFormSubmissions,
|
|
17020
|
-
|
|
17065
|
+
selectFormSubmissionsByAssets,
|
|
17021
17066
|
selectFormSubmissionsByFormRevisions,
|
|
17022
17067
|
selectFormSubmissionsMapping,
|
|
17023
|
-
|
|
17068
|
+
selectFormSubmissionsOfAsset,
|
|
17024
17069
|
selectFormSubmissionsOfForm,
|
|
17025
17070
|
selectFormSubmissionsOfIssue,
|
|
17026
17071
|
selectFormsCount,
|
|
17027
17072
|
selectGeneralFormCount,
|
|
17073
|
+
selectHiddenAssetTypeIds,
|
|
17028
17074
|
selectHiddenCategoryCount,
|
|
17029
|
-
selectHiddenComponentTypeIds,
|
|
17030
17075
|
selectIsFetchingInitialData,
|
|
17031
17076
|
selectIsImportingProjectFile,
|
|
17032
17077
|
selectIsLoading,
|
|
@@ -17048,7 +17093,7 @@ export {
|
|
|
17048
17093
|
selectIssuesOfIssueTypeCount,
|
|
17049
17094
|
selectLatestFormRevisionByForm,
|
|
17050
17095
|
selectLatestFormRevisionOfForm,
|
|
17051
|
-
|
|
17096
|
+
selectLatestFormRevisionsOfAssetTypes,
|
|
17052
17097
|
selectLatestRetryTime,
|
|
17053
17098
|
selectLicense,
|
|
17054
17099
|
selectLicenseForProject,
|
|
@@ -17056,8 +17101,8 @@ export {
|
|
|
17056
17101
|
selectLicensesForProjectsMapping,
|
|
17057
17102
|
selectMainWorkspace,
|
|
17058
17103
|
selectMapStyle,
|
|
17059
|
-
|
|
17060
|
-
|
|
17104
|
+
selectNumberOfAssetTypesMatchingCaseInsensitiveName,
|
|
17105
|
+
selectNumberOfAssetsOfAssetType,
|
|
17061
17106
|
selectOrganization,
|
|
17062
17107
|
selectOrganizationAccess,
|
|
17063
17108
|
selectOrganizationAccessForUser,
|
|
@@ -17098,9 +17143,9 @@ export {
|
|
|
17098
17143
|
selectStageFormIdsFromStageIds,
|
|
17099
17144
|
selectStageMapping,
|
|
17100
17145
|
selectStages,
|
|
17101
|
-
|
|
17102
|
-
selectStagesFromComponentTypeIds,
|
|
17146
|
+
selectStagesFromAssetTypeIds,
|
|
17103
17147
|
selectStagesFromStageIds,
|
|
17148
|
+
selectStagesOfAssetType,
|
|
17104
17149
|
selectTeam,
|
|
17105
17150
|
selectTeams,
|
|
17106
17151
|
selectTeamsMapping,
|
|
@@ -17122,14 +17167,16 @@ export {
|
|
|
17122
17167
|
setActiveProjectId,
|
|
17123
17168
|
setActiveWorkspaceId,
|
|
17124
17169
|
setAppearance,
|
|
17170
|
+
setAssetAttachment,
|
|
17171
|
+
setAssetAttachments,
|
|
17172
|
+
setAssetTypeAttachment,
|
|
17173
|
+
setAssetTypeAttachments,
|
|
17174
|
+
setAssetTypes,
|
|
17175
|
+
setAssets,
|
|
17125
17176
|
setCategories,
|
|
17126
17177
|
setCenterMapToProject,
|
|
17127
|
-
|
|
17128
|
-
|
|
17129
|
-
setComponentTypeAttachment,
|
|
17130
|
-
setComponentTypeAttachments,
|
|
17131
|
-
setComponentTypes,
|
|
17132
|
-
setComponents,
|
|
17178
|
+
setConversation,
|
|
17179
|
+
setConversations,
|
|
17133
17180
|
setCreateProjectType,
|
|
17134
17181
|
setCurrentUser,
|
|
17135
17182
|
setDocumentAttachment,
|
|
@@ -17190,18 +17237,19 @@ export {
|
|
|
17190
17237
|
teamSlice,
|
|
17191
17238
|
toFileNameSafeString,
|
|
17192
17239
|
toOfflineIdRecord,
|
|
17193
|
-
|
|
17240
|
+
toggleAssetTypeVisibility,
|
|
17194
17241
|
truncate,
|
|
17195
17242
|
unfavoriteForm,
|
|
17196
17243
|
unhideAllCategories,
|
|
17197
17244
|
unhideCategory,
|
|
17198
17245
|
unlinkStageToForm,
|
|
17199
17246
|
updateActiveOrganization,
|
|
17200
|
-
|
|
17201
|
-
|
|
17202
|
-
|
|
17203
|
-
|
|
17204
|
-
|
|
17247
|
+
updateAsset,
|
|
17248
|
+
updateAssetAttachment,
|
|
17249
|
+
updateAssetAttachments,
|
|
17250
|
+
updateAssetTypeAttachment,
|
|
17251
|
+
updateAssetTypeAttachments,
|
|
17252
|
+
updateConversation,
|
|
17205
17253
|
updateDocumentAttachment,
|
|
17206
17254
|
updateDocumentAttachments,
|
|
17207
17255
|
updateDocuments,
|