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
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
15 changed files with 320 additions and 44 deletions

View File

@ -17,6 +17,7 @@ specifiers:
'@rush-temp/model-core': file:./projects/model-core.tgz
'@rush-temp/model-rig': file:./projects/model-rig.tgz
'@rush-temp/model-view': file:./projects/model-view.tgz
'@rush-temp/model-workbench': file:./projects/model-workbench.tgz
'@rush-temp/platform': file:./projects/platform.tgz
'@rush-temp/platform-rig': file:./projects/platform-rig.tgz
'@rush-temp/presentation': file:./projects/presentation.tgz
@ -87,6 +88,7 @@ dependencies:
'@rush-temp/model-core': file:projects/model-core.tgz_6c259fadfeb3a4b20890aefe87070b8b
'@rush-temp/model-rig': file:projects/model-rig.tgz_6ab28797e7a22071465f7d680ae81ae5
'@rush-temp/model-view': file:projects/model-view.tgz_6c259fadfeb3a4b20890aefe87070b8b
'@rush-temp/model-workbench': file:projects/model-workbench.tgz_6c259fadfeb3a4b20890aefe87070b8b
'@rush-temp/platform': file:projects/platform.tgz_6c259fadfeb3a4b20890aefe87070b8b
'@rush-temp/platform-rig': file:projects/platform-rig.tgz_6ab28797e7a22071465f7d680ae81ae5
'@rush-temp/presentation': file:projects/presentation.tgz_c38cf1a7a413db8918b0b4754c21e4c5
@ -7892,7 +7894,7 @@ packages:
dev: false
file:projects/dev-client-resources.tgz_6c259fadfeb3a4b20890aefe87070b8b:
resolution: {integrity: sha512-EUDIrb3wXy6PHSbUnxEkKagNVsM5jKUBg0qSdd6/BriulwYZ5C1BlLqS58oDWxaySjHBSMGyaKN4Ath5QYrI8A==, tarball: file:projects/dev-client-resources.tgz}
resolution: {integrity: sha512-biw7Qe9DoDRjkgmEJ4Dl1MAxSzzm580Eb3cqU5ISPSrJ+1EIR+RqUf7W7fwN+PQQuZHy24/mR/tm6P2w8zJnwQ==, tarball: file:projects/dev-client-resources.tgz}
id: file:projects/dev-client-resources.tgz
name: '@rush-temp/dev-client-resources'
version: 0.0.0
@ -8073,6 +8075,23 @@ packages:
- typescript
dev: false
file:projects/model-workbench.tgz_6c259fadfeb3a4b20890aefe87070b8b:
resolution: {integrity: sha512-QV8gtCxPbFWNe3e2zV2XtK197RIGLFqpgP4KiN8Z6AieeAFP0HieLJgqovTLZT7lvDX2mtfnHuWGQxGg643taw==, tarball: file:projects/model-workbench.tgz}
id: file:projects/model-workbench.tgz
name: '@rush-temp/model-workbench'
version: 0.0.0
dependencies:
'@typescript-eslint/eslint-plugin': 4.28.5_a8e83fcad666e1ba86be4b2e27a20aea
eslint: 7.32.0
eslint-plugin-import: 2.23.4_eslint@7.32.0
eslint-plugin-node: 11.1.0_eslint@7.32.0
eslint-plugin-promise: 4.3.1
transitivePeerDependencies:
- '@typescript-eslint/parser'
- supports-color
- typescript
dev: false
file:projects/model.tgz_6c259fadfeb3a4b20890aefe87070b8b:
resolution: {integrity: sha512-+U81cS6gjuC42PMvI6lh/tICT4o4DpJQZDFCcfDsK0EZRHlhnndytVgRGCmD/KTDv1Nvs7FDSLzsAADGmeP0JA==, tarball: file:projects/model.tgz}
id: file:projects/model.tgz
@ -8160,7 +8179,7 @@ packages:
dev: false
file:projects/prod.tgz_9242e79bee31c899aa4d2de67405a771:
resolution: {integrity: sha512-RKHRlPdnGvUzQoKQ0oFqyfykBDw4DGUGBMBukgx1TJu95/HRLuDVcX2PWxL3KMMHToqRVajpUkvQMYKT6fcWWQ==, tarball: file:projects/prod.tgz}
resolution: {integrity: sha512-TDq/BJPcrIJ5sD5OkabgEh2lLuhgqcWG3iJg+1dkRuBWbiclHiR8PgB4OOHK7wFVVaEr10vVyF3AKa1GNeHaYw==, tarball: file:projects/prod.tgz}
id: file:projects/prod.tgz
name: '@rush-temp/prod'
version: 0.0.0

