@overmap-ai/core 1.0.58-asset-description.10 → 1.0.58-csv-parse-fix.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/forms/typings.d.ts +1 -1
- package/dist/overmap-core.js +157 -114
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +157 -114
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/UserFormService.d.ts +7 -11
- package/dist/store/slices/formSlice.d.ts +2 -76
- package/dist/typings/models/forms.d.ts +6 -10
- package/package.json +1 -1
package/dist/forms/typings.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface BaseSerializedField<TIdentifier extends FieldTypeIdentifier = F
|
|
|
28
28
|
image?: File | Promise<File>;
|
|
29
29
|
}
|
|
30
30
|
/** All the possible field values */
|
|
31
|
-
export type FieldValue = string | number | boolean | string[] |
|
|
31
|
+
export type FieldValue = string | number | boolean | string[] | File[] | Date | Marker | null;
|
|
32
32
|
export interface SerializedCondition<TValue extends FieldValue = FieldValue> {
|
|
33
33
|
identifier: string;
|
|
34
34
|
value: TValue;
|
package/dist/overmap-core.js
CHANGED
|
@@ -3832,17 +3832,15 @@ const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
|
3832
3832
|
(_state, search) => search
|
|
3833
3833
|
],
|
|
3834
3834
|
(userForms, revisions, search) => {
|
|
3835
|
-
const { searchTerm, maxResults, favorites,
|
|
3835
|
+
const { searchTerm, maxResults, favorites, organization } = search;
|
|
3836
3836
|
const favoriteMatches = [];
|
|
3837
3837
|
const regularMatches = [];
|
|
3838
3838
|
for (const [userFormId, userForm] of Object.entries(userForms)) {
|
|
3839
3839
|
if (favorites !== void 0 && userForm.favorite != favorites)
|
|
3840
3840
|
continue;
|
|
3841
|
-
if (Number.isInteger(
|
|
3841
|
+
if (Number.isInteger(organization) && organization !== userForm.organization) {
|
|
3842
3842
|
continue;
|
|
3843
3843
|
}
|
|
3844
|
-
if (Number.isInteger(owner_user) && owner_user !== userForm.owner_user)
|
|
3845
|
-
continue;
|
|
3846
3844
|
const latestRevision = _selectLatestFormRevision(revisions, userFormId);
|
|
3847
3845
|
if (latestRevision.title.toLowerCase().includes(searchTerm.toLowerCase())) {
|
|
3848
3846
|
if (userForm.favorite) {
|
|
@@ -4627,10 +4625,6 @@ function handleWorkspaceRemoval(draft, action) {
|
|
|
4627
4625
|
throw new Error(`Failed to update index_workspace of issue ${issue.offline_id} to main workspace`);
|
|
4628
4626
|
}
|
|
4629
4627
|
}
|
|
4630
|
-
const indexedForms = Object.values(draft.formReducer.forms).filter((form) => form.index_workspace === workspaceId);
|
|
4631
|
-
for (const form of indexedForms) {
|
|
4632
|
-
form.index_workspace = mainWorkspace.offline_id;
|
|
4633
|
-
}
|
|
4634
4628
|
}
|
|
4635
4629
|
const rootReducer = (state, action) => {
|
|
4636
4630
|
if (action.type === "auth/setLoggedIn" && !action.payload) {
|
|
@@ -5489,6 +5483,7 @@ class AssetService extends BaseApiService {
|
|
|
5489
5483
|
bulkAdd(assetsToCreate, workspaceId, assetTypeId, batchSize) {
|
|
5490
5484
|
const { store } = this.client;
|
|
5491
5485
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5486
|
+
const transactionId = v4();
|
|
5492
5487
|
const assetBatches = chunkArray(assetsToCreate, batchSize).map((assetBatch) => {
|
|
5493
5488
|
const assetPayloads = assetBatch.map((assetPayload) => {
|
|
5494
5489
|
return offline({
|
|
@@ -5499,6 +5494,7 @@ class AssetService extends BaseApiService {
|
|
|
5499
5494
|
return {
|
|
5500
5495
|
batchId: v4(),
|
|
5501
5496
|
payload: {
|
|
5497
|
+
transaction_id: transactionId,
|
|
5502
5498
|
assets: assetPayloads
|
|
5503
5499
|
}
|
|
5504
5500
|
};
|
|
@@ -7023,8 +7019,7 @@ class ProjectService extends BaseApiService {
|
|
|
7023
7019
|
});
|
|
7024
7020
|
}
|
|
7025
7021
|
}
|
|
7026
|
-
const separateImageFromFields = async (
|
|
7027
|
-
const { fields } = payload;
|
|
7022
|
+
const separateImageFromFields = async (fields) => {
|
|
7028
7023
|
const images = {};
|
|
7029
7024
|
const newFields = [];
|
|
7030
7025
|
for (const section of fields) {
|
|
@@ -7050,11 +7045,7 @@ const separateImageFromFields = async (payload) => {
|
|
|
7050
7045
|
}
|
|
7051
7046
|
newFields.push({ ...section, fields: newSectionFields });
|
|
7052
7047
|
}
|
|
7053
|
-
|
|
7054
|
-
...payload,
|
|
7055
|
-
fields: newFields
|
|
7056
|
-
};
|
|
7057
|
-
return { payloadWithoutImage, images };
|
|
7048
|
+
return { fields: newFields, images };
|
|
7058
7049
|
};
|
|
7059
7050
|
class UserFormService extends BaseApiService {
|
|
7060
7051
|
constructor() {
|
|
@@ -7088,93 +7079,90 @@ class UserFormService extends BaseApiService {
|
|
|
7088
7079
|
});
|
|
7089
7080
|
});
|
|
7090
7081
|
}
|
|
7091
|
-
async add(
|
|
7092
|
-
if (!!ownerUser === !!ownerOrganization) {
|
|
7093
|
-
throw new Error("Exactly one of ownerUser and ownerOrganization must be defined.");
|
|
7094
|
-
}
|
|
7095
|
-
const ownerAttrs = {
|
|
7096
|
-
owner_user: ownerUser,
|
|
7097
|
-
owner_organization: ownerOrganization
|
|
7098
|
-
};
|
|
7099
|
-
const currentUser = state.userReducer.currentUser;
|
|
7100
|
-
const activeWorkspaceId = state.workspaceReducer.activeWorkspaceId;
|
|
7101
|
-
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7102
|
-
const offlineFormPayload = offline({ ...ownerAttrs });
|
|
7103
|
-
const offlineRevisionPayload = offline({ ...initialRevision, submitted_at: submittedAt });
|
|
7104
|
-
const retForm = {
|
|
7105
|
-
...offlineFormPayload,
|
|
7106
|
-
index_workspace: activeWorkspaceId,
|
|
7107
|
-
favorite: true,
|
|
7108
|
-
submitted_at: submittedAt,
|
|
7109
|
-
created_by: currentUser.id,
|
|
7110
|
-
...assetTypeId && { asset_type: assetTypeId },
|
|
7111
|
-
...issueTypeId && { issue_type: issueTypeId },
|
|
7112
|
-
...ownerAttrs
|
|
7113
|
-
};
|
|
7114
|
-
const { payloadWithoutImage, images } = await separateImageFromFields(offlineRevisionPayload);
|
|
7115
|
-
const retRevision = {
|
|
7116
|
-
...payloadWithoutImage,
|
|
7117
|
-
created_by: currentUser.id,
|
|
7118
|
-
form: retForm.offline_id,
|
|
7119
|
-
revision: 0,
|
|
7120
|
-
submitted_at: submittedAt
|
|
7121
|
-
};
|
|
7082
|
+
async add(ownerId, form, initialRevision, urlPrefix) {
|
|
7122
7083
|
const { store } = this.client;
|
|
7123
|
-
|
|
7124
|
-
|
|
7084
|
+
const { fields, images } = await separateImageFromFields(initialRevision.fields);
|
|
7085
|
+
const offlineFormRevision = offline({
|
|
7086
|
+
...initialRevision,
|
|
7087
|
+
fields,
|
|
7088
|
+
created_by: form.created_by,
|
|
7089
|
+
form: form.offline_id,
|
|
7090
|
+
submitted_at: form.submitted_at,
|
|
7091
|
+
revision: "Pending"
|
|
7092
|
+
});
|
|
7093
|
+
store.dispatch(addForm(form));
|
|
7094
|
+
store.dispatch(addFormRevision(offlineFormRevision));
|
|
7125
7095
|
const formPromise = this.client.enqueueRequest({
|
|
7126
7096
|
description: "Create form",
|
|
7127
7097
|
method: HttpMethod.POST,
|
|
7128
|
-
url,
|
|
7129
|
-
queryParams: activeWorkspaceId ? {
|
|
7130
|
-
workspace_id: activeWorkspaceId
|
|
7131
|
-
} : void 0,
|
|
7098
|
+
url: urlPrefix,
|
|
7132
7099
|
payload: {
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7100
|
+
// Sending exactly what is currently needed for the endpoint
|
|
7101
|
+
offline_id: form.offline_id,
|
|
7102
|
+
initial_revision: {
|
|
7103
|
+
offline_id: offlineFormRevision.offline_id,
|
|
7104
|
+
submitted_at: offlineFormRevision.submitted_at,
|
|
7105
|
+
title: offlineFormRevision.title,
|
|
7106
|
+
description: offlineFormRevision.description,
|
|
7107
|
+
fields: offlineFormRevision.fields
|
|
7108
|
+
}
|
|
7137
7109
|
},
|
|
7138
|
-
blockers:
|
|
7139
|
-
blocks: [
|
|
7110
|
+
blockers: [ownerId],
|
|
7111
|
+
blocks: [form.offline_id, offlineFormRevision.offline_id]
|
|
7140
7112
|
});
|
|
7141
|
-
const attachImagesPromises = this.getAttachImagePromises(images,
|
|
7113
|
+
const attachImagesPromises = this.getAttachImagePromises(images, offlineFormRevision.offline_id);
|
|
7142
7114
|
void formPromise.catch((e) => {
|
|
7143
|
-
store.dispatch(deleteForm(
|
|
7144
|
-
store.dispatch(deleteFormRevision(
|
|
7115
|
+
store.dispatch(deleteForm(form.offline_id));
|
|
7116
|
+
store.dispatch(deleteFormRevision(offlineFormRevision.offline_id));
|
|
7145
7117
|
throw e;
|
|
7146
7118
|
});
|
|
7147
7119
|
const settledPromise = Promise.all([formPromise, ...attachImagesPromises]).then(() => formPromise);
|
|
7148
|
-
return [
|
|
7120
|
+
return [form, offlineFormRevision, formPromise, settledPromise];
|
|
7149
7121
|
}
|
|
7150
|
-
|
|
7122
|
+
addForOrganization(organizationId, initialRevision) {
|
|
7151
7123
|
const state = this.client.store.getState();
|
|
7152
|
-
const
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7124
|
+
const offlineForm = offline({
|
|
7125
|
+
favorite: false,
|
|
7126
|
+
created_by: state.userReducer.currentUser.id,
|
|
7127
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7128
|
+
organization: organizationId
|
|
7129
|
+
});
|
|
7130
|
+
return this.add(
|
|
7131
|
+
organizationId.toString(),
|
|
7132
|
+
offlineForm,
|
|
7158
7133
|
initialRevision,
|
|
7159
|
-
`/
|
|
7160
|
-
void 0,
|
|
7161
|
-
activeOrganizationId,
|
|
7162
|
-
attachedTo && "assetTypeId" in attachedTo ? attachedTo.assetTypeId : void 0,
|
|
7163
|
-
attachedTo && "issueTypeId" in attachedTo ? attachedTo.issueTypeId : void 0
|
|
7134
|
+
`/organizations/${organizationId}/create-form/`
|
|
7164
7135
|
);
|
|
7165
7136
|
}
|
|
7166
|
-
|
|
7137
|
+
addForProject(projectId, initialRevision) {
|
|
7167
7138
|
const state = this.client.store.getState();
|
|
7168
|
-
const
|
|
7169
|
-
|
|
7170
|
-
state,
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
);
|
|
7139
|
+
const offlineForm = offline({
|
|
7140
|
+
favorite: false,
|
|
7141
|
+
created_by: state.userReducer.currentUser.id,
|
|
7142
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7143
|
+
project: projectId
|
|
7144
|
+
});
|
|
7145
|
+
return this.add(projectId.toString(), offlineForm, initialRevision, `/projects/${projectId}/create-form/`);
|
|
7146
|
+
}
|
|
7147
|
+
addForIssueType(issueTypeId, initialRevision) {
|
|
7148
|
+
const state = this.client.store.getState();
|
|
7149
|
+
const offlineForm = offline({
|
|
7150
|
+
favorite: false,
|
|
7151
|
+
created_by: state.userReducer.currentUser.id,
|
|
7152
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7153
|
+
issue_type: issueTypeId
|
|
7154
|
+
});
|
|
7155
|
+
return this.add(issueTypeId, offlineForm, initialRevision, `/issues/types/${issueTypeId}/create-form/`);
|
|
7156
|
+
}
|
|
7157
|
+
addForAssetType(assetTypeId, initialRevision) {
|
|
7158
|
+
const state = this.client.store.getState();
|
|
7159
|
+
const offlineForm = offline({
|
|
7160
|
+
favorite: false,
|
|
7161
|
+
created_by: state.userReducer.currentUser.id,
|
|
7162
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7163
|
+
asset_type: assetTypeId
|
|
7164
|
+
});
|
|
7165
|
+
return this.add(assetTypeId, offlineForm, initialRevision, `/assets/types/${assetTypeId}/create-form/`);
|
|
7178
7166
|
}
|
|
7179
7167
|
async createRevision(formId2, revision) {
|
|
7180
7168
|
const offlineRevision = offline(revision);
|
|
@@ -7185,9 +7173,10 @@ class UserFormService extends BaseApiService {
|
|
|
7185
7173
|
throw new Error("Cannot create form revision when there is no active project.");
|
|
7186
7174
|
}
|
|
7187
7175
|
const currentUserId = state.userReducer.currentUser.id;
|
|
7188
|
-
const {
|
|
7176
|
+
const { fields, images } = await separateImageFromFields(offlineRevision.fields);
|
|
7189
7177
|
const fullRevision = {
|
|
7190
|
-
...
|
|
7178
|
+
...offlineRevision,
|
|
7179
|
+
fields,
|
|
7191
7180
|
created_by: currentUserId,
|
|
7192
7181
|
revision: "Pending",
|
|
7193
7182
|
form: formId2,
|
|
@@ -7198,9 +7187,14 @@ class UserFormService extends BaseApiService {
|
|
|
7198
7187
|
description: "Create form revision",
|
|
7199
7188
|
method: HttpMethod.PATCH,
|
|
7200
7189
|
url: `/forms/${formId2}/`,
|
|
7201
|
-
payload: {
|
|
7202
|
-
|
|
7203
|
-
|
|
7190
|
+
payload: {
|
|
7191
|
+
initial_revision: {
|
|
7192
|
+
offline_id: fullRevision.offline_id,
|
|
7193
|
+
submitted_at: fullRevision.submitted_at,
|
|
7194
|
+
title: fullRevision.title,
|
|
7195
|
+
description: fullRevision.description,
|
|
7196
|
+
fields: fullRevision.fields
|
|
7197
|
+
}
|
|
7204
7198
|
},
|
|
7205
7199
|
blockers: [formId2],
|
|
7206
7200
|
blocks: [offlineRevision.offline_id]
|
|
@@ -7285,16 +7279,68 @@ class UserFormService extends BaseApiService {
|
|
|
7285
7279
|
}
|
|
7286
7280
|
async refreshStore() {
|
|
7287
7281
|
const { store } = this.client;
|
|
7288
|
-
const
|
|
7289
|
-
|
|
7282
|
+
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
7283
|
+
if (!activeProjectId) {
|
|
7284
|
+
throw new Error("No active project");
|
|
7285
|
+
}
|
|
7286
|
+
const forms = [];
|
|
7287
|
+
const revisions = [];
|
|
7288
|
+
const attachments = [];
|
|
7289
|
+
const projectFormsResult = await this.client.enqueueRequest({
|
|
7290
|
+
description: "Fetch project forms",
|
|
7290
7291
|
method: HttpMethod.GET,
|
|
7291
|
-
url: `/
|
|
7292
|
-
blockers: [],
|
|
7292
|
+
url: `/projects/${activeProjectId}/forms/`,
|
|
7293
|
+
blockers: [activeProjectId.toString()],
|
|
7293
7294
|
blocks: []
|
|
7294
7295
|
});
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7296
|
+
for (const form of projectFormsResult.forms)
|
|
7297
|
+
forms.push(form);
|
|
7298
|
+
for (const revision of projectFormsResult.revisions)
|
|
7299
|
+
revisions.push(revision);
|
|
7300
|
+
for (const attachment of projectFormsResult.attachments)
|
|
7301
|
+
attachments.push(attachment);
|
|
7302
|
+
const organizationFormsResult = await this.client.enqueueRequest({
|
|
7303
|
+
description: "Fetch organization forms",
|
|
7304
|
+
method: HttpMethod.GET,
|
|
7305
|
+
url: `/projects/${activeProjectId}/organizations/forms/`,
|
|
7306
|
+
blockers: [activeProjectId.toString()],
|
|
7307
|
+
blocks: []
|
|
7308
|
+
});
|
|
7309
|
+
for (const form of organizationFormsResult.forms)
|
|
7310
|
+
forms.push(form);
|
|
7311
|
+
for (const revision of organizationFormsResult.revisions)
|
|
7312
|
+
revisions.push(revision);
|
|
7313
|
+
for (const attachment of organizationFormsResult.attachments)
|
|
7314
|
+
attachments.push(attachment);
|
|
7315
|
+
const assetTypeFormsResult = await this.client.enqueueRequest({
|
|
7316
|
+
description: "Fetch asset type forms",
|
|
7317
|
+
method: HttpMethod.GET,
|
|
7318
|
+
url: `/projects/${activeProjectId}/asset-types/forms/`,
|
|
7319
|
+
blockers: [activeProjectId.toString()],
|
|
7320
|
+
blocks: []
|
|
7321
|
+
});
|
|
7322
|
+
for (const form of assetTypeFormsResult.forms)
|
|
7323
|
+
forms.push(form);
|
|
7324
|
+
for (const revision of assetTypeFormsResult.latest_revisions)
|
|
7325
|
+
revisions.push(revision);
|
|
7326
|
+
for (const attachment of assetTypeFormsResult.attachments)
|
|
7327
|
+
attachments.push(attachment);
|
|
7328
|
+
const issueTypeFormsResult = await this.client.enqueueRequest({
|
|
7329
|
+
description: "Fetch issue type forms",
|
|
7330
|
+
method: HttpMethod.GET,
|
|
7331
|
+
url: `/projects/${activeProjectId}/issue-types/forms/`,
|
|
7332
|
+
blockers: [activeProjectId.toString()],
|
|
7333
|
+
blocks: []
|
|
7334
|
+
});
|
|
7335
|
+
for (const form of issueTypeFormsResult.forms)
|
|
7336
|
+
forms.push(form);
|
|
7337
|
+
for (const revision of issueTypeFormsResult.latest_revisions)
|
|
7338
|
+
revisions.push(revision);
|
|
7339
|
+
for (const attachment of issueTypeFormsResult.attachments)
|
|
7340
|
+
attachments.push(attachment);
|
|
7341
|
+
store.dispatch(setForms(forms));
|
|
7342
|
+
store.dispatch(setFormRevisions(revisions));
|
|
7343
|
+
store.dispatch(setFormRevisionAttachments(attachments));
|
|
7298
7344
|
}
|
|
7299
7345
|
}
|
|
7300
7346
|
const isArrayOfFiles = (value) => {
|
|
@@ -7403,6 +7449,7 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7403
7449
|
const allFilesRecord = {};
|
|
7404
7450
|
const { values: fileSeperatedCommonFieldValues, files: commonFiles } = separateFilesFromValues(commonFieldValues);
|
|
7405
7451
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7452
|
+
const transactionId = v4();
|
|
7406
7453
|
const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset), batchSize);
|
|
7407
7454
|
const bulkAddBatches = await Promise.all(
|
|
7408
7455
|
assetIdBatches.map(async (assetIdBatch) => {
|
|
@@ -7447,6 +7494,7 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7447
7494
|
return {
|
|
7448
7495
|
batchId,
|
|
7449
7496
|
payload: {
|
|
7497
|
+
transaction_id: transactionId,
|
|
7450
7498
|
form_data: fileSeperatedCommonFieldValues,
|
|
7451
7499
|
submitted_at: submittedAt,
|
|
7452
7500
|
submissions: submissionPayloads,
|
|
@@ -8864,6 +8912,9 @@ class BaseField extends BaseFormElement {
|
|
|
8864
8912
|
return [...this.formValidators];
|
|
8865
8913
|
}
|
|
8866
8914
|
encodeValueToJson(value) {
|
|
8915
|
+
if (typeof value === "string") {
|
|
8916
|
+
return value;
|
|
8917
|
+
}
|
|
8867
8918
|
return JSON.stringify(value);
|
|
8868
8919
|
}
|
|
8869
8920
|
decodeJsonToValue(json) {
|
|
@@ -13243,7 +13294,10 @@ const MultiStringInput = memo((props) => {
|
|
|
13243
13294
|
mb: "1",
|
|
13244
13295
|
asChild: true,
|
|
13245
13296
|
children: /* @__PURE__ */ jsxs(Badge, { color: "gray", size: "2", children: [
|
|
13246
|
-
/* @__PURE__ */ jsx("span", {
|
|
13297
|
+
/* @__PURE__ */ jsx("span", {
|
|
13298
|
+
// TODO: remove this, its just a saftey check for old compatibility of what was acceptable as a value for multi string
|
|
13299
|
+
children: typeof option === "object" && "label" in option ? option.label : option
|
|
13300
|
+
}),
|
|
13247
13301
|
/* @__PURE__ */ jsx(
|
|
13248
13302
|
IconButton,
|
|
13249
13303
|
{
|
|
@@ -15352,7 +15406,6 @@ const styles$3 = {
|
|
|
15352
15406
|
regularIcon
|
|
15353
15407
|
};
|
|
15354
15408
|
const orgOptionPrefix = "organization:";
|
|
15355
|
-
const userOptionPrefix = "user:";
|
|
15356
15409
|
const FormBrowser = memo(
|
|
15357
15410
|
forwardRef((props, ref) => {
|
|
15358
15411
|
const { maxResults = 20, ...entryProps } = props;
|
|
@@ -15363,9 +15416,7 @@ const FormBrowser = memo(
|
|
|
15363
15416
|
const ret = { maxResults, searchTerm: filter };
|
|
15364
15417
|
if (ownerFilter) {
|
|
15365
15418
|
if (ownerFilter.startsWith(orgOptionPrefix)) {
|
|
15366
|
-
ret.
|
|
15367
|
-
} else if (ownerFilter.startsWith(userOptionPrefix)) {
|
|
15368
|
-
ret.owner_user = parseInt(ownerFilter.slice(userOptionPrefix.length));
|
|
15419
|
+
ret.organization = parseInt(ownerFilter.slice(orgOptionPrefix.length));
|
|
15369
15420
|
}
|
|
15370
15421
|
}
|
|
15371
15422
|
return ret;
|
|
@@ -15390,14 +15441,10 @@ const FormBrowser = memo(
|
|
|
15390
15441
|
const state = sdk.store.getState();
|
|
15391
15442
|
const accumulator = {};
|
|
15392
15443
|
for (const form of attachableUserFormMapping) {
|
|
15393
|
-
const organization = selectOrganization(form.
|
|
15444
|
+
const organization = selectOrganization(form.organization || -1)(state);
|
|
15394
15445
|
if (organization) {
|
|
15395
15446
|
accumulator[`${orgOptionPrefix}${organization.id}`] = organization.name;
|
|
15396
15447
|
}
|
|
15397
|
-
const user = selectUser(form.owner_user || -1)(state);
|
|
15398
|
-
if (user) {
|
|
15399
|
-
accumulator[`${userOptionPrefix}${user.id}`] = user.username;
|
|
15400
|
-
}
|
|
15401
15448
|
}
|
|
15402
15449
|
return Object.entries(accumulator).map(([value, label]) => ({ itemContent: label, value }));
|
|
15403
15450
|
}, [sdk.store, attachableUserFormMapping]);
|
|
@@ -15439,11 +15486,7 @@ const FormBrowser = memo(
|
|
|
15439
15486
|
const FormBrowserEntry = (props) => {
|
|
15440
15487
|
var _a2;
|
|
15441
15488
|
const { form, onSelectForm, isFavoriteEditable, handleToggleFavorite } = props;
|
|
15442
|
-
const ownerOrganization = (_a2 = useAppSelector(selectOrganization(form.
|
|
15443
|
-
const ownerUser = useAppSelector(selectUser(form.owner_user || -1));
|
|
15444
|
-
const currentUserId = useAppSelector(selectCurrentUser).id;
|
|
15445
|
-
const ownedByCurrentUser = !!ownerUser && ownerUser.id === currentUserId;
|
|
15446
|
-
const owner = ownerOrganization ?? (ownedByCurrentUser ? "You" : ownerUser == null ? void 0 : ownerUser.username) ?? "Unknown";
|
|
15489
|
+
const ownerOrganization = (_a2 = useAppSelector(selectOrganization(form.organization || -1))) == null ? void 0 : _a2.name;
|
|
15447
15490
|
const handleFavoriteClick = useCallback(
|
|
15448
15491
|
(e) => {
|
|
15449
15492
|
e.stopPropagation();
|
|
@@ -15474,10 +15517,10 @@ const FormBrowserEntry = (props) => {
|
|
|
15474
15517
|
/* @__PURE__ */ jsx(Text$1, { noWrap: true, children: form.latestRevision.title }),
|
|
15475
15518
|
form.latestRevision.description && /* @__PURE__ */ jsx(RiIcon, { icon: "RiQuestionLine" })
|
|
15476
15519
|
] }),
|
|
15477
|
-
|
|
15520
|
+
ownerOrganization && /* @__PURE__ */ jsxs(Flex$1, { align: "center", gap: "2", children: [
|
|
15478
15521
|
/* @__PURE__ */ jsx(RiIcon, { icon: "RiUserLine" }),
|
|
15479
15522
|
" ",
|
|
15480
|
-
|
|
15523
|
+
ownerOrganization
|
|
15481
15524
|
] })
|
|
15482
15525
|
] })
|
|
15483
15526
|
}
|