mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 11:01:54 +03:00
Setting plugin (#328)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
ef0c3e8c91
commit
5e807d466a
@ -41,6 +41,7 @@ specifiers:
|
||||
'@rush-temp/model-server-core': file:./projects/model-server-core.tgz
|
||||
'@rush-temp/model-server-recruit': file:./projects/model-server-recruit.tgz
|
||||
'@rush-temp/model-server-view': file:./projects/model-server-view.tgz
|
||||
'@rush-temp/model-setting': file:./projects/model-setting.tgz
|
||||
'@rush-temp/model-task': file:./projects/model-task.tgz
|
||||
'@rush-temp/model-view': file:./projects/model-view.tgz
|
||||
'@rush-temp/model-workbench': file:./projects/model-workbench.tgz
|
||||
@ -64,6 +65,9 @@ specifiers:
|
||||
'@rush-temp/server-view': file:./projects/server-view.tgz
|
||||
'@rush-temp/server-view-resources': file:./projects/server-view-resources.tgz
|
||||
'@rush-temp/server-ws': file:./projects/server-ws.tgz
|
||||
'@rush-temp/setting': file:./projects/setting.tgz
|
||||
'@rush-temp/setting-assets': file:./projects/setting-assets.tgz
|
||||
'@rush-temp/setting-resources': file:./projects/setting-resources.tgz
|
||||
'@rush-temp/task': file:./projects/task.tgz
|
||||
'@rush-temp/task-assets': file:./projects/task-assets.tgz
|
||||
'@rush-temp/task-resources': file:./projects/task-resources.tgz
|
||||
@ -182,6 +186,7 @@ dependencies:
|
||||
'@rush-temp/model-server-core': file:projects/model-server-core.tgz_typescript@4.4.3
|
||||
'@rush-temp/model-server-recruit': file:projects/model-server-recruit.tgz_typescript@4.4.3
|
||||
'@rush-temp/model-server-view': file:projects/model-server-view.tgz_typescript@4.4.3
|
||||
'@rush-temp/model-setting': file:projects/model-setting.tgz_typescript@4.4.3
|
||||
'@rush-temp/model-task': file:projects/model-task.tgz_typescript@4.4.3
|
||||
'@rush-temp/model-view': file:projects/model-view.tgz_typescript@4.4.3
|
||||
'@rush-temp/model-workbench': file:projects/model-workbench.tgz_typescript@4.4.3
|
||||
@ -205,6 +210,9 @@ dependencies:
|
||||
'@rush-temp/server-view': file:projects/server-view.tgz_typescript@4.4.3
|
||||
'@rush-temp/server-view-resources': file:projects/server-view-resources.tgz_typescript@4.4.3
|
||||
'@rush-temp/server-ws': file:projects/server-ws.tgz_typescript@4.4.3
|
||||
'@rush-temp/setting': file:projects/setting.tgz_typescript@4.4.3
|
||||
'@rush-temp/setting-assets': file:projects/setting-assets.tgz
|
||||
'@rush-temp/setting-resources': file:projects/setting-resources.tgz_e1367da94684b005adf08f025c517b1a
|
||||
'@rush-temp/task': file:projects/task.tgz_typescript@4.4.3
|
||||
'@rush-temp/task-assets': file:projects/task-assets.tgz
|
||||
'@rush-temp/task-resources': file:projects/task-resources.tgz_e1367da94684b005adf08f025c517b1a
|
||||
@ -2234,7 +2242,7 @@ packages:
|
||||
ajv:
|
||||
optional: true
|
||||
dependencies:
|
||||
ajv: 8.8.1
|
||||
ajv: 8.8.2
|
||||
dev: false
|
||||
|
||||
/ajv-keywords/3.5.2_ajv@6.12.6:
|
||||
@ -2245,12 +2253,12 @@ packages:
|
||||
ajv: 6.12.6
|
||||
dev: false
|
||||
|
||||
/ajv-keywords/5.0.0_ajv@8.8.1:
|
||||
resolution: {integrity: sha512-ULd1QMjRoH6JDNUQIfDLrlE+OgZlFaxyYCjzt58uNuUQtKXt8/U+vK/8Ql0gyn/C5mqZzUWtKMqr/4YquvTrWA==}
|
||||
/ajv-keywords/5.1.0_ajv@8.8.2:
|
||||
resolution: {integrity: sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==}
|
||||
peerDependencies:
|
||||
ajv: ^8.0.0
|
||||
ajv: ^8.8.2
|
||||
dependencies:
|
||||
ajv: 8.8.1
|
||||
ajv: 8.8.2
|
||||
fast-deep-equal: 3.1.3
|
||||
dev: false
|
||||
|
||||
@ -2272,8 +2280,8 @@ packages:
|
||||
uri-js: 4.4.1
|
||||
dev: false
|
||||
|
||||
/ajv/8.8.1:
|
||||
resolution: {integrity: sha512-6CiMNDrzv0ZR916u2T+iRunnD60uWmNn8SkdB44/6stVORUg0aAkWO7PkOhpCmjmW8f2I/G/xnowD66fxGyQJg==}
|
||||
/ajv/8.8.2:
|
||||
resolution: {integrity: sha512-x9VuX+R/jcFj1DHo/fCp99esgGDWiHENrKxaCENuCxpoMCmAt/COCGVDwA7kleEpEzJjDnvh3yGoOuLu0Dtllw==}
|
||||
dependencies:
|
||||
fast-deep-equal: 3.1.3
|
||||
json-schema-traverse: 1.0.0
|
||||
@ -2633,6 +2641,7 @@ packages:
|
||||
|
||||
/bindings/1.5.0:
|
||||
resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
file-uri-to-path: 1.0.0
|
||||
dev: false
|
||||
@ -4294,6 +4303,7 @@ packages:
|
||||
|
||||
/file-uri-to-path/1.0.0:
|
||||
resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==}
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
@ -6450,6 +6460,7 @@ packages:
|
||||
|
||||
/nan/2.15.0:
|
||||
resolution: {integrity: sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==}
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
@ -7547,7 +7558,7 @@ packages:
|
||||
/resolve/1.20.0:
|
||||
resolution: {integrity: sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==}
|
||||
dependencies:
|
||||
is-core-module: 2.7.0
|
||||
is-core-module: 2.8.0
|
||||
path-parse: 1.0.7
|
||||
dev: false
|
||||
|
||||
@ -7719,9 +7730,9 @@ packages:
|
||||
engines: {node: '>= 12.13.0'}
|
||||
dependencies:
|
||||
'@types/json-schema': 7.0.9
|
||||
ajv: 8.8.1
|
||||
ajv: 8.8.2
|
||||
ajv-formats: 2.1.1
|
||||
ajv-keywords: 5.0.0_ajv@8.8.1
|
||||
ajv-keywords: 5.1.0_ajv@8.8.2
|
||||
dev: false
|
||||
|
||||
/secure-json-parse/2.4.0:
|
||||
@ -9978,7 +9989,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/model-all.tgz_typescript@4.4.3:
|
||||
resolution: {integrity: sha512-dgYN/ewRyTz9ehJVxJP7GYqm9i/aC24yOG4nOmLq1WU8joV8mlXxwoZJhA5fmdrgS23Ww6xiLwNoZ7ir+TsNNA==, tarball: file:projects/model-all.tgz}
|
||||
resolution: {integrity: sha512-UP8PoaNuPoVGjUg1fAHenpbEjGRGwz4PHXGuadhXHzbglw5g2tGJbEGTvrIOkty28uh3K54OZ0EPhcz7it67nA==, tarball: file:projects/model-all.tgz}
|
||||
id: file:projects/model-all.tgz
|
||||
name: '@rush-temp/model-all'
|
||||
version: 0.0.0
|
||||
@ -10170,6 +10181,23 @@ packages:
|
||||
- typescript
|
||||
dev: false
|
||||
|
||||
file:projects/model-setting.tgz_typescript@4.4.3:
|
||||
resolution: {integrity: sha512-iIfNBlCCEb8X0Ex7ZImM6rV2Q9UZ5wmqRqepHK4cp8yJ7IPN/gwETHLqLnm9kkkSiPdI/pVNmIhSReyR+65AqQ==, tarball: file:projects/model-setting.tgz}
|
||||
id: file:projects/model-setting.tgz
|
||||
name: '@rush-temp/model-setting'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@typescript-eslint/eslint-plugin': 4.33.0_eslint@7.32.0+typescript@4.4.3
|
||||
eslint: 7.32.0
|
||||
eslint-plugin-import: 2.25.3_eslint@7.32.0
|
||||
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
||||
eslint-plugin-promise: 4.3.1
|
||||
transitivePeerDependencies:
|
||||
- '@typescript-eslint/parser'
|
||||
- supports-color
|
||||
- typescript
|
||||
dev: false
|
||||
|
||||
file:projects/model-task.tgz_typescript@4.4.3:
|
||||
resolution: {integrity: sha512-ECVFsBQDPeXBhwde4kBvnJlE8sXbSuSPOVa76QAdw4poccNaXabQbDUMNKNIquq4kTPGp7GhUUbaDk316zWmcw==, tarball: file:projects/model-task.tgz}
|
||||
id: file:projects/model-task.tgz
|
||||
@ -10381,7 +10409,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/prod.tgz_sass@1.42.1+typescript@4.4.3:
|
||||
resolution: {integrity: sha512-x7H3hwhd/DGstkIJ2QG1AJMUyFKeP//3BVCL24c8w4Z1xMD+fnfsg5pf3V1c/LkHk/e3D3YyPTqBOAt5+u1mJQ==, tarball: file:projects/prod.tgz}
|
||||
resolution: {integrity: sha512-GCcPe++xT1m51ZmTKEX/KBB957pSUkO2CbgSa93yCs6XX8V4O6/fiG/w+EPTdhNP/3TSIf8Lk0Ys8pE2uwy20g==, tarball: file:projects/prod.tgz}
|
||||
id: file:projects/prod.tgz
|
||||
name: '@rush-temp/prod'
|
||||
version: 0.0.0
|
||||
@ -10682,6 +10710,66 @@ packages:
|
||||
- typescript
|
||||
dev: false
|
||||
|
||||
file:projects/setting-assets.tgz:
|
||||
resolution: {integrity: sha512-JKszjyXjZ3ec9TNPCllwQAdZSL07axM5RKwRqhZzgV95S5/n3aMZF9R7crgR3VNSBZ2FEq0G9do2nX5Z+7kptA==, tarball: file:projects/setting-assets.tgz}
|
||||
name: '@rush-temp/setting-assets'
|
||||
version: 0.0.0
|
||||
dev: false
|
||||
|
||||
file:projects/setting-resources.tgz_e1367da94684b005adf08f025c517b1a:
|
||||
resolution: {integrity: sha512-aoByeag8MLg3JMnxAgMrLZddsHJ3dhi53wPp2md27kB6fqP3ZbL9zoOoPelEtauKe6XMuufEscpVINP4ojsM4g==, tarball: file:projects/setting-resources.tgz}
|
||||
id: file:projects/setting-resources.tgz
|
||||
name: '@rush-temp/setting-resources'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@types/deep-equal': 1.0.1
|
||||
'@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/setting.tgz_typescript@4.4.3:
|
||||
resolution: {integrity: sha512-gJg91WiZ9nc4qsqwv/i+K60U7sOryXP2aGNHKlv6jXumRKAVki2HBsrUC6yk/Rbbu5E1gyuIYTeEPC5pDrFQkw==, tarball: file:projects/setting.tgz}
|
||||
id: file:projects/setting.tgz
|
||||
name: '@rush-temp/setting'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@types/heft-jest': 1.0.2
|
||||
'@typescript-eslint/eslint-plugin': 4.33.0_eslint@7.32.0+typescript@4.4.3
|
||||
eslint: 7.32.0
|
||||
eslint-plugin-import: 2.25.3_eslint@7.32.0
|
||||
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
||||
eslint-plugin-promise: 4.3.1
|
||||
transitivePeerDependencies:
|
||||
- '@typescript-eslint/parser'
|
||||
- supports-color
|
||||
- typescript
|
||||
dev: false
|
||||
|
||||
file:projects/task-assets.tgz:
|
||||
resolution: {integrity: sha512-iCE65Ymh4mzKwv/rdQLUKsr616J8EFXGjsfbPG35QwRNWStKMyiGTRxgnqs+ANKoZMztGdcZXq3DXemT1IZWeQ==, tarball: file:projects/task-assets.tgz}
|
||||
name: '@rush-temp/task-assets'
|
||||
@ -10915,7 +11003,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/workbench-resources.tgz_e1367da94684b005adf08f025c517b1a:
|
||||
resolution: {integrity: sha512-qnWLfIbQ3OZ9SrZo+0Y9FnJlx+hPimmRgdXuziAK95a+K6nScmGTxQI0klGDvA9M1IFWikxButJ8GAPMqU1QBQ==, tarball: file:projects/workbench-resources.tgz}
|
||||
resolution: {integrity: sha512-y7W8oQuhPXIzrM/erW/ajFnF4iO8f2FHXHNZ+jM2XSLqnhXeXZQlIzYMOq4lVWWl+RfYoZNxLeeia76z5qAHdQ==, tarball: file:projects/workbench-resources.tgz}
|
||||
id: file:projects/workbench-resources.tgz
|
||||
name: '@rush-temp/workbench-resources'
|
||||
version: 0.0.0
|
||||
|
@ -62,6 +62,9 @@
|
||||
"@anticrm/recruit": "~0.6.0",
|
||||
"@anticrm/recruit-assets": "~0.6.0",
|
||||
"@anticrm/recruit-resources": "~0.6.0",
|
||||
"@anticrm/setting": "~0.6.0",
|
||||
"@anticrm/setting-assets": "~0.6.0",
|
||||
"@anticrm/setting-resources": "~0.6.0",
|
||||
"@anticrm/server-chunter": "~0.6.1",
|
||||
"@anticrm/dev-server-chunter-resources": "~0.6.0",
|
||||
"@anticrm/client-resources": "~0.6.4",
|
||||
|
@ -24,6 +24,7 @@ import { contactId } from '@anticrm/contact'
|
||||
import { chunterId } from '@anticrm/chunter'
|
||||
import { recruitId } from '@anticrm/recruit'
|
||||
import { activityId } from '@anticrm/activity'
|
||||
import { settingId } from '@anticrm/setting'
|
||||
|
||||
import { serverChunterId } from '@anticrm/server-chunter'
|
||||
import { serverRecruitId } from '@anticrm/server-recruit'
|
||||
@ -36,6 +37,7 @@ import '@anticrm/chunter-assets'
|
||||
import '@anticrm/contact-assets'
|
||||
import '@anticrm/recruit-assets'
|
||||
import '@anticrm/activity-assets'
|
||||
import '@anticrm/setting-assets'
|
||||
|
||||
import { setMetadata } from '@anticrm/platform'
|
||||
export function configurePlatform() {
|
||||
@ -46,6 +48,7 @@ export function configurePlatform() {
|
||||
setMetadata(login.metadata.UploadUrl, value.UPLOAD_URL)
|
||||
})
|
||||
})
|
||||
setMetadata(login.metadata.TelegramUrl, process.env.TELEGRAM_URL)
|
||||
setMetadata(login.metadata.OverrideEndpoint, process.env.LOGIN_ENDPOINT)
|
||||
|
||||
if (process.env.CLIENT_TYPE === 'dev') {
|
||||
@ -73,4 +76,5 @@ export function configurePlatform() {
|
||||
addLocation(chunterId, () => import(/* webpackChunkName: "chunter" */ '@anticrm/chunter-resources'))
|
||||
addLocation(recruitId, () => import(/* webpackChunkName: "recruit" */ '@anticrm/recruit-resources'))
|
||||
addLocation(activityId, () => import(/*webpackChunkName: "activity" */ '@anticrm/activity-resources'))
|
||||
addLocation(settingId, () => import(/* webpackChunkName: "setting" */ '@anticrm/setting-resources'))
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -29,6 +29,7 @@
|
||||
"@anticrm/model-task": "~0.6.0",
|
||||
"@anticrm/model-chunter": "~0.6.0",
|
||||
"@anticrm/model-recruit": "~0.6.0",
|
||||
"@anticrm/model-setting": "~0.6.0",
|
||||
"@anticrm/model-demo": "~0.6.0",
|
||||
"@anticrm/model-server-core": "~0.6.0",
|
||||
"@anticrm/model-server-chunter": "~0.6.0",
|
||||
|
@ -22,6 +22,7 @@ import { createModel as contactModel } from '@anticrm/model-contact'
|
||||
import { createModel as taskModel } from '@anticrm/model-task'
|
||||
import { createModel as chunterModel } from '@anticrm/model-chunter'
|
||||
import { createModel as recruitModel } from '@anticrm/model-recruit'
|
||||
import { createModel as settingModel } from '@anticrm/model-setting'
|
||||
|
||||
import { createModel as serverCoreModel } from '@anticrm/model-server-core'
|
||||
import { createModel as serverChunterModel } from '@anticrm/model-server-chunter'
|
||||
@ -41,6 +42,7 @@ contactModel(builder)
|
||||
chunterModel(builder)
|
||||
taskModel(builder)
|
||||
recruitModel(builder)
|
||||
settingModel(builder)
|
||||
|
||||
serverCoreModel(builder)
|
||||
serverChunterModel(builder)
|
||||
|
@ -98,6 +98,7 @@ export function createModel (builder: Builder): void {
|
||||
builder.createDoc(workbench.class.Application, core.space.Model, {
|
||||
label: chunter.string.ApplicationLabelChunter,
|
||||
icon: chunter.icon.Chunter,
|
||||
hidden: false,
|
||||
navigatorModel: {
|
||||
spaces: [
|
||||
{
|
||||
|
@ -89,6 +89,7 @@ export function createModel (builder: Builder): void {
|
||||
builder.createDoc(workbench.class.Application, core.space.Model, {
|
||||
label: recruit.string.RecruitApplication,
|
||||
icon: recruit.icon.RecruitApplication,
|
||||
hidden: false,
|
||||
navigatorModel: {
|
||||
spaces: [
|
||||
{
|
||||
|
7
models/setting/.eslintrc.js
Normal file
7
models/setting/.eslintrc.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
extends: ['./node_modules/@anticrm/model-rig/profiles/default/config/eslint.config.json'],
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: './tsconfig.json'
|
||||
}
|
||||
}
|
4
models/setting/.npmignore
Normal file
4
models/setting/.npmignore
Normal file
@ -0,0 +1,4 @@
|
||||
*
|
||||
!/lib/**
|
||||
!CHANGELOG.md
|
||||
/lib/**/__tests__/
|
18
models/setting/config/rig.json
Normal file
18
models/setting/config/rig.json
Normal file
@ -0,0 +1,18 @@
|
||||
// The "rig.json" file directs tools to look for their config files in an external package.
|
||||
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
|
||||
|
||||
/**
|
||||
* (Required) The name of the rig package to inherit from.
|
||||
* It should be an NPM package name with the "-rig" suffix.
|
||||
*/
|
||||
"rigPackageName": "@anticrm/model-rig"
|
||||
|
||||
/**
|
||||
* (Optional) Selects a config profile from the rig package. The name must consist of
|
||||
* lowercase alphanumeric words separated by hyphens, for example "sample-profile".
|
||||
* If omitted, then the "default" profile will be used."
|
||||
*/
|
||||
// "rigProfile": "your-profile-name"
|
||||
}
|
31
models/setting/package.json
Normal file
31
models/setting/package.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "@anticrm/model-setting",
|
||||
"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"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anticrm/model-rig":"~0.6.0",
|
||||
"@typescript-eslint/eslint-plugin":"4",
|
||||
"eslint-plugin-import":"2",
|
||||
"eslint-plugin-promise":"4",
|
||||
"eslint-plugin-node":"11",
|
||||
"eslint":"^7.32.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anticrm/core": "~0.6.11",
|
||||
"@anticrm/model": "~0.6.0",
|
||||
"@anticrm/ui": "~0.6.0",
|
||||
"@anticrm/view": "~0.6.0",
|
||||
"@anticrm/setting": "~0.6.0",
|
||||
"@anticrm/platform": "~0.6.5",
|
||||
"@anticrm/model-core": "~0.6.0",
|
||||
"@anticrm/model-view": "~0.6.0",
|
||||
"@anticrm/model-workbench": "~0.6.1"
|
||||
}
|
||||
}
|
99
models/setting/src/index.ts
Normal file
99
models/setting/src/index.ts
Normal file
@ -0,0 +1,99 @@
|
||||
//
|
||||
// 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 { Builder, Model } from '@anticrm/model'
|
||||
import { Ref, Domain, DOMAIN_MODEL } from '@anticrm/core'
|
||||
import core, { TDoc } from '@anticrm/model-core'
|
||||
import setting from '@anticrm/setting'
|
||||
import type { Integration, IntegrationType } from '@anticrm/setting'
|
||||
import type { IntlString } from '@anticrm/platform'
|
||||
|
||||
import workbench from '@anticrm/model-workbench'
|
||||
import { AnyComponent } from '@anticrm/ui'
|
||||
|
||||
export const DOMAIN_SETTING = 'setting' as Domain
|
||||
|
||||
@Model(setting.class.Integration, core.class.Doc, DOMAIN_SETTING)
|
||||
export class TIntegration extends TDoc implements Integration {
|
||||
type!: Ref<IntegrationType>
|
||||
value!: string
|
||||
}
|
||||
|
||||
@Model(setting.class.IntegrationType, core.class.Doc, DOMAIN_MODEL)
|
||||
export class TIntegrationType extends TDoc implements IntegrationType {
|
||||
label!: string | IntlString
|
||||
description!: IntlString
|
||||
icon!: AnyComponent
|
||||
createComponent!: AnyComponent
|
||||
}
|
||||
|
||||
export function createModel (builder: Builder): void {
|
||||
builder.createModel(TIntegration, TIntegrationType)
|
||||
|
||||
builder.createDoc(workbench.class.Application, core.space.Model, {
|
||||
label: setting.string.Setting,
|
||||
icon: setting.icon.Setting,
|
||||
hidden: true,
|
||||
navigatorModel: {
|
||||
specials: [
|
||||
{
|
||||
id: 'setting',
|
||||
label: setting.string.Setting,
|
||||
icon: setting.icon.Setting,
|
||||
component: setting.component.Setting
|
||||
},
|
||||
{
|
||||
id: 'integrations',
|
||||
label: setting.string.Integrations,
|
||||
icon: setting.icon.Integrations,
|
||||
component: setting.component.Integrations
|
||||
},
|
||||
{
|
||||
id: 'support',
|
||||
label: setting.string.Support,
|
||||
icon: setting.icon.Support,
|
||||
component: setting.component.Support
|
||||
},
|
||||
{
|
||||
id: 'privacy',
|
||||
label: setting.string.Privacy,
|
||||
icon: setting.icon.Privacy,
|
||||
component: setting.component.Privacy
|
||||
},
|
||||
{
|
||||
id: 'terms',
|
||||
label: setting.string.Terms,
|
||||
icon: setting.icon.Terms,
|
||||
component: setting.component.Terms
|
||||
}
|
||||
],
|
||||
spaces: []
|
||||
}
|
||||
}, setting.ids.SettingApp)
|
||||
|
||||
builder.createDoc(setting.class.IntegrationType, core.space.Model, {
|
||||
label: 'Telegram',
|
||||
description: 'Use telegram integration' as IntlString,
|
||||
icon: setting.component.IconTelegram,
|
||||
createComponent: setting.component.ConnectTelegram
|
||||
})
|
||||
|
||||
builder.createDoc(setting.class.IntegrationType, core.space.Model, {
|
||||
label: 'Email',
|
||||
description: 'Use email integration' as IntlString,
|
||||
icon: setting.component.IconGmail,
|
||||
createComponent: setting.component.ConnectEmail
|
||||
})
|
||||
}
|
8
models/setting/tsconfig.json
Normal file
8
models/setting/tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./node_modules/@anticrm/model-rig/profiles/default/tsconfig.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib",
|
||||
}
|
||||
}
|
@ -68,6 +68,7 @@ export function createModel (builder: Builder): void {
|
||||
builder.createDoc(workbench.class.Application, core.space.Model, {
|
||||
label: task.string.ApplicationLabelTask,
|
||||
icon: task.icon.Task,
|
||||
hidden: false,
|
||||
navigatorModel: {
|
||||
spaces: [
|
||||
{
|
||||
|
@ -25,6 +25,7 @@ import workbench from './plugin'
|
||||
export class TApplication extends TDoc implements Application {
|
||||
label!: IntlString
|
||||
icon!: Asset
|
||||
hidden!: boolean
|
||||
}
|
||||
|
||||
@Mixin(workbench.mixin.SpaceView, core.class.Class)
|
||||
|
@ -38,6 +38,7 @@ export default plugin(loginId, {
|
||||
metadata: {
|
||||
AccountsUrl: '' as Asset,
|
||||
UploadUrl: '' as Asset,
|
||||
TelegramUrl: '' as Asset,
|
||||
LoginToken: '' as Metadata<string>,
|
||||
LoginEndpoint: '' as Metadata<string>,
|
||||
LoginEmail: '' as Metadata<string>,
|
||||
|
@ -36,11 +36,7 @@
|
||||
import recruit from '../plugin'
|
||||
import { combineName, formatName, getFirstName, getLastName } from '@anticrm/contact'
|
||||
|
||||
// Start Demo
|
||||
import PluginCard from './PluginCard.svelte'
|
||||
import Telegram from './icons/Telegram.svelte'
|
||||
import Gmail from './icons/Gmail.svelte'
|
||||
// End Demo
|
||||
|
||||
|
||||
export let _id: Ref<Candidate>
|
||||
let object: Candidate
|
||||
@ -122,15 +118,6 @@
|
||||
{/if}
|
||||
|
||||
<style lang="scss">
|
||||
// Start Demo
|
||||
.cards-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(20rem, auto));
|
||||
grid-auto-rows: minmax(12.5rem, auto);
|
||||
grid-gap: 1.5rem;
|
||||
}
|
||||
// End Demo
|
||||
|
||||
.name {
|
||||
font-weight: 500;
|
||||
font-size: 1.25rem;
|
||||
|
@ -1,69 +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.
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import type { AnySvelteComponent } from '@anticrm/ui'
|
||||
import { Button, Link } from '@anticrm/ui'
|
||||
|
||||
export let icon: AnySvelteComponent
|
||||
</script>
|
||||
|
||||
<div class="flex-col plugin-container">
|
||||
<div class="flex-row-center header">
|
||||
<div class="icon mr-4"><svelte:component this={icon} /></div>
|
||||
<div class="flex-grow flex-col">
|
||||
<div class="fs-title max-label overflow-label">Telegram</div>
|
||||
<div class="small-text content-dark-color max-label overflow-label">Lorem ipsum something</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temp</div>
|
||||
<div class="footer">
|
||||
<Button label={'Add'} primary on:click={() => { }} />
|
||||
<Link label={'Learn more'} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.plugin-container {
|
||||
background-color: var(--theme-button-bg-enabled);
|
||||
border: 1px solid var(--theme-bg-accent-color);
|
||||
border-radius: .75rem;
|
||||
}
|
||||
.header { margin: 1.5rem 1.5rem 1rem; }
|
||||
.max-label { max-width: calc(100% - 6.25rem); }
|
||||
.icon {
|
||||
flex-shrink: 0;
|
||||
width: 2.25rem;
|
||||
height: 2.25rem;
|
||||
}
|
||||
.content {
|
||||
margin: 0 1.5rem .25rem;
|
||||
color: var(--theme-caption-color);
|
||||
}
|
||||
.footer {
|
||||
flex-shrink: 0;
|
||||
display: grid;
|
||||
grid-auto-flow: column;
|
||||
direction: rtl;
|
||||
justify-content: start;
|
||||
align-items: center;
|
||||
column-gap: 1rem;
|
||||
padding: 1.5rem 1.75rem 1.25rem;
|
||||
height: 5.25rem;
|
||||
mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0) 1.25rem, rgba(0, 0, 0, 1) 2.5rem);
|
||||
overflow: hidden;
|
||||
border-radius: 0 0 1.25rem 1.25rem;
|
||||
}
|
||||
</style>
|
@ -1,24 +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.
|
||||
-->
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 36 36" style="enable-background:new 0 0 36 36;" xml:space="preserve">
|
||||
<linearGradient id="SVGID_TELEGRAM_" gradientUnits="userSpaceOnUse" x1="18" y1="-36" x2="18" y2="-72" gradientTransform="matrix(1 0 0 -1 0 -36)">
|
||||
<stop offset="0" style="stop-color:#37BBFE"/>
|
||||
<stop offset="1" style="stop-color:#007DBB"/>
|
||||
</linearGradient>
|
||||
<path fill={'url(#SVGID_TELEGRAM_)'} d="M0,12.8c0-4.5,0-6.7,0.9-8.4c0.8-1.5,2-2.7,3.5-3.5C6.1,0,8.3,0,12.8,0h10.4c4.5,0,6.7,0,8.4,0.9 c1.5,0.8,2.7,2,3.5,3.5c0.9,1.7,0.9,4,0.9,8.4v10.4c0,4.5,0,6.7-0.9,8.4c-0.8,1.5-2,2.7-3.5,3.5c-1.7,0.9-4,0.9-8.4,0.9H12.8 c-4.5,0-6.7,0-8.4-0.9c-1.5-0.8-2.7-2-3.5-3.5C0,29.9,0,27.7,0,23.2V12.8z"/>
|
||||
<path fill={'#FFFFFF'} d="M27,10.6c0.2-1-0.8-1.9-1.7-1.4L7.5,17.2c-0.6,0.3-0.6,1.3,0.1,1.5l3.7,1.2c0.7,0.2,1.5,0.1,2.1-0.3l8.3-5.9 c0.2-0.2,0.5,0.2,0.3,0.4l-6,6.3c-0.6,0.6-0.5,1.7,0.2,2.1l6.7,4.3c0.7,0.5,1.7,0,1.9-0.9L27,10.6z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
9
plugins/setting-assets/lang/en.json
Normal file
9
plugins/setting-assets/lang/en.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"string": {
|
||||
"Setting": "Setting",
|
||||
"Integrations": "Integrations",
|
||||
"Support": "Support",
|
||||
"Privacy": "Privacy",
|
||||
"Terms": "Terms"
|
||||
}
|
||||
}
|
20
plugins/setting-assets/package.json
Normal file
20
plugins/setting-assets/package.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "@anticrm/setting-assets",
|
||||
"version": "0.6.0",
|
||||
"main": "src/index.ts",
|
||||
"author": "Anticrm Platform Contributors",
|
||||
"license": "EPL-2.0",
|
||||
"scripts": {
|
||||
"build": "",
|
||||
"build:docs": "api-extractor run --local",
|
||||
"lint": "ts-standard src",
|
||||
"lint:fix": "ts-standard --fix src",
|
||||
"format": "prettier --write 'src/**/*.{ts*,js*,yml}' && ts-standard --fix src"
|
||||
},
|
||||
"devDependencies": {
|
||||
},
|
||||
"dependencies": {
|
||||
"@anticrm/platform":"~0.6.5",
|
||||
"@anticrm/setting":"~0.6.0"
|
||||
}
|
||||
}
|
28
plugins/setting-assets/src/index.ts
Normal file
28
plugins/setting-assets/src/index.ts
Normal file
@ -0,0 +1,28 @@
|
||||
//
|
||||
// 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 { loadMetadata, addStringsLoader } from '@anticrm/platform'
|
||||
import setting, { settingId } from '@anticrm/setting'
|
||||
|
||||
const icons = require('../assets/icons.svg')
|
||||
loadMetadata(setting.icon, {
|
||||
Setting: `${icons}#settings`,
|
||||
Integrations: `${icons}#integration`,
|
||||
Support: `${icons}#support`,
|
||||
Privacy: `${icons}#privacy`,
|
||||
Terms: `${icons}#terms`
|
||||
})
|
||||
|
||||
addStringsLoader(settingId, async (lang: string) => await import(`../lang/${lang}.json`))
|
15
plugins/setting-assets/tsconfig.json
Normal file
15
plugins/setting-assets/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"
|
||||
]
|
||||
}
|
||||
}
|
40
plugins/setting-resources/package.json
Normal file
40
plugins/setting-resources/package.json
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "@anticrm/setting-resources",
|
||||
"version": "0.6.0",
|
||||
"main": "src/index.ts",
|
||||
"author": "Anticrm Platform Contributors",
|
||||
"license": "EPL-2.0",
|
||||
"scripts": {
|
||||
"build": "",
|
||||
"build:docs": "api-extractor run --local",
|
||||
"lint": "eslint src",
|
||||
"lint:fix": "eslint --fix src",
|
||||
"format": "prettier --write --plugin-search-dir=. src && eslint --fix src"
|
||||
},
|
||||
"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/platform": "~0.6.5",
|
||||
"@anticrm/core": "~0.6.11",
|
||||
"svelte": "^3.37.0",
|
||||
"@anticrm/setting": "~0.6.0",
|
||||
"@anticrm/login": "~0.6.1",
|
||||
"@anticrm/ui": "~0.6.0",
|
||||
"@anticrm/presentation": "~0.6.2"
|
||||
}
|
||||
}
|
5
plugins/setting-resources/postcss.config.js
Normal file
5
plugins/setting-resources/postcss.config.js
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require('autoprefixer')
|
||||
]
|
||||
}
|
45
plugins/setting-resources/src/components/Integrations.svelte
Normal file
45
plugins/setting-resources/src/components/Integrations.svelte
Normal file
@ -0,0 +1,45 @@
|
||||
<!--
|
||||
// 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.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { createQuery } from '@anticrm/presentation'
|
||||
import setting from '@anticrm/setting'
|
||||
import type { Integration, IntegrationType } from '@anticrm/setting'
|
||||
import PluginCard from './PluginCard.svelte'
|
||||
|
||||
const typeQuery = createQuery()
|
||||
const integrationQuery = createQuery()
|
||||
|
||||
let integrations: Integration[] = []
|
||||
let integrationTypes: IntegrationType[] = []
|
||||
|
||||
typeQuery.query(setting.class.IntegrationType, {}, (res) => (integrationTypes = res))
|
||||
integrationQuery.query(setting.class.Integration, {}, (res) => (integrations = res))
|
||||
</script>
|
||||
|
||||
<div class="cards-container">
|
||||
{#each integrationTypes as integrationType (integrationType._id)}
|
||||
<PluginCard integration={integrations.find((p) => p.type === integrationType._id)} {integrationType} />
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.cards-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(20rem, auto));
|
||||
grid-auto-rows: minmax(12.5rem, auto);
|
||||
grid-gap: 1.5rem;
|
||||
padding: 3rem;
|
||||
}
|
||||
</style>
|
@ -12,9 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte"
|
||||
import { onMount } from 'svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
|
||||
export let length: number = 6
|
||||
@ -34,7 +33,7 @@
|
||||
filled = 0
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (digits[i] && digits[i].length > 1) {
|
||||
if (i < length - 1) digits[i+1] = digits[i].substring(1)
|
||||
if (i < length - 1) digits[i + 1] = digits[i].substring(1)
|
||||
digits[i] = digits[i][0]
|
||||
}
|
||||
if (digits[i]) filled++
|
||||
@ -64,15 +63,14 @@
|
||||
|
||||
const keyPressed = (ev: Event, n: number): void => {
|
||||
if ((ev as KeyboardEvent).key === 'Backspace' && n > 0 && digits[n] === '') {
|
||||
digits[n-1] = ''
|
||||
digits[n - 1] = ''
|
||||
digits = digits
|
||||
onInput(undefined, n-1)
|
||||
onInput(undefined, n - 1)
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (areas[0]) onInput()
|
||||
console.log('AREAS', areas)
|
||||
})
|
||||
</script>
|
||||
|
||||
@ -83,7 +81,9 @@
|
||||
type="text"
|
||||
bind:this={areas[i]}
|
||||
bind:value={digit}
|
||||
on:input={(ev) => { onInput(ev, i) }}
|
||||
on:input={(ev) => {
|
||||
onInput(ev, i)
|
||||
}}
|
||||
on:keydown={async (ev) => keyPressed(ev, i)}
|
||||
on:click={async () => selectInput(i)}
|
||||
/>
|
||||
@ -98,7 +98,7 @@
|
||||
background-color: var(--theme-card-bg-dark);
|
||||
border: 1px solid transparent;
|
||||
border-style: none;
|
||||
border-radius: .5rem;
|
||||
border-radius: 0.5rem;
|
||||
|
||||
&:focus {
|
||||
border: 1px solid var(--primary-button-focused-border);
|
108
plugins/setting-resources/src/components/PluginCard.svelte
Normal file
108
plugins/setting-resources/src/components/PluginCard.svelte
Normal file
@ -0,0 +1,108 @@
|
||||
<!--
|
||||
// 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.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Button, Component, Label, Link } from '@anticrm/ui'
|
||||
import { getMetadata } from '@anticrm/platform'
|
||||
import { showPopup } from '@anticrm/ui'
|
||||
import type { Integration, IntegrationType } from '@anticrm/setting'
|
||||
import setting from '@anticrm/setting'
|
||||
import { getClient } from '@anticrm/presentation'
|
||||
import type { Ref, Space } from '@anticrm/core'
|
||||
import login from '@anticrm/login'
|
||||
|
||||
export let integrationType: IntegrationType
|
||||
export let integration: Integration | undefined
|
||||
const accountId = getMetadata(login.metadata.LoginEmail)
|
||||
const client = getClient()
|
||||
|
||||
async function close(res: any): Promise<void> {
|
||||
if (res.value) {
|
||||
await client.createDoc(setting.class.Integration, accountId as Ref<Space>, {
|
||||
type: integrationType._id,
|
||||
value: res.value
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function disconnect(): Promise<void> {
|
||||
if (integration !== undefined) {
|
||||
await client.removeDoc(setting.class.Integration, accountId as Ref<Space>, integration._id)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="flex-col plugin-container">
|
||||
<div class="flex-row-center header">
|
||||
<div class="icon mr-4"><Component is={integrationType.icon} /></div>
|
||||
<div class="flex-grow flex-col">
|
||||
<div class="fs-title max-label overflow-label"><Label label={integrationType.label} /></div>
|
||||
<div class="small-text content-dark-color max-label overflow-label">
|
||||
<Label label={integrationType.description} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temp</div>
|
||||
<div class="footer">
|
||||
{#if integration}
|
||||
<Button label={'Disconnect'} on:click={disconnect} />
|
||||
{:else}
|
||||
<Button
|
||||
label={'Add'}
|
||||
primary
|
||||
on:click={(e) => {
|
||||
showPopup(integrationType.createComponent, {}, e.target, close)
|
||||
}}
|
||||
/>
|
||||
<Link label={'Learn more'} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.plugin-container {
|
||||
background-color: var(--theme-button-bg-enabled);
|
||||
border: 1px solid var(--theme-bg-accent-color);
|
||||
border-radius: 0.75rem;
|
||||
}
|
||||
.header {
|
||||
margin: 1.5rem 1.5rem 1rem;
|
||||
}
|
||||
.max-label {
|
||||
max-width: calc(100% - 6.25rem);
|
||||
}
|
||||
.icon {
|
||||
flex-shrink: 0;
|
||||
width: 2.25rem;
|
||||
height: 2.25rem;
|
||||
}
|
||||
.content {
|
||||
margin: 0 1.5rem 0.25rem;
|
||||
color: var(--theme-caption-color);
|
||||
}
|
||||
.footer {
|
||||
flex-shrink: 0;
|
||||
display: grid;
|
||||
grid-auto-flow: column;
|
||||
direction: rtl;
|
||||
justify-content: start;
|
||||
align-items: center;
|
||||
column-gap: 1rem;
|
||||
padding: 1.5rem 1.75rem 1.25rem;
|
||||
height: 5.25rem;
|
||||
mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0) 1.25rem, rgba(0, 0, 0, 1) 2.5rem);
|
||||
overflow: hidden;
|
||||
border-radius: 0 0 1.25rem 1.25rem;
|
||||
}
|
||||
</style>
|
@ -14,13 +14,22 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 36 36" style="enable-background:new 0 0 36 36;" xml:space="preserve">
|
||||
<path fill={'#FFFFFF'} d="M0,12.8c0-4.5,0-6.7,0.9-8.4c0.8-1.5,2-2.7,3.5-3.5C6.1,0,8.3,0,12.8,0h10.4c4.5,0,6.7,0,8.4,0.9 c1.5,0.8,2.7,2,3.5,3.5c0.9,1.7,0.9,4,0.9,8.4v10.4c0,4.5,0,6.7-0.9,8.4c-0.8,1.5-2,2.7-3.5,3.5c-1.7,0.9-4,0.9-8.4,0.9H12.8 c-4.5,0-6.7,0-8.4-0.9c-1.5-0.8-2.7-2-3.5-3.5C0,29.9,0,27.7,0,23.2V12.8z"/>
|
||||
<path fill={'#EA4335'} d="M25.8,8.4l-7.7,6l-7.9-6v0l0,0v8.4l7.8,6.1l7.8-5.9V8.4z"/>
|
||||
<path fill={'#FBBC05'} d="M27.8,6.9l-2,1.5V17l6.4-4.9V9.2C32.1,9.2,31.4,5,27.8,6.9z"/>
|
||||
<path fill={'#34A853'} d="M25.8,17v11.2h4.9c0,0,1.4-0.1,1.5-1.7V12.2L25.8,17z"/>
|
||||
<path fill={'#C5221F'} d="M10.2,28.3V16.8l0,0L10.2,28.3z"/>
|
||||
<path fill={'#C5221F'} d="M10.2,8.4l-2-1.5C4.6,5,3.9,9.2,3.9,9.2v2.9l6.4,4.6V8.4z"/>
|
||||
<path fill={'#C5221F'} d="M10.2,8.4v8.4l0,0L10.2,8.4L10.2,8.4z"/>
|
||||
<path fill={'#4285F4'} d="M3.9,12.2v14.4c0.1,1.6,1.5,1.7,1.5,1.7h4.9l0-11.5L3.9,12.2z"/>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
viewBox="0 0 36 36"
|
||||
style="enable-background:new 0 0 36 36;"
|
||||
xml:space="preserve"
|
||||
>
|
||||
<path
|
||||
fill={'#FFFFFF'}
|
||||
d="M0,12.8c0-4.5,0-6.7,0.9-8.4c0.8-1.5,2-2.7,3.5-3.5C6.1,0,8.3,0,12.8,0h10.4c4.5,0,6.7,0,8.4,0.9 c1.5,0.8,2.7,2,3.5,3.5c0.9,1.7,0.9,4,0.9,8.4v10.4c0,4.5,0,6.7-0.9,8.4c-0.8,1.5-2,2.7-3.5,3.5c-1.7,0.9-4,0.9-8.4,0.9H12.8 c-4.5,0-6.7,0-8.4-0.9c-1.5-0.8-2.7-2-3.5-3.5C0,29.9,0,27.7,0,23.2V12.8z"
|
||||
/>
|
||||
<path fill={'#EA4335'} d="M25.8,8.4l-7.7,6l-7.9-6v0l0,0v8.4l7.8,6.1l7.8-5.9V8.4z" />
|
||||
<path fill={'#FBBC05'} d="M27.8,6.9l-2,1.5V17l6.4-4.9V9.2C32.1,9.2,31.4,5,27.8,6.9z" />
|
||||
<path fill={'#34A853'} d="M25.8,17v11.2h4.9c0,0,1.4-0.1,1.5-1.7V12.2L25.8,17z" />
|
||||
<path fill={'#C5221F'} d="M10.2,28.3V16.8l0,0L10.2,28.3z" />
|
||||
<path fill={'#C5221F'} d="M10.2,8.4l-2-1.5C4.6,5,3.9,9.2,3.9,9.2v2.9l6.4,4.6V8.4z" />
|
||||
<path fill={'#C5221F'} d="M10.2,8.4v8.4l0,0L10.2,8.4L10.2,8.4z" />
|
||||
<path fill={'#4285F4'} d="M3.9,12.2v14.4c0.1,1.6,1.5,1.7,1.5,1.7h4.9l0-11.5L3.9,12.2z" />
|
||||
</svg>
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1,44 @@
|
||||
<!--
|
||||
// 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.
|
||||
-->
|
||||
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
viewBox="0 0 36 36"
|
||||
style="enable-background:new 0 0 36 36;"
|
||||
xml:space="preserve"
|
||||
>
|
||||
<linearGradient
|
||||
id="SVGID_TELEGRAM_"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="18"
|
||||
y1="-36"
|
||||
x2="18"
|
||||
y2="-72"
|
||||
gradientTransform="matrix(1 0 0 -1 0 -36)"
|
||||
>
|
||||
<stop offset="0" style="stop-color:#37BBFE" />
|
||||
<stop offset="1" style="stop-color:#007DBB" />
|
||||
</linearGradient>
|
||||
<path
|
||||
fill={'url(#SVGID_TELEGRAM_)'}
|
||||
d="M0,12.8c0-4.5,0-6.7,0.9-8.4c0.8-1.5,2-2.7,3.5-3.5C6.1,0,8.3,0,12.8,0h10.4c4.5,0,6.7,0,8.4,0.9 c1.5,0.8,2.7,2,3.5,3.5c0.9,1.7,0.9,4,0.9,8.4v10.4c0,4.5,0,6.7-0.9,8.4c-0.8,1.5-2,2.7-3.5,3.5c-1.7,0.9-4,0.9-8.4,0.9H12.8 c-4.5,0-6.7,0-8.4-0.9c-1.5-0.8-2.7-2-3.5-3.5C0,29.9,0,27.7,0,23.2V12.8z"
|
||||
/>
|
||||
<path
|
||||
fill={'#FFFFFF'}
|
||||
d="M27,10.6c0.2-1-0.8-1.9-1.7-1.4L7.5,17.2c-0.6,0.3-0.6,1.3,0.1,1.5l3.7,1.2c0.7,0.2,1.5,0.1,2.1-0.3l8.3-5.9 c0.2-0.2,0.5,0.2,0.3,0.4l-6,6.3c-0.6,0.6-0.5,1.7,0.2,2.1l6.7,4.3c0.7,0.5,1.7,0,1.9-0.9L27,10.6z"
|
||||
/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1,83 @@
|
||||
<!--
|
||||
// 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.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { IconClose, Label } from '@anticrm/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-bg" />
|
||||
<div class="flex-between header">
|
||||
<div class="overflow-label fs-title"><Label label={'Connect Email account'} /></div>
|
||||
<div
|
||||
class="tool"
|
||||
on:click={() => {
|
||||
dispatch('close')
|
||||
}}
|
||||
>
|
||||
<IconClose size={'small'} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">Not implemented yet</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.card {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 20rem;
|
||||
min-width: 20rem;
|
||||
max-width: 20rem;
|
||||
border-radius: 1.25rem;
|
||||
|
||||
.header {
|
||||
flex-shrink: 0;
|
||||
margin: 1.75rem 1.75rem 1.25rem;
|
||||
|
||||
.tool {
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
color: var(--theme-caption-color);
|
||||
}
|
||||
&:active {
|
||||
color: var(--theme-content-accent-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
flex-shrink: 0;
|
||||
flex-grow: 1;
|
||||
height: fit-content;
|
||||
margin: 0 1.75rem 0.5rem;
|
||||
}
|
||||
|
||||
.card-bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: var(--theme-card-bg);
|
||||
border-radius: 1.25rem;
|
||||
backdrop-filter: blur(15px);
|
||||
box-shadow: var(--theme-card-shadow);
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -0,0 +1,183 @@
|
||||
<!--
|
||||
// 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.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { getMetadata, serialize } from '@anticrm/platform'
|
||||
import { Button, EditBox, IconClose, Label } from '@anticrm/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import login from '@anticrm/login'
|
||||
import PinPad from '../PinPad.svelte'
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
let requested = false
|
||||
let secondFactor = false
|
||||
let phone: string = ''
|
||||
let code: string = ''
|
||||
let password: string = ''
|
||||
const url = getMetadata(login.metadata.TelegramUrl)
|
||||
|
||||
async function requestCode(): Promise<void> {
|
||||
const res = await sendRequest('/auth', { phone: phone })
|
||||
if (res.next === 'code') {
|
||||
requested = true
|
||||
}
|
||||
}
|
||||
|
||||
async function sendPassword(): Promise<void> {
|
||||
const res = await sendRequest('/auth/pass', { pass: password })
|
||||
if (res.next === 'end') {
|
||||
dispatch('close', { value: phone })
|
||||
}
|
||||
}
|
||||
|
||||
async function sendCode(): Promise<void> {
|
||||
const res = await sendRequest('/auth/code', { code: code })
|
||||
if (res.next === 'pass') {
|
||||
secondFactor = true
|
||||
} else if (res.next === 'end') {
|
||||
dispatch('close', { value: phone })
|
||||
}
|
||||
}
|
||||
|
||||
async function sendRequest(path: string, data: any): Promise<any> {
|
||||
const response = await fetch(url + path, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + getMetadata(login.metadata.LoginToken),
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: serialize(data)
|
||||
})
|
||||
const res = await response.json()
|
||||
if (res.err != null) {
|
||||
throw new Error(res.err)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
function back() {
|
||||
password = ''
|
||||
code = ''
|
||||
phone = ''
|
||||
requested = false
|
||||
secondFactor = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-bg" />
|
||||
<div class="flex-between header">
|
||||
<div class="overflow-label fs-title"><Label label={'Connect Telegram account'} /></div>
|
||||
<div
|
||||
class="tool"
|
||||
on:click={() => {
|
||||
dispatch('close')
|
||||
}}
|
||||
>
|
||||
<IconClose size={'small'} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
{#if secondFactor}
|
||||
<p><Label label={'Enter your second factor password'} /></p>
|
||||
<EditBox label={'Password'} password placeholder={'password'} bind:value={password} />
|
||||
<div class="footer">
|
||||
<Button label={'Connect'} primary disabled={!password.length} on:click={sendPassword} />
|
||||
<a class="link" href={'#'} on:click={back}><Label label={'Back'} /></a>
|
||||
</div>
|
||||
{:else if requested}
|
||||
<p><Label label={'Enter the 5-digit code you received on your Telegram account.'} /></p>
|
||||
<PinPad length={5} bind:value={code} />
|
||||
<div class="footer">
|
||||
<Button label={'Connect'} primary disabled={!code.match(/^\d{5}$/)} on:click={sendCode} />
|
||||
<a class="link" href={'#'} on:click={back}><Label label={'Back'} /></a>
|
||||
</div>
|
||||
{:else}
|
||||
<p><Label label={'Enter your Telegram phone number to connect your account.'} /></p>
|
||||
<EditBox label={'Phone number'} placeholder={'+1 555 333 7777'} bind:value={phone} />
|
||||
<div class="footer">
|
||||
<Button label={'Next'} primary disabled={!phone.match(/^\+\d{9,15}$/)} on:click={requestCode} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.card {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 20rem;
|
||||
min-width: 20rem;
|
||||
max-width: 20rem;
|
||||
border-radius: 1.25rem;
|
||||
|
||||
.header {
|
||||
flex-shrink: 0;
|
||||
margin: 1.75rem 1.75rem 1.25rem;
|
||||
|
||||
.tool {
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
color: var(--theme-caption-color);
|
||||
}
|
||||
&:active {
|
||||
color: var(--theme-content-accent-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
flex-shrink: 0;
|
||||
flex-grow: 1;
|
||||
height: fit-content;
|
||||
margin: 0 1.75rem 0.5rem;
|
||||
p {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 1rem 1.75rem 1.75rem;
|
||||
|
||||
.link {
|
||||
color: var(--theme-content-dark-color);
|
||||
&:hover {
|
||||
color: var(--theme-caption-color);
|
||||
}
|
||||
&:active {
|
||||
color: var(--theme-content-accent-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: var(--theme-card-bg);
|
||||
border-radius: 1.25rem;
|
||||
backdrop-filter: blur(15px);
|
||||
box-shadow: var(--theme-card-shadow);
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
</style>
|
30
plugins/setting-resources/src/index.ts
Normal file
30
plugins/setting-resources/src/index.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// 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 Integrations from './components/Integrations.svelte'
|
||||
import ConnectTelegram from './components/integrations/ConnectTelegram.svelte'
|
||||
import ConnectEmail from './components/integrations/ConnectEmail.svelte'
|
||||
import IconTelegram from './components/icons/Telegram.svelte'
|
||||
import IconGmail from './components/icons/Gmail.svelte'
|
||||
|
||||
export default async () => ({
|
||||
component: {
|
||||
Integrations,
|
||||
ConnectTelegram,
|
||||
ConnectEmail,
|
||||
IconTelegram,
|
||||
IconGmail
|
||||
}
|
||||
})
|
5
plugins/setting-resources/svelte.config.js
Normal file
5
plugins/setting-resources/svelte.config.js
Normal file
@ -0,0 +1,5 @@
|
||||
const sveltePreprocess = require('svelte-preprocess')
|
||||
|
||||
module.exports = {
|
||||
preprocess: sveltePreprocess()
|
||||
};
|
15
plugins/setting-resources/tsconfig.json
Normal file
15
plugins/setting-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/setting/.eslintrc.js
Normal file
7
plugins/setting/.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/setting/.npmignore
Normal file
4
plugins/setting/.npmignore
Normal file
@ -0,0 +1,4 @@
|
||||
*
|
||||
!/lib/**
|
||||
!CHANGELOG.md
|
||||
/lib/**/__tests__/
|
18
plugins/setting/config/rig.json
Normal file
18
plugins/setting/config/rig.json
Normal file
@ -0,0 +1,18 @@
|
||||
// The "rig.json" file directs tools to look for their config files in an external package.
|
||||
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
|
||||
|
||||
/**
|
||||
* (Required) The name of the rig package to inherit from.
|
||||
* It should be an NPM package name with the "-rig" suffix.
|
||||
*/
|
||||
"rigPackageName": "@anticrm/platform-rig"
|
||||
|
||||
/**
|
||||
* (Optional) Selects a config profile from the rig package. The name must consist of
|
||||
* lowercase alphanumeric words separated by hyphens, for example "sample-profile".
|
||||
* If omitted, then the "default" profile will be used."
|
||||
*/
|
||||
// "rigProfile": "your-profile-name"
|
||||
}
|
26
plugins/setting/package.json
Normal file
26
plugins/setting/package.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "@anticrm/setting",
|
||||
"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"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anticrm/platform-rig":"~0.6.0",
|
||||
"@types/heft-jest":"^1.0.2",
|
||||
"@typescript-eslint/eslint-plugin":"4",
|
||||
"eslint-plugin-import":"2",
|
||||
"eslint-plugin-promise":"4",
|
||||
"eslint-plugin-node":"11",
|
||||
"eslint":"^7.32.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anticrm/platform":"~0.6.5",
|
||||
"@anticrm/core":"~0.6.11",
|
||||
"@anticrm/ui":"~0.6.0"
|
||||
}
|
||||
}
|
77
plugins/setting/src/index.ts
Normal file
77
plugins/setting/src/index.ts
Normal file
@ -0,0 +1,77 @@
|
||||
//
|
||||
// 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 { Asset, IntlString, plugin } from '@anticrm/platform'
|
||||
import type { Plugin } from '@anticrm/platform'
|
||||
import { AnyComponent } from '@anticrm/ui'
|
||||
import type { Class, Doc, Ref } from '@anticrm/core'
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface IntegrationType extends Doc {
|
||||
label: string | IntlString
|
||||
description: IntlString
|
||||
icon: AnyComponent
|
||||
createComponent: AnyComponent
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Integration extends Doc {
|
||||
type: Ref<IntegrationType>
|
||||
value: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const settingId = 'setting' as Plugin
|
||||
|
||||
export default plugin(settingId, {
|
||||
ids: {
|
||||
SettingApp: '' as Ref<Doc>
|
||||
},
|
||||
class: {
|
||||
Integration: '' as Ref<Class<Integration>>,
|
||||
IntegrationType: '' as Ref<Class<IntegrationType>>
|
||||
},
|
||||
component: {
|
||||
Setting: '' as AnyComponent,
|
||||
Integrations: '' as AnyComponent,
|
||||
Support: '' as AnyComponent,
|
||||
Privacy: '' as AnyComponent,
|
||||
Terms: '' as AnyComponent,
|
||||
ConnectTelegram: '' as AnyComponent,
|
||||
ConnectEmail: '' as AnyComponent,
|
||||
IconTelegram: '' as AnyComponent,
|
||||
IconGmail: '' as AnyComponent
|
||||
},
|
||||
string: {
|
||||
Setting: '' as IntlString,
|
||||
Integrations: '' as IntlString,
|
||||
Support: '' as IntlString,
|
||||
Privacy: '' as IntlString,
|
||||
Terms: '' as IntlString
|
||||
},
|
||||
icon: {
|
||||
Setting: '' as Asset,
|
||||
Integrations: '' as Asset,
|
||||
Support: '' as Asset,
|
||||
Privacy: '' as Asset,
|
||||
Terms: '' as Asset
|
||||
}
|
||||
})
|
9
plugins/setting/tsconfig.json
Normal file
9
plugins/setting/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"]
|
||||
}
|
||||
}
|
@ -26,6 +26,7 @@
|
||||
"@anticrm/view": "~0.6.0",
|
||||
"@anticrm/presentation": "~0.6.2",
|
||||
"@anticrm/login": "~0.6.1",
|
||||
"@anticrm/setting": "~0.6.0",
|
||||
"@anticrm/contact": "~0.6.2"
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,25 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { Label, showPopup } from '@anticrm/ui'
|
||||
import { Avatar } from '@anticrm/presentation'
|
||||
import TelegramPopup from './TelegramPopup.svelte'
|
||||
import { getCurrentLocation, Label, navigate } from '@anticrm/ui'
|
||||
import { Avatar, getClient } from '@anticrm/presentation'
|
||||
import workbench, { Application, SpecialNavModel } from '@anticrm/workbench'
|
||||
import setting from '@anticrm/setting'
|
||||
import { Ref } from '@anticrm/core'
|
||||
|
||||
let items: string[] = ['Settings', 'Integrations', 'Support', 'Privacy', 'Terms & policy', 'Sign out']
|
||||
const client = getClient()
|
||||
async function getItems(): Promise<SpecialNavModel[] | undefined> {
|
||||
const app = await client.findOne(workbench.class.Application, { _id: setting.ids.SettingApp as Ref<Application> })
|
||||
return app?.navigatorModel?.specials
|
||||
}
|
||||
|
||||
function selectSpecial (sp: SpecialNavModel): void {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[1] = setting.ids.SettingApp
|
||||
loc.path[2] = sp.id
|
||||
loc.path.length = 3
|
||||
navigate(loc)
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="account-popup">
|
||||
@ -32,12 +45,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
{#each items as item }
|
||||
<div class="item" on:click={() => {
|
||||
if (item === 'Integrations')
|
||||
showPopup(TelegramPopup, {})
|
||||
}}>{item}</div>
|
||||
{/each}
|
||||
{#await getItems() then items}
|
||||
{#if items}
|
||||
{#each items as item }
|
||||
<div class="item" on:click={() => selectSpecial(item)}><Label label={item.label} /></div>
|
||||
{/each}
|
||||
{/if}
|
||||
{/await}
|
||||
<div class="item"><Label label={'Sign out'} /></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
let apps: Application[] = []
|
||||
|
||||
const query = createQuery()
|
||||
$: query.query(workbench.class.Application, {}, result => { apps = result })
|
||||
$: query.query(workbench.class.Application, { hidden: false }, result => { apps = result })
|
||||
|
||||
function navigateApp(app: Ref<Application>) {
|
||||
const loc = getCurrentLocation()
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
// Copyright © 2020 Anticrm Platform Contributors.
|
||||
// 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
|
||||
@ -14,14 +14,31 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import type { Ref, Space } from '@anticrm/core'
|
||||
import type { NavigatorModel } from '@anticrm/workbench'
|
||||
import type { NavigatorModel, SpecialNavModel } from '@anticrm/workbench'
|
||||
import SpacesNav from './navigator/SpacesNav.svelte'
|
||||
import TreeSeparator from './navigator/TreeSeparator.svelte'
|
||||
import SpecialElement from './navigator/SpecialElement.svelte'
|
||||
import { getCurrentLocation, navigate } from '@anticrm/ui'
|
||||
|
||||
export let model: NavigatorModel | undefined
|
||||
|
||||
function selectSpecial (sp: SpecialNavModel): void {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[2] = sp.id
|
||||
loc.path.length = 3
|
||||
navigate(loc)
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if model}
|
||||
{#if model.specials}
|
||||
{#each model.specials as special}
|
||||
<SpecialElement label={special.label} icon={special.icon} on:click={() => selectSpecial(special)} />
|
||||
{/each}
|
||||
{#if model.spaces.length}
|
||||
<TreeSeparator />
|
||||
{/if}
|
||||
{/if}
|
||||
{#each model.spaces as m}
|
||||
<SpacesNav model={m}/>
|
||||
{/each}
|
||||
|
@ -1,121 +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.
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { Label, IconClose, Button, EditBox } from '@anticrm/ui'
|
||||
import PinPad from './PinPad.svelte'
|
||||
|
||||
export let checkState: boolean = false
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const digitsCount: number = 6
|
||||
|
||||
const changeState = (): void => {
|
||||
if (checkState) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
checkState = !checkState
|
||||
}
|
||||
|
||||
const checkInput = (result: CustomEvent) => {
|
||||
if (result) console.log('Telegram pin code filled', result.detail)
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="plugin-popup">
|
||||
<div class="popup-bg" />
|
||||
<div class="flex-between header">
|
||||
<div class="overflow-label fs-title"><Label label={'Connect your Telegram account'} /></div>
|
||||
<div class="tool" on:click={() => { dispatch('close') }}>
|
||||
<IconClose size={'small'}/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content" class:more={!checkState}>
|
||||
{#if checkState}
|
||||
<p>Enter the {digitsCount}-digit code you received on your Telegram account.</p>
|
||||
<PinPad length={digitsCount} on:filled={checkInput} />
|
||||
{:else}
|
||||
<p>Enter your Telegram username or phone number to connect your account.</p>
|
||||
<EditBox label={'Username or phone number'} placeholder={'@johnappleseed'} />
|
||||
{/if}
|
||||
</div>
|
||||
<div class="footer">
|
||||
<Button label={checkState ? 'Connect' : 'Next'} primary on:click={changeState} />
|
||||
{#if checkState}
|
||||
<a class="link" href={'#'} on:click={changeState}>Back</a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.plugin-popup {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 20rem;
|
||||
min-width: 20rem;
|
||||
max-width: 20rem;
|
||||
border-radius: 1.25rem;
|
||||
|
||||
.header {
|
||||
flex-shrink: 0;
|
||||
margin: 1.75rem 1.75rem 1.25rem;
|
||||
.tool {
|
||||
cursor: pointer;
|
||||
&:hover { color: var(--theme-caption-color); }
|
||||
&:active { color: var(--theme-content-accent-color); }
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
flex-shrink: 0;
|
||||
flex-grow: 1;
|
||||
margin: 0 1.75rem .5rem;
|
||||
height: fit-content;
|
||||
p { margin: 0 0 1rem; }
|
||||
&.more { margin-bottom: 1rem; }
|
||||
}
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 1rem 1.75rem 1.75rem;
|
||||
|
||||
.link {
|
||||
color: var(--theme-content-dark-color);
|
||||
&:hover { color: var(--theme-caption-color); }
|
||||
&:active { color: var(--theme-content-accent-color); }
|
||||
}
|
||||
}
|
||||
|
||||
.popup-bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: var(--theme-card-bg);
|
||||
border-radius: 1.25rem;
|
||||
backdrop-filter: blur(15px);
|
||||
box-shadow: var(--theme-card-shadow);
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -22,14 +22,14 @@
|
||||
|
||||
import type { Ref, Space, Client } from '@anticrm/core'
|
||||
import type { Application, NavigatorModel, ViewConfiguration } from '@anticrm/workbench'
|
||||
import { setClient, Avatar, MessageBox } from '@anticrm/presentation'
|
||||
import { setClient, Avatar } from '@anticrm/presentation'
|
||||
import workbench from '@anticrm/workbench'
|
||||
|
||||
import Navigator from './Navigator.svelte'
|
||||
import SpaceHeader from './SpaceHeader.svelte'
|
||||
import SpaceView from './SpaceView.svelte'
|
||||
|
||||
import { AnyComponent, location, Popup, showPopup, TooltipInstance } from '@anticrm/ui'
|
||||
import { AnyComponent, Component, location, Popup, showPopup, TooltipInstance } from '@anticrm/ui'
|
||||
import core from '@anticrm/core'
|
||||
import AccountPopup from './AccountPopup.svelte'
|
||||
|
||||
@ -39,25 +39,35 @@
|
||||
|
||||
let currentApp: Ref<Application> | undefined
|
||||
let currentSpace: Ref<Space> | undefined
|
||||
let specialComponent: AnyComponent | undefined
|
||||
let currentView: ViewConfiguration | undefined
|
||||
let createItemDialog: AnyComponent | undefined
|
||||
let navigatorModel: NavigatorModel | undefined
|
||||
|
||||
onDestroy(location.subscribe(async (loc) => {
|
||||
currentApp = loc.path[1] as Ref<Application>
|
||||
currentSpace = loc.path[2] as Ref<Space>
|
||||
const space = (await client.findAll(core.class.Space, { _id: currentSpace }))[0]
|
||||
if (space) {
|
||||
const spaceClass = client.getHierarchy().getClass(space._class) // (await client.findAll(core.class.Class, { _id: space._class }))[0]
|
||||
const view = client.getHierarchy().as(spaceClass, workbench.mixin.SpaceView)
|
||||
currentView = view.view
|
||||
createItemDialog = currentView.createItemDialog
|
||||
} else {
|
||||
currentView = undefined
|
||||
createItemDialog = undefined
|
||||
}
|
||||
navigatorModel = (await client.findAll(workbench.class.Application, { _id: currentApp }))[0]?.navigatorModel
|
||||
let currentFolder = loc.path[2] as Ref<Space>
|
||||
specialComponent = getSpecialComponent(currentFolder)
|
||||
if (!specialComponent) {
|
||||
currentSpace = currentFolder
|
||||
const space = (await client.findAll(core.class.Space, { _id: currentSpace }))[0]
|
||||
if (space) {
|
||||
const spaceClass = client.getHierarchy().getClass(space._class) // (await client.findAll(core.class.Class, { _id: space._class }))[0]
|
||||
const view = client.getHierarchy().as(spaceClass, workbench.mixin.SpaceView)
|
||||
currentView = view.view
|
||||
createItemDialog = currentView.createItemDialog
|
||||
} else {
|
||||
currentView = undefined
|
||||
createItemDialog = undefined
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
||||
function getSpecialComponent (id: string): AnyComponent | undefined {
|
||||
let special = navigatorModel?.specials?.find((x) => x.id === id)
|
||||
return special?.component
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if client}
|
||||
@ -82,13 +92,17 @@
|
||||
{#if navigator}
|
||||
<div class="panel-navigator">
|
||||
<NavHeader label={'Chat'} action={() => {}} />
|
||||
<Navigator model={navigatorModel}/>
|
||||
<Navigator model={navigatorModel} />
|
||||
</div>
|
||||
{/if}
|
||||
<div class="panel-component">
|
||||
<SpaceHeader space={currentSpace} {createItemDialog} />
|
||||
{#if currentView && currentSpace}
|
||||
<SpaceView space={currentSpace} _class={currentView.class} options={currentView.options} />
|
||||
{#if specialComponent}
|
||||
<Component is={specialComponent} />
|
||||
{:else}
|
||||
<SpaceHeader space={currentSpace} {createItemDialog} />
|
||||
{#if currentView && currentSpace}
|
||||
<SpaceView space={currentSpace} _class={currentView.class} options={currentView.options} />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<!-- <div class="aside"><Chat thread/></div> -->
|
||||
|
@ -0,0 +1,98 @@
|
||||
<!--
|
||||
// Copyright © 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.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import type { Asset, IntlString } from '@anticrm/platform'
|
||||
import type { Action } from '@anticrm/ui'
|
||||
import { ActionIcon, Icon, Label } from '@anticrm/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
|
||||
export let icon: Asset | undefined = undefined
|
||||
export let label: IntlString | undefined = undefined
|
||||
export let notifications = 0
|
||||
export let actions: Action[] = []
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
</script>
|
||||
|
||||
<!-- svelte-ignore a11y-mouse-events-have-key-events -->
|
||||
<div
|
||||
class="flex-row-center container"
|
||||
on:click|stopPropagation={() => {
|
||||
dispatch('click')
|
||||
}}
|
||||
>
|
||||
<div class="icon">
|
||||
{#if icon}
|
||||
<Icon {icon} size={'small'} />
|
||||
{/if}
|
||||
</div>
|
||||
<span>
|
||||
{#if label}<Label {label} />{:else}{label}{/if}
|
||||
</span>
|
||||
{#each actions as action}
|
||||
<div class="tool">
|
||||
<ActionIcon label={action.label} icon={action.icon} size={'small'} action={action.action} />
|
||||
</div>
|
||||
{/each}
|
||||
{#if notifications > 0}
|
||||
<div class="counter">{notifications}</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
margin: 0 16px;
|
||||
padding-left: 10px;
|
||||
padding-right: 12px;
|
||||
min-height: 36px;
|
||||
font-weight: 500;
|
||||
color: var(--theme-caption-color);
|
||||
border-radius: 8px;
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
|
||||
.icon {
|
||||
margin-right: 18px;
|
||||
width: 16px;
|
||||
min-width: 16px;
|
||||
height: 16px;
|
||||
border-radius: 4px;
|
||||
opacity: 0.3;
|
||||
}
|
||||
span {
|
||||
flex-grow: 1;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.tool {
|
||||
margin-left: 12px;
|
||||
visibility: hidden;
|
||||
}
|
||||
.counter {
|
||||
margin-left: 12px;
|
||||
font-weight: 600;
|
||||
font-size: 12px;
|
||||
line-height: 100%;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: var(--theme-button-bg-enabled);
|
||||
.tool {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -26,6 +26,7 @@ import { plugin } from '@anticrm/platform'
|
||||
export interface Application extends Doc {
|
||||
label: IntlString
|
||||
icon: Asset
|
||||
hidden: boolean
|
||||
navigatorModel?: NavigatorModel
|
||||
}
|
||||
|
||||
@ -45,6 +46,17 @@ export interface SpacesNavModel {
|
||||
*/
|
||||
export interface NavigatorModel {
|
||||
spaces: SpacesNavModel[]
|
||||
specials?: SpecialNavModel[]
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface SpecialNavModel {
|
||||
id: string // Uniq id
|
||||
label: IntlString
|
||||
icon: Asset
|
||||
component: AnyComponent
|
||||
}
|
||||
|
||||
/**
|
||||
|
20
rush.json
20
rush.json
@ -816,5 +816,25 @@
|
||||
"projectFolder": "models/activity",
|
||||
"shouldPublish": true
|
||||
},
|
||||
{
|
||||
"packageName": "@anticrm/setting",
|
||||
"projectFolder": "plugins/setting",
|
||||
"shouldPublish": true
|
||||
},
|
||||
{
|
||||
"packageName": "@anticrm/setting-assets",
|
||||
"projectFolder": "plugins/setting-assets",
|
||||
"shouldPublish": true
|
||||
},
|
||||
{
|
||||
"packageName": "@anticrm/setting-resources",
|
||||
"projectFolder": "plugins/setting-resources",
|
||||
"shouldPublish": true
|
||||
},
|
||||
{
|
||||
"packageName": "@anticrm/model-setting",
|
||||
"projectFolder": "models/setting",
|
||||
"shouldPublish": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user