mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-29 19:55:20 +00:00
parent
3cbc321f5f
commit
c06d48e0b0
@ -23,6 +23,8 @@ specifiers:
|
|||||||
'@rush-temp/dev-server': file:./projects/dev-server.tgz
|
'@rush-temp/dev-server': file:./projects/dev-server.tgz
|
||||||
'@rush-temp/dev-server-chunter-resources': file:./projects/dev-server-chunter-resources.tgz
|
'@rush-temp/dev-server-chunter-resources': file:./projects/dev-server-chunter-resources.tgz
|
||||||
'@rush-temp/dev-storage': file:./projects/dev-storage.tgz
|
'@rush-temp/dev-storage': file:./projects/dev-storage.tgz
|
||||||
|
'@rush-temp/devmodel': file:./projects/devmodel.tgz
|
||||||
|
'@rush-temp/devmodel-resources': file:./projects/devmodel-resources.tgz
|
||||||
'@rush-temp/elastic': file:./projects/elastic.tgz
|
'@rush-temp/elastic': file:./projects/elastic.tgz
|
||||||
'@rush-temp/front': file:./projects/front.tgz
|
'@rush-temp/front': file:./projects/front.tgz
|
||||||
'@rush-temp/login': file:./projects/login.tgz
|
'@rush-temp/login': file:./projects/login.tgz
|
||||||
@ -172,6 +174,8 @@ dependencies:
|
|||||||
'@rush-temp/dev-server': file:projects/dev-server.tgz_typescript@4.4.3
|
'@rush-temp/dev-server': file:projects/dev-server.tgz_typescript@4.4.3
|
||||||
'@rush-temp/dev-server-chunter-resources': file:projects/dev-server-chunter-resources.tgz_typescript@4.4.3
|
'@rush-temp/dev-server-chunter-resources': file:projects/dev-server-chunter-resources.tgz_typescript@4.4.3
|
||||||
'@rush-temp/dev-storage': file:projects/dev-storage.tgz_typescript@4.4.3
|
'@rush-temp/dev-storage': file:projects/dev-storage.tgz_typescript@4.4.3
|
||||||
|
'@rush-temp/devmodel': file:projects/devmodel.tgz_typescript@4.4.3
|
||||||
|
'@rush-temp/devmodel-resources': file:projects/devmodel-resources.tgz_e1367da94684b005adf08f025c517b1a
|
||||||
'@rush-temp/elastic': file:projects/elastic.tgz_typescript@4.4.3
|
'@rush-temp/elastic': file:projects/elastic.tgz_typescript@4.4.3
|
||||||
'@rush-temp/front': file:projects/front.tgz_typescript@4.4.3
|
'@rush-temp/front': file:projects/front.tgz_typescript@4.4.3
|
||||||
'@rush-temp/login': file:projects/login.tgz_typescript@4.4.3
|
'@rush-temp/login': file:projects/login.tgz_typescript@4.4.3
|
||||||
@ -9877,6 +9881,62 @@ packages:
|
|||||||
- typescript
|
- typescript
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
file:projects/devmodel-resources.tgz_e1367da94684b005adf08f025c517b1a:
|
||||||
|
resolution: {integrity: sha512-eA8s5XJOwP4vu/EVRb73vl3z0C2K4cqsp3Pa2E0TREP2K78AjJPSGxIZD6WEwjg4K2L1dCOCG9kWGSShWwAt3A==, tarball: file:projects/devmodel-resources.tgz}
|
||||||
|
id: file:projects/devmodel-resources.tgz
|
||||||
|
name: '@rush-temp/devmodel-resources'
|
||||||
|
version: 0.0.0
|
||||||
|
dependencies:
|
||||||
|
'@typescript-eslint/eslint-plugin': 5.4.0_87dbf04088b125598d0271706532eaf3
|
||||||
|
'@typescript-eslint/parser': 5.4.0_eslint@7.32.0+typescript@4.4.3
|
||||||
|
eslint: 7.32.0
|
||||||
|
eslint-config-standard-with-typescript: 21.0.1_05a8ea1454e6ca4c9f98b94b8f3abf9c
|
||||||
|
eslint-plugin-import: 2.25.3_eslint@7.32.0
|
||||||
|
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
||||||
|
eslint-plugin-promise: 5.1.1_eslint@7.32.0
|
||||||
|
eslint-plugin-svelte3: 3.2.1_eslint@7.32.0+svelte@3.43.1
|
||||||
|
prettier: 2.4.1
|
||||||
|
prettier-plugin-svelte: 2.5.0_prettier@2.4.1+svelte@3.43.1
|
||||||
|
sass: 1.42.1
|
||||||
|
svelte: 3.43.1
|
||||||
|
svelte-check: 2.2.10_3708ed3db7329f2cbf76db19160094b1
|
||||||
|
svelte-loader: 3.1.2_svelte@3.43.1
|
||||||
|
svelte-preprocess: 4.9.8_b1ccfb371c7d68f75291f5a547be0b14
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- '@babel/core'
|
||||||
|
- coffeescript
|
||||||
|
- less
|
||||||
|
- node-sass
|
||||||
|
- postcss
|
||||||
|
- postcss-load-config
|
||||||
|
- pug
|
||||||
|
- stylus
|
||||||
|
- sugarss
|
||||||
|
- supports-color
|
||||||
|
- typescript
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
file:projects/devmodel.tgz_typescript@4.4.3:
|
||||||
|
resolution: {integrity: sha512-1VtK6jXB5uH+z3VGtIESE9fE1UgUfAKsmmLjl5YAfe++WcWAZqQzuaRShcFvQiKGR2FfTyAEtSdq+J6CqEdc0g==, tarball: file:projects/devmodel.tgz}
|
||||||
|
id: file:projects/devmodel.tgz
|
||||||
|
name: '@rush-temp/devmodel'
|
||||||
|
version: 0.0.0
|
||||||
|
dependencies:
|
||||||
|
'@rushstack/heft': 0.41.1
|
||||||
|
'@types/heft-jest': 1.0.2
|
||||||
|
'@typescript-eslint/eslint-plugin': 5.4.0_87dbf04088b125598d0271706532eaf3
|
||||||
|
'@typescript-eslint/parser': 5.4.0_eslint@7.32.0+typescript@4.4.3
|
||||||
|
eslint: 7.32.0
|
||||||
|
eslint-config-standard-with-typescript: 21.0.1_05a8ea1454e6ca4c9f98b94b8f3abf9c
|
||||||
|
eslint-plugin-import: 2.25.3_eslint@7.32.0
|
||||||
|
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
||||||
|
eslint-plugin-promise: 5.1.1_eslint@7.32.0
|
||||||
|
prettier: 2.4.1
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
- typescript
|
||||||
|
dev: false
|
||||||
|
|
||||||
file:projects/elastic.tgz_typescript@4.4.3:
|
file:projects/elastic.tgz_typescript@4.4.3:
|
||||||
resolution: {integrity: sha512-uoPGQmOAopNC8F64rYWrRDU1s3/u70CNQeBYz7EH/PE6mR0QsYIFJW3U6/LgeDWsMXNge+5fKkjwAJh0+EQtBA==, tarball: file:projects/elastic.tgz}
|
resolution: {integrity: sha512-uoPGQmOAopNC8F64rYWrRDU1s3/u70CNQeBYz7EH/PE6mR0QsYIFJW3U6/LgeDWsMXNge+5fKkjwAJh0+EQtBA==, tarball: file:projects/elastic.tgz}
|
||||||
id: file:projects/elastic.tgz
|
id: file:projects/elastic.tgz
|
||||||
@ -10434,7 +10494,7 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
file:projects/prod.tgz_sass@1.42.1+typescript@4.4.3:
|
file:projects/prod.tgz_sass@1.42.1+typescript@4.4.3:
|
||||||
resolution: {integrity: sha512-ZgzyuEX4q/KCtkXfJOVOSHEBZEYI6FrJJO2tYxQaynmSq7AQpjIp3XB0uwoagnD3dyzH/S3qAXqvQ7ltgPXhbQ==, tarball: file:projects/prod.tgz}
|
resolution: {integrity: sha512-jYkFXSc3TaFdljpFFcRvEWTmtHKLA7nQUn+9kSDD9/J91/LmQEv3yEyJH89kb1ETNiTK6vnuLlp9br+RZipWVg==, tarball: file:projects/prod.tgz}
|
||||||
id: file:projects/prod.tgz
|
id: file:projects/prod.tgz
|
||||||
name: '@rush-temp/prod'
|
name: '@rush-temp/prod'
|
||||||
version: 0.0.0
|
version: 0.0.0
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import { createClient, Client } from '@anticrm/core'
|
import { createClient, Client } from '@anticrm/core'
|
||||||
|
import { getMetadata, getResource } from '@anticrm/platform'
|
||||||
import { connect } from './connection'
|
import { connect } from './connection'
|
||||||
|
import clientPlugin from '@anticrm/client'
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Anticrm Platform™ Client Dev Plugin
|
* Anticrm Platform™ Client Dev Plugin
|
||||||
@ -30,6 +32,13 @@ export default async () => {
|
|||||||
if (client === undefined) {
|
if (client === undefined) {
|
||||||
client = await createClient(connect)
|
client = await createClient(connect)
|
||||||
}
|
}
|
||||||
|
// Check if we had dev hook for client.
|
||||||
|
// Check if we had dev hook for client.
|
||||||
|
const hook = getMetadata(clientPlugin.metadata.ClientHook)
|
||||||
|
if (hook !== undefined) {
|
||||||
|
const hookProc = await getResource(hook)
|
||||||
|
client = await hookProc(client)
|
||||||
|
}
|
||||||
return client
|
return client
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,8 @@
|
|||||||
"@anticrm/activity-resources": "~0.6.0",
|
"@anticrm/activity-resources": "~0.6.0",
|
||||||
"@anticrm/telegram": "~0.6.0",
|
"@anticrm/telegram": "~0.6.0",
|
||||||
"@anticrm/telegram-resources": "~0.6.0",
|
"@anticrm/telegram-resources": "~0.6.0",
|
||||||
|
"@anticrm/devmodel": "~0.6.0",
|
||||||
|
"@anticrm/devmodel-resources": "~0.6.0",
|
||||||
"@anticrm/workbench-assets": "~0.6.0"
|
"@anticrm/workbench-assets": "~0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,10 @@ import { serverRecruitId } from '@anticrm/server-recruit'
|
|||||||
import { serverViewId } from '@anticrm/server-view'
|
import { serverViewId } from '@anticrm/server-view'
|
||||||
|
|
||||||
import { setMetadata } from '@anticrm/platform'
|
import { setMetadata } from '@anticrm/platform'
|
||||||
|
|
||||||
|
import devmodel, { devModelId } from '@anticrm/devmodel'
|
||||||
|
import client from '@anticrm/client'
|
||||||
|
|
||||||
export function configurePlatformDev() {
|
export function configurePlatformDev() {
|
||||||
setMetadata(login.metadata.OverrideLoginToken, process.env.LOGIN_TOKEN_DEV)
|
setMetadata(login.metadata.OverrideLoginToken, process.env.LOGIN_TOKEN_DEV)
|
||||||
setMetadata(login.metadata.OverrideEndpoint, process.env.LOGIN_ENDPOINT_DEV)
|
setMetadata(login.metadata.OverrideEndpoint, process.env.LOGIN_ENDPOINT_DEV)
|
||||||
@ -30,9 +34,21 @@ export function configurePlatformDev() {
|
|||||||
addLocation(serverChunterId, () => import(/* webpackChunkName: "server-chunter" */ '@anticrm/dev-server-chunter-resources'))
|
addLocation(serverChunterId, () => import(/* webpackChunkName: "server-chunter" */ '@anticrm/dev-server-chunter-resources'))
|
||||||
addLocation(serverRecruitId, () => import(/* webpackChunkName: "server-recruit" */ '@anticrm/server-recruit-resources'))
|
addLocation(serverRecruitId, () => import(/* webpackChunkName: "server-recruit" */ '@anticrm/server-recruit-resources'))
|
||||||
addLocation(serverViewId, () => import(/* webpackChunkName: "server-view" */ '@anticrm/server-view-resources'))
|
addLocation(serverViewId, () => import(/* webpackChunkName: "server-view" */ '@anticrm/server-view-resources'))
|
||||||
|
|
||||||
|
// Set devmodel to hook client to be able to present all activity
|
||||||
|
enableDevModel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function configurePlatformDevServer() {
|
export function configurePlatformDevServer() {
|
||||||
console.log('Use Endpoint override:', process.env.LOGIN_ENDPOINT)
|
console.log('Use Endpoint override:', process.env.LOGIN_ENDPOINT)
|
||||||
setMetadata(login.metadata.OverrideEndpoint, process.env.LOGIN_ENDPOINT)
|
setMetadata(login.metadata.OverrideEndpoint, process.env.LOGIN_ENDPOINT)
|
||||||
|
|
||||||
|
// Set devmodel to hook client to be able to present all activity
|
||||||
|
enableDevModel()
|
||||||
|
}
|
||||||
|
|
||||||
|
function enableDevModel() {
|
||||||
|
setMetadata(client.metadata.ClientHook, devmodel.hook.Hook)
|
||||||
|
addLocation(devModelId, () => import(/* webpackChunkName: "devmodel" */ '@anticrm/devmodel-resources'))
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
export let direction: TooltipAligment | undefined = undefined
|
export let direction: TooltipAligment | undefined = undefined
|
||||||
export let icon: Asset | AnySvelteComponent
|
export let icon: Asset | AnySvelteComponent
|
||||||
export let size: 'small' | 'medium' | 'large'
|
export let size: 'small' | 'medium' | 'large'
|
||||||
export let action: (ev?: Event) => Promise<void>
|
export let action: (ev?: Event) => Promise<void> | void
|
||||||
export let invisible: boolean = false
|
export let invisible: boolean = false
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
import { createClient, Client, TxHander } from '@anticrm/core'
|
import { createClient, Client, TxHander } from '@anticrm/core'
|
||||||
|
|
||||||
import { connect } from './connection'
|
import { connect } from './connection'
|
||||||
|
import clientPlugin from '@anticrm/client'
|
||||||
|
import { getMetadata, getResource } from '@anticrm/platform'
|
||||||
export { connect }
|
export { connect }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -31,11 +33,18 @@ export default async () => {
|
|||||||
function: {
|
function: {
|
||||||
GetClient: async (token: string, endpoint: string): Promise<Client> => {
|
GetClient: async (token: string, endpoint: string): Promise<Client> => {
|
||||||
if (client === undefined) {
|
if (client === undefined) {
|
||||||
return await createClient((handler: TxHander) => {
|
client = await createClient((handler: TxHander) => {
|
||||||
const url = new URL(`/${token}`, endpoint)
|
const url = new URL(`/${token}`, endpoint)
|
||||||
console.log('connecting to', url.href)
|
console.log('connecting to', url.href)
|
||||||
return connect(url.href, handler)
|
return connect(url.href, handler)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Check if we had dev hook for client.
|
||||||
|
const hook = getMetadata(clientPlugin.metadata.ClientHook)
|
||||||
|
if (hook !== undefined) {
|
||||||
|
const hookProc = await getResource(hook)
|
||||||
|
client = await hookProc(client)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return client
|
return client
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
import { plugin } from '@anticrm/platform'
|
import { Metadata, plugin } from '@anticrm/platform'
|
||||||
import type { Plugin, Resource } from '@anticrm/platform'
|
import type { Plugin, Resource } from '@anticrm/platform'
|
||||||
import type { Client } from '@anticrm/core'
|
import type { Client } from '@anticrm/core'
|
||||||
// import type { LiveQuery } from '@anticrm/query'
|
// import type { LiveQuery } from '@anticrm/query'
|
||||||
@ -25,10 +25,23 @@ import type { Client } from '@anticrm/core'
|
|||||||
*/
|
*/
|
||||||
export const clientId = 'client' as Plugin
|
export const clientId = 'client' as Plugin
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export type ClientHook = (client: Client) => Promise<Client>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export type ClientFactory = (token: string, endpoint: string) => Promise<Client>
|
||||||
|
|
||||||
export default plugin(clientId,
|
export default plugin(clientId,
|
||||||
{
|
{
|
||||||
|
metadata: {
|
||||||
|
ClientHook: '' as Metadata<Resource<ClientHook>>
|
||||||
|
},
|
||||||
function: {
|
function: {
|
||||||
GetClient: '' as Resource<(token: string, endpoint: string) => Promise<Client>>
|
GetClient: '' as Resource<ClientFactory>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
7
plugins/devmodel-resources/.eslintrc.js
Normal file
7
plugins/devmodel-resources/.eslintrc.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
module.exports = {
|
||||||
|
extends: ['./node_modules/@anticrm/platform-rig/profiles/ui/config/eslint.config.json'],
|
||||||
|
parserOptions: { tsconfigRootDir: __dirname },
|
||||||
|
settings: {
|
||||||
|
'svelte3/ignore-styles': () => true
|
||||||
|
}
|
||||||
|
};
|
48
plugins/devmodel-resources/package.json
Normal file
48
plugins/devmodel-resources/package.json
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"name": "@anticrm/devmodel-resources",
|
||||||
|
"version": "0.6.0",
|
||||||
|
"main": "src/index.ts",
|
||||||
|
"author": "Anticrm Platform Contributors",
|
||||||
|
"license": "EPL-2.0",
|
||||||
|
"scripts": {
|
||||||
|
"build": "svelte-check",
|
||||||
|
"lint": "eslint src",
|
||||||
|
"lint:fix": "eslint --fix src",
|
||||||
|
"format": "prettier --write --plugin-search-dir=. src && eslint --fix src",
|
||||||
|
"svelte-check": "svelte-check"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"svelte-loader":"^3.1.2",
|
||||||
|
"sass":"^1.37.5",
|
||||||
|
"svelte-preprocess":"^4.7.4",
|
||||||
|
"@anticrm/platform-rig":"~0.6.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
||||||
|
"@typescript-eslint/parser": "^5.4.0",
|
||||||
|
"eslint-config-standard-with-typescript": "^21.0.1",
|
||||||
|
"eslint-plugin-import": "^2.25.3",
|
||||||
|
"eslint-plugin-node": "^11.1.0",
|
||||||
|
"eslint-plugin-promise": "^5.1.1",
|
||||||
|
"eslint-plugin-svelte3": "~3.2.1",
|
||||||
|
"prettier-plugin-svelte": "^2.2.0",
|
||||||
|
"eslint": "^7.32.0",
|
||||||
|
"prettier": "^2.4.1",
|
||||||
|
"svelte-check": "^2.2.10"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@anticrm/core":"~0.6.11",
|
||||||
|
"@anticrm/platform":"~0.6.5",
|
||||||
|
"@anticrm/ui":"~0.6.0",
|
||||||
|
"@anticrm/presentation":"~0.6.2",
|
||||||
|
"@anticrm/activity":"~0.6.0",
|
||||||
|
"svelte":"^3.37.0",
|
||||||
|
"@anticrm/chunter":"~0.6.1",
|
||||||
|
"@anticrm/text-editor":"~0.6.0",
|
||||||
|
"@anticrm/contact":"~0.6.2",
|
||||||
|
"@anticrm/view": "~0.6.0",
|
||||||
|
"@anticrm/view-resources": "~0.6.0",
|
||||||
|
"@anticrm/client": "~0.6.1",
|
||||||
|
"@anticrm/devmodel": "~0.6.0",
|
||||||
|
"@anticrm/model": "~0.6.0",
|
||||||
|
"@anticrm/workbench": "~0.6.1"
|
||||||
|
}
|
||||||
|
}
|
5
plugins/devmodel-resources/postcss.config.js
Normal file
5
plugins/devmodel-resources/postcss.config.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
plugins: [
|
||||||
|
require('autoprefixer')
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
<script lang='ts'>
|
||||||
|
|
||||||
|
export let content: any
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
{JSON.stringify(content, undefined, 2)}
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
pre {
|
||||||
|
overflow: auto;
|
||||||
|
max-height: 500px;
|
||||||
|
}
|
||||||
|
</style>
|
82
plugins/devmodel-resources/src/components/ModelView.svelte
Normal file
82
plugins/devmodel-resources/src/components/ModelView.svelte
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<!--
|
||||||
|
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
||||||
|
// Copyright © 2021 Hardcore Engineering Inc.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
-->
|
||||||
|
<script lang="ts">
|
||||||
|
import core, { Doc, TxCUD } from '@anticrm/core'
|
||||||
|
import { createQuery } from '@anticrm/presentation'
|
||||||
|
import { ScrollBox, Tooltip } from '@anticrm/ui'
|
||||||
|
import { toIntl } from '..'
|
||||||
|
import ContentPopup from './ContentPopup.svelte'
|
||||||
|
|
||||||
|
let txes: TxCUD<Doc>[] = []
|
||||||
|
|
||||||
|
const activityQuery = createQuery()
|
||||||
|
|
||||||
|
$: activityQuery.query(core.class.TxCUD, { objectSpace: core.space.Model }, (result) => {
|
||||||
|
txes = result
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<ScrollBox vertical>
|
||||||
|
<div class='model-content'>
|
||||||
|
<table class='table'>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Class</th>
|
||||||
|
<th>Body</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{#each txes as tx}
|
||||||
|
<tr class='tr-body'>
|
||||||
|
<td>{tx.objectId}</td>
|
||||||
|
<td>{tx.objectClass}</td>
|
||||||
|
<td>
|
||||||
|
<Tooltip label={toIntl('Content')} component={ContentPopup} props={{ content: tx }}>
|
||||||
|
Content
|
||||||
|
</Tooltip>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/each}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</ScrollBox>
|
||||||
|
<style lang="scss">
|
||||||
|
.model-content {
|
||||||
|
display: flex;
|
||||||
|
margin: 20px;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
padding: .5rem 1.5rem;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
height: 2.5rem;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: .75rem;
|
||||||
|
color: var(--theme-content-dark-color);
|
||||||
|
box-shadow: inset 0 -1px 0 0 var(--theme-bg-focused-color);
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tr-body {
|
||||||
|
height: 3.25rem;
|
||||||
|
color: var(--theme-caption-color);
|
||||||
|
border-bottom: 1px solid var(--theme-button-border-hovered);
|
||||||
|
}
|
||||||
|
</style>
|
87
plugins/devmodel-resources/src/components/QueryView.svelte
Normal file
87
plugins/devmodel-resources/src/components/QueryView.svelte
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<!--
|
||||||
|
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
||||||
|
// Copyright © 2021 Hardcore Engineering Inc.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
-->
|
||||||
|
<script lang="ts">
|
||||||
|
import { ScrollBox, Tooltip } from '@anticrm/ui'
|
||||||
|
import ActionIcon from '@anticrm/ui/src/components/ActionIcon.svelte'
|
||||||
|
import view from '@anticrm/view'
|
||||||
|
import { queries, toIntl } from '..'
|
||||||
|
import ContentPopup from './ContentPopup.svelte'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<ScrollBox vertical>
|
||||||
|
<div class='query-content'>
|
||||||
|
<table class='table'>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Index</th>
|
||||||
|
<th>Class</th>
|
||||||
|
<th>Query</th>
|
||||||
|
<th>Options</th>
|
||||||
|
<th>Result Count</th>
|
||||||
|
<th>Result</th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{#each queries as q}
|
||||||
|
<tr class='tr-body'>
|
||||||
|
<td>{queries.indexOf(q)}</td>
|
||||||
|
<td>{q._class}</td>
|
||||||
|
<td>{JSON.stringify(q.query)}</td>
|
||||||
|
<td>{JSON.stringify(q.options ?? {})}</td>
|
||||||
|
<td>{q.result.length}</td>
|
||||||
|
<td>
|
||||||
|
<Tooltip label={toIntl('Content')} component={ContentPopup} props={{ content: q.result }}>
|
||||||
|
Results
|
||||||
|
</Tooltip>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ActionIcon direction={undefined} size='small' icon={view.icon.Kanban} label={toIntl('Perform Class Query')} action={() => {
|
||||||
|
}}/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/each}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</ScrollBox>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.query-content {
|
||||||
|
display: flex;
|
||||||
|
margin: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
th, td {
|
||||||
|
padding: .5rem 1.5rem;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
height: 2.5rem;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: .75rem;
|
||||||
|
color: var(--theme-content-dark-color);
|
||||||
|
box-shadow: inset 0 -1px 0 0 var(--theme-bg-focused-color);
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tr-body {
|
||||||
|
height: 3.25rem;
|
||||||
|
color: var(--theme-caption-color);
|
||||||
|
border-bottom: 1px solid var(--theme-button-border-hovered);
|
||||||
|
}
|
||||||
|
</style>
|
130
plugins/devmodel-resources/src/index.ts
Normal file
130
plugins/devmodel-resources/src/index.ts
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
//
|
||||||
|
// 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 { IntlString, Resources } from '@anticrm/platform'
|
||||||
|
import ModelView from './components/ModelView.svelte'
|
||||||
|
import QueryView from './components/QueryView.svelte'
|
||||||
|
import core, { Class, Client, Doc, DocumentQuery, FindOptions, Ref, FindResult, Hierarchy, ModelDb, Tx, TxResult, WithLookup } from '@anticrm/core'
|
||||||
|
import { Builder } from '@anticrm/model'
|
||||||
|
import workbench from '@anticrm/workbench'
|
||||||
|
import view from '@anticrm/view'
|
||||||
|
import devmodel from './plugin'
|
||||||
|
|
||||||
|
export interface TxWitHResult {
|
||||||
|
tx: Tx
|
||||||
|
result: TxResult
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QueryWithResult {
|
||||||
|
_class: Ref<Class<Doc>>
|
||||||
|
query: DocumentQuery<Doc>
|
||||||
|
options?: FindOptions<Doc>
|
||||||
|
result: FindResult<Doc>
|
||||||
|
findOne: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export const transactions: TxWitHResult[] = []
|
||||||
|
export const notifications: Tx[] = []
|
||||||
|
export const queries: QueryWithResult[] = []
|
||||||
|
|
||||||
|
class ModelClient implements Client {
|
||||||
|
constructor (readonly client: Client) {
|
||||||
|
}
|
||||||
|
|
||||||
|
notify (tx: Tx): void {
|
||||||
|
this.client.notify?.(tx)
|
||||||
|
notifications.push(tx)
|
||||||
|
}
|
||||||
|
|
||||||
|
getHierarchy (): Hierarchy {
|
||||||
|
return this.client.getHierarchy()
|
||||||
|
}
|
||||||
|
|
||||||
|
getModel (): ModelDb {
|
||||||
|
return this.client.getModel()
|
||||||
|
}
|
||||||
|
|
||||||
|
async findOne <T extends Doc>(_class: Ref<Class<T>>, query: DocumentQuery<T>, options?: FindOptions<T>): Promise<WithLookup<T> | undefined> {
|
||||||
|
const result = await this.client.findOne(_class, query, options)
|
||||||
|
console.info('devmodel# findOne=>', _class, query, options, 'result => ', result, ' =>model', this.client.getModel())
|
||||||
|
queries.push({ _class, query, options, result: result !== undefined ? [result] : [], findOne: true })
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
async findAll<T extends Doc>(_class: Ref<Class<T>>, query: DocumentQuery<T>, options?: FindOptions<T>): Promise<FindResult<T>> {
|
||||||
|
const result = await this.client.findAll(_class, query, options)
|
||||||
|
console.info('devmodel# findAll=>', _class, query, options, 'result => ', result, ' =>model', this.client.getModel())
|
||||||
|
queries.push({ _class, query, options, result, findOne: false })
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
async tx (tx: Tx): Promise<TxResult> {
|
||||||
|
const result = await this.client.tx(tx)
|
||||||
|
console.info('devmodel# tx=>', tx, result)
|
||||||
|
transactions.push({ tx, result })
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export async function Hook (client: Client): Promise<Client> {
|
||||||
|
console.info('devmodel# Client HOOKED by DevModel')
|
||||||
|
|
||||||
|
// Client is alive here, we could hook with some model extensions special for DevModel plugin.
|
||||||
|
const builder = new Builder()
|
||||||
|
|
||||||
|
builder.createDoc(workbench.class.Application, core.space.Model, {
|
||||||
|
label: 'DevModel' as IntlString,
|
||||||
|
icon: view.icon.Table,
|
||||||
|
hidden: false,
|
||||||
|
navigatorModel: {
|
||||||
|
spaces: [
|
||||||
|
],
|
||||||
|
specials: [
|
||||||
|
{
|
||||||
|
label: 'Transactions' as IntlString,
|
||||||
|
icon: view.icon.Table,
|
||||||
|
id: 'transactions',
|
||||||
|
component: devmodel.component.ModelView
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Queries' as IntlString,
|
||||||
|
icon: view.icon.Table,
|
||||||
|
id: 'queries',
|
||||||
|
component: devmodel.component.QueryView
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}, devmodel.ids.DevModelApp)
|
||||||
|
|
||||||
|
const model = client.getModel()
|
||||||
|
for (const tx of builder.getTxes()) {
|
||||||
|
await model.tx(tx)
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ModelClient(client)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function toIntl (value: string): IntlString {
|
||||||
|
return value as IntlString
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async (): Promise<Resources> => ({
|
||||||
|
component: {
|
||||||
|
ModelView,
|
||||||
|
QueryView
|
||||||
|
},
|
||||||
|
hook: {
|
||||||
|
Hook
|
||||||
|
}
|
||||||
|
})
|
25
plugins/devmodel-resources/src/plugin.ts
Normal file
25
plugins/devmodel-resources/src/plugin.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// 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 devmodel, { devModelId } from '@anticrm/devmodel'
|
||||||
|
import { mergeIds } from '@anticrm/platform'
|
||||||
|
import { Ref } from '@anticrm/core'
|
||||||
|
import { Application } from '@anticrm/workbench'
|
||||||
|
|
||||||
|
export default mergeIds(devModelId, devmodel, {
|
||||||
|
ids: {
|
||||||
|
DevModelApp: '' as Ref<Application>
|
||||||
|
}
|
||||||
|
})
|
5
plugins/devmodel-resources/svelte.config.js
Normal file
5
plugins/devmodel-resources/svelte.config.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const sveltePreprocess = require('svelte-preprocess')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
preprocess: sveltePreprocess()
|
||||||
|
};
|
15
plugins/devmodel-resources/tsconfig.json
Normal file
15
plugins/devmodel-resources/tsconfig.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"target": "esnext",
|
||||||
|
"module": "esnext",
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "./lib",
|
||||||
|
"strict": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"lib": [
|
||||||
|
"esnext",
|
||||||
|
"dom"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
7
plugins/devmodel/.eslintrc.js
Normal file
7
plugins/devmodel/.eslintrc.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
module.exports = {
|
||||||
|
extends: ['./node_modules/@anticrm/platform-rig/profiles/default/config/eslint.config.json'],
|
||||||
|
parserOptions: {
|
||||||
|
tsconfigRootDir: __dirname,
|
||||||
|
project: './tsconfig.json'
|
||||||
|
}
|
||||||
|
}
|
4
plugins/devmodel/.npmignore
Normal file
4
plugins/devmodel/.npmignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
*
|
||||||
|
!/lib/**
|
||||||
|
!CHANGELOG.md
|
||||||
|
/lib/**/__tests__/
|
5
plugins/devmodel/config/rig.json
Normal file
5
plugins/devmodel/config/rig.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
|
||||||
|
"rigPackageName": "@anticrm/platform-rig",
|
||||||
|
"rigProfile": "default"
|
||||||
|
}
|
32
plugins/devmodel/package.json
Normal file
32
plugins/devmodel/package.json
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"name": "@anticrm/devmodel",
|
||||||
|
"version": "0.6.0",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"author": "Anticrm Platform Contributors",
|
||||||
|
"license": "EPL-2.0",
|
||||||
|
"scripts": {
|
||||||
|
"build": "heft build",
|
||||||
|
"build:watch": "tsc",
|
||||||
|
"lint:fix": "eslint --fix src",
|
||||||
|
"format": "prettier --write src && eslint --fix src"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@anticrm/platform-rig":"~0.6.0",
|
||||||
|
"@types/heft-jest":"^1.0.2",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
||||||
|
"@typescript-eslint/parser": "^5.4.0",
|
||||||
|
"eslint-config-standard-with-typescript": "^21.0.1",
|
||||||
|
"eslint-plugin-import": "^2.25.3",
|
||||||
|
"eslint-plugin-node": "^11.1.0",
|
||||||
|
"eslint-plugin-promise": "^5.1.1",
|
||||||
|
"eslint": "^7.32.0",
|
||||||
|
"prettier": "^2.4.1",
|
||||||
|
"@rushstack/heft": "^0.41.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@anticrm/platform":"~0.6.5",
|
||||||
|
"@anticrm/core":"~0.6.12",
|
||||||
|
"@anticrm/ui": "~0.6.0",
|
||||||
|
"@anticrm/client": "~0.6.1"
|
||||||
|
}
|
||||||
|
}
|
39
plugins/devmodel/src/index.ts
Normal file
39
plugins/devmodel/src/index.ts
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
//
|
||||||
|
// Copyright © 2020, 2021 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 { Asset, Plugin, Resource } from '@anticrm/platform'
|
||||||
|
import { plugin } from '@anticrm/platform'
|
||||||
|
import type { AnyComponent } from '@anticrm/ui'
|
||||||
|
import { ClientHook } from '@anticrm/client'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export const devModelId = 'devmodel' as Plugin
|
||||||
|
|
||||||
|
export default plugin(devModelId, {
|
||||||
|
icon: {
|
||||||
|
Activity: '' as Asset
|
||||||
|
},
|
||||||
|
component: {
|
||||||
|
ModelView: '' as AnyComponent,
|
||||||
|
QueryView: '' as AnyComponent,
|
||||||
|
TransactionView: '' as AnyComponent,
|
||||||
|
NotificationsView: '' as AnyComponent
|
||||||
|
},
|
||||||
|
hook: {
|
||||||
|
Hook: '' as Resource<ClientHook>
|
||||||
|
}
|
||||||
|
})
|
9
plugins/devmodel/tsconfig.json
Normal file
9
plugins/devmodel/tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./node_modules/@anticrm/platform-rig/profiles/default/tsconfig.json",
|
||||||
|
|
||||||
|
"compilerOptions": {
|
||||||
|
"rootDir": "./src",
|
||||||
|
"outDir": "./lib",
|
||||||
|
"lib": ["esnext", "dom"]
|
||||||
|
}
|
||||||
|
}
|
12
rush.json
12
rush.json
@ -855,6 +855,16 @@
|
|||||||
"packageName": "@anticrm/model-telegram",
|
"packageName": "@anticrm/model-telegram",
|
||||||
"projectFolder": "models/telegram",
|
"projectFolder": "models/telegram",
|
||||||
"shouldPublish": true
|
"shouldPublish": true
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"packageName": "@anticrm/devmodel-resources",
|
||||||
|
"projectFolder": "plugins/devmodel-resources",
|
||||||
|
"shouldPublish": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"packageName": "@anticrm/devmodel",
|
||||||
|
"projectFolder": "plugins/devmodel",
|
||||||
|
"shouldPublish": true
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user