diff --git a/common/scripts/version.txt b/common/scripts/version.txt index 0be6b2d195..0d9ffca7ea 100644 --- a/common/scripts/version.txt +++ b/common/scripts/version.txt @@ -1 +1 @@ -"0.6.431" +"0.6.435" diff --git a/models/document/src/migration.ts b/models/document/src/migration.ts index cba17b93c6..97377ed95b 100644 --- a/models/document/src/migration.ts +++ b/models/document/src/migration.ts @@ -401,6 +401,10 @@ export const documentOperation: MigrateOperation = { { state: 'accounts-to-social-ids', func: migrateAccountsToSocialIds + }, + { + state: 'migrateEmbeddingsRefs', + func: migrateEmbeddingsRefs } ]) }, @@ -416,3 +420,13 @@ async function migrateEmbeddings (client: MigrationClient): Promise { ) await client.move(DOMAIN_DOCUMENT, { _class: attachment.class.Embedding }, DOMAIN_ATTACHMENT) } + +async function migrateEmbeddingsRefs (client: MigrationClient): Promise { + const _class = 'document:class:DocumentEmbedding' + + await client.update(DOMAIN_ACTIVITY, { attachedToClass: _class }, { attachedToClass: attachment.class.Embedding }) + await client.update(DOMAIN_ACTIVITY, { objectClass: _class }, { objectClass: attachment.class.Embedding }) + await client.update(DOMAIN_NOTIFICATION, { attachedToClass: _class }, { attachedToClass: attachment.class.Embedding }) + await client.update(DOMAIN_TX, { objectClass: _class }, { objectClass: attachment.class.Embedding }) + await client.update(DOMAIN_TX, { 'tx.objectClass': _class }, { 'tx.objectClass': attachment.class.Embedding }) +} diff --git a/packages/platform-rig/profiles/ui/tsconfig.json b/packages/platform-rig/profiles/ui/tsconfig.json index 5a81153571..b2ec4aec54 100644 --- a/packages/platform-rig/profiles/ui/tsconfig.json +++ b/packages/platform-rig/profiles/ui/tsconfig.json @@ -12,17 +12,9 @@ "esModuleInterop": true, "declarationMap": true, "sourceMap": true, - "lib": [ - "esnext", - "dom" - ], + "lib": ["esnext", "dom"], "incremental": true, - "types": [ - "jest" - ], + "types": ["jest"], "isolatedModules": true - }, - "exclude": [ - "node_modules/**" - ] -} \ No newline at end of file + } +} diff --git a/plugins/chunter-resources/src/components/ChannelInput.svelte b/plugins/chunter-resources/src/components/ChannelInput.svelte index 4590d6634e..ccc9c02594 100644 --- a/plugins/chunter-resources/src/components/ChannelInput.svelte +++ b/plugins/chunter-resources/src/components/ChannelInput.svelte @@ -45,7 +45,7 @@ if (res.length > 0) { return res } - clazz = hierarchy.getClass(_class).extends + clazz = hierarchy.getClass(clazz).extends } } catch (e) { console.error(e) diff --git a/plugins/controlled-documents-assets/lang/cs.json b/plugins/controlled-documents-assets/lang/cs.json index 72564318c7..34f47aca5f 100644 --- a/plugins/controlled-documents-assets/lang/cs.json +++ b/plugins/controlled-documents-assets/lang/cs.json @@ -21,7 +21,7 @@ "Major": "Hlavní", "Minor": "Vedlejší", "Patch": "Oprava", - "DocumentApprovals": "Revize a schválení", + "ValidationWorkflow": "Ověřovací pracovní postup", "ChangeOwner": "Změnit vlastníka dokumentu", "ChangeOwnerHintBeginning": "Převést vlastnictví", "ChangeOwnerHintEnd": "na jinou osobu.", diff --git a/plugins/controlled-documents-assets/lang/de.json b/plugins/controlled-documents-assets/lang/de.json index 3c44f68fda..0653e4b4c0 100644 --- a/plugins/controlled-documents-assets/lang/de.json +++ b/plugins/controlled-documents-assets/lang/de.json @@ -21,7 +21,7 @@ "Major": "Hauptversion", "Minor": "Nebenversion", "Patch": "Patch", - "DocumentApprovals": "Prüfungen und Genehmigungen", + "ValidationWorkflow": "Validierungsworkflow", "ChangeOwner": "Dokumentenbesitzer ändern", "ChangeOwnerHintBeginning": "Übertragen Sie den Besitz des", "ChangeOwnerHintEnd": "an eine andere Person.", diff --git a/plugins/controlled-documents-assets/lang/en.json b/plugins/controlled-documents-assets/lang/en.json index 9bbde8a196..dbd49df4b7 100644 --- a/plugins/controlled-documents-assets/lang/en.json +++ b/plugins/controlled-documents-assets/lang/en.json @@ -21,7 +21,7 @@ "Major": "Major", "Minor": "Minor", "Patch": "Patch", - "DocumentApprovals": "Reviews and Approvals", + "ValidationWorkflow": "Validation workflow", "ChangeOwner": "Change document owner", "ChangeOwnerHintBeginning": "Transfer ownership of the", "ChangeOwnerHintEnd": "to another person.", diff --git a/plugins/controlled-documents-assets/lang/fr.json b/plugins/controlled-documents-assets/lang/fr.json index 5ccba0a666..9b2ee9fe3f 100644 --- a/plugins/controlled-documents-assets/lang/fr.json +++ b/plugins/controlled-documents-assets/lang/fr.json @@ -21,7 +21,7 @@ "Major": "Majeur", "Minor": "Mineur", "Patch": "Correctif", - "DocumentApprovals": "Révisions et approbations", + "ValidationWorkflow": "Flux de validation", "ChangeOwner": "Changer le propriétaire du document", "ChangeOwnerHintBeginning": "Transférer la propriété du", "ChangeOwnerHintEnd": "à une autre personne.", diff --git a/plugins/controlled-documents-assets/lang/it.json b/plugins/controlled-documents-assets/lang/it.json index 5fcaf63e52..1ec19f9672 100644 --- a/plugins/controlled-documents-assets/lang/it.json +++ b/plugins/controlled-documents-assets/lang/it.json @@ -21,7 +21,7 @@ "Major": "Maggiore", "Minor": "Minore", "Patch": "Patch", - "DocumentApprovals": "Revisioni e Approvazioni", + "ValidationWorkflow": "Flusso di convalida", "ChangeOwner": "Cambia proprietario del documento", "ChangeOwnerHintBeginning": "Trasferisci la proprietà del", "ChangeOwnerHintEnd": "a un'altra persona.", diff --git a/plugins/controlled-documents-assets/lang/ru.json b/plugins/controlled-documents-assets/lang/ru.json index 9093c92ee1..dd99112ec0 100644 --- a/plugins/controlled-documents-assets/lang/ru.json +++ b/plugins/controlled-documents-assets/lang/ru.json @@ -21,7 +21,7 @@ "Major": "Мажорная", "Minor": "Минорная", "Patch": "Патч", - "DocumentApprovals": "Рецензии и утверждения", + "ValidationWorkflow": "Процесс валидации", "ChangeOwner": "Изменить владельца документа", "ChangeOwnerHintBeginning": "Передайте права владельца документа", "ChangeOwnerHintEnd": "другому лицу.", diff --git a/plugins/controlled-documents-assets/lang/zh.json b/plugins/controlled-documents-assets/lang/zh.json index f7ac73621a..d0b07eddbe 100644 --- a/plugins/controlled-documents-assets/lang/zh.json +++ b/plugins/controlled-documents-assets/lang/zh.json @@ -21,7 +21,7 @@ "Major": "主要", "Minor": "次要", "Patch": "补丁", - "DocumentApprovals": "审查和批准", + "ValidationWorkflow": "验证工作流程", "ChangeOwner": "更改文档所有者", "ChangeOwnerHintBeginning": "转移所有权", "ChangeOwnerHintEnd": "给其他人。", diff --git a/plugins/controlled-documents-resources/src/components/EditDocPanel.svelte b/plugins/controlled-documents-resources/src/components/EditDocPanel.svelte index 5af0cfa7d2..e11c2c176f 100644 --- a/plugins/controlled-documents-resources/src/components/EditDocPanel.svelte +++ b/plugins/controlled-documents-resources/src/components/EditDocPanel.svelte @@ -36,6 +36,7 @@ ControlledDocument, ControlledDocumentState, DocumentRequest, + DocumentState, Project } from '@hcengineering/controlled-documents' import { createEventDispatcher, onDestroy, onMount } from 'svelte' @@ -163,10 +164,15 @@ return } + const hierarchy = client.getHierarchy() + + const isReviewed = $controlledDocument.controlledState === ControlledDocumentState.Reviewed + const isApprovalRequest = hierarchy.isDerived(requestClass, documents.class.DocumentApprovalRequest) + const teamPopupData: TeamPopupData = { controlledDoc: $controlledDocument, requestClass, - requireSignature: true + requireSignature: !(isReviewed && isApprovalRequest) } showPopup(TeamPopup, teamPopupData, 'center') diff --git a/plugins/controlled-documents-resources/src/components/document/DocumentSignatories.svelte b/plugins/controlled-documents-resources/src/components/document/DocumentSignatories.svelte index 3d128dd2d9..390a3197cc 100644 --- a/plugins/controlled-documents-resources/src/components/document/DocumentSignatories.svelte +++ b/plugins/controlled-documents-resources/src/components/document/DocumentSignatories.svelte @@ -13,121 +13,68 @@ // limitations under the License. --> {#if expanded}
- {#each approvals as approver} + {#each approvals as approval} + {@const messages = approval.messages ?? []}
- - {#key approver.timestamp} - + + {#key approval.timestamp} - {#if approver.approved === 'approved'} + + {#if approval.state === 'approved'} - {:else if approver.approved === 'rejected'} + {:else if approval.state === 'rejected'} - {:else if approver.approved === 'cancelled'} + {:else if approval.state === 'cancelled'} - {:else if approver.approved === 'waiting'} + {:else if approval.state === 'waiting'} {/if} {/key}
- {#if rejectingMessage !== undefined && approver.approved === 'rejected'} -
{rejectingMessage}
- {/if} + {#each messages as m} +
{m.message}
+ {/each} {/each}
{/if} @@ -196,7 +137,7 @@ flex-shrink: 0; border-bottom: 1px solid var(--theme-divider-color); - .reject-message { + .approval-status-message { font-weight: 400; padding: 0.625rem 1rem 0 2rem; } diff --git a/plugins/controlled-documents-resources/src/components/document/right-panel/DocumentApprovalsTab.svelte b/plugins/controlled-documents-resources/src/components/document/right-panel/DocumentApprovalsTab.svelte index 8bdd6645c5..61149a69f5 100644 --- a/plugins/controlled-documents-resources/src/components/document/right-panel/DocumentApprovalsTab.svelte +++ b/plugins/controlled-documents-resources/src/components/document/right-panel/DocumentApprovalsTab.svelte @@ -2,56 +2,71 @@ import documents, { ControlledDocumentState, DocumentRequest, - DocumentState + DocumentState, + emptyBundle, + extractValidationWorkflow } from '@hcengineering/controlled-documents' import { SortingOrder } from '@hcengineering/core' import { createQuery, getClient } from '@hcengineering/presentation' import { Label, Scroller } from '@hcengineering/ui' - import { $controlledDocument as controlledDocument } from '../../../stores/editors/document' - import document from '../../../plugin' - import RightPanelTabHeader from './RightPanelTabHeader.svelte' - import DocumentApprovalItem from './DocumentApprovalItem.svelte' + import { personIdByAccountId } from '@hcengineering/contact-resources' + import documentsRes from '../../../plugin' + import { + $controlledDocument as controlledDocument, + $documentSnapshots as documentSnapshots + } from '../../../stores/editors/document' import DocumentApprovalGuideItem from './DocumentApprovalGuideItem.svelte' + import DocumentApprovalItem from './DocumentApprovalItem.svelte' + import RightPanelTabHeader from './RightPanelTabHeader.svelte' + import chunter, { ChatMessage } from '@hcengineering/chunter' const client = getClient() const hierarchy = client.getHierarchy() let requests: DocumentRequest[] = [] - let approvals: DocumentRequest[] = [] + let messages: ChatMessage[] = [] - $: approvals = requests.filter((p) => hierarchy.isDerived(p._class, documents.class.DocumentApprovalRequest)) + $: doc = $controlledDocument + const requestQuery = createQuery() + $: if (doc) { + requestQuery.query(documents.class.DocumentRequest, { attachedTo: doc._id }, (r) => { + requests = r + }) + } - const query = createQuery() - $: query.query( - documents.class.DocumentRequest, + const messageQuery = createQuery() + $: if (doc) { + messageQuery.query(chunter.class.ChatMessage, { attachedTo: { $in: requests.map((r) => r._id) } }, (r) => { + messages = r + }) + } + + $: workflow = extractValidationWorkflow( + hierarchy, { - _class: { - $in: [documents.class.DocumentApprovalRequest, documents.class.DocumentReviewRequest] - }, - attachedTo: $controlledDocument?._id + ...emptyBundle(), + ControlledDocument: doc ? [doc] : [], + DocumentRequest: requests, + DocumentSnapshot: $documentSnapshots, + ChatMessage: messages }, - (result) => { - requests = result - }, - { - sort: { createdOn: SortingOrder.Descending } - } + (ref) => $personIdByAccountId.get(ref) ) - $: hasGuide = - $controlledDocument?.state === DocumentState.Draft && - ($controlledDocument?.controlledState == null || - ![ - ControlledDocumentState.Approved, - ControlledDocumentState.Rejected, - ControlledDocumentState.InApproval - ].includes($controlledDocument?.controlledState)) + $: validationStates = ((doc ? workflow.get(doc._id) : []) ?? []).slice() + + const noGuideStates: (ControlledDocumentState | undefined)[] = [ + ControlledDocumentState.Approved, + ControlledDocumentState.Rejected, + ControlledDocumentState.InApproval + ] + $: hasGuide = doc && doc.state === DocumentState.Draft && !noGuideStates.includes(doc.controlledState) - @@ -60,13 +75,13 @@ {/if} - {#if requests.length > 0} - {#each requests as object, idx} - + {#if validationStates.length > 0} + {#each validationStates as state, idx} + {/each} {/if} - {#if !hasGuide && approvals.length === 0} -
+ {#if !hasGuide && requests.length === 0} +
{/if}
diff --git a/plugins/controlled-documents-resources/src/components/document/right-panel/info/DocumentFlatHierarchy.svelte b/plugins/controlled-documents-resources/src/components/document/right-panel/info/DocumentFlatHierarchy.svelte index 4f144783f2..b08c388105 100644 --- a/plugins/controlled-documents-resources/src/components/document/right-panel/info/DocumentFlatHierarchy.svelte +++ b/plugins/controlled-documents-resources/src/components/document/right-panel/info/DocumentFlatHierarchy.svelte @@ -14,183 +14,70 @@ --> {#if levels.length > 0} {@const [firstDocs, firstHltd] = levels[0]}
- {#each firstDocs as doc} - + {#each firstDocs as bundle} + {/each} {#if levels.length > 1} {@const [secondDocs, secondHltd] = levels[1]}
- {#each secondDocs as doc} - + {#each secondDocs as bundle} + {/each} {#if levels.length > 2} {@const [thirdDocs, thirdHltd] = levels[2]}
- {#each thirdDocs as doc} - + {#each thirdDocs as bundle} + {/each}
{/if} @@ -214,5 +101,8 @@ padding: 0 1rem; border-left: 2px solid var(--theme-navpanel-border); gap: 0.25rem; + + padding-left: 0.25rem; + margin-left: 0.75rem; } diff --git a/plugins/controlled-documents-resources/src/components/document/right-panel/info/DocumentFlatTreeElement.svelte b/plugins/controlled-documents-resources/src/components/document/right-panel/info/DocumentFlatTreeElement.svelte index d7e274b9c0..85bf78e8ad 100644 --- a/plugins/controlled-documents-resources/src/components/document/right-panel/info/DocumentFlatTreeElement.svelte +++ b/plugins/controlled-documents-resources/src/components/document/right-panel/info/DocumentFlatTreeElement.svelte @@ -14,17 +14,25 @@ --> @@ -32,7 +40,8 @@
{ - const loc = getProjectDocumentLink(doc, project) + if (!document) return + const loc = getProjectDocumentLink(document, project) navigate(loc) }} > @@ -48,7 +57,7 @@
{/if} - {getDocumentName(doc)} + {document ? getDocumentName(document) : meta.title}
diff --git a/plugins/controlled-documents-resources/src/components/hierarchy/DocHierarchyLevel.svelte b/plugins/controlled-documents-resources/src/components/hierarchy/DocHierarchyLevel.svelte index 05661ebaf2..58e2665ea8 100644 --- a/plugins/controlled-documents-resources/src/components/hierarchy/DocHierarchyLevel.svelte +++ b/plugins/controlled-documents-resources/src/components/hierarchy/DocHierarchyLevel.svelte @@ -13,23 +13,20 @@ // limitations under the License. --> -{#each docs as prjdoc} - {@const pjmeta = projectMetaById.get(prjdoc.attachedTo)} - {@const doc = prjdoc.$lookup?.document} - {@const metaid = pjmeta?.meta} - {@const meta = metaid ? docsMetaById.get(metaid) : undefined} +{#each documentIds as metaid} + {@const bundle = tree.bundleOf(metaid)} + {@const prjdoc = bundle?.ProjectDocument[0]} + {@const doc = bundle?.ControlledDocument[0]} + {@const meta = bundle?.DocumentMeta[0]} {@const title = doc ? getDocumentName(doc) : meta?.title ?? ''} - {@const docid = doc?._id ?? prjdoc._id} - {@const isFolder = prjdoc.document === documents.ids.Folder} - {@const isObsolete = doc ? doc.state === DocumentState.Obsolete : false} - {@const children = metaid ? childrenByParent[metaid] ?? [] : []} + {@const docid = doc?._id ?? prjdoc?._id} + {@const isFolder = prjdoc?.document === documents.ids.Folder} + {@const children = tree.childrenOf(metaid)} + {@const isRemoved = doc && removeStates.includes(doc.state)} - {#if metaid && (!isObsolete || children.length > 0)} + {#if prjdoc && metaid} {@const isDraggedOver = draggedOver === metaid}
{#if isDraggedOver} @@ -160,7 +72,7 @@ _id={docid} icon={isFolder ? documents.icon.Folder : documents.icon.Document} iconProps={{ - fill: isObsolete ? 'var(--dangerous-bg-color)' : 'currentColor' + fill: isRemoved ? 'var(--dangerous-bg-color)' : 'currentColor' }} {title} selected={selected === docid || selected === prjdoc._id} @@ -190,8 +102,8 @@ {#if children.length} { dispatch('selected', space) }} > - + diff --git a/plugins/controlled-documents-resources/src/components/hierarchy/DocumentSpacePresenter.svelte b/plugins/controlled-documents-resources/src/components/hierarchy/DocumentSpacePresenter.svelte index 14db33b85b..585623a41d 100644 --- a/plugins/controlled-documents-resources/src/components/hierarchy/DocumentSpacePresenter.svelte +++ b/plugins/controlled-documents-resources/src/components/hierarchy/DocumentSpacePresenter.svelte @@ -13,20 +13,6 @@ // limitations under the License. -->