View File

@ -1,25 +1,25 @@
[
{
"_id": "610e735f946b3ebe7af501e1",
"_id": "610e75fa3685f8266ee31e0e",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "core:class:Obj",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628336991083,
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"kind": 0
}
},
{
"_id": "610e735f946b3ebe7af501e2",
"_id": "610e75fa3685f8266ee31e0f",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "core:class:Doc",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628336991083,
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"kind": 0,
@ -27,13 +27,13 @@
}
},
{
"_id": "610e735f946b3ebe7af501e3",
"_id": "610e75fa3685f8266ee31e10",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "core:class:Type",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628336991083,
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"kind": 0,
@ -41,13 +41,13 @@
}
},
{
"_id": "610e735f946b3ebe7af501e4",
"_id": "610e75fa3685f8266ee31e11",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "core:class:TypeString",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628336991083,
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"kind": 0,
@ -55,13 +55,13 @@
}
},
{
"_id": "610e735f946b3ebe7af501e5",
"_id": "610e75fa3685f8266ee31e12",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "core:class:Attribute",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628336991083,
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"kind": 0,
@ -69,13 +69,13 @@
}
},
{
"_id": "610e735f946b3ebe7af501e6",
"_id": "610e75fa3685f8266ee31e13",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "core:class:Account",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628336991083,
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"domain": "model",
@ -84,13 +84,13 @@
}
},
{
"_id": "610e735f946b3ebe7af501e7",
"_id": "610e75fa3685f8266ee31e14",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "core:class:Space",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628336991083,
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"domain": "model",
@ -99,13 +99,13 @@
}
},
{
"_id": "610e735f946b3ebe7af501e8",
"_id": "610e75fa3685f8266ee31e15",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "core:class:Tx",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628336991083,
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"domain": "tx",
@ -114,13 +114,13 @@
}
},
{
"_id": "610e735f946b3ebe7af501e9",
"_id": "610e75fa3685f8266ee31e16",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "core:class:TxCUD",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628336991083,
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"kind": 0,
@ -128,13 +128,13 @@
}
},
{
"_id": "610e735f946b3ebe7af501ea",
"_id": "610e75fa3685f8266ee31e17",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "core:class:TxUpdateDoc",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628336991083,
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"kind": 0,
@ -142,13 +142,13 @@
}
},
{
"_id": "610e735f946b3ebe7af501eb",
"_id": "610e75fa3685f8266ee31e18",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "core:class:TxMixin",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628336991083,
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"kind": 0,
@ -156,13 +156,13 @@
}
},
{
"_id": "610e735f946b3ebe7af501ec",
"_id": "610e75fa3685f8266ee31e19",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "core:class:TxCreateDoc",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628336991083,
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"kind": 0,
@ -170,13 +170,13 @@
}
},
{
"_id": "610e735f946b3ebe7af501ed",
"_id": "610e75fa3685f8266ee31e1a",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "core:class:Class",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628336991083,
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"domain": "model",
@ -185,17 +185,147 @@
}
},
{
"_id": "610e735f946b3ebe7af501ee",
"_id": "610e75fa3685f8266ee31e1b",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "core:class:Mixin",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628336991083,
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"kind": 0,
"extends": "core:class:Class"
}
},
{
"_id": "610e75fa3685f8266ee31e1c",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "view:class:Viewlet",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"domain": "model",
"kind": 0,
"extends": "core:class:Doc"
}
},
{
"_id": "610e75fa3685f8266ee31e1d",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "view:class:ViewletDescriptor",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"domain": "model",
"kind": 0,
"extends": "core:class:Doc"
}
},
{
"_id": "610e75fa3685f8266ee31e1e",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "view:mixin:AttributePresenter",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628337658501,
"modifiedBy": "core:account:System",
"attributes": {
"kind": 0,
"extends": "core:class:Class"
}
},
{
"_id": "610e75fa3685f8266ee31e1f",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "view:mixin:AttributeEditor",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628337658502,
"modifiedBy": "core:account:System",
"attributes": {
"kind": 0,
"extends": "core:class:Class"
}
},
{
"_id": "610e75fa3685f8266ee31e20",
"_class": "core:class:TxMixin",
"space": "core:space:Tx",
"modifiedBy": "core:account:System",
"modifiedOn": 1628337658502,
"objectId": "core:class:TypeString",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"mixin": "view:mixin:AttributeEditor",
"attributes": {
"editor": "view:component:StringEditor"
}
},
{
"_id": "610e75fa3685f8266ee31e21",
"_class": "core:class:TxMixin",
"space": "core:space:Tx",
"modifiedBy": "core:account:System",
"modifiedOn": 1628337658502,
"objectId": "core:class:TypeString",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"mixin": "view:mixin:AttributePresenter",
"attributes": {
"presenter": "view:component:StringPresenter"
}
},
{
"_id": "610e75fa3685f8266ee31e22",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "view:viewlet:Table",
"objectClass": "view:class:ViewletDescriptor",
"objectSpace": "core:space:Model",
"modifiedOn": 1628337658502,
"modifiedBy": "core:account:System",
"attributes": {
"label": "Table",
"icon": "view:icon:Table",
"component": "view:component:TableView"
}
},
{
"_id": "610e75fa3685f8266ee31e23",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "workbench:mixin:SpaceView",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628337658502,
"modifiedBy": "core:account:System",
"attributes": {
"kind": 0,
"extends": "core:class:Class"
}
},
{
"_id": "610e75fa3685f8266ee31e24",
"_class": "core:class:TxCreateDoc",
"space": "core:space:Tx",
"objectId": "workbench:class:Application",
"objectClass": "core:class:Class",
"objectSpace": "core:space:Model",
"modifiedOn": 1628337658502,
"modifiedBy": "core:account:System",
"attributes": {
"domain": "model",
"kind": 0,
"extends": "core:class:Doc"
}
}
]

