@overmap-ai/core 1.0.52 → 1.0.53-issue-types.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/overmap-core.js +299 -32
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +299 -32
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/sdk.d.ts +2 -1
- package/dist/sdk/services/IssueService.d.ts +2 -2
- package/dist/sdk/services/IssueTypeService.d.ts +9 -0
- package/dist/sdk/services/UserFormService.d.ts +10 -2
- package/dist/sdk/services/index.d.ts +1 -0
- package/dist/store/slices/categorySlice.d.ts +1 -0
- package/dist/store/slices/documentSlice.d.ts +29 -56
- package/dist/store/slices/formRevisionSlice.d.ts +1 -0
- package/dist/store/slices/formSlice.d.ts +7 -0
- package/dist/store/slices/formSubmissionSlice.d.ts +2 -0
- package/dist/store/slices/index.d.ts +1 -0
- package/dist/store/slices/issueSlice.d.ts +6 -1
- package/dist/store/slices/issueTypeSlice.d.ts +20 -0
- package/dist/store/slices/projectFileSlice.d.ts +1 -0
- package/dist/store/slices/workspaceSlice.d.ts +1 -0
- package/dist/store/store.d.ts +4 -1
- package/dist/typings/models/attachments.d.ts +2 -3
- package/dist/typings/models/base.d.ts +4 -0
- package/dist/typings/models/documents.d.ts +3 -6
- package/dist/typings/models/forms.d.ts +3 -3
- package/dist/typings/models/index.d.ts +1 -0
- package/dist/typings/models/issueTypes.d.ts +8 -0
- package/dist/typings/models/issues.d.ts +4 -5
- package/dist/typings/models/organizations.d.ts +2 -3
- package/package.json +1 -1
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$r = {
|
|
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$r,
|
|
689
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
|
|
690
690
|
reducers: {
|
|
691
691
|
setTokens: (state, action) => {
|
|
692
692
|
state.accessToken = action.payload.accessToken;
|
|
@@ -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$q = {
|
|
1434
1434
|
categories: {},
|
|
1435
1435
|
usedCategoryColors: [],
|
|
1436
1436
|
categoryVisibility: {
|
|
@@ -1440,8 +1440,8 @@ const initialState$p = {
|
|
|
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$q,
|
|
1444
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
|
|
1445
1445
|
reducers: {
|
|
1446
1446
|
setCategories: (state, action) => {
|
|
1447
1447
|
if (!Array.isArray(action.payload))
|
|
@@ -1613,14 +1613,14 @@ function removeAttachments(state, action) {
|
|
|
1613
1613
|
delete state.attachments[attachmentId];
|
|
1614
1614
|
}
|
|
1615
1615
|
}
|
|
1616
|
-
const initialState$
|
|
1616
|
+
const initialState$p = {
|
|
1617
1617
|
components: {},
|
|
1618
1618
|
attachments: {}
|
|
1619
1619
|
};
|
|
1620
1620
|
const componentSlice = createSlice({
|
|
1621
1621
|
name: "components",
|
|
1622
|
-
initialState: initialState$
|
|
1623
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1622
|
+
initialState: initialState$p,
|
|
1623
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
|
|
1624
1624
|
reducers: {
|
|
1625
1625
|
addComponent: (state, action) => {
|
|
1626
1626
|
state.components[action.payload.offline_id] = action.payload;
|
|
@@ -1776,13 +1776,13 @@ const {
|
|
|
1776
1776
|
removeAllComponentsOfType
|
|
1777
1777
|
} = componentSlice.actions;
|
|
1778
1778
|
const componentReducer = componentSlice.reducer;
|
|
1779
|
-
const initialState$
|
|
1779
|
+
const initialState$o = {
|
|
1780
1780
|
completionsByComponentId: {}
|
|
1781
1781
|
};
|
|
1782
1782
|
const componentStageCompletionSlice = createSlice({
|
|
1783
1783
|
name: "componentStageCompletions",
|
|
1784
|
-
initialState: initialState$
|
|
1785
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1784
|
+
initialState: initialState$o,
|
|
1785
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
|
|
1786
1786
|
reducers: {
|
|
1787
1787
|
addStageCompletion: (state, action) => {
|
|
1788
1788
|
let stageToCompletionDateMapping = state.completionsByComponentId[action.payload.component];
|
|
@@ -1833,13 +1833,13 @@ const selectCompletedStageIdsForComponent = (component) => (state) => {
|
|
|
1833
1833
|
return Object.keys(state.componentStageCompletionReducer.completionsByComponentId[component.offline_id] ?? {});
|
|
1834
1834
|
};
|
|
1835
1835
|
const componentStageCompletionReducer = componentStageCompletionSlice.reducer;
|
|
1836
|
-
const initialState$
|
|
1836
|
+
const initialState$n = {
|
|
1837
1837
|
stages: {}
|
|
1838
1838
|
};
|
|
1839
1839
|
const componentStageSlice = createSlice({
|
|
1840
1840
|
name: "componentStages",
|
|
1841
|
-
initialState: initialState$
|
|
1842
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1841
|
+
initialState: initialState$n,
|
|
1842
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
|
|
1843
1843
|
reducers: {
|
|
1844
1844
|
addStages: (state, action) => {
|
|
1845
1845
|
Object.assign(state.stages, toOfflineIdRecord(action.payload));
|
|
@@ -1949,15 +1949,15 @@ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
|
|
|
1949
1949
|
);
|
|
1950
1950
|
const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = componentStageSlice.actions;
|
|
1951
1951
|
const componentStageReducer = componentStageSlice.reducer;
|
|
1952
|
-
const initialState$
|
|
1952
|
+
const initialState$m = {
|
|
1953
1953
|
componentTypes: {},
|
|
1954
1954
|
hiddenComponentTypeIds: {},
|
|
1955
1955
|
attachments: {}
|
|
1956
1956
|
};
|
|
1957
1957
|
const componentTypeSlice = createSlice({
|
|
1958
1958
|
name: "componentTypes",
|
|
1959
|
-
initialState: initialState$
|
|
1960
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1959
|
+
initialState: initialState$m,
|
|
1960
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
|
|
1961
1961
|
reducers: {
|
|
1962
1962
|
addComponentType: (state, action) => {
|
|
1963
1963
|
state.componentTypes[action.payload.offline_id] = action.payload;
|
|
@@ -2068,13 +2068,13 @@ const {
|
|
|
2068
2068
|
deleteComponentType
|
|
2069
2069
|
} = componentTypeSlice.actions;
|
|
2070
2070
|
const componentTypeReducer = componentTypeSlice.reducer;
|
|
2071
|
-
const initialState$
|
|
2071
|
+
const initialState$l = {
|
|
2072
2072
|
workspaces: {},
|
|
2073
2073
|
activeWorkspaceId: null
|
|
2074
2074
|
};
|
|
2075
2075
|
const workspaceSlice = createSlice({
|
|
2076
2076
|
name: "workspace",
|
|
2077
|
-
initialState: initialState$
|
|
2077
|
+
initialState: initialState$l,
|
|
2078
2078
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
2079
2079
|
reducers: {
|
|
2080
2080
|
setWorkspaces: (state, action) => {
|
|
@@ -2131,7 +2131,7 @@ const selectPermittedWorkspaceIds = createSelector(
|
|
|
2131
2131
|
);
|
|
2132
2132
|
const workspaceReducer = workspaceSlice.reducer;
|
|
2133
2133
|
const maxRecentIssues = 10;
|
|
2134
|
-
const initialState$
|
|
2134
|
+
const initialState$k = {
|
|
2135
2135
|
issues: {},
|
|
2136
2136
|
attachments: {},
|
|
2137
2137
|
comments: {},
|
|
@@ -2143,9 +2143,9 @@ const initialState$j = {
|
|
|
2143
2143
|
};
|
|
2144
2144
|
const issueSlice = createSlice({
|
|
2145
2145
|
name: "issues",
|
|
2146
|
-
initialState: initialState$
|
|
2146
|
+
initialState: initialState$k,
|
|
2147
2147
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2148
|
-
Object.assign(state, initialState$
|
|
2148
|
+
Object.assign(state, initialState$k);
|
|
2149
2149
|
}),
|
|
2150
2150
|
reducers: {
|
|
2151
2151
|
setIssues: (state, action) => {
|
|
@@ -2176,6 +2176,16 @@ const issueSlice = createSlice({
|
|
|
2176
2176
|
}
|
|
2177
2177
|
state.issues[action.payload.offline_id] = action.payload;
|
|
2178
2178
|
},
|
|
2179
|
+
addIssues: (state, action) => {
|
|
2180
|
+
for (const issue of action.payload) {
|
|
2181
|
+
if (issue.offline_id in state.issues) {
|
|
2182
|
+
throw new Error(`Tried to add duplicate issue with ID: ${issue.offline_id}`);
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
for (const issue of action.payload) {
|
|
2186
|
+
state.issues[issue.offline_id] = issue;
|
|
2187
|
+
}
|
|
2188
|
+
},
|
|
2179
2189
|
addIssueAttachment: addAttachment,
|
|
2180
2190
|
addIssueAttachments: addAttachments,
|
|
2181
2191
|
addIssueUpdate: (state, action) => {
|
|
@@ -2207,6 +2217,11 @@ const issueSlice = createSlice({
|
|
|
2207
2217
|
throw new Error(`Failed to remove issue because ID doesn't exist: ${action.payload}`);
|
|
2208
2218
|
}
|
|
2209
2219
|
},
|
|
2220
|
+
removeIssues: (state, action) => {
|
|
2221
|
+
for (const issueId of action.payload) {
|
|
2222
|
+
delete state.issues[issueId];
|
|
2223
|
+
}
|
|
2224
|
+
},
|
|
2210
2225
|
removeIssueAttachment: removeAttachment,
|
|
2211
2226
|
removeIssueUpdate: (state, action) => {
|
|
2212
2227
|
if (action.payload in state.updates) {
|
|
@@ -2311,6 +2326,7 @@ const {
|
|
|
2311
2326
|
addIssueAttachment,
|
|
2312
2327
|
addIssueAttachments,
|
|
2313
2328
|
addIssue,
|
|
2329
|
+
addIssues,
|
|
2314
2330
|
addIssueUpdate,
|
|
2315
2331
|
addIssueUpdates,
|
|
2316
2332
|
addOrReplaceIssueComment,
|
|
@@ -2319,6 +2335,7 @@ const {
|
|
|
2319
2335
|
removeIssueAttachment,
|
|
2320
2336
|
removeAttachmentsOfIssue,
|
|
2321
2337
|
removeIssue,
|
|
2338
|
+
removeIssues,
|
|
2322
2339
|
removeIssueUpdate,
|
|
2323
2340
|
removeIssueUpdates,
|
|
2324
2341
|
removeRecentIssue,
|
|
@@ -2553,6 +2570,80 @@ const selectRecentIssuesAsSearchResults = createSelector(
|
|
|
2553
2570
|
}
|
|
2554
2571
|
);
|
|
2555
2572
|
const issueReducer = issueSlice.reducer;
|
|
2573
|
+
const initialState$j = {
|
|
2574
|
+
issueTypes: {}
|
|
2575
|
+
};
|
|
2576
|
+
const issueTypeSlice = createSlice({
|
|
2577
|
+
name: "issueTypes",
|
|
2578
|
+
initialState: initialState$j,
|
|
2579
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
2580
|
+
Object.assign(state, initialState$j);
|
|
2581
|
+
}),
|
|
2582
|
+
reducers: {
|
|
2583
|
+
setIssueTypes: (state, action) => {
|
|
2584
|
+
for (const issueType of action.payload) {
|
|
2585
|
+
state.issueTypes[issueType.offline_id] = issueType;
|
|
2586
|
+
}
|
|
2587
|
+
},
|
|
2588
|
+
setIssueType: (state, action) => {
|
|
2589
|
+
state.issueTypes[action.payload.offline_id] = action.payload;
|
|
2590
|
+
},
|
|
2591
|
+
addIssueType: (state, action) => {
|
|
2592
|
+
if (action.payload.offline_id in state.issueTypes) {
|
|
2593
|
+
throw new Error(`IssueType with offline_id ${action.payload.offline_id} already exists in the store.`);
|
|
2594
|
+
}
|
|
2595
|
+
state.issueTypes[action.payload.offline_id] = action.payload;
|
|
2596
|
+
},
|
|
2597
|
+
updateIssueType: (state, action) => {
|
|
2598
|
+
if (!(action.payload.offline_id in state.issueTypes)) {
|
|
2599
|
+
throw new Error(`IssueType with offline_id ${action.payload.offline_id} does not exist in the store.`);
|
|
2600
|
+
}
|
|
2601
|
+
state.issueTypes[action.payload.offline_id] = action.payload;
|
|
2602
|
+
},
|
|
2603
|
+
removeIssueType: (state, action) => {
|
|
2604
|
+
if (!(action.payload in state.issueTypes)) {
|
|
2605
|
+
throw new Error(`IssueType with offline_id ${action.payload} does not exist in the store.`);
|
|
2606
|
+
}
|
|
2607
|
+
delete state.issueTypes[action.payload];
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
});
|
|
2611
|
+
const { setIssueTypes, setIssueType, addIssueType, updateIssueType, removeIssueType } = issueTypeSlice.actions;
|
|
2612
|
+
const selectIssueTypeMapping = (state) => {
|
|
2613
|
+
return state.issueTypeReducer.issueTypes;
|
|
2614
|
+
};
|
|
2615
|
+
const selectIssueTypes = createSelector(selectIssueTypeMapping, (issueTypes) => {
|
|
2616
|
+
return Object.values(issueTypes);
|
|
2617
|
+
});
|
|
2618
|
+
const selectIssueType = restructureCreateSelectorWithArgs(
|
|
2619
|
+
createSelector(
|
|
2620
|
+
[selectIssueTypeMapping, (_, issueTypeId) => issueTypeId],
|
|
2621
|
+
(issueTypesMapping, issueTypeId) => {
|
|
2622
|
+
return issueTypesMapping[issueTypeId];
|
|
2623
|
+
}
|
|
2624
|
+
)
|
|
2625
|
+
);
|
|
2626
|
+
const selectIssueTypesOfOrganization = restructureCreateSelectorWithArgs(
|
|
2627
|
+
createSelector(
|
|
2628
|
+
[selectIssueTypes, (_, organizationId) => organizationId],
|
|
2629
|
+
(issueTypes, organizationId) => {
|
|
2630
|
+
return issueTypes.filter((issueType) => issueType.organization === organizationId);
|
|
2631
|
+
}
|
|
2632
|
+
)
|
|
2633
|
+
);
|
|
2634
|
+
const selectIssuesOfIssueType = restructureCreateSelectorWithArgs(
|
|
2635
|
+
createSelector(
|
|
2636
|
+
[(state) => state.issueReducer.issues, (_, issueTypeId) => issueTypeId],
|
|
2637
|
+
(issuesMapping, issueTypeId) => {
|
|
2638
|
+
return Object.values(issuesMapping).filter((issue) => issue.issue_type === issueTypeId);
|
|
2639
|
+
}
|
|
2640
|
+
)
|
|
2641
|
+
);
|
|
2642
|
+
const selectIssuesOfIssueTypeCount = (issueTypeId) => (state) => {
|
|
2643
|
+
var _a2;
|
|
2644
|
+
return ((_a2 = selectIssuesOfIssueType(issueTypeId)(state)) == null ? void 0 : _a2.length) ?? 0;
|
|
2645
|
+
};
|
|
2646
|
+
const issueTypeReducer = issueTypeSlice.reducer;
|
|
2556
2647
|
const initialState$i = {
|
|
2557
2648
|
s3Urls: {}
|
|
2558
2649
|
};
|
|
@@ -3781,6 +3872,14 @@ const selectFormOfComponentType = restructureCreateSelectorWithArgs(
|
|
|
3781
3872
|
}
|
|
3782
3873
|
)
|
|
3783
3874
|
);
|
|
3875
|
+
const selectFormOfIssueType = restructureCreateSelectorWithArgs(
|
|
3876
|
+
createSelector(
|
|
3877
|
+
[selectFormMapping, (_state, issueTypeId) => issueTypeId],
|
|
3878
|
+
(userForms, issueTypeId) => {
|
|
3879
|
+
return Object.values(userForms).find((userForm) => userForm.issue_type === issueTypeId);
|
|
3880
|
+
}
|
|
3881
|
+
)
|
|
3882
|
+
);
|
|
3784
3883
|
const selectFormsCount = createSelector([selectFormMapping], (userForms) => {
|
|
3785
3884
|
return Object.keys(userForms).length;
|
|
3786
3885
|
});
|
|
@@ -3946,6 +4045,43 @@ const selectFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
|
3946
4045
|
}
|
|
3947
4046
|
)
|
|
3948
4047
|
);
|
|
4048
|
+
const selectFormSubmissionsByFormRevisions = createSelector([selectFormRevisionMapping, selectFormSubmissions], (revisions, submissions) => {
|
|
4049
|
+
var _a2;
|
|
4050
|
+
const submissionMapping = {};
|
|
4051
|
+
for (const revisionId in revisions) {
|
|
4052
|
+
submissionMapping[revisionId] = [];
|
|
4053
|
+
}
|
|
4054
|
+
for (const submission of submissions) {
|
|
4055
|
+
(_a2 = submissionMapping[submission.form_revision]) == null ? void 0 : _a2.push(submission);
|
|
4056
|
+
}
|
|
4057
|
+
return submissionMapping;
|
|
4058
|
+
});
|
|
4059
|
+
const selectSortedFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
4060
|
+
createSelector(
|
|
4061
|
+
[
|
|
4062
|
+
selectFormRevisionMapping,
|
|
4063
|
+
selectFormSubmissionsByFormRevisions,
|
|
4064
|
+
(_state, formId2) => formId2
|
|
4065
|
+
],
|
|
4066
|
+
(revisionsMapping, submissionsByRevision, formId2) => {
|
|
4067
|
+
const submissionsByFormRevisions = {};
|
|
4068
|
+
for (const revisionId in revisionsMapping) {
|
|
4069
|
+
const revision = revisionsMapping[revisionId];
|
|
4070
|
+
const submissionsOfRevision = submissionsByRevision[revisionId];
|
|
4071
|
+
if (revision && submissionsOfRevision && revision.form === formId2) {
|
|
4072
|
+
submissionsByFormRevisions[revisionId] = submissionsOfRevision.sort(
|
|
4073
|
+
(a, b) => a.submitted_at < b.submitted_at ? -1 : 1
|
|
4074
|
+
);
|
|
4075
|
+
}
|
|
4076
|
+
}
|
|
4077
|
+
return Object.entries(submissionsByFormRevisions).sort((a, b) => {
|
|
4078
|
+
const aRevision = revisionsMapping[a[0]];
|
|
4079
|
+
const bRevision = revisionsMapping[b[0]];
|
|
4080
|
+
return formRevisionSortFn(aRevision, bRevision);
|
|
4081
|
+
}).map(([_revisionId, submissions]) => submissions).flat();
|
|
4082
|
+
}
|
|
4083
|
+
)
|
|
4084
|
+
);
|
|
3949
4085
|
const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
3950
4086
|
createSelector(
|
|
3951
4087
|
[selectFormSubmissions, (_state, issueId) => issueId],
|
|
@@ -4348,6 +4484,7 @@ const overmapReducers = {
|
|
|
4348
4484
|
componentStageReducer,
|
|
4349
4485
|
componentTypeReducer,
|
|
4350
4486
|
issueReducer,
|
|
4487
|
+
issueTypeReducer,
|
|
4351
4488
|
mapReducer,
|
|
4352
4489
|
organizationReducer,
|
|
4353
4490
|
outboxReducer,
|
|
@@ -6292,7 +6429,7 @@ class IssueService extends BaseApiService {
|
|
|
6292
6429
|
// Basic CRUD functions
|
|
6293
6430
|
// TODO: Once all models are represented in `Created<TModel>`, use `Created` in `OptimisticModelResult`, so we don't
|
|
6294
6431
|
// have to repeat it for all optimistic model results (all optimistic results are created).
|
|
6295
|
-
add(issue) {
|
|
6432
|
+
add(issue, issue_type = null) {
|
|
6296
6433
|
const { store } = this.client;
|
|
6297
6434
|
const dateWithoutMilliseconds = /* @__PURE__ */ new Date();
|
|
6298
6435
|
const state = store.getState();
|
|
@@ -6318,7 +6455,8 @@ class IssueService extends BaseApiService {
|
|
|
6318
6455
|
method: HttpMethod.POST,
|
|
6319
6456
|
url: "/issues/",
|
|
6320
6457
|
queryParams: {
|
|
6321
|
-
workspace_id: workspaceId
|
|
6458
|
+
workspace_id: workspaceId,
|
|
6459
|
+
...issue_type ? { issue_type } : {}
|
|
6322
6460
|
},
|
|
6323
6461
|
payload: issuePayload,
|
|
6324
6462
|
blockers: [
|
|
@@ -6503,6 +6641,103 @@ class IssueService extends BaseApiService {
|
|
|
6503
6641
|
store.dispatch(setIssues(result));
|
|
6504
6642
|
}
|
|
6505
6643
|
}
|
|
6644
|
+
class IssueTypeService extends BaseApiService {
|
|
6645
|
+
add(payload) {
|
|
6646
|
+
const { store } = this.client;
|
|
6647
|
+
const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
|
|
6648
|
+
if (!activeOrganizationId) {
|
|
6649
|
+
throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
|
|
6650
|
+
}
|
|
6651
|
+
const offlineIssueType = offline({
|
|
6652
|
+
...payload,
|
|
6653
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6654
|
+
created_by: store.getState().userReducer.currentUser.id,
|
|
6655
|
+
organization: activeOrganizationId
|
|
6656
|
+
});
|
|
6657
|
+
store.dispatch(addIssueType(offlineIssueType));
|
|
6658
|
+
const promise = this.enqueueRequest({
|
|
6659
|
+
method: HttpMethod.POST,
|
|
6660
|
+
url: `/organizations/${activeOrganizationId}/issue-types/`,
|
|
6661
|
+
// Sending only whats needed here
|
|
6662
|
+
payload: {
|
|
6663
|
+
offline_id: offlineIssueType.offline_id,
|
|
6664
|
+
submitted_at: offlineIssueType.submitted_at,
|
|
6665
|
+
icon: offlineIssueType.icon,
|
|
6666
|
+
icon_color: offlineIssueType.icon_color,
|
|
6667
|
+
name: offlineIssueType.name,
|
|
6668
|
+
description: offlineIssueType.description
|
|
6669
|
+
},
|
|
6670
|
+
blockers: [],
|
|
6671
|
+
blocks: [offlineIssueType.offline_id]
|
|
6672
|
+
});
|
|
6673
|
+
promise.then((createdIssueType) => {
|
|
6674
|
+
store.dispatch(setIssueType(createdIssueType));
|
|
6675
|
+
}).catch(() => {
|
|
6676
|
+
store.dispatch(removeIssueType(offlineIssueType.offline_id));
|
|
6677
|
+
});
|
|
6678
|
+
return [offlineIssueType, promise];
|
|
6679
|
+
}
|
|
6680
|
+
update(issueTypeFields) {
|
|
6681
|
+
const { store } = this.client;
|
|
6682
|
+
const issueTypeToBeUpdated = store.getState().issueTypeReducer.issueTypes[issueTypeFields.offline_id];
|
|
6683
|
+
if (!issueTypeToBeUpdated) {
|
|
6684
|
+
throw new Error(`IssueType with offline_id ${issueTypeFields.offline_id} does not exist in the store.`);
|
|
6685
|
+
}
|
|
6686
|
+
const offlineUpdatedIssueType = {
|
|
6687
|
+
...issueTypeToBeUpdated,
|
|
6688
|
+
...issueTypeFields
|
|
6689
|
+
};
|
|
6690
|
+
store.dispatch(updateIssueType(offlineUpdatedIssueType));
|
|
6691
|
+
const promise = this.enqueueRequest({
|
|
6692
|
+
method: HttpMethod.PATCH,
|
|
6693
|
+
url: `/issues/types/${issueTypeFields.offline_id}/`,
|
|
6694
|
+
payload: issueTypeFields,
|
|
6695
|
+
blockers: [issueTypeFields.offline_id],
|
|
6696
|
+
blocks: [issueTypeFields.offline_id]
|
|
6697
|
+
});
|
|
6698
|
+
promise.then((updatedIssueType) => {
|
|
6699
|
+
store.dispatch(setIssueType(updatedIssueType));
|
|
6700
|
+
}).catch(() => {
|
|
6701
|
+
store.dispatch(setIssueType(issueTypeToBeUpdated));
|
|
6702
|
+
});
|
|
6703
|
+
return [offlineUpdatedIssueType, promise];
|
|
6704
|
+
}
|
|
6705
|
+
delete(issueTypeId) {
|
|
6706
|
+
const { store } = this.client;
|
|
6707
|
+
const issueTypeToDelete = store.getState().issueTypeReducer.issueTypes[issueTypeId];
|
|
6708
|
+
if (!issueTypeToDelete) {
|
|
6709
|
+
throw new Error(`IssueType with offline_id ${issueTypeId} does not exist in the store.`);
|
|
6710
|
+
}
|
|
6711
|
+
const issuesOfIssueType = selectIssuesOfIssueType(issueTypeId)(store.getState()) ?? [];
|
|
6712
|
+
store.dispatch(removeIssueType(issueTypeId));
|
|
6713
|
+
store.dispatch(removeIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
|
|
6714
|
+
const promise = this.enqueueRequest({
|
|
6715
|
+
method: HttpMethod.DELETE,
|
|
6716
|
+
url: `/issues/types/${issueTypeId}/`,
|
|
6717
|
+
blockers: [issueTypeId],
|
|
6718
|
+
blocks: []
|
|
6719
|
+
});
|
|
6720
|
+
promise.catch(() => {
|
|
6721
|
+
store.dispatch(setIssueType(issueTypeToDelete));
|
|
6722
|
+
store.dispatch(addIssues(issuesOfIssueType));
|
|
6723
|
+
});
|
|
6724
|
+
return promise;
|
|
6725
|
+
}
|
|
6726
|
+
async refreshStore() {
|
|
6727
|
+
const { store } = this.client;
|
|
6728
|
+
const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
|
|
6729
|
+
if (!activeOrganizationId) {
|
|
6730
|
+
throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
|
|
6731
|
+
}
|
|
6732
|
+
const result = await this.enqueueRequest({
|
|
6733
|
+
method: HttpMethod.GET,
|
|
6734
|
+
url: `/organizations/${activeOrganizationId}/issue-types/`,
|
|
6735
|
+
blockers: [],
|
|
6736
|
+
blocks: []
|
|
6737
|
+
});
|
|
6738
|
+
store.dispatch(setIssueTypes(result));
|
|
6739
|
+
}
|
|
6740
|
+
}
|
|
6506
6741
|
class MainService extends BaseApiService {
|
|
6507
6742
|
async fetchInitialData(replaceExisting, uuid) {
|
|
6508
6743
|
if (replaceExisting) {
|
|
@@ -6678,6 +6913,7 @@ class MainService extends BaseApiService {
|
|
|
6678
6913
|
});
|
|
6679
6914
|
void this.client.documents.refreshStore();
|
|
6680
6915
|
void this.client.issueUpdates.refreshStore();
|
|
6916
|
+
void this.client.issueTypes.refreshStore();
|
|
6681
6917
|
}
|
|
6682
6918
|
store.dispatch(setIsFetchingInitialData(false));
|
|
6683
6919
|
if (overwrite) {
|
|
@@ -7047,7 +7283,7 @@ class UserFormService extends BaseApiService {
|
|
|
7047
7283
|
});
|
|
7048
7284
|
});
|
|
7049
7285
|
}
|
|
7050
|
-
async add(state, initialRevision, url, ownerUser, ownerOrganization, componentTypeId) {
|
|
7286
|
+
async add(state, initialRevision, url, ownerUser, ownerOrganization, componentTypeId, issueTypeId) {
|
|
7051
7287
|
if (!!ownerUser === !!ownerOrganization) {
|
|
7052
7288
|
throw new Error("Exactly one of ownerUser and ownerOrganization must be defined.");
|
|
7053
7289
|
}
|
|
@@ -7067,6 +7303,7 @@ class UserFormService extends BaseApiService {
|
|
|
7067
7303
|
submitted_at: submittedAt,
|
|
7068
7304
|
created_by: currentUser.id,
|
|
7069
7305
|
...componentTypeId && { component_type: componentTypeId },
|
|
7306
|
+
...issueTypeId && { issue_type: issueTypeId },
|
|
7070
7307
|
...ownerAttrs
|
|
7071
7308
|
};
|
|
7072
7309
|
const { payloadWithoutImage, images } = await separateImageFromFields(offlineRevisionPayload);
|
|
@@ -7090,9 +7327,10 @@ class UserFormService extends BaseApiService {
|
|
|
7090
7327
|
payload: {
|
|
7091
7328
|
...offlineFormPayload,
|
|
7092
7329
|
...componentTypeId && { component_type: componentTypeId },
|
|
7330
|
+
...issueTypeId && { issue_type: issueTypeId },
|
|
7093
7331
|
initial_revision: payloadWithoutImage
|
|
7094
7332
|
},
|
|
7095
|
-
blockers: componentTypeId ? [componentTypeId] : [],
|
|
7333
|
+
blockers: componentTypeId ? [componentTypeId] : issueTypeId ? [issueTypeId] : [],
|
|
7096
7334
|
blocks: [offlineFormPayload.offline_id, payloadWithoutImage.offline_id]
|
|
7097
7335
|
});
|
|
7098
7336
|
const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
|
|
@@ -7104,7 +7342,7 @@ class UserFormService extends BaseApiService {
|
|
|
7104
7342
|
const settledPromise = Promise.all([formPromise, ...attachImagesPromises]).then(() => formPromise);
|
|
7105
7343
|
return [retForm, retRevision, formPromise, settledPromise];
|
|
7106
7344
|
}
|
|
7107
|
-
async addForOrganization(initialRevision,
|
|
7345
|
+
async addForOrganization(initialRevision, attachedTo) {
|
|
7108
7346
|
const state = this.client.store.getState();
|
|
7109
7347
|
const activeOrganizationId = state.organizationReducer.activeOrganizationId;
|
|
7110
7348
|
if (!activeOrganizationId) {
|
|
@@ -7116,13 +7354,22 @@ class UserFormService extends BaseApiService {
|
|
|
7116
7354
|
`/forms/in-organization/${activeOrganizationId}/`,
|
|
7117
7355
|
void 0,
|
|
7118
7356
|
activeOrganizationId,
|
|
7119
|
-
componentTypeId
|
|
7357
|
+
attachedTo && "componentTypeId" in attachedTo ? attachedTo.componentTypeId : void 0,
|
|
7358
|
+
attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
|
|
7120
7359
|
);
|
|
7121
7360
|
}
|
|
7122
|
-
async addForCurrentUser(initialRevision,
|
|
7361
|
+
async addForCurrentUser(initialRevision, attachedTo) {
|
|
7123
7362
|
const state = this.client.store.getState();
|
|
7124
7363
|
const currentUser = state.userReducer.currentUser;
|
|
7125
|
-
return await this.add(
|
|
7364
|
+
return await this.add(
|
|
7365
|
+
state,
|
|
7366
|
+
initialRevision,
|
|
7367
|
+
"/forms/my-forms/",
|
|
7368
|
+
currentUser.id,
|
|
7369
|
+
void 0,
|
|
7370
|
+
attachedTo && "componentTypeId" in attachedTo ? attachedTo.componentTypeId : void 0,
|
|
7371
|
+
attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
|
|
7372
|
+
);
|
|
7126
7373
|
}
|
|
7127
7374
|
async createRevision(formId2, revision) {
|
|
7128
7375
|
const offlineRevision = offline(revision);
|
|
@@ -8402,6 +8649,7 @@ class OvermapSDK {
|
|
|
8402
8649
|
__publicField(this, "organizations", new OrganizationService(this));
|
|
8403
8650
|
__publicField(this, "organizationAccess", new OrganizationAccessService(this));
|
|
8404
8651
|
__publicField(this, "issues", new IssueService(this));
|
|
8652
|
+
__publicField(this, "issueTypes", new IssueTypeService(this));
|
|
8405
8653
|
__publicField(this, "issueComments", new IssueCommentService(this));
|
|
8406
8654
|
__publicField(this, "issueUpdates", new IssueUpdateService(this));
|
|
8407
8655
|
__publicField(this, "workspaces", new WorkspaceService(this));
|
|
@@ -14844,7 +15092,7 @@ const FormBrowser = memo(
|
|
|
14844
15092
|
}, [filter, maxResults, ownerFilter]);
|
|
14845
15093
|
const userForms = useAppSelector(selectFilteredForms(ownerFilterOptions)) ?? [];
|
|
14846
15094
|
const userFormMapping = useAppSelector(selectFormMapping);
|
|
14847
|
-
const attachableUserForms = userForms.filter((form) => !form.component_type);
|
|
15095
|
+
const attachableUserForms = userForms.filter((form) => !form.component_type && !form.issue_type);
|
|
14848
15096
|
const attachableUserFormMapping = Object.values(userFormMapping).filter(
|
|
14849
15097
|
(form) => !form.component_type
|
|
14850
15098
|
);
|
|
@@ -16298,6 +16546,7 @@ export {
|
|
|
16298
16546
|
IssuePriority,
|
|
16299
16547
|
IssueService,
|
|
16300
16548
|
IssueStatus,
|
|
16549
|
+
IssueTypeService,
|
|
16301
16550
|
IssueUpdateChange,
|
|
16302
16551
|
IssueUpdateService,
|
|
16303
16552
|
LicenseLevel,
|
|
@@ -16382,8 +16631,10 @@ export {
|
|
|
16382
16631
|
addIssueAttachments,
|
|
16383
16632
|
addIssueComment,
|
|
16384
16633
|
addIssueComments,
|
|
16634
|
+
addIssueType,
|
|
16385
16635
|
addIssueUpdate,
|
|
16386
16636
|
addIssueUpdates,
|
|
16637
|
+
addIssues,
|
|
16387
16638
|
addLicenses,
|
|
16388
16639
|
addOrReplaceCategories,
|
|
16389
16640
|
addOrReplaceIssueComment,
|
|
@@ -16495,6 +16746,8 @@ export {
|
|
|
16495
16746
|
issueReducer,
|
|
16496
16747
|
issueSlice,
|
|
16497
16748
|
issueToSearchResult,
|
|
16749
|
+
issueTypeReducer,
|
|
16750
|
+
issueTypeSlice,
|
|
16498
16751
|
licenseReducer,
|
|
16499
16752
|
licenseSlice,
|
|
16500
16753
|
linkStageToForm,
|
|
@@ -16553,8 +16806,10 @@ export {
|
|
|
16553
16806
|
removeIssueAttachment,
|
|
16554
16807
|
removeIssueComment,
|
|
16555
16808
|
removeIssueComments,
|
|
16809
|
+
removeIssueType,
|
|
16556
16810
|
removeIssueUpdate,
|
|
16557
16811
|
removeIssueUpdates,
|
|
16812
|
+
removeIssues,
|
|
16558
16813
|
removeOrganizationAccess,
|
|
16559
16814
|
removeProjectAccess,
|
|
16560
16815
|
removeProjectAccessesOfProject,
|
|
@@ -16658,6 +16913,7 @@ export {
|
|
|
16658
16913
|
selectForm,
|
|
16659
16914
|
selectFormMapping,
|
|
16660
16915
|
selectFormOfComponentType,
|
|
16916
|
+
selectFormOfIssueType,
|
|
16661
16917
|
selectFormRevision,
|
|
16662
16918
|
selectFormRevisionMapping,
|
|
16663
16919
|
selectFormRevisions,
|
|
@@ -16666,6 +16922,7 @@ export {
|
|
|
16666
16922
|
selectFormSubmissionAttachmentsMapping,
|
|
16667
16923
|
selectFormSubmissions,
|
|
16668
16924
|
selectFormSubmissionsByComponents,
|
|
16925
|
+
selectFormSubmissionsByFormRevisions,
|
|
16669
16926
|
selectFormSubmissionsMapping,
|
|
16670
16927
|
selectFormSubmissionsOfComponent,
|
|
16671
16928
|
selectFormSubmissionsOfForm,
|
|
@@ -16684,9 +16941,15 @@ export {
|
|
|
16684
16941
|
selectIssueAttachments,
|
|
16685
16942
|
selectIssueCountOfCategory,
|
|
16686
16943
|
selectIssueMapping,
|
|
16944
|
+
selectIssueType,
|
|
16945
|
+
selectIssueTypeMapping,
|
|
16946
|
+
selectIssueTypes,
|
|
16947
|
+
selectIssueTypesOfOrganization,
|
|
16687
16948
|
selectIssueUpdateMapping,
|
|
16688
16949
|
selectIssueUpdatesOfIssue,
|
|
16689
16950
|
selectIssues,
|
|
16951
|
+
selectIssuesOfIssueType,
|
|
16952
|
+
selectIssuesOfIssueTypeCount,
|
|
16690
16953
|
selectLatestFormRevisionByForm,
|
|
16691
16954
|
selectLatestFormRevisionOfForm,
|
|
16692
16955
|
selectLatestFormRevisionsOfComponentTypes,
|
|
@@ -16729,6 +16992,7 @@ export {
|
|
|
16729
16992
|
selectRootDocuments,
|
|
16730
16993
|
selectShowTooltips,
|
|
16731
16994
|
selectSortedEmailDomains,
|
|
16995
|
+
selectSortedFormSubmissionsOfForm,
|
|
16732
16996
|
selectSortedOrganizationLicenses,
|
|
16733
16997
|
selectSortedOrganizationUsers,
|
|
16734
16998
|
selectSortedProjectUsers,
|
|
@@ -16788,6 +17052,8 @@ export {
|
|
|
16788
17052
|
setIssueAttachments,
|
|
16789
17053
|
setIssueComment,
|
|
16790
17054
|
setIssueComments,
|
|
17055
|
+
setIssueType,
|
|
17056
|
+
setIssueTypes,
|
|
16791
17057
|
setIssueUpdates,
|
|
16792
17058
|
setIssues,
|
|
16793
17059
|
setLicenses,
|
|
@@ -16839,6 +17105,7 @@ export {
|
|
|
16839
17105
|
updateFormSubmissions,
|
|
16840
17106
|
updateIssue,
|
|
16841
17107
|
updateIssueAttachment,
|
|
17108
|
+
updateIssueType,
|
|
16842
17109
|
updateLicense,
|
|
16843
17110
|
updateOrCreateProject,
|
|
16844
17111
|
updateOrganizationAccess,
|