Remove old automation (#3835)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-10-13 12:21:01 +06:00 committed by GitHub
parent 41f54455fe
commit 8772391971
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 10 additions and 1641 deletions

View File

@ -44,15 +44,6 @@ dependencies:
'@rush-temp/attachment-resources':
specifier: file:./projects/attachment-resources.tgz
version: file:projects/attachment-resources.tgz(@types/node@16.11.68)(esbuild@0.16.17)(postcss-load-config@4.0.1)(postcss@8.4.31)(ts-node@10.9.1)
'@rush-temp/automation':
specifier: file:./projects/automation.tgz
version: file:projects/automation.tgz(@types/node@16.11.68)(esbuild@0.16.17)(ts-node@10.9.1)
'@rush-temp/automation-assets':
specifier: file:./projects/automation-assets.tgz
version: file:projects/automation-assets.tgz(esbuild@0.16.17)(ts-node@10.9.1)(typescript@5.2.2)
'@rush-temp/automation-resources':
specifier: file:./projects/automation-resources.tgz
version: file:projects/automation-resources.tgz(@types/node@16.11.68)(esbuild@0.16.17)(postcss-load-config@4.0.1)(postcss@8.4.31)(ts-node@10.9.1)
'@rush-temp/bitrix':
specifier: file:./projects/bitrix.tgz
version: file:projects/bitrix.tgz(@types/node@16.11.68)(esbuild@0.16.17)(ts-node@10.9.1)
@ -206,9 +197,6 @@ dependencies:
'@rush-temp/model-attachment':
specifier: file:./projects/model-attachment.tgz
version: file:projects/model-attachment.tgz(typescript@5.2.2)
'@rush-temp/model-automation':
specifier: file:./projects/model-automation.tgz
version: file:projects/model-automation.tgz(typescript@5.2.2)
'@rush-temp/model-bitrix':
specifier: file:./projects/model-bitrix.tgz
version: file:projects/model-bitrix.tgz(typescript@5.2.2)
@ -701,6 +689,9 @@ dependencies:
'@tiptap/extension-link':
specifier: ^2.0.3
version: 2.1.11(@tiptap/core@2.1.11)(@tiptap/pm@2.1.11)
'@tiptap/extension-list-keymap':
specifier: ^2.0.4
version: 2.1.12(@tiptap/core@2.1.11)
'@tiptap/extension-mention':
specifier: ^2.0.3
version: 2.1.11(@tiptap/core@2.1.11)(@tiptap/pm@2.1.11)(@tiptap/suggestion@2.1.11)
@ -17251,111 +17242,6 @@ packages:
- ts-node
dev: false
file:projects/automation-assets.tgz(esbuild@0.16.17)(ts-node@10.9.1)(typescript@5.2.2):
resolution: {integrity: sha512-FUobXBxTDopQ8DD0n6krW9b+Xjxyk1iN26iYPFgAp9ft652j8KinNVFC7MSKTip+gRFqeg+OrG8JYt2UA73RAg==, tarball: file:projects/automation-assets.tgz}
id: file:projects/automation-assets.tgz
name: '@rush-temp/automation-assets'
version: 0.0.0
dependencies:
'@types/jest': 29.5.5
'@types/node': 16.11.68
'@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.51.0)(typescript@5.2.2)
'@typescript-eslint/parser': 5.62.0(eslint@8.51.0)(typescript@5.2.2)
eslint: 8.51.0
eslint-config-standard-with-typescript: 23.0.0(@typescript-eslint/eslint-plugin@5.62.0)(eslint-plugin-import@2.28.1)(eslint-plugin-n@15.7.0)(eslint-plugin-promise@6.1.1)(eslint@8.51.0)(typescript@5.2.2)
eslint-plugin-import: 2.28.1(eslint@8.51.0)
eslint-plugin-n: 15.7.0(eslint@8.51.0)
eslint-plugin-promise: 6.1.1(eslint@8.51.0)
jest: 29.7.0(@types/node@16.11.68)(ts-node@10.9.1)
prettier: 2.8.8
ts-jest: 29.1.1(esbuild@0.16.17)(jest@29.7.0)(typescript@5.2.2)
transitivePeerDependencies:
- '@babel/core'
- '@jest/types'
- babel-jest
- babel-plugin-macros
- esbuild
- node-notifier
- supports-color
- ts-node
- typescript
dev: false
file:projects/automation-resources.tgz(@types/node@16.11.68)(esbuild@0.16.17)(postcss-load-config@4.0.1)(postcss@8.4.31)(ts-node@10.9.1):
resolution: {integrity: sha512-Hd9+HaIp4zoRwRfGyQ6vw1d83+utlM7ve7W3RA1UmHRAis5DHpxJ2yg+0hcFxJ3pPK4gYFANs1pO3AiXy7S95g==, tarball: file:projects/automation-resources.tgz}
id: file:projects/automation-resources.tgz
name: '@rush-temp/automation-resources'
version: 0.0.0
dependencies:
'@types/jest': 29.5.5
'@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.51.0)(typescript@5.2.2)
'@typescript-eslint/parser': 5.62.0(eslint@8.51.0)(typescript@5.2.2)
eslint: 8.51.0
eslint-config-standard-with-typescript: 23.0.0(@typescript-eslint/eslint-plugin@5.62.0)(eslint-plugin-import@2.28.1)(eslint-plugin-n@15.7.0)(eslint-plugin-promise@6.1.1)(eslint@8.51.0)(typescript@5.2.2)
eslint-plugin-import: 2.28.1(eslint@8.51.0)
eslint-plugin-n: 15.7.0(eslint@8.51.0)
eslint-plugin-promise: 6.1.1(eslint@8.51.0)
eslint-plugin-svelte3: 4.0.0(eslint@8.51.0)(svelte@3.55.1)
jest: 29.7.0(@types/node@16.11.68)(ts-node@10.9.1)
prettier: 2.8.8
prettier-plugin-svelte: 2.10.1(prettier@2.8.8)(svelte@3.55.1)
sass: 1.69.0
svelte: 3.55.1
svelte-check: 3.5.2(postcss-load-config@4.0.1)(postcss@8.4.31)(sass@1.69.0)(svelte@3.55.1)
svelte-loader: 3.1.9(svelte@3.55.1)
svelte-preprocess: 5.0.3(postcss-load-config@4.0.1)(postcss@8.4.31)(sass@1.69.0)(svelte@3.55.1)(typescript@5.2.2)
ts-jest: 29.1.1(esbuild@0.16.17)(jest@29.7.0)(typescript@5.2.2)
typescript: 5.2.2
transitivePeerDependencies:
- '@babel/core'
- '@jest/types'
- '@types/node'
- babel-jest
- babel-plugin-macros
- coffeescript
- esbuild
- less
- node-notifier
- postcss
- postcss-load-config
- pug
- stylus
- sugarss
- supports-color
- ts-node
dev: false
file:projects/automation.tgz(@types/node@16.11.68)(esbuild@0.16.17)(ts-node@10.9.1):
resolution: {integrity: sha512-c0LD5OtqQUTfmpWIjJeA5SAvTdTM+ctxwBLuHSxshLR2rpL1L+9S8MQLzxdlj2QGhttF+PIeQ3LCbDa1pL7WJg==, tarball: file:projects/automation.tgz}
id: file:projects/automation.tgz
name: '@rush-temp/automation'
version: 0.0.0
dependencies:
'@types/jest': 29.5.5
'@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.51.0)(typescript@5.2.2)
'@typescript-eslint/parser': 5.62.0(eslint@8.51.0)(typescript@5.2.2)
eslint: 8.51.0
eslint-config-standard-with-typescript: 23.0.0(@typescript-eslint/eslint-plugin@5.62.0)(eslint-plugin-import@2.28.1)(eslint-plugin-n@15.7.0)(eslint-plugin-promise@6.1.1)(eslint@8.51.0)(typescript@5.2.2)
eslint-plugin-import: 2.28.1(eslint@8.51.0)
eslint-plugin-n: 15.7.0(eslint@8.51.0)
eslint-plugin-promise: 6.1.1(eslint@8.51.0)
jest: 29.7.0(@types/node@16.11.68)(ts-node@10.9.1)
prettier: 2.8.8
simplytyped: 3.3.0(typescript@5.2.2)
ts-jest: 29.1.1(esbuild@0.16.17)(jest@29.7.0)(typescript@5.2.2)
typescript: 5.2.2
transitivePeerDependencies:
- '@babel/core'
- '@jest/types'
- '@types/node'
- babel-jest
- babel-plugin-macros
- esbuild
- node-notifier
- supports-color
- ts-node
dev: false
file:projects/bitrix-assets.tgz(esbuild@0.16.17)(ts-node@10.9.1)(typescript@5.2.2):
resolution: {integrity: sha512-50gkYPJcVlKyMjdSBVimwnau3KZfGi7lZ1PRKSOuVV4DX8KcsFyxSTcyTvk8M97P9Vw69ybFiMhe855g4+Ur1g==, tarball: file:projects/bitrix-assets.tgz}
id: file:projects/bitrix-assets.tgz
@ -19028,7 +18914,7 @@ packages:
dev: false
file:projects/model-all.tgz(typescript@5.2.2):
resolution: {integrity: sha512-dP4RJRcluO2Ei5V3M1wsBrXEpbUg6sbL46YmpZjNz3KtsUW9fV/kgVMckxGGVR3FmAcMA+AbYV6PJ7rYsX5KIg==, tarball: file:projects/model-all.tgz}
resolution: {integrity: sha512-9wjcmKdzeKziyzmJWkY8GmhLTbZ6h9pRntFnsucalr9SwnLxVjILU2OaUCBVCfdjToMBoHyLm18GZ9RPf0vM9g==, tarball: file:projects/model-all.tgz}
id: file:projects/model-all.tgz
name: '@rush-temp/model-all'
version: 0.0.0
@ -19069,25 +18955,6 @@ packages:
- typescript
dev: false
file:projects/model-automation.tgz(typescript@5.2.2):
resolution: {integrity: sha512-8HX6OcKqQud/fTby0tsQMWIfrZBOKvaySqarmXPs0F6hovRVhMJmktzvriwWZXEC5VIY9feWvlFatyctvr5ivQ==, tarball: file:projects/model-automation.tgz}
id: file:projects/model-automation.tgz
name: '@rush-temp/model-automation'
version: 0.0.0
dependencies:
'@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.51.0)(typescript@5.2.2)
'@typescript-eslint/parser': 5.62.0(eslint@8.51.0)(typescript@5.2.2)
eslint: 8.51.0
eslint-config-standard-with-typescript: 23.0.0(@typescript-eslint/eslint-plugin@5.62.0)(eslint-plugin-import@2.28.1)(eslint-plugin-n@15.7.0)(eslint-plugin-promise@6.1.1)(eslint@8.51.0)(typescript@5.2.2)
eslint-plugin-import: 2.28.1(eslint@8.51.0)
eslint-plugin-n: 15.7.0(eslint@8.51.0)
eslint-plugin-promise: 6.1.1(eslint@8.51.0)
prettier: 2.8.8
transitivePeerDependencies:
- supports-color
- typescript
dev: false
file:projects/model-bitrix.tgz(typescript@5.2.2):
resolution: {integrity: sha512-jeo2BIpJ5ny/DFHjjLReoQez2uPfWrOq+f9npbyTDRtU+vdPUgE4OFLBoqa3UBQu8yWDQRkxKo+AGnq9Mjyv+A==, tarball: file:projects/model-bitrix.tgz}
id: file:projects/model-bitrix.tgz
@ -19108,7 +18975,7 @@ packages:
dev: false
file:projects/model-board.tgz(typescript@5.2.2):
resolution: {integrity: sha512-YsOGs10AaaeAD+BjGQmGrVsDI4Yb3bMB2t61GZZXiczmwwmxaHbzjttYWxExi3hX0EYibORHpZ5bMBv+7Z1i5Q==, tarball: file:projects/model-board.tgz}
resolution: {integrity: sha512-iMhWORSTEgsEQvWcrQ3JSnA3w3JfuXIxHMlNpam/RKrx2EEjrnbDrWCobnzmftvq0e4vb/KFcYxXmVkPYDpzfg==, tarball: file:projects/model-board.tgz}
id: file:projects/model-board.tgz
name: '@rush-temp/model-board'
version: 0.0.0
@ -20381,7 +20248,7 @@ packages:
dev: false
file:projects/pod-server.tgz:
resolution: {integrity: sha512-Ae+6m4MB5si83+NbrDlJLrON4zJzMeaAOk4GVBps1VZtH1mp+tU5/kIOVU551TmQZ6Mswqt4XVh0zAUvum/EAQ==, tarball: file:projects/pod-server.tgz}
resolution: {integrity: sha512-WXNerKZvEK0IPbSBdD3PbZus3GW/idmn7RYAC1lIOJlbXEcTUqt3q3O+IUcDcesg5le4j+j94tOR8bet7UaRvg==, tarball: file:projects/pod-server.tgz}
name: '@rush-temp/pod-server'
version: 0.0.0
dependencies:
@ -20520,7 +20387,7 @@ packages:
dev: false
file:projects/prod.tgz(bufferutil@4.0.7)(esbuild@0.16.17)(sass@1.69.0)(ts-node@10.9.1)(typescript@5.2.2):
resolution: {integrity: sha512-+JRI+5ugHlHkKQmXovzdY3vZp/Acio+pLL79InL10Nd8QA43rTC90zDNztdxvOvxFZ8HhztHnEunfLo1PUYwhA==, tarball: file:projects/prod.tgz}
resolution: {integrity: sha512-B9Sp5Jjjl+wrrnSkv/PyZdFTLFdMJd11aOBcEq9kwZYqAvqYlz6sBO8lloLd11zeyj8u6eLAnYB4Cny4g6hO+A==, tarball: file:projects/prod.tgz}
id: file:projects/prod.tgz
name: '@rush-temp/prod'
version: 0.0.0

View File

@ -78,9 +78,6 @@
"@hcengineering/activity": "^0.6.0",
"@hcengineering/activity-assets": "^0.6.1",
"@hcengineering/activity-resources": "^0.6.1",
"@hcengineering/automation": "^0.6.0",
"@hcengineering/automation-assets": "^0.6.0",
"@hcengineering/automation-resources": "^0.6.0",
"@hcengineering/telegram": "^0.6.13",
"@hcengineering/telegram-assets": "^0.6.0",
"@hcengineering/telegram-resources": "^0.6.0",

View File

@ -17,7 +17,6 @@ import { Plugin, addLocation, addStringsLoader, platformId } from '@hcengineerin
import { activityId } from '@hcengineering/activity'
import { attachmentId } from '@hcengineering/attachment'
import { automationId } from '@hcengineering/automation'
import { boardId } from '@hcengineering/board'
import calendar, { calendarId } from '@hcengineering/calendar'
import { chunterId } from '@hcengineering/chunter'
@ -48,7 +47,6 @@ import { bitrixId } from '@hcengineering/bitrix'
import '@hcengineering/activity-assets'
import '@hcengineering/attachment-assets'
import '@hcengineering/automation-assets'
import '@hcengineering/bitrix-assets'
import '@hcengineering/board-assets'
import '@hcengineering/calendar-assets'
@ -106,7 +104,6 @@ function configureI18n(): void {
addStringsLoader(uiId, async (lang: string) => await import(`@hcengineering/ui/lang/${lang}.json`))
addStringsLoader(activityId, async (lang: string) => await import(`@hcengineering/activity-assets/lang/${lang}.json`))
addStringsLoader(attachmentId, async (lang: string) => await import(`@hcengineering/attachment-assets/lang/${lang}.json`))
addStringsLoader(automationId, async (lang: string) => await import(`@hcengineering/automation-assets/lang/${lang}.json`))
addStringsLoader(bitrixId, async (lang: string) => await import(`@hcengineering/bitrix-assets/lang/${lang}.json`))
addStringsLoader(boardId, async (lang: string) => await import(`@hcengineering/board-assets/lang/${lang}.json`))
addStringsLoader(calendarId, async (lang: string) => await import(`@hcengineering/calendar-assets/lang/${lang}.json`))
@ -193,7 +190,6 @@ export async function configurePlatform() {
addLocation(trackerId, () => import(/* webpackChunkName: "tracker" */ '@hcengineering/tracker-resources'))
addLocation(boardId, () => import(/* webpackChunkName: "board" */ '@hcengineering/board-resources'))
addLocation(automationId, () => import(/* webpackChunkName: "automation" */ '@hcengineering/automation-resources'))
addLocation(hrId, () => import(/* webpackChunkName: "hr" */ '@hcengineering/hr-resources'))
addLocation(bitrixId, () => import(/* webpackChunkName: "bitrix" */ '@hcengineering/bitrix-resources'))
addLocation(requestId, () => import(/* webpackChunkName: "request" */ '@hcengineering/request-resources'))

View File

@ -30,7 +30,6 @@
},
"dependencies": {
"@hcengineering/model": "^0.6.6",
"@hcengineering/model-automation": "^0.6.0",
"@hcengineering/model-core": "^0.6.0",
"@hcengineering/model-view": "^0.6.0",
"@hcengineering/model-workbench": "^0.6.1",

View File

@ -19,7 +19,6 @@ import jsonVersion from './version.json'
import { Builder } from '@hcengineering/model'
import { activityId, createModel as activityModel } from '@hcengineering/model-activity'
import { attachmentId, createModel as attachmentModel } from '@hcengineering/model-attachment'
import { automationId, createModel as automationModel } from '@hcengineering/model-automation'
import bitrix, { bitrixId, createModel as bitrixModel } from '@hcengineering/model-bitrix'
import board, { boardId, createModel as boardModel } from '@hcengineering/model-board'
import calendar, { calendarId, createModel as calendarModel } from '@hcengineering/model-calendar'
@ -260,7 +259,6 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
classFilter: defaultFilter
}
],
[automationModel, automationId],
[supportModel, supportId],
[serverCoreModel, serverCoreId],

View File

@ -16,7 +16,6 @@
// Import migrate operations.
import { MigrateOperation } from '@hcengineering/model'
import { attachmentOperation } from '@hcengineering/model-attachment'
import { automationOperation } from '@hcengineering/model-automation'
import { chunterOperation } from '@hcengineering/model-chunter'
import { contactOperation } from '@hcengineering/model-contact'
import { coreOperation } from '@hcengineering/model-core'
@ -47,7 +46,6 @@ export const migrateOperations: [string, MigrateOperation][] = [
['telegram', telegramOperation],
['task', taskOperation],
['attachment', attachmentOperation],
['automation', automationOperation],
['lead', leadOperation],
['preference', preferenceOperation],
['recruit', recruitOperation],

View File

@ -1,7 +0,0 @@
module.exports = {
extends: ['./node_modules/@hcengineering/platform-rig/profiles/model/eslint.config.json'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json'
}
}

View File

@ -1,5 +0,0 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
"rigPackageName": "@hcengineering/platform-rig",
"rigProfile": "model"
}

View File

@ -1,36 +0,0 @@
{
"name": "@hcengineering/model-automation",
"version": "0.6.0",
"main": "lib/index.js",
"author": "Anticrm Platform Contributors",
"license": "EPL-2.0",
"scripts": {
"build": "tsc",
"build:watch": "tsc",
"lint:fix": "eslint --fix src",
"lint": "eslint src",
"format": "prettier --write src && eslint --fix src"
},
"template": "@hcengineering/model-package",
"devDependencies": {
"@hcengineering/platform-rig": "^0.6.0",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-n": "^15.4.0",
"eslint": "^8.26.0",
"@typescript-eslint/parser": "^5.41.0",
"eslint-config-standard-with-typescript": "^23.0.0",
"prettier": "^2.7.1"
},
"dependencies": {
"@hcengineering/core": "^0.6.27",
"@hcengineering/automation": "^0.6.0",
"@hcengineering/model": "^0.6.6",
"@hcengineering/model-core": "^0.6.0",
"@hcengineering/view": "^0.6.8",
"@hcengineering/setting": "^0.6.10",
"@hcengineering/platform": "^0.6.9",
"@hcengineering/automation-resources": "^0.6.0"
}
}

View File

@ -1,95 +0,0 @@
//
// Copyright © 2022 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.
//
// To help typescript locate view plugin properly
import automation, {
AttributeAutomationSupport,
Automation,
AutomationSortSupport,
AutomationSupport,
AutomationTriggerSupport,
Command,
TriggerType
} from '@hcengineering/automation'
import { Class, Doc, Domain, Ref } from '@hcengineering/core'
import { Builder, Mixin, Model, Prop, TypeString, UX } from '@hcengineering/model'
import core, { TAttachedDoc, TClass } from '@hcengineering/model-core'
import view from '@hcengineering/view'
export { automationId } from '@hcengineering/automation'
export { automationOperation } from './migration'
export const DOMAIN_AUTOMATION = 'automation' as Domain
@Model(automation.class.Automation, core.class.AttachedDoc, DOMAIN_AUTOMATION)
@UX(automation.string.Automation)
export class TAutomation extends TAttachedDoc implements Automation<Doc> {
@Prop(TypeString(), core.string.Name)
name!: string
@Prop(TypeString(), core.string.Description)
description!: string | null
targetClass!: Ref<Class<Doc>> | null
declare trigger: {
type: TriggerType
}
declare commands: Command<Doc>[]
}
@Mixin(automation.mixin.AutomationSupport, core.class.Class)
export class TAutomationSupport extends TClass implements AutomationSupport<Doc> {
declare attributes: AttributeAutomationSupport<Doc>[]
declare trigger: AutomationTriggerSupport<Doc>
sort?: AutomationSortSupport<Doc>
}
export function createModel (builder: Builder): void {
builder.createModel(TAutomation, TAutomationSupport)
builder.createDoc(
core.class.Space,
core.space.Model,
{
archived: false,
description: 'Automation space',
members: [],
name: 'Automation space',
private: true
},
automation.space.Automation
)
/** Disable Automation UI
builder.createDoc(
setting.class.WorkspaceSettingCategory,
core.space.Model,
{
name: 'automation',
label: automation.string.Automation,
icon: automation.icon.Automation, // TODO: update icon
component: plugin.component.AutomationSettingsElement,
order: 3600,
secured: false
},
plugin.ids.Automation
)
*/
// TODO: Enable when server triggers are added
builder.mixin(automation.class.Automation, core.class.Class, view.mixin.IgnoreActions, {
actions: [view.action.Delete]
})
}

View File

@ -1,21 +0,0 @@
//
// Copyright © 2022 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.
//
import { MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@hcengineering/model'
export const automationOperation: MigrateOperation = {
async migrate (client: MigrationClient): Promise<void> {},
async upgrade (client: MigrationUpgradeClient): Promise<void> {}
}

View File

@ -1,29 +0,0 @@
//
// Copyright © 2022 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.
//
import { Ref } from '@hcengineering/core'
import { automationId } from '@hcengineering/automation'
import automation, { PluginType } from '@hcengineering/automation-resources/src/plugin'
import { mergeIds } from '@hcengineering/platform'
import { SettingsCategory } from '@hcengineering/setting'
const pluginData = {
ids: {
Automation: '' as Ref<SettingsCategory>
}
}
const automations: PluginType & typeof pluginData = mergeIds(automationId, automation, pluginData)
export default automations

View File

@ -1,9 +0,0 @@
{
"extends": "./node_modules/@hcengineering/platform-rig/profiles/model/tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./lib",
"tsBuildInfoFile": ".build/build.tsbuildinfo"
}
}

View File

@ -35,7 +35,6 @@
"@hcengineering/model-contact": "^0.6.1",
"@hcengineering/model-chunter": "^0.6.0",
"@hcengineering/model-attachment": "^0.6.0",
"@hcengineering/automation": "^0.6.0",
"@hcengineering/board": "^0.6.11",
"@hcengineering/board-resources": "^0.6.0",
"@hcengineering/view": "^0.6.8",

View File

@ -14,10 +14,9 @@
//
// To help typescript locate view plugin properly
import automation, { AutomationSupport } from '@hcengineering/automation'
import { Board, boardId, Card, CardCover, CommonBoardPreference, MenuPage } from '@hcengineering/board'
import type { Employee } from '@hcengineering/contact'
import { Class, DOMAIN_MODEL, IndexKind, Markup, Ref, Timestamp, Type } from '@hcengineering/core'
import { DOMAIN_MODEL, IndexKind, Markup, Ref, Timestamp, Type } from '@hcengineering/core'
import {
ArrOf,
Builder,
@ -35,13 +34,13 @@ import contact from '@hcengineering/model-contact'
import core, { TDoc, TType } from '@hcengineering/model-core'
import preference, { TPreference } from '@hcengineering/model-preference'
import tags from '@hcengineering/model-tags'
import task, { TSpaceWithStates, TTask, actionTemplates as taskActionTemplates } from '@hcengineering/model-task'
import task, { actionTemplates as taskActionTemplates, TSpaceWithStates, TTask } from '@hcengineering/model-task'
import view, { actionTemplates, createAction, actionTemplates as viewTemplates } from '@hcengineering/model-view'
import workbench, { Application } from '@hcengineering/model-workbench'
import { IntlString } from '@hcengineering/platform'
import { DoneState, State } from '@hcengineering/task'
import type { AnyComponent } from '@hcengineering/ui'
import board from './plugin'
import { DoneState, State } from '@hcengineering/task'
export { boardId } from '@hcengineering/board'
export { boardOperation } from './migration'
@ -487,56 +486,6 @@ export function createModel (builder: Builder): void {
builder.mixin(board.class.Card, core.class.Class, view.mixin.IgnoreActions, {
actions: [view.action.Delete, task.action.Move]
})
builder.mixin<Class<Card>, AutomationSupport<Card>>(
board.class.Card,
core.class.Class,
automation.mixin.AutomationSupport,
{
attributes: [
{
name: 'isArchived'
},
{
name: 'title'
},
{
name: 'description'
}
],
trigger: {
action: {
mode: ['context', 'editor']
}
}
}
)
builder.mixin<Class<Board>, AutomationSupport<Board>>(
board.class.Board,
core.class.Class,
automation.mixin.AutomationSupport,
{
attributes: [
{
name: 'name'
},
{
name: 'description'
},
{
name: 'private'
},
{
name: 'archived'
}
],
trigger: {
action: {
mode: ['context']
}
}
}
)
// TODO: update query when nested query is available
createAction(

View File

@ -1,7 +0,0 @@
module.exports = {
extends: ['./node_modules/@hcengineering/platform-rig/profiles/assets/eslint.config.json'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json'
}
}

View File

@ -1,6 +0,0 @@
<!-- !!! Dublicate chunter-assets (cunter, hashtag, lock) !!! -->
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="automation" viewBox="0 0 16 16">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.6541 10.7952L14.7544 11.6213C14.8576 11.6618 14.9394 11.7434 14.9801 11.8466C15.0511 12.0264 14.9828 12.2268 14.827 12.3284L14.755 12.3656L8.35645 14.8924C8.15935 14.9703 7.94372 14.9831 7.74052 14.9309L7.62035 14.8918L1.25259 12.3653C1.1499 12.3246 1.06864 12.2432 1.02806 12.1404C0.957068 11.9607 1.02536 11.7603 1.1812 11.6587L1.25319 11.6215L3.34307 10.7962L7.06917 12.2751C7.65895 12.5091 8.31525 12.5097 8.9054 12.2766L12.6541 10.7952ZM12.6541 6.77688L14.7544 7.60289C14.8576 7.64346 14.9394 7.72508 14.9801 7.82824C15.0511 8.00803 14.9828 8.20839 14.827 8.31004L14.755 8.3472L10.6001 9.98825L9.619 10.375L8.35645 10.8741L8.317 10.886L8.23566 10.9132C8.20301 10.9215 8.17004 10.9282 8.13688 10.9331C8.12585 10.9346 8.11547 10.936 8.10507 10.9372C8.02541 10.9468 7.94422 10.9464 7.86397 10.9363L7.74052 10.9126L7.62035 10.8735L6.391 10.385L5.38907 9.98825L1.25259 8.34697C1.1499 8.30623 1.06864 8.22483 1.02806 8.12208C0.957068 7.94229 1.02536 7.74192 1.1812 7.64029L1.25319 7.60312L3.34307 6.77788L7.06917 8.25677C7.65895 8.49078 8.31525 8.4913 8.9054 8.25824L12.6541 6.77688ZM7.62186 1.06989C7.85734 0.976906 8.11932 0.976697 8.35494 1.06931L14.7544 3.58452C14.8576 3.62509 14.9394 3.70671 14.9801 3.80987C15.0612 4.01534 14.9605 4.24769 14.755 4.32884L10.6001 5.96988L8.35565 6.856L8.27468 6.88396C8.25405 6.8901 8.23326 6.89557 8.21236 6.90036C8.09824 6.92674 7.98013 6.93258 7.86397 6.91788L7.74052 6.89419L7.62035 6.8551L1.25259 4.3286C1.1499 4.28786 1.06864 4.20646 1.02806 4.10371C0.946925 3.89823 1.04772 3.66589 1.25319 3.58475L7.62186 1.06989Z"></path>
</symbol>
</svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1,5 +0,0 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
"rigPackageName": "@hcengineering/platform-rig",
"rigProfile": "assets"
}

View File

@ -1,7 +0,0 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'],
roots: ["./src"],
coverageReporters: ["text-summary", "html"]
}

View File

@ -1,20 +0,0 @@
{
"string": {
"Automation": "Automation",
"Actions": "Actions",
"Chat": "Chat",
"Content": "Content",
"Dates": "Dates",
"Tracker": "Tracker",
"Trigger": "Trigger",
"Set": "Set",
"To": "to",
"Mode": "Mode",
"AddMenu": "Add menu",
"Menu": "Menu",
"Icon": "Icon",
"SelectClass": "Select class",
"In": "in",
"Update": "Update"
}
}

View File

@ -1,20 +0,0 @@
{
"string": {
"Automation": "Автоматизация",
"Actions": "Действия",
"Chat": "Чат",
"Content": "Контент",
"Dates": "Даты",
"Tracker": "Трекер",
"Trigger": "Триггер",
"Set": "Присвоить",
"To": "значение",
"Mode": "Режим",
"AddMenu": "Добавить меню",
"Menu": "Menu",
"Icon": "Изображение",
"SelectClass": "Выберите класс",
"In": "в",
"Update": "Обновить"
}
}

View File

@ -1,36 +0,0 @@
{
"name": "@hcengineering/automation-assets",
"version": "0.6.0",
"main": "lib/index.js",
"author": "Anticrm Platform Contributors",
"template": "@hcengineering/assets-package",
"license": "EPL-2.0",
"scripts": {
"build": "tsc",
"test": "jest --passWithNoTests --silent",
"build:docs": "",
"lint": "eslint src",
"lint:fix": "eslint --fix src",
"format": "prettier --write src && eslint --fix src",
"build:watch": "tsc"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
"eslint-config-standard-with-typescript": "^23.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.4.0",
"eslint-plugin-promise": "^6.1.1",
"eslint": "^8.26.0",
"prettier": "^2.7.1",
"@types/node": "~16.11.12",
"@hcengineering/platform-rig": "^0.6.0",
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
"@types/jest": "^29.5.5"
},
"dependencies": {
"@hcengineering/platform": "^0.6.9",
"@hcengineering/automation": "^0.6.0"
}
}

View File

@ -1,6 +0,0 @@
import { makeLocalesTest } from '@hcengineering/platform'
it(
'Locales are equale',
makeLocalesTest((lang) => import(`../../lang/${lang}.json`))
)

View File

@ -1,22 +0,0 @@
//
// Copyright © 2022 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 automation from '@hcengineering/automation'
import { loadMetadata } from '@hcengineering/platform'
const icons = require('../assets/icons.svg') as string // eslint-disable-line
loadMetadata(automation.icon, {
Automation: `${icons}#automation`
})

View File

@ -1,10 +0,0 @@
{
"extends": "./node_modules/@hcengineering/platform-rig/profiles/assets/tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./lib",
"types": ["node", "jest"],
"tsBuildInfoFile": ".build/build.tsbuildinfo"
}
}

View File

@ -1,7 +0,0 @@
module.exports = {
extends: ['./node_modules/@hcengineering/platform-rig/profiles/ui/eslint.config.json'],
parserOptions: { tsconfigRootDir: __dirname },
settings: {
'svelte3/ignore-styles': () => true
}
}

View File

@ -1,5 +0,0 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
"rigPackageName": "@hcengineering/platform-rig",
"rigProfile": "ui"
}