View File

@ -21,6 +21,8 @@
},
"dependencies": {
"@anticrm/model": "~0.6.0",
"@anticrm/model-core": "~0.6.0"
"@anticrm/model-core": "~0.6.0",
"@anticrm/model-view": "~0.6.0",
"@anticrm/model-workbench": "~0.6.0"
}
}

View File

@ -16,11 +16,11 @@
import { Builder } from '@anticrm/model'
import { createModel as coreModel } from '@anticrm/model-core'
// import { createModel as workbenchModel } from '@anticrm/model-workbench'
import { createModel as viewModel } from '@anticrm/model-view'
import { createModel as workbenchModel } from '@anticrm/model-workbench'
// import { createModel as contactModel } from '@anticrm/model-contact'
// import { createModel as chunterModel } from '@anticrm/model-chunter'
// import { createModel as recruitModel } from '@anticrm/model-recruit'
// import { createModel as viewModel } from '@anticrm/model-view'
// import { createModel as taskModel } from '@anticrm/model-task'
// import { createDemo } from '@anticrm/model-demo'
@ -28,8 +28,8 @@ import { createModel as coreModel } from '@anticrm/model-core'
const builder = new Builder()
coreModel(builder)
// viewModel(builder)
// workbenchModel(builder)
viewModel(builder)
workbenchModel(builder)
// contactModel(builder)
// chunterModel(builder)
// taskModel(builder)

