Fix Contacts layout (#2631)

+ Fix migration

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-02-14 11:00:12 +07:00 committed by GitHub
parent 961de0ddc0
commit 47d5db2f61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 4 deletions

View File

@ -43,6 +43,7 @@ async function createSpace (tx: TxOperations): Promise<void> {
}
}
let totalCreateOn = 0
async function setCreate (client: MigrationClient): Promise<void> {
while (true) {
const docs = await client.find<Contact>(
@ -58,7 +59,8 @@ async function setCreate (client: MigrationClient): Promise<void> {
if (docs.length === 0) {
break
}
console.log('processing createOn migration', docs.length)
totalCreateOn += docs.length
console.log('processing createOn migration', totalCreateOn)
const creates = await client.find<TxCreateDoc<Contact>>(DOMAIN_TX, {
objectId: { $in: docs.map((it) => it._id) },
_class: core.class.TxCreateDoc
@ -84,6 +86,16 @@ async function setCreate (client: MigrationClient): Promise<void> {
'attributes.createOn': tx.modifiedOn
}
)
} else {
await client.update(
DOMAIN_CONTACT,
{
_id: doc._id
},
{
createOn: doc.modifiedOn
}
)
}
}
}

View File

@ -13,10 +13,10 @@
// limitations under the License.
-->
<script lang="ts">
import { getClient } from '@hcengineering/presentation'
import { Tabs, Component, AnyComponent } from '@hcengineering/ui'
import contact from '@hcengineering/contact'
import { IntlString } from '@hcengineering/platform'
import { getClient } from '@hcengineering/presentation'
import { AnyComponent, Component, Tabs } from '@hcengineering/ui'
const client = getClient()
@ -33,7 +33,7 @@
</script>
{#if tabs && tabs.length > 1}
<div class="pl-2">
<div class="flex-col p-4 flex-grow">
<Tabs model={tabs} />
</div>
{:else if tabs?.[0]}