add model-workbench and fix queries

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov
2021-08-07 14:15:18 +02:00
parent af0a69db1b
commit d42fa602e2
15 changed files with 320 additions and 44 deletions
@@ -15,11 +15,10 @@
<script lang="ts">
import { onDestroy, createEventDispatcher } from 'svelte'
import type { Ref } from '@anticrm/core'
import type { Application } from '@anticrm/workbench'
import { getCurrentLocation, navigate } from '@anticrm/ui'
import { getClient } from '@anticrm/presentation'
import { createQuery } from '@anticrm/presentation'
import workbench from '@anticrm/workbench'
import AppItem from './AppItem.svelte'
@@ -27,7 +26,9 @@
export let active: Ref<Application> | undefined
let apps: Application[] = []
onDestroy(getClient().query(workbench.class.Application, {}, result => { apps = result }))
const query = createQuery()
$: query.query(workbench.class.Application, {}, result => { apps = result })
function navigateApp(app: Ref<Application>) {
const loc = getCurrentLocation()
@@ -21,7 +21,7 @@
import Add from './icons/Add.svelte'
import Star from './icons/Star.svelte'
import { getClient } from '@anticrm/presentation'
import { getClient, createQuery } from '@anticrm/presentation'
import { showModal } from '@anticrm/ui'
import { classIcon } from '../utils'
import core from '@anticrm/core'
@@ -30,13 +30,10 @@
export let createItemDialog: AnyComponent | undefined
const client = getClient()
const query = createQuery()
let data: Space | undefined
let unsubscribe = () => {}
$: {
unsubscribe()
unsubscribe = client.query(core.class.Space, { _id: space }, result => { data = result[0] })
}
$: query.query(core.class.Space, { _id: space }, result => { data = result[0] })
function showCreateDialog() {
showModal(createItemDialog as AnyComponent, { space })