View File

@ -0,0 +1,6 @@
module.exports = {
extends: ['./node_modules/@anticrm/model-rig/profiles/default/config/eslint.config.json'],
parserOptions: {
project: './tsconfig.json'
}
}

View File

@ -0,0 +1,4 @@
*
!/lib/**
!CHANGELOG.md
/lib/**/__tests__/

View File

@ -0,0 +1,18 @@
// The "rig.json" file directs tools to look for their config files in an external package.
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
{
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
/**
* (Required) The name of the rig package to inherit from.
* It should be an NPM package name with the "-rig" suffix.
*/
"rigPackageName": "@anticrm/model-rig"
/**
* (Optional) Selects a config profile from the rig package. The name must consist of
* lowercase alphanumeric words separated by hyphens, for example "sample-profile".
* If omitted, then the "default" profile will be used."
*/
// "rigProfile": "your-profile-name"
}

View File

@ -0,0 +1,26 @@
{
"name": "@anticrm/model-workbench",
"version": "0.6.0",
"main": "lib/index.js",
"author": "Anticrm Platform Contributors",
"license": "EPL-2.0",
"scripts": {
"build": "heft build",
"lint:fix": "eslint --fix src"
},
"devDependencies": {
"@anticrm/model-rig":"~0.6.0",
"@typescript-eslint/eslint-plugin":"4",
"eslint-plugin-import":"2",
"eslint-plugin-promise":"4",
"eslint-plugin-node":"11",
"eslint":"^7.32.0"
},
"dependencies": {
"@anticrm/core": "~0.6.7",
"@anticrm/model": "~0.6.0",
"@anticrm/platform": "~0.6.3",
"@anticrm/model-core": "~0.6.0",
"@anticrm/workbench": "~0.6.0"
}
}

View File

@ -0,0 +1,39 @@
//
// Copyright © 2020 Anticrm Platform Contributors.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
import type { IntlString, Asset } from '@anticrm/platform'
import { DOMAIN_MODEL } from '@anticrm/core'
import { Model, Mixin, Builder } from '@anticrm/model'
import type { Application, SpaceView, ViewConfiguration } from '@anticrm/workbench'
import core, { TDoc, TClass } from '@anticrm/model-core'
import workbench from './plugin'
@Model(workbench.class.Application, core.class.Doc, DOMAIN_MODEL)
export class TApplication extends TDoc implements Application {
label!: IntlString
icon!: Asset
}
@Mixin(workbench.mixin.SpaceView, core.class.Class)
export class TSpaceView extends TClass implements SpaceView {
view!: ViewConfiguration
}
export function createModel (builder: Builder): void {
builder.createModel(TApplication, TSpaceView)
}
export default workbench

View File

@ -0,0 +1,20 @@
//
// Copyright © 2020 Anticrm Platform Contributors.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
import { mergeIds } from '@anticrm/platform'
import workbench, { workbenchId } from '@anticrm/workbench'
export default mergeIds(workbenchId, workbench, {
})

View File

@ -0,0 +1,8 @@
{
"extends": "./node_modules/@anticrm/model-rig/profiles/default/tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./lib",
}
}

View File

@ -73,6 +73,7 @@ async function broadcastEvent (event: string, data: any): Promise<void> {
* @returns
*/
export async function setPlatformStatus (status: Status | Error): Promise<void> {
console.log('platform status', status)
if (status instanceof Error) {
return await broadcastEvent(PlatformEvent, unknownError(status))
} else {

View File

@ -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()

View File

@ -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 })

View File

@ -591,5 +591,10 @@
"projectFolder": "dev/client-resources",
"shouldPublish": true
},
{
"packageName": "@anticrm/model-workbench",
"projectFolder": "models/workbench",
"shouldPublish": true
},
]
}