mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-26 11:34:58 +02:00
UBERF-11415: Optimise contact UI stores (#9185)
This commit is contained in:
+14
-14
@@ -14,11 +14,12 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Employee, Person, formatName } from '@hcengineering/contact'
|
||||
import { employeeByIdStore, personRefByPersonIdStore } from '@hcengineering/contact-resources'
|
||||
import { employeeByIdStore } from '@hcengineering/contact-resources'
|
||||
import documents, {
|
||||
ControlledDocument,
|
||||
DocumentRequest,
|
||||
emptyBundle,
|
||||
extractValidationWorkflow
|
||||
DocumentValidationState,
|
||||
emptyBundle
|
||||
} from '@hcengineering/controlled-documents'
|
||||
import { Ref } from '@hcengineering/core'
|
||||
import { IntlString } from '@hcengineering/platform'
|
||||
@@ -30,7 +31,7 @@
|
||||
$controlledDocument as controlledDocument,
|
||||
$documentSnapshots as documentSnapshots
|
||||
} from '../../stores/editors/document/editor'
|
||||
import { formatSignatureDate } from '../../utils'
|
||||
import { formatSignatureDate, extractValidationWorkflow } from '../../utils'
|
||||
|
||||
let requests: DocumentRequest[] = []
|
||||
|
||||
@@ -45,16 +46,15 @@
|
||||
})
|
||||
}
|
||||
|
||||
$: workflow = extractValidationWorkflow(
|
||||
hierarchy,
|
||||
{
|
||||
...emptyBundle(),
|
||||
ControlledDocument: doc ? [doc] : [],
|
||||
DocumentRequest: requests,
|
||||
DocumentSnapshot: $documentSnapshots
|
||||
},
|
||||
(ref) => $personRefByPersonIdStore.get(ref)
|
||||
)
|
||||
let workflow: Map<Ref<ControlledDocument>, DocumentValidationState[]>
|
||||
$: void extractValidationWorkflow(hierarchy, {
|
||||
...emptyBundle(),
|
||||
ControlledDocument: doc ? [doc] : [],
|
||||
DocumentRequest: requests,
|
||||
DocumentSnapshot: $documentSnapshots
|
||||
}).then((res) => {
|
||||
workflow = res
|
||||
})
|
||||
|
||||
$: state = (doc ? workflow?.get(doc._id) ?? [] : [])[0]
|
||||
$: signers = (state?.approvals ?? [])
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
<script lang="ts">
|
||||
import documents, { Document } from '@hcengineering/controlled-documents'
|
||||
import { Employee } from '@hcengineering/contact'
|
||||
import { EmployeeBox, EmployeePresenter, personRefByAccountUuidStore } from '@hcengineering/contact-resources'
|
||||
import { EmployeeBox, EmployeePresenter, employeeRefByAccountUuidStore } from '@hcengineering/contact-resources'
|
||||
import core, { Ref, Space, notEmpty } from '@hcengineering/core'
|
||||
import presentation, { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { Button, Icon, Label } from '@hcengineering/ui'
|
||||
@@ -60,7 +60,7 @@
|
||||
$: isOwner = isDocOwner(object)
|
||||
|
||||
$: members = space?.members ?? []
|
||||
$: employees = members.map((m) => $personRefByAccountUuidStore.get(m) as Ref<Employee>).filter(notEmpty)
|
||||
$: employees = members.map((m) => $employeeRefByAccountUuidStore.get(m) as Ref<Employee>).filter(notEmpty)
|
||||
|
||||
$: docQuery = space?.private ?? false ? { active: true, _id: { $in: employees } } : { active: true }
|
||||
</script>
|
||||
|
||||
+16
-15
@@ -1,17 +1,17 @@
|
||||
<script lang="ts">
|
||||
import documents, {
|
||||
ControlledDocument,
|
||||
ControlledDocumentState,
|
||||
DocumentRequest,
|
||||
DocumentState,
|
||||
emptyBundle,
|
||||
extractValidationWorkflow
|
||||
DocumentValidationState,
|
||||
emptyBundle
|
||||
} from '@hcengineering/controlled-documents'
|
||||
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { Label, Scroller } from '@hcengineering/ui'
|
||||
|
||||
import chunter, { ChatMessage } from '@hcengineering/chunter'
|
||||
import { personRefByPersonIdStore } from '@hcengineering/contact-resources'
|
||||
import documentsRes from '../../../plugin'
|
||||
import {
|
||||
$controlledDocument as controlledDocument,
|
||||
@@ -21,6 +21,8 @@
|
||||
import DocumentApprovalGuideItem from './DocumentApprovalGuideItem.svelte'
|
||||
import DocumentApprovalItem from './DocumentApprovalItem.svelte'
|
||||
import RightPanelTabHeader from './RightPanelTabHeader.svelte'
|
||||
import { extractValidationWorkflow } from '../../../utils'
|
||||
import { Ref } from '@hcengineering/core'
|
||||
|
||||
const client = getClient()
|
||||
const hierarchy = client.getHierarchy()
|
||||
@@ -43,19 +45,18 @@
|
||||
})
|
||||
}
|
||||
|
||||
$: workflow = extractValidationWorkflow(
|
||||
hierarchy,
|
||||
{
|
||||
...emptyBundle(),
|
||||
ControlledDocument: doc ? [doc] : [],
|
||||
DocumentRequest: requests,
|
||||
DocumentSnapshot: $documentSnapshots,
|
||||
ChatMessage: messages
|
||||
},
|
||||
(ref) => $personRefByPersonIdStore.get(ref)
|
||||
)
|
||||
let workflow: Map<Ref<ControlledDocument>, DocumentValidationState[]> | undefined
|
||||
$: void extractValidationWorkflow(hierarchy, {
|
||||
...emptyBundle(),
|
||||
ControlledDocument: doc ? [doc] : [],
|
||||
DocumentRequest: requests,
|
||||
DocumentSnapshot: $documentSnapshots,
|
||||
ChatMessage: messages
|
||||
}).then((res) => {
|
||||
workflow = res
|
||||
})
|
||||
|
||||
$: validationStates = ((doc ? workflow.get(doc._id) : []) ?? []).slice()
|
||||
$: validationStates = ((doc ? workflow?.get(doc._id) : []) ?? []).slice()
|
||||
|
||||
const noGuideStates: (ControlledDocumentState | undefined)[] = [
|
||||
ControlledDocumentState.Approved,
|
||||
|
||||
Reference in New Issue
Block a user