View File

@ -1,5 +0,0 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)']
}

View File

@ -1,46 +0,0 @@
{
"name": "@hcengineering/automation-resources",
"version": "0.6.0",
"main": "src/index.ts",
"author": "Anticrm Platform Contributors",
"license": "EPL-2.0",
"scripts": {
"build": "tsc --noEmit --outDir ./dist_cache && echo build",
"build:docs": "api-extractor run --local",
"lint": "svelte-check && eslint",
"lint:fix": "eslint --fix src",
"format": "prettier --write --plugin-search-dir=. src && eslint --fix src",
"build:watch": "tsc --noEmit --outDir ./dist_cache"
},
"devDependencies": {
"@hcengineering/platform-rig": "^0.6.0",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
"eslint": "^8.26.0",
"eslint-config-standard-with-typescript": "^23.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.4.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-svelte3": "^4.0.0",
"prettier": "^2.7.1",
"prettier-plugin-svelte": "^2.8.0",
"sass": "^1.53.0",
"svelte-check": "3.5.2",
"svelte-loader": "^3.1.3",
"svelte-preprocess": "5.0.3",
"typescript": "^5.2.2",
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
"@types/jest": "^29.5.5"
},
"dependencies": {
"@hcengineering/automation": "^0.6.0",
"@hcengineering/core": "^0.6.27",
"@hcengineering/platform": "^0.6.9",
"@hcengineering/presentation": "^0.6.2",
"svelte": "3.55.1",
"@hcengineering/ui": "^0.6.10",
"@hcengineering/view": "^0.6.8",
"@hcengineering/view-resources": "^0.6.0"
}
}

View File

@ -1,5 +0,0 @@
module.exports = {
plugins: [
require('autoprefixer')
]
}

View File

@ -1,101 +0,0 @@
<script lang="ts">
import { AutomationSupport } from '@hcengineering/automation'
import core, { Class, Doc, Ref } from '@hcengineering/core'
import { Asset } from '@hcengineering/platform'
import { getClient } from '@hcengineering/presentation'
import { Button, Dropdown, EditBox, eventToHTMLElement, IconAdd, Label, ListItem, showPopup } from '@hcengineering/ui'
import view from '@hcengineering/view'
import { createEventDispatcher } from 'svelte'
import { Trigger } from '../models'
import automation from '../plugin'
import ClassSelector from './selectors/ClassSelector.svelte'
import IconChooser from './selectors/IconChooser.svelte'
export let trigger: Trigger | undefined = undefined
let targetClass: Ref<Class<Doc>>
let automationSupport: AutomationSupport<Doc>
const dispatch = createEventDispatcher()
const client = getClient()
const hierarchy = client.getHierarchy()
let selectedActionMode: ListItem | undefined = undefined
let name: string | undefined = undefined
let icon: Asset | undefined = undefined
function addActionTrigger () {
if (!name || !selectedActionMode) {
return
}
trigger = {
action: {
context: selectedActionMode?._id as 'editor' | 'context',
target: targetClass,
label: name!,
icon
}
}
dispatch('targetClass', targetClass)
dispatch('trigger', trigger)
}
function chooseIcon (ev: MouseEvent) {
showPopup(IconChooser, { icon }, eventToHTMLElement(ev), (result) => {
if (result !== undefined && result !== null) {
icon = result
}
})
}
const classes = hierarchy
.getDescendants(core.class.Doc)
.map((p) => hierarchy.getClass(p))
.filter((p) => {
if (!hierarchy.hasMixin(p, automation.mixin.AutomationSupport)) {
return false
}
const support = hierarchy.as(p, automation.mixin.AutomationSupport)
return !!support.trigger.action
})
$: if (targetClass) {
automationSupport = hierarchy.as(hierarchy.getClass(targetClass), automation.mixin.AutomationSupport)
}
</script>
<div class="flex-col">
<Label label={automation.string.AddMenu} />
<div class="flex flex-gap-2 mt-2 mb-2 items-center">
<Label label={automation.string.SelectClass} />
<ClassSelector
{classes}
on:selected={(e) => {
targetClass = e.detail
}}
/>
</div>
{#if automationSupport?.trigger?.action}
<div class="flex-between">
<div class="flex flex-gap-3 mb-2">
<div class="flex-col items-baseline justify-center flex-gap-2">
<Label label={automation.string.Icon} />
<Button icon={icon ?? IconAdd} kind="no-border" size="medium" on:click={chooseIcon} />
</div>
<div class="flex-col items-baseline justify-center flex-gap-2">
<Label label={core.string.Name} />
<div class="h-7">
<EditBox bind:value={name} />
</div>
</div>
<div class="flex-col items-baseline justify-center flex-gap-2">
<Label label={automation.string.Mode} />
<Dropdown
items={automationSupport.trigger.action.mode.map((m) => ({ _id: m, isSelectable: true, label: m }))}
bind:selected={selectedActionMode}
placeholder={view.string.LabelNA}
size="medium"
/>
</div>
</div>
<Button icon={IconAdd} kind="ghost" disabled={!name || !selectedActionMode} on:click={addActionTrigger} />
</div>
{/if}
</div>

View File

@ -1,61 +0,0 @@
<script lang="ts">
import { Command } from '@hcengineering/automation'
import core, { Class, Doc, Ref } from '@hcengineering/core'
import presentation, { getClient } from '@hcengineering/presentation'
import { Button, EditBox, Label } from '@hcengineering/ui'
import { Trigger } from '../models'
import { createAutomation } from '../utils'
import AutomationActions from './AutomationActions.svelte'
import AutomationTrigger from './AutomationTrigger.svelte'
export let trigger: Trigger | undefined = undefined
export let commands: Command<Doc>[] = []
const client = getClient()
let targetClass: Ref<Class<Doc>> | undefined = undefined
let name: string | undefined = undefined
let description: string | undefined = undefined
function save () {
if (!name || !trigger || !commands.length) {
return
}
createAutomation(client, name, trigger, commands, { description, targetClass })
}
</script>
<div class="flex-col p-4 w-full">
<div class="flex flex-gap-2 mb-2">
<Label label={core.string.Name} />
<EditBox bind:value={name} />
</div>
<div class="flex flex-gap-2 mb-4">
<Label label={core.string.Description} />
<EditBox bind:value={description} />
</div>
<div class="mb-2">
<AutomationTrigger
{trigger}
on:trigger={(e) => {
trigger = e.detail
}}
on:targetClass={(e) => {
targetClass = e.detail
}}
/>
</div>
{#if trigger}
<div class="mb-2">
<AutomationActions {targetClass} bind:commands />
</div>
{/if}
<Button
label={presentation.string.Save}
disabled={!name || !trigger || !commands.length}
kind="accented"
on:click={save}
/>
</div>

View File

@ -1,130 +0,0 @@
<script lang="ts">
import { Command } from '@hcengineering/automation'
import core, { AnyAttribute, Class, Doc, Ref } from '@hcengineering/core'
import { getClient } from '@hcengineering/presentation'
import { Button, IconDelete, Label } from '@hcengineering/ui'
import { ActionTab } from '../models'
import automation from '../plugin'
import ContentActionCreate from './actions/ContentActionCreate.svelte'
import CommandPresenter from './presenters/CommandPresenter.svelte'
export let targetClass: Ref<Class<Doc>> | undefined = undefined
export let commands: Command<Doc>[] = []
let attributes: Map<string, AnyAttribute> = new Map()
const client = getClient()
const hierarchy = client.getHierarchy()
const attributeSupportMap = new Map()
const contentAttributes: string[] = []
const dateAttributes: string[] = []
const collectionAttributes: string[] = []
const arrayAttributes: string[] = []
const refAttributes: string[] = []
let currentTab: ActionTab | undefined = undefined
function addCommand (e: CustomEvent<Command<Doc>>) {
commands.push(e.detail)
commands = commands
}
function removeCommand (command: Command<Doc>) {
commands = commands.filter((c) => c !== command)
}
if (targetClass) {
const classObj = hierarchy.getClass(targetClass)
const automationSupport = hierarchy.as(classObj, automation.mixin.AutomationSupport)
automationSupport?.attributes?.forEach((attr) => {
attributeSupportMap.set(attr.name, attr)
attributes = hierarchy.getAllAttributes(targetClass!)
const classifier = attributes.get(attr.name)
if (classifier) {
const typeClass = classifier.type._class
if (
typeClass === core.class.TypeBoolean ||
typeClass === core.class.TypeNumber ||
typeClass === core.class.TypeString ||
typeClass === core.class.TypeMarkup
) {
contentAttributes.push(attr.name)
} else if (typeClass === core.class.TypeTimestamp || typeClass === core.class.TypeDate) {
dateAttributes.push(attr.name)
} else if (typeClass === core.class.Collection) {
collectionAttributes.push(attr.name) // TODO
} else if (typeClass === core.class.ArrOf) {
arrayAttributes.push(attr.name) // TODO
} else if (typeClass === core.class.RefTo) {
refAttributes.push(attr.name) // TODO
}
}
})
}
</script>
<div class="flex-col">
<div class="fs-title mb-4">
<Label label={automation.string.Actions} />
</div>
{#each commands as command}
<div class="flex-between mb-2">
<CommandPresenter value={command} />
<Button
icon={IconDelete}
kind="ghost"
on:click={() => {
removeCommand(command)
}}
/>
</div>
{/each}
<div class="flex flex-gap-2">
{#if contentAttributes.length > 0}
<Button
label={automation.string.Content}
kind="no-border"
on:click={() => {
currentTab = ActionTab.Content
}}
/>
{/if}
{#if dateAttributes.length > 0}
<Button
label={automation.string.Dates}
kind="no-border"
on:click={() => {
currentTab = ActionTab.Dates
}}
/>
{/if}
<!--
<Button
label={automation.string.Chat}
kind="no-border"
on:click={() => {
currentTab = ActionTab.Chat
}}
/>
<Button
label={automation.string.Tracker}
kind="no-border"
on:click={() => {
currentTab = ActionTab.Tracker
}}
/>
-->
</div>
<div class="mt-4">
{#if currentTab === ActionTab.Content && targetClass}
{#each contentAttributes as attr}
<ContentActionCreate
attribute={attributes.get(attr)}
automationSupport={attributeSupportMap.get(attr)}
{targetClass}
on:add={addCommand}
/>
{/each}
<!-- {:else if currentTab === ActionTab.Dates}{:else if currentTab === ActionTab.Chat}{:else if currentTab === ActionTab.Tracker} -->
{/if}
</div>
</div>

View File

@ -1,36 +0,0 @@
<script lang="ts">
import ui, { Button, Icon, IconAdd, IconBack, Label } from '@hcengineering/ui'
import automation from '../plugin'
import AddAutomation from './AddAutomation.svelte'
import Automations from './Automations.svelte'
let isAdding = false
</script>
<div class="antiPanel-component">
<div class="ac-header full withSettings short divide">
<div class="ac-header__wrap-title">
<div class="ac-header__icon"><Icon icon={automation.icon.Automation} size="small" /></div>
<span class="ac-header__title"><Label label={automation.string.Automation} /></span>
</div>
<Button
icon={isAdding ? IconBack : IconAdd}
label={isAdding ? ui.string.Cancel : automation.string.Automation}
kind={isAdding ? 'no-border' : 'accented'}
on:click={() => {
isAdding = !isAdding
}}
/>
</div>
{#if isAdding}
<div class="ac-body columns hScroll">
<AddAutomation
on:close={() => {
isAdding = false
}}
/>
</div>
{:else}
<Automations />
{/if}
</div>

View File

@ -1,30 +0,0 @@
<script lang="ts">
import { Button, IconDelete, Label } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
import { Trigger } from '../models'
import automation from '../plugin'
import TriggerPresenter from './presenters/TriggerPresenter.svelte'
import AddActionTrigger from './AddActionTrigger.svelte'
export let trigger: Trigger | undefined = undefined
const dispatch = createEventDispatcher()
function clearTrigger () {
trigger = undefined
dispatch('trigger', trigger)
}
</script>
<div class="flex-col">
<div class="fs-title mb-4">
<Label label={automation.string.Trigger} />
</div>
{#if trigger}
<div class="flex-between">
<TriggerPresenter value={trigger} />
<Button icon={IconDelete} kind="ghost" on:click={clearTrigger} />
</div>
{:else}
<AddActionTrigger on:trigger on:targetClass />
{/if}
</div>

View File

@ -1,6 +0,0 @@
<script lang="ts">
import automation from '@hcengineering/automation'
import { TableBrowser } from '@hcengineering/view-resources'
</script>
<TableBrowser _class={automation.class.Automation} config={['name', 'description', 'modifiedOn']} query={{}} />

View File

@ -1,57 +0,0 @@
<script lang="ts">
import { CommandType, UpdateDocCommand } from '@hcengineering/automation'
import core, { AnyAttribute, Class, Doc, Ref } from '@hcengineering/core'
import ui, { Button, EditBox, IconAdd, Label } from '@hcengineering/ui'
import { BooleanEditor, NumberEditor } from '@hcengineering/view-resources'
import { createEventDispatcher } from 'svelte'
import automation from '../../plugin'
export let automationSupport: { name: string }
export let attribute: AnyAttribute | undefined = undefined
export let targetClass: Ref<Class<Doc>>
const dispatch = createEventDispatcher()
const typeClass = attribute?.type._class
let value: string | undefined = undefined
function onChange (v: any) {
value = v
}
function add () {
if (attribute && value !== undefined) {
const command: UpdateDocCommand<any> = {
type: CommandType.UpdateDoc,
targetClass,
update: {
[attribute.name]: value
}
}
dispatch('add', command)
}
}
</script>
{#if attribute && automationSupport}
<div class="flex-between">
<div class="flex flex-gap-1 mr-3 items-center">
<Label label={automation.string.Set} />
<span class="font-semi-bold">
<Label label={attribute.label} />
</span>
<Label label={automation.string.To} />
<div>
{#if typeClass === core.class.TypeString || typeClass === core.class.TypeMarkup}
<EditBox bind:value />
{:else if typeClass === core.class.TypeNumber}
<NumberEditor value={Number(value)} {onChange} autoFocus placeholder={ui.string.EditBoxPlaceholder} />
{:else if typeClass === core.class.TypeBoolean}
<BooleanEditor {value} {onChange} />
{/if}
</div>
</div>
<Button icon={IconAdd} kind="ghost" on:click={add} />
</div>
{/if}

View File

@ -1,43 +0,0 @@
<script lang="ts">
import { Doc } from '@hcengineering/core'
import { Command, isUpdateDocCommand, UpdateDocCommand } from '@hcengineering/automation'
import { getClient } from '@hcengineering/presentation'
import { Label } from '@hcengineering/ui'
import { ClassPresenter } from '@hcengineering/view-resources'
import automation from '../../plugin'
export let value: Command<Doc>
const client = getClient()
const hierarchy = client.getHierarchy()
function toUpdateDocCommand (command: Command<Doc>): UpdateDocCommand<Doc> {
return command as UpdateDocCommand<Doc>
}
function toObjectValue (obj: any, attr: any): string {
if (!obj || !attr) {
return ''
}
return obj[attr]?.toString()
}
</script>
{#if isUpdateDocCommand(value)}
{@const updateCommand = toUpdateDocCommand(value)}
{@const targetClass = hierarchy.getClass(updateCommand.targetClass)}
{#each Object.keys(updateCommand.update) as attr}
{@const attribute = hierarchy.getAttribute(updateCommand.targetClass, attr)}
<div class="flex flex-gap-1 items-center">
<Label label={automation.string.Update} />
<span class="font-semi-bold">
<ClassPresenter value={targetClass} />
</span>
<Label label={automation.string.Set} />
<span class="font-semi-bold">
<Label label={attribute.label} />
</span>
<Label label={automation.string.To} />
<span>{toObjectValue(updateCommand.update, attr)}</span>
</div>
{/each}
{/if}

View File

@ -1,29 +0,0 @@
<script lang="ts">
import { getClient } from '@hcengineering/presentation'
import { Icon, Label } from '@hcengineering/ui'
import { ClassPresenter } from '@hcengineering/view-resources'
import { Trigger } from '../../models'
import automation from '../../plugin'
export let value: Trigger
const client = getClient()
const hierarchy = client.getHierarchy()
</script>
{#if value.action}
{@const targetClass = hierarchy.getClass(value.action.target)}
<div class="flex flex-gap-1 items-center">
<span class="mr-4">
<Label label={automation.string.Menu} />
</span>
{#if value.action.icon}
<Icon icon={value.action.icon} size="small" />
{/if}
<span class="mr-2">{value.action.label}</span>
<Label label={automation.string.In} />
<span class="font-semi-bold">
<ClassPresenter value={targetClass} />
</span>
</div>
{/if}

View File

@ -1,22 +0,0 @@
<script lang="ts">
import { Class, Obj } from '@hcengineering/core'
import { translate } from '@hcengineering/platform'
import { DropdownLabels, DropdownTextItem, themeStore } from '@hcengineering/ui'
import automation from '../../plugin'
export let classes: Class<Obj>[] = []
async function getClassItems () {
const classItems: DropdownTextItem[] = []
for (const cl of classes) {
const label = await translate(cl.label, {}, $themeStore.language)
classItems.push({ id: cl._id, label })
}
return classItems
}
</script>
{#await getClassItems() then classItems}
<DropdownLabels label={automation.string.SelectClass} items={classItems} on:selected />
{/await}

View File

@ -1,58 +0,0 @@
<script lang="ts">
import { Metadata } from '@hcengineering/platform'
import presentation, { Card } from '@hcengineering/presentation'
import { Button } from '@hcengineering/ui'
import view from '@hcengineering/view'
import { createEventDispatcher } from 'svelte'
import automation from '../../plugin'
export let icon: Metadata<string> | undefined = undefined
const dispatch = createEventDispatcher()
const icons = [
view.icon.Archive,
view.icon.ArrowRight,
view.icon.Card,
view.icon.Delete,
view.icon.Model,
view.icon.MoreH,
view.icon.Move,
view.icon.Open,
view.icon.Pin,
view.icon.Setting,
view.icon.Statuses,
view.icon.Table,
view.icon.Views
]
function save () {
dispatch('close', icon)
}
</script>
<Card
label={automation.string.Automation}
okLabel={presentation.string.Save}
okAction={save}
canSave={icon !== undefined}
on:changeContent
on:close={() => {
dispatch('close')
}}
>
<div class="float-left-box">
{#each icons as obj}
<div class="float-left p-2">
<Button
icon={obj}
size="medium"
kind={obj === icon ? 'accented' : 'ghost'}
on:click={() => {
icon = obj
}}
/>
</div>
{/each}
</div>
</Card>

View File

@ -1,27 +0,0 @@
//
// 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.
//
import { Resources } from '@hcengineering/platform'
import AutomationSettingsElement from './components/AutomationSettingsElement.svelte'
import { performAutomation } from './utils'
export default async (): Promise<Resources> => ({
component: {
AutomationSettingsElement
},
action: {
PerformAutomation: performAutomation
}
})

View File

@ -1,21 +0,0 @@
import { Class, Doc, Ref } from '@hcengineering/core'
import { Asset } from '@hcengineering/platform'
export enum ActionTab {
Add = 'Add',
Chat = 'Chat',
Content = 'Content',
Dates = 'Dates',
Move = 'Move',
Sort = 'Sort',
Tracker = 'Tracker'
}
export interface Trigger {
action?: {
context: 'context' | 'editor'
target: Ref<Class<Doc>>
label: string
icon?: Asset
}
}

View File

@ -1,28 +0,0 @@
//
// 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 automation, { automationId } from '@hcengineering/automation'
import { mergeIds } from '@hcengineering/platform'
import type { AnyComponent } from '@hcengineering/ui'
const automations = mergeIds(automationId, automation, {
component: {
AutomationSettingsElement: '' as AnyComponent
}
})
export type PluginType = typeof automations
export default automations

View File

@ -1,120 +0,0 @@
import automation, {
Automation,
Command,
isUpdateDocCommand,
PerformAutomationProps,
TriggerType
} from '@hcengineering/automation'
import core, { Class, Doc, Ref, Space, TxOperations } from '@hcengineering/core'
import { IntlString } from '@hcengineering/platform'
import { getClient } from '@hcengineering/presentation'
import view, { Action } from '@hcengineering/view'
import { Trigger } from './models'
export async function createAutomation (
client: TxOperations,
name: string,
trigger: Trigger,
commands: Array<Command<Doc>>,
props: { targetClass?: Ref<Class<Doc>>, attachedTo?: Doc, description?: string } = {}
): Promise<Ref<Automation<Doc>>> {
let space: Ref<Space> = automation.space.Automation
let attachedTo: Ref<Doc> = automation.space.Automation
let attachedToClass: Ref<Class<Doc>> = core.class.Space
const collection = 'automations'
if (props.attachedTo !== undefined) {
space = props.attachedTo.space
attachedTo = props.attachedTo._id
attachedToClass = props.attachedTo._class
}
const automationId = await client.addCollection(
automation.class.Automation,
space,
attachedTo,
attachedToClass,
collection,
{
name,
description: null,
targetClass: props.targetClass ?? null,
trigger: {
type: getTriggerType(trigger)
},
commands
}
)
await createTrigger(client, trigger, space, automationId)
return automationId
}
export function getTriggerType (trigger: Trigger): TriggerType {
if (trigger.action !== undefined) {
return TriggerType.Action
} else {
throw new Error('Unknown automation trigger')
}
}
export async function createTrigger (
client: TxOperations,
trigger: Trigger,
space: Ref<Space>,
automationId: Ref<Automation<Doc>>
): Promise<Doc | undefined> {
if (trigger.action !== undefined) {
const triggerId = await client.createDoc<Action<Doc, PerformAutomationProps>>(view.class.Action, core.space.Model, {
action: automation.action.PerformAutomation,
actionProps: {
automationId,
automationClass: automation.class.Automation
},
category: automation.category.Automation,
context: { mode: trigger.action.context },
icon: trigger.action.icon,
input: 'any',
label: trigger.action.label as IntlString,
target: trigger.action.target
})
return await client.findOne<Action<Doc, PerformAutomationProps>>(view.class.Action, { _id: triggerId })
} else {
throw new Error('Unknown automation trigger')
}
}
export async function performAutomation (
doc: Doc | Doc[] | undefined,
evt: Event,
props: PerformAutomationProps | undefined
): Promise<void> {
if (doc === undefined || props?.automationId === undefined) {
throw new Error('Unknown automation action')
}
const client = getClient()
const automationObj = await client.findOne(props.automationClass ?? automation.class.Automation, {
_id: props.automationId
})
if (automationObj === undefined) {
return
}
let objects = []
if (Array.isArray(doc)) {
objects = doc
} else {
objects = [doc]
}
await doPerformAutomation(client, objects, automationObj)
}
async function doPerformAutomation (client: TxOperations, docs: Doc[], automationObj: Automation<Doc>): Promise<void> {
// TODO: move to automation server
const hierarchy = client.getHierarchy()
for (const doc of docs) {
for (const command of automationObj.commands) {
if (isUpdateDocCommand(command) && hierarchy.isDerived(doc._class, command.targetClass)) {
await client.update(doc, command.update)
}
}
}
}

View File

@ -1,5 +0,0 @@
const sveltePreprocess = require('svelte-preprocess')
module.exports = {
preprocess: sveltePreprocess()
};

View File

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

View File

@ -1,7 +0,0 @@
module.exports = {
extends: ['./node_modules/@hcengineering/platform-rig/profiles/default/eslint.config.json'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json'
}
}

View File

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

View File

@ -1,4 +0,0 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
"rigPackageName": "@hcengineering/platform-rig"
}

View File

@ -1,7 +0,0 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'],
roots: ["./src"],
coverageReporters: ["text-summary", "html"]
}

View File

@ -1,36 +0,0 @@
{
"name": "@hcengineering/automation",
"version": "0.6.0",
"main": "lib/index.js",
"author": "Anticrm Platform Contributors",
"license": "EPL-2.0",
"scripts": {
"build": "tsc",
"build:watch": "tsc",
"test": "jest --passWithNoTests --silent",
"lint:fix": "eslint --fix src",
"lint": "eslint src",
"format": "prettier --write src && eslint --fix src"
},
"devDependencies": {
"@hcengineering/platform-rig": "^0.6.0",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-n": "^15.4.0",
"eslint": "^8.26.0",
"simplytyped": "^3.3.0",
"@typescript-eslint/parser": "^5.41.0",
"eslint-config-standard-with-typescript": "^23.0.0",
"prettier": "^2.7.1",
"typescript": "^5.2.2",
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
"@types/jest": "^29.5.5"
},
"dependencies": {
"@hcengineering/platform": "^0.6.9",
"@hcengineering/core": "^0.6.27",
"@hcengineering/view": "^0.6.8"
}
}

View File

@ -1,148 +0,0 @@
import { AttachedDoc, Class, Doc, DocumentQuery, DocumentUpdate, Mixin, Ref, Space } from '@hcengineering/core'
import { Asset, IntlString, Plugin, plugin } from '@hcengineering/platform'
import { ActionCategory, ViewAction } from '@hcengineering/view'
/**
* @public
*/
export const automationId = 'automation' as Plugin
/**
* @public
*/
export enum CommandType {
UpdateDoc = 'UPDATE_DOC'
}
/**
* @public
*/
export enum TriggerType {
Action = 'ACTION',
Trigger = 'TRIGGER'
}
/**
* @public
*/
export interface AttributeAutomationSupport<T extends Doc> {
name: keyof T
sort?: {
groupBy?: DocumentQuery<Doc>
}
}
/**
* @public
*/
export interface AttributeAutomationTriggerSupport<T extends Doc> {
name: keyof T
}
/**
* @public
*/
export interface AutomationTriggerSupport<T extends Doc> {
action?: {
mode: ('editor' | 'context')[]
}
attributes?: AttributeAutomationTriggerSupport<T>[]
}
/**
* @public
*/
export interface AutomationSortSupport<T extends Doc> {
groupBy?: DocumentQuery<T>
}
/**
* @public
*/
export interface AutomationSupport<T extends Doc> extends Class<Doc> {
attributes: AttributeAutomationSupport<T>[]
trigger: AutomationTriggerSupport<T>
sort?: AutomationSortSupport<T>
}
/**
* @public
*/
export interface Command<T extends Doc> {
fetch?: DocumentQuery<T>
type: CommandType
}
/**
* @public
*/
export interface UpdateDocCommand<T extends Doc> extends Command<T> {
type: CommandType.UpdateDoc
targetClass: Ref<Class<T>>
update: DocumentUpdate<T>
}
/**
* @public
*/
export function isUpdateDocCommand (command: Command<Doc>): command is UpdateDocCommand<Doc> {
return command.type === CommandType.UpdateDoc
}
/**
* @public
*/
export interface Automation<T extends Doc> extends AttachedDoc {
name: string
description: string | null
targetClass: Ref<Class<T>> | null
trigger: {
type: TriggerType
}
commands: Command<T>[]
}
/**
* @public
*/
export interface PerformAutomationProps {
automationId: Ref<Automation<Doc>>
automationClass: Ref<Class<Automation<Doc>>>
}
export default plugin(automationId, {
class: {
Automation: '' as Ref<Class<Automation<Doc>>>
},
action: {
PerformAutomation: '' as ViewAction<PerformAutomationProps>
},
mixin: {
AutomationSupport: '' as Ref<Mixin<AutomationSupport<Doc>>>
},
category: {
Automation: '' as Ref<ActionCategory>
},
string: {
Automation: '' as IntlString,
Actions: '' as IntlString,
Chat: '' as IntlString,
Content: '' as IntlString,
Dates: '' as IntlString,
Tracker: '' as IntlString,
Trigger: '' as IntlString,
Set: '' as IntlString,
To: '' as IntlString,
AddMenu: '' as IntlString,
Menu: '' as IntlString,
Mode: '' as IntlString,
Icon: '' as IntlString,
SelectClass: '' as IntlString,
In: '' as IntlString,
Update: '' as IntlString
},
icon: {
Automation: '' as Asset
},
space: {
Automation: '' as Ref<Space>
}
})

View File

@ -1,9 +0,0 @@
{
"extends": "./node_modules/@hcengineering/platform-rig/profiles/default/tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./lib",
"tsBuildInfoFile": ".build/build.tsbuildinfo"
}
}

View File

@ -47,7 +47,6 @@
"AttachmentTip": "Tip: You can drag and drop files onto cards to upload them.",
"Computer": "Computer",
"CustomFields": "Custom Fields",
"Automation": "Automation",
"AddButton": "Add Button",
"Actions": "Actions",
"Cover": "Cover",

View File

@ -47,7 +47,6 @@
"AttachmentTip": "Совет: Вы можете перетаскивать файлы на карточки, чтобы прикрепить их.",
"Computer": "Компьютер",
"CustomFields": "Дополнительно",
"Automation": "Автоматизация",
"AddButton": "Добавить",
"Actions": "Действия",
"Cover": "Обложка",

View File

@ -68,7 +68,6 @@ export default mergeIds(boardId, board, {
AttachmentTip: '' as IntlString,
Computer: '' as IntlString,
CustomFields: '' as IntlString,
Automation: '' as IntlString,
AddButton: '' as IntlString,
Actions: '' as IntlString,
Cover: '' as IntlString,

View File

@ -97,7 +97,6 @@
"@hcengineering/support-assets": "^0.6.0",
"@hcengineering/contact-assets": "^0.6.8",
"@hcengineering/activity-assets": "^0.6.1",
"@hcengineering/automation-assets": "^0.6.0",
"@hcengineering/telegram-assets": "^0.6.0",
"@hcengineering/workbench-assets": "^0.6.6",
"@hcengineering/attachment-assets": "^0.6.6",
@ -122,7 +121,6 @@
"@hcengineering/setting": "^0.6.10",
"@hcengineering/contact": "^0.6.19",
"@hcengineering/activity": "^0.6.0",
"@hcengineering/automation": "^0.6.0",
"@hcengineering/telegram": "^0.6.13",
"@hcengineering/workbench": "^0.6.8",
"@hcengineering/attachment": "^0.6.8",

View File

@ -89,7 +89,6 @@ import {
import { activityId } from '@hcengineering/activity'
import { attachmentId } from '@hcengineering/attachment'
import { automationId } from '@hcengineering/automation'
import { bitrixId } from '@hcengineering/bitrix'
import { boardId } from '@hcengineering/board'
import { calendarId } from '@hcengineering/calendar'
@ -120,7 +119,6 @@ import loginEng from '@hcengineering/login-assets/lang/en.json'
import activityEn from '@hcengineering/activity-assets/lang/en.json'
import attachmentEn from '@hcengineering/attachment-assets/lang/en.json'
import automationEn from '@hcengineering/automation-assets/lang/en.json'
import bitrixEn from '@hcengineering/bitrix-assets/lang/en.json'
import boardEn from '@hcengineering/board-assets/lang/en.json'
import calendarEn from '@hcengineering/calendar-assets/lang/en.json'
@ -154,7 +152,6 @@ addStringsLoader(attachmentId, async (lang: string) => attachmentEn)
addStringsLoader(contactId, async (lang: string) => contactEn)
addStringsLoader(recruitId, async (lang: string) => recruitEn)
addStringsLoader(activityId, async (lang: string) => activityEn)
addStringsLoader(automationId, async (lang: string) => automationEn)
addStringsLoader(settingId, async (lang: string) => settingEn)
addStringsLoader(supportId, async (lang: string) => supportEn)
addStringsLoader(telegramId, async (lang: string) => telegramEn)

View File

@ -1323,26 +1323,6 @@
"projectFolder": "pods/backup",
"shouldPublish": false
},
{
"packageName": "@hcengineering/automation",
"projectFolder": "plugins/automation",
"shouldPublish": false
},
{
"packageName": "@hcengineering/automation-resources",
"projectFolder": "plugins/automation-resources",
"shouldPublish": false
},
{
"packageName": "@hcengineering/automation-assets",
"projectFolder": "plugins/automation-assets",
"shouldPublish": false
},
{
"packageName": "@hcengineering/model-automation",
"projectFolder": "models/automation",
"shouldPublish": false
},
{
"packageName": "@hcengineering/hr",
"projectFolder": "plugins/hr",