mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-01 21:47:00 +00:00
Merge remote-tracking branch 'origin/develop' into staging
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
commit
1926088489
.vscode
dev
models/recruit/src
packages
plugins
task-resources/src
view-resources/src/components
pods/front
qms-tests
server-plugins
server
workers/datalake/src
7
.vscode/launch.json
vendored
7
.vscode/launch.json
vendored
@ -181,7 +181,6 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": ["src/__start.ts"],
|
"args": ["src/__start.ts"],
|
||||||
"env": {
|
"env": {
|
||||||
"ELASTIC_URL": "http://localhost:9200",
|
|
||||||
"MONGO_URL": "mongodb://localhost:27017",
|
"MONGO_URL": "mongodb://localhost:27017",
|
||||||
"METRICS_CONSOLE": "false",
|
"METRICS_CONSOLE": "false",
|
||||||
"STORAGE_CONFIG": "minio|localhost?accessKey=minioadmin&secretKey=minioadmin",
|
"STORAGE_CONFIG": "minio|localhost?accessKey=minioadmin&secretKey=minioadmin",
|
||||||
@ -264,8 +263,7 @@
|
|||||||
"SERVER_SECRET": "secret",
|
"SERVER_SECRET": "secret",
|
||||||
"MONGO_URL": "mongodb://localhost:27017",
|
"MONGO_URL": "mongodb://localhost:27017",
|
||||||
"ACCOUNTS_URL": "http://localhost:3000",
|
"ACCOUNTS_URL": "http://localhost:3000",
|
||||||
"TELEGRAM_DATABASE": "telegram-service",
|
"TELEGRAM_DATABASE": "telegram-service"
|
||||||
"ELASTIC_URL": "http://localhost:9200"
|
|
||||||
},
|
},
|
||||||
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
|
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
@ -290,7 +288,6 @@
|
|||||||
"DB_URL": "mongodb://localhost:27017",
|
"DB_URL": "mongodb://localhost:27017",
|
||||||
"ACCOUNTS_URL": "http://localhost:3000",
|
"ACCOUNTS_URL": "http://localhost:3000",
|
||||||
"TELEGRAM_DATABASE": "telegram-service",
|
"TELEGRAM_DATABASE": "telegram-service",
|
||||||
"ELASTIC_URL": "http://localhost:9200",
|
|
||||||
"REKONI_URL": "http://localhost:4004",
|
"REKONI_URL": "http://localhost:4004",
|
||||||
"MODEL_VERSION": "0.6.287"
|
"MODEL_VERSION": "0.6.287"
|
||||||
},
|
},
|
||||||
@ -318,7 +315,6 @@
|
|||||||
"DB_URL": "postgresql://root@host.docker.internal:26257/defaultdb?sslmode=disable",
|
"DB_URL": "postgresql://root@host.docker.internal:26257/defaultdb?sslmode=disable",
|
||||||
"MONGO_URL": "mongodb://localhost:27017",
|
"MONGO_URL": "mongodb://localhost:27017",
|
||||||
"TELEGRAM_DATABASE": "telegram-service",
|
"TELEGRAM_DATABASE": "telegram-service",
|
||||||
"ELASTIC_URL": "http://localhost:9200",
|
|
||||||
"REKONI_URL": "http://localhost:4004",
|
"REKONI_URL": "http://localhost:4004",
|
||||||
"MODEL_VERSION": "0.6.287"
|
"MODEL_VERSION": "0.6.287"
|
||||||
},
|
},
|
||||||
@ -342,7 +338,6 @@
|
|||||||
"DB_URL": "postgresql://postgres:example@localhost:5432",
|
"DB_URL": "postgresql://postgres:example@localhost:5432",
|
||||||
"ACCOUNTS_URL": "http://localhost:3000",
|
"ACCOUNTS_URL": "http://localhost:3000",
|
||||||
"TELEGRAM_DATABASE": "telegram-service",
|
"TELEGRAM_DATABASE": "telegram-service",
|
||||||
"ELASTIC_URL": "http://localhost:9200",
|
|
||||||
"REKONI_URL": "http://localhost:4004"
|
"REKONI_URL": "http://localhost:4004"
|
||||||
},
|
},
|
||||||
"runtimeVersion": "20",
|
"runtimeVersion": "20",
|
||||||
|
@ -232,7 +232,6 @@ services:
|
|||||||
- ACCOUNTS_URL=http://host.docker.internal:3000
|
- ACCOUNTS_URL=http://host.docker.internal:3000
|
||||||
- STATS_URL=http://host.docker.internal:4900
|
- STATS_URL=http://host.docker.internal:4900
|
||||||
- UPLOAD_URL=/files
|
- UPLOAD_URL=/files
|
||||||
- ELASTIC_URL=http://host.docker.internal:9200
|
|
||||||
- GMAIL_URL=http://host.docker.internal:8088
|
- GMAIL_URL=http://host.docker.internal:8088
|
||||||
- CALENDAR_URL=http://host.docker.internal:8095
|
- CALENDAR_URL=http://host.docker.internal:8095
|
||||||
- TELEGRAM_URL=http://host.docker.internal:8086
|
- TELEGRAM_URL=http://host.docker.internal:8086
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
"docker:tbuild": "docker build -t hardcoreeng/import-tool . --platform=linux/amd64 && ../../common/scripts/docker_tag_push.sh hardcoreeng/import-tool",
|
"docker:tbuild": "docker build -t hardcoreeng/import-tool . --platform=linux/amd64 && ../../common/scripts/docker_tag_push.sh hardcoreeng/import-tool",
|
||||||
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/import-tool staging",
|
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/import-tool staging",
|
||||||
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/import-tool",
|
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/import-tool",
|
||||||
"run-local": "rush bundle --to @hcengineering/import-tool >/dev/null && cross-env SERVER_SECRET=secret ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3333 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost MONGO_URL=mongodb://localhost:27017 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --max-old-space-size=18000 ./bundle/bundle.js",
|
"run-local": "rush bundle --to @hcengineering/import-tool >/dev/null && cross-env SERVER_SECRET=secret ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3333 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost MONGO_URL=mongodb://localhost:27017 TELEGRAM_DATABASE=telegram-service REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --max-old-space-size=18000 ./bundle/bundle.js",
|
||||||
"run-local-brk": "rush bundle --to @hcengineering/import-tool >/dev/null && cross-env SERVER_SECRET=secret ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3333 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost MONGO_URL=mongodb://localhost:27017 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --inspect-brk --enable-source-maps --max-old-space-size=18000 ./bundle/bundle.js",
|
"run-local-brk": "rush bundle --to @hcengineering/import-tool >/dev/null && cross-env SERVER_SECRET=secret ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3333 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost MONGO_URL=mongodb://localhost:27017 TELEGRAM_DATABASE=telegram-service REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --inspect-brk --enable-source-maps --max-old-space-size=18000 ./bundle/bundle.js",
|
||||||
"run": "rush bundle --to @hcengineering/import-tool >/dev/null && cross-env node --max-old-space-size=8000 ./bundle/bundle.js",
|
"run": "rush bundle --to @hcengineering/import-tool >/dev/null && cross-env node --max-old-space-size=8000 ./bundle/bundle.js",
|
||||||
"upgrade": "rushx run-local upgrade",
|
"upgrade": "rushx run-local upgrade",
|
||||||
"format": "format src",
|
"format": "format src",
|
||||||
|
@ -87,7 +87,6 @@ services:
|
|||||||
- 'MONGO_OPTIONS={"appName":"front","maxPoolSize":1}'
|
- 'MONGO_OPTIONS={"appName":"front","maxPoolSize":1}'
|
||||||
- ACCOUNTS_URL=http://localhost:3000
|
- ACCOUNTS_URL=http://localhost:3000
|
||||||
- UPLOAD_URL=/files
|
- UPLOAD_URL=/files
|
||||||
- ELASTIC_URL=http://elastic:9200
|
|
||||||
- GMAIL_URL=http://localhost:8088
|
- GMAIL_URL=http://localhost:8088
|
||||||
- CALENDAR_URL=http://localhost:8095
|
- CALENDAR_URL=http://localhost:8095
|
||||||
- TELEGRAM_URL=http://localhost:8086
|
- TELEGRAM_URL=http://localhost:8086
|
||||||
@ -121,7 +120,6 @@ services:
|
|||||||
- SERVER_PORT=3333
|
- SERVER_PORT=3333
|
||||||
- SERVER_SECRET=secret
|
- SERVER_SECRET=secret
|
||||||
- ENABLE_COMPRESSION=true
|
- ENABLE_COMPRESSION=true
|
||||||
- ELASTIC_URL=http://elastic:9200
|
|
||||||
- MONGO_URL=mongodb://host.docker.internal:27017?compressors=snappy
|
- MONGO_URL=mongodb://host.docker.internal:27017?compressors=snappy
|
||||||
- 'MONGO_OPTIONS={"appName": "transactor", "maxPoolSize": 10}'
|
- 'MONGO_OPTIONS={"appName": "transactor", "maxPoolSize": 10}'
|
||||||
- METRICS_CONSOLE=false
|
- METRICS_CONSOLE=false
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
"docker:tbuild": "docker build -t hardcoreeng/tool . --platform=linux/amd64 && ../../common/scripts/docker_tag_push.sh hardcoreeng/tool",
|
"docker:tbuild": "docker build -t hardcoreeng/tool . --platform=linux/amd64 && ../../common/scripts/docker_tag_push.sh hardcoreeng/tool",
|
||||||
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/tool staging",
|
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/tool staging",
|
||||||
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/tool",
|
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/tool",
|
||||||
"run-local": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=secret ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3333 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost ACCOUNT_DB_URL=mongodb://localhost:27017 DB_URL=mongodb://localhost:27017 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --expose-gc --max-old-space-size=18000 ./bundle/bundle.js",
|
"run-local": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=secret ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3333 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost ACCOUNT_DB_URL=mongodb://localhost:27017 DB_URL=mongodb://localhost:27017 TELEGRAM_DATABASE=telegram-service REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --expose-gc --max-old-space-size=18000 ./bundle/bundle.js",
|
||||||
"run-local-pg": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=secret ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3333 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost ACCOUNT_DB_URL=mongodb://localhost:27017 DB_URL=postgresql://postgres:example@localhost:5432 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --expose-gc --max-old-space-size=18000 ./bundle/bundle.js",
|
"run-local-pg": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=secret ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3333 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost ACCOUNT_DB_URL=mongodb://localhost:27017 DB_URL=postgresql://postgres:example@localhost:5432 TELEGRAM_DATABASE=telegram-service REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --expose-gc --max-old-space-size=18000 ./bundle/bundle.js",
|
||||||
"run-local-cr": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=secret ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3332 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost ACCOUNT_DB_URL=mongodb://localhost:27017 DB_URL=postgresql://root@host.docker.internal:26257/defaultdb?sslmode=disable TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --expose-gc --max-old-space-size=18000 ./bundle/bundle.js",
|
"run-local-cr": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=secret ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3332 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost ACCOUNT_DB_URL=mongodb://localhost:27017 DB_URL=postgresql://root@host.docker.internal:26257/defaultdb?sslmode=disable TELEGRAM_DATABASE=telegram-service REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --expose-gc --max-old-space-size=18000 ./bundle/bundle.js",
|
||||||
"run-local-brk": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=secret ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3333 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost ACCOUNT_DB_URL=mongodb://localhost:27017 DB_URL=mongodb://localhost:27017 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --inspect-brk --enable-source-maps --max-old-space-size=18000 ./bundle/bundle.js",
|
"run-local-brk": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=secret ACCOUNTS_URL=http://localhost:3000 TRANSACTOR_URL=ws://localhost:3333 MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost ACCOUNT_DB_URL=mongodb://localhost:27017 DB_URL=mongodb://localhost:27017 TELEGRAM_DATABASE=telegram-service REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --inspect-brk --enable-source-maps --max-old-space-size=18000 ./bundle/bundle.js",
|
||||||
"run": "rush bundle --to @hcengineering/tool >/dev/null && cross-env node --max-old-space-size=8000 ./bundle/bundle.js",
|
"run": "rush bundle --to @hcengineering/tool >/dev/null && cross-env node --max-old-space-size=8000 ./bundle/bundle.js",
|
||||||
"upgrade": "rushx run-local upgrade",
|
"upgrade": "rushx run-local upgrade",
|
||||||
"format": "format src",
|
"format": "format src",
|
||||||
|
@ -82,7 +82,6 @@ export async function cleanWorkspace (
|
|||||||
mongoUrl: string,
|
mongoUrl: string,
|
||||||
workspaceId: WorkspaceId,
|
workspaceId: WorkspaceId,
|
||||||
storageAdapter: StorageAdapter,
|
storageAdapter: StorageAdapter,
|
||||||
elasticUrl: string,
|
|
||||||
transactorUrl: string,
|
transactorUrl: string,
|
||||||
opt: { recruit: boolean, tracker: boolean, removedTx: boolean }
|
opt: { recruit: boolean, tracker: boolean, removedTx: boolean }
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
@ -167,15 +167,6 @@ export function devTool (
|
|||||||
console.error('please provide transactor url.')
|
console.error('please provide transactor url.')
|
||||||
}
|
}
|
||||||
|
|
||||||
function getElasticUrl (): string {
|
|
||||||
const elasticUrl = process.env.ELASTIC_URL
|
|
||||||
if (elasticUrl === undefined) {
|
|
||||||
console.error('please provide elastic url')
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
return elasticUrl
|
|
||||||
}
|
|
||||||
|
|
||||||
const initScriptUrl = process.env.INIT_SCRIPT_URL
|
const initScriptUrl = process.env.INIT_SCRIPT_URL
|
||||||
if (initScriptUrl !== undefined) {
|
if (initScriptUrl !== undefined) {
|
||||||
setMetadata(toolPlugin.metadata.InitScriptURL, initScriptUrl)
|
setMetadata(toolPlugin.metadata.InitScriptURL, initScriptUrl)
|
||||||
@ -1443,7 +1434,7 @@ export function devTool (
|
|||||||
await withDatabase(dbUrl, async (db) => {
|
await withDatabase(dbUrl, async (db) => {
|
||||||
const wsid = getWorkspaceId(workspace)
|
const wsid = getWorkspaceId(workspace)
|
||||||
const endpoint = await getTransactorEndpoint(generateToken(systemAccountEmail, wsid), 'external')
|
const endpoint = await getTransactorEndpoint(generateToken(systemAccountEmail, wsid), 'external')
|
||||||
await cleanWorkspace(toolCtx, dbUrl, wsid, adapter, getElasticUrl(), endpoint, cmd)
|
await cleanWorkspace(toolCtx, dbUrl, wsid, adapter, endpoint, cmd)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -435,6 +435,26 @@ export function createModel (builder: Builder): void {
|
|||||||
},
|
},
|
||||||
recruit.viewlet.TableApplicant
|
recruit.viewlet.TableApplicant
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const applicationDoneOption: ViewOptionModel = {
|
||||||
|
key: 'hideDoneState',
|
||||||
|
type: 'toggle',
|
||||||
|
defaultValue: true,
|
||||||
|
actionTarget: 'query',
|
||||||
|
action: recruit.function.HideDoneState,
|
||||||
|
label: recruit.string.HideDoneState
|
||||||
|
}
|
||||||
|
|
||||||
|
// hiding applicants related to archived vacancies from applicants view
|
||||||
|
const hideApplicantsFromArchivedVacanciesOption: ViewOptionModel = {
|
||||||
|
key: 'hideArchivedVacancies',
|
||||||
|
type: 'toggle',
|
||||||
|
defaultValue: true,
|
||||||
|
actionTarget: 'query',
|
||||||
|
action: recruit.function.HideArchivedVacancies,
|
||||||
|
label: recruit.string.HideApplicantsFromArchivedVacancies
|
||||||
|
}
|
||||||
|
|
||||||
builder.createDoc(
|
builder.createDoc(
|
||||||
view.class.Viewlet,
|
view.class.Viewlet,
|
||||||
core.space.Model,
|
core.space.Model,
|
||||||
@ -479,9 +499,10 @@ export function createModel (builder: Builder): void {
|
|||||||
hiddenKeys: ['name', 'attachedTo'],
|
hiddenKeys: ['name', 'attachedTo'],
|
||||||
sortable: true
|
sortable: true
|
||||||
},
|
},
|
||||||
baseQuery: {
|
viewOptions: {
|
||||||
isDone: false,
|
groupBy: [],
|
||||||
'$lookup.space.archived': false
|
orderBy: [],
|
||||||
|
other: [applicationDoneOption, hideApplicantsFromArchivedVacanciesOption]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
recruit.viewlet.ApplicantTable
|
recruit.viewlet.ApplicantTable
|
||||||
@ -519,25 +540,6 @@ export function createModel (builder: Builder): void {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
const applicationDoneOption: ViewOptionModel = {
|
|
||||||
key: 'hideDoneState',
|
|
||||||
type: 'toggle',
|
|
||||||
defaultValue: true,
|
|
||||||
actionTarget: 'query',
|
|
||||||
action: recruit.function.HideDoneState,
|
|
||||||
label: recruit.string.HideDoneState
|
|
||||||
}
|
|
||||||
|
|
||||||
// hiding applicants related to archived vacancies from applicants view
|
|
||||||
const hideApplicantsFromArchivedVacanciesOption: ViewOptionModel = {
|
|
||||||
key: 'hideArchivedVacancies',
|
|
||||||
type: 'toggle',
|
|
||||||
defaultValue: true,
|
|
||||||
actionTarget: 'query',
|
|
||||||
action: recruit.function.HideArchivedVacancies,
|
|
||||||
label: recruit.string.HideApplicantsFromArchivedVacancies
|
|
||||||
}
|
|
||||||
|
|
||||||
const applicantViewOptions = (colors: boolean, hides: boolean): ViewOptionsModel => {
|
const applicantViewOptions = (colors: boolean, hides: boolean): ViewOptionsModel => {
|
||||||
const model: ViewOptionsModel = {
|
const model: ViewOptionsModel = {
|
||||||
groupBy: ['status', 'assignee', 'space', 'createdBy', 'modifiedBy'],
|
groupBy: ['status', 'assignee', 'space', 'createdBy', 'modifiedBy'],
|
||||||
@ -794,13 +796,8 @@ export function createModel (builder: Builder): void {
|
|||||||
{
|
{
|
||||||
attachTo: recruit.class.Applicant,
|
attachTo: recruit.class.Applicant,
|
||||||
descriptor: task.viewlet.Kanban,
|
descriptor: task.viewlet.Kanban,
|
||||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
||||||
baseQuery: {
|
|
||||||
isDone: false,
|
|
||||||
'$lookup.space.archived': false
|
|
||||||
},
|
|
||||||
viewOptions: {
|
viewOptions: {
|
||||||
...applicantViewOptions(false, false),
|
...applicantViewOptions(false, true),
|
||||||
groupDepth: 1
|
groupDepth: 1
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
@ -65,6 +65,10 @@ export function clone (obj: any, as?: (doc: any, m: any) => any, needAs?: (value
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (typeOf === 'Object') {
|
||||||
|
const m = needAs?.(obj)
|
||||||
|
return m !== undefined && as !== undefined ? as(result, m) : result
|
||||||
|
}
|
||||||
return result
|
return result
|
||||||
} else {
|
} else {
|
||||||
return obj
|
return obj
|
||||||
|
@ -27,6 +27,7 @@ import core, {
|
|||||||
IndexingUpdateEvent,
|
IndexingUpdateEvent,
|
||||||
Lookup,
|
Lookup,
|
||||||
LookupData,
|
LookupData,
|
||||||
|
Mixin,
|
||||||
ModelDb,
|
ModelDb,
|
||||||
Ref,
|
Ref,
|
||||||
ReverseLookups,
|
ReverseLookups,
|
||||||
@ -150,6 +151,13 @@ export class LiveQuery implements WithTx, Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private match (q: Query, doc: Doc, skipLookup = false): boolean {
|
private match (q: Query, doc: Doc, skipLookup = false): boolean {
|
||||||
|
if (this.getHierarchy().isMixin(q._class)) {
|
||||||
|
if (this.getHierarchy().hasMixin(doc, q._class)) {
|
||||||
|
doc = this.getHierarchy().as(doc, q._class)
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!this.getHierarchy().isDerived(doc._class, q._class)) {
|
if (!this.getHierarchy().isDerived(doc._class, q._class)) {
|
||||||
// Check if it is not a mixin and not match class
|
// Check if it is not a mixin and not match class
|
||||||
const mixinClass = Hierarchy.mixinClass(doc)
|
const mixinClass = Hierarchy.mixinClass(doc)
|
||||||
@ -518,20 +526,30 @@ export class LiveQuery implements WithTx, Client {
|
|||||||
return current
|
return current
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private asMixin (doc: Doc, mixin: Ref<Mixin<Doc>>): Doc {
|
||||||
|
if (this.getHierarchy().isMixin(mixin)) {
|
||||||
|
return this.getHierarchy().as(doc, mixin)
|
||||||
|
}
|
||||||
|
return doc
|
||||||
|
}
|
||||||
|
|
||||||
private async getCurrentDoc (
|
private async getCurrentDoc (
|
||||||
q: Query,
|
q: Query,
|
||||||
_id: Ref<Doc>,
|
_id: Ref<Doc>,
|
||||||
space: Ref<Space>,
|
space: Ref<Space>,
|
||||||
docCache: Map<string, Doc>
|
docCache: Map<string, Doc>
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
const current = await this.getDocFromCache(docCache, _id, q._class, space, q)
|
let current = await this.getDocFromCache(docCache, _id, q._class, space, q)
|
||||||
if (q.result instanceof Promise) {
|
if (q.result instanceof Promise) {
|
||||||
q.result = await q.result
|
q.result = await q.result
|
||||||
}
|
}
|
||||||
|
|
||||||
const pos = q.result.findDoc(_id)
|
const pos = q.result.findDoc(_id)
|
||||||
|
if (current !== undefined) {
|
||||||
|
current = this.asMixin(current, q._class)
|
||||||
|
}
|
||||||
if (current !== undefined && this.match(q, current)) {
|
if (current !== undefined && this.match(q, current)) {
|
||||||
q.result.updateDoc(current)
|
q.result.updateDoc(current, false)
|
||||||
this.refs.updateDocuments(q, [current])
|
this.refs.updateDocuments(q, [current])
|
||||||
} else {
|
} else {
|
||||||
if (q.options?.limit === q.result.length) {
|
if (q.options?.limit === q.result.length) {
|
||||||
@ -543,7 +561,6 @@ export class LiveQuery implements WithTx, Client {
|
|||||||
if (q.options?.total === true) {
|
if (q.options?.total === true) {
|
||||||
q.total--
|
q.total--
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -597,7 +614,7 @@ export class LiveQuery implements WithTx, Client {
|
|||||||
if (q.result instanceof Promise) {
|
if (q.result instanceof Promise) {
|
||||||
q.result = await q.result
|
q.result = await q.result
|
||||||
}
|
}
|
||||||
const updatedDoc = q.result.findDoc(tx.objectId)
|
let updatedDoc = q.result.findDoc(tx.objectId)
|
||||||
if (updatedDoc !== undefined) {
|
if (updatedDoc !== undefined) {
|
||||||
// If query contains search we must check use fulltext
|
// If query contains search we must check use fulltext
|
||||||
if (q.query.$search != null && q.query.$search.length > 0) {
|
if (q.query.$search != null && q.query.$search.length > 0) {
|
||||||
@ -608,6 +625,7 @@ export class LiveQuery implements WithTx, Client {
|
|||||||
} else {
|
} else {
|
||||||
if (updatedDoc.modifiedOn < tx.modifiedOn) {
|
if (updatedDoc.modifiedOn < tx.modifiedOn) {
|
||||||
await this.__updateMixinDoc(q, updatedDoc, tx)
|
await this.__updateMixinDoc(q, updatedDoc, tx)
|
||||||
|
updatedDoc = this.asMixin(updatedDoc, q._class)
|
||||||
const updateRefresh = this.checkUpdatedDocMatch(q, q.result, updatedDoc)
|
const updateRefresh = this.checkUpdatedDocMatch(q, q.result, updatedDoc)
|
||||||
if (updateRefresh) {
|
if (updateRefresh) {
|
||||||
continue
|
continue
|
||||||
|
@ -17,7 +17,7 @@ import {
|
|||||||
type ViewQueryOption,
|
type ViewQueryOption,
|
||||||
type Viewlet
|
type Viewlet
|
||||||
} from '@hcengineering/view'
|
} from '@hcengineering/view'
|
||||||
import { getCategories, getCategorySpaces } from '@hcengineering/view-resources'
|
import { getCategories, getCategorySpaces, concatCategories } from '@hcengineering/view-resources'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -55,7 +55,7 @@ export async function updateTaskKanbanCategories (
|
|||||||
viewlet.descriptor
|
viewlet.descriptor
|
||||||
)
|
)
|
||||||
if (res !== undefined) {
|
if (res !== undefined) {
|
||||||
categories = res
|
categories = concatCategories(res, categories)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ export async function getTaskKanbanResultQuery (
|
|||||||
if (viewOption.actionTarget !== 'query') continue
|
if (viewOption.actionTarget !== 'query') continue
|
||||||
const queryOption = viewOption as ViewQueryOption
|
const queryOption = viewOption as ViewQueryOption
|
||||||
const f = await getResource(queryOption.action)
|
const f = await getResource(queryOption.action)
|
||||||
result = f(viewOptionsStore[queryOption.key] ?? queryOption.defaultValue, query)
|
result = f(viewOptionsStore[queryOption.key] ?? queryOption.defaultValue, result)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,11 @@
|
|||||||
Ref,
|
Ref,
|
||||||
SortingOrder,
|
SortingOrder,
|
||||||
TxOperations,
|
TxOperations,
|
||||||
getObjectValue
|
getObjectValue,
|
||||||
|
mergeQueries
|
||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import notification from '@hcengineering/notification'
|
import notification from '@hcengineering/notification'
|
||||||
|
import { getResource } from '@hcengineering/platform'
|
||||||
import { createQuery, getClient, reduceCalls, updateAttribute } from '@hcengineering/presentation'
|
import { createQuery, getClient, reduceCalls, updateAttribute } from '@hcengineering/presentation'
|
||||||
import ui, {
|
import ui, {
|
||||||
Button,
|
Button,
|
||||||
@ -39,7 +41,14 @@
|
|||||||
mouseAttractor,
|
mouseAttractor,
|
||||||
resizeObserver
|
resizeObserver
|
||||||
} from '@hcengineering/ui'
|
} from '@hcengineering/ui'
|
||||||
import { AttributeModel, BuildModelKey, BuildModelOptions } from '@hcengineering/view'
|
import {
|
||||||
|
AttributeModel,
|
||||||
|
BuildModelKey,
|
||||||
|
BuildModelOptions,
|
||||||
|
ViewOptionModel,
|
||||||
|
ViewOptions,
|
||||||
|
ViewQueryOption
|
||||||
|
} from '@hcengineering/view'
|
||||||
import { deepEqual } from 'fast-equals'
|
import { deepEqual } from 'fast-equals'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
import { showMenu } from '../actions'
|
import { showMenu } from '../actions'
|
||||||
@ -59,6 +68,8 @@
|
|||||||
export let tableId: string | undefined = undefined
|
export let tableId: string | undefined = undefined
|
||||||
export let readonly = false
|
export let readonly = false
|
||||||
export let showFooter = false
|
export let showFooter = false
|
||||||
|
export let viewOptionsConfig: ViewOptionModel[] | undefined = undefined
|
||||||
|
export let viewOptions: ViewOptions | undefined = undefined
|
||||||
|
|
||||||
export let totalQuery: DocumentQuery<Doc> | undefined = undefined
|
export let totalQuery: DocumentQuery<Doc> | undefined = undefined
|
||||||
|
|
||||||
@ -117,6 +128,29 @@
|
|||||||
: { ...(options?.sort ?? {}), [sortKey]: sortOrder }
|
: { ...(options?.sort ?? {}), [sortKey]: sortOrder }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getResultQuery (
|
||||||
|
query: DocumentQuery<Doc>,
|
||||||
|
viewOptions: ViewOptionModel[] | undefined,
|
||||||
|
viewOptionsStore: ViewOptions | undefined
|
||||||
|
): Promise<DocumentQuery<Doc>> {
|
||||||
|
if (viewOptions === undefined || viewOptionsStore === undefined) {
|
||||||
|
return query
|
||||||
|
}
|
||||||
|
let result: DocumentQuery<Doc> = hierarchy.clone(query)
|
||||||
|
for (const viewOption of viewOptions) {
|
||||||
|
if (viewOption.actionTarget !== 'query') continue
|
||||||
|
const queryOption = viewOption as ViewQueryOption
|
||||||
|
const f = await getResource(queryOption.action)
|
||||||
|
const resultP = f(viewOptionsStore[queryOption.key] ?? queryOption.defaultValue, result)
|
||||||
|
if (resultP instanceof Promise) {
|
||||||
|
result = await resultP
|
||||||
|
} else {
|
||||||
|
result = resultP
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
const update = reduceCalls(async function (
|
const update = reduceCalls(async function (
|
||||||
_class: Ref<Class<Doc>>,
|
_class: Ref<Class<Doc>>,
|
||||||
query: DocumentQuery<Doc>,
|
query: DocumentQuery<Doc>,
|
||||||
@ -126,9 +160,11 @@
|
|||||||
limit: number,
|
limit: number,
|
||||||
options?: FindOptions<Doc>
|
options?: FindOptions<Doc>
|
||||||
) {
|
) {
|
||||||
|
const p = await getResultQuery(query, viewOptionsConfig, viewOptions)
|
||||||
|
const resultQuery = mergeQueries(p, query)
|
||||||
loading += q.query(
|
loading += q.query(
|
||||||
_class,
|
_class,
|
||||||
query,
|
resultQuery,
|
||||||
(result) => {
|
(result) => {
|
||||||
if (sortingFunction !== undefined) {
|
if (sortingFunction !== undefined) {
|
||||||
const sf = sortingFunction
|
const sf = sortingFunction
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
import type { Class, Doc, DocumentQuery, FindOptions, Ref } from '@hcengineering/core'
|
import type { Class, Doc, DocumentQuery, FindOptions, Ref } from '@hcengineering/core'
|
||||||
import { ActionContext } from '@hcengineering/presentation'
|
import { ActionContext } from '@hcengineering/presentation'
|
||||||
import { FadeOptions, Scroller, tableSP } from '@hcengineering/ui'
|
import { FadeOptions, Scroller, tableSP } from '@hcengineering/ui'
|
||||||
import { BuildModelKey } from '@hcengineering/view'
|
import { BuildModelKey, ViewOptions, Viewlet } from '@hcengineering/view'
|
||||||
import { onMount } from 'svelte'
|
import { onMount } from 'svelte'
|
||||||
import { focusStore, ListSelectionProvider, SelectDirection } from '../selection'
|
import { focusStore, ListSelectionProvider, SelectDirection } from '../selection'
|
||||||
import { LoadingProps } from '../utils'
|
import { LoadingProps } from '../utils'
|
||||||
@ -34,6 +34,8 @@
|
|||||||
export let tableId: string | undefined = undefined
|
export let tableId: string | undefined = undefined
|
||||||
export let fade: FadeOptions = tableSP
|
export let fade: FadeOptions = tableSP
|
||||||
export let prefferedSorting: string = 'modifiedOn'
|
export let prefferedSorting: string = 'modifiedOn'
|
||||||
|
export let viewOptions: ViewOptions | undefined = undefined
|
||||||
|
export let viewlet: Viewlet | undefined = undefined
|
||||||
|
|
||||||
// If defined, will show a number of dummy items before real data will appear.
|
// If defined, will show a number of dummy items before real data will appear.
|
||||||
export let loadingProps: LoadingProps | undefined = undefined
|
export let loadingProps: LoadingProps | undefined = undefined
|
||||||
@ -79,6 +81,8 @@
|
|||||||
checked={$selection ?? []}
|
checked={$selection ?? []}
|
||||||
{prefferedSorting}
|
{prefferedSorting}
|
||||||
{tableId}
|
{tableId}
|
||||||
|
{viewOptions}
|
||||||
|
viewOptionsConfig={viewlet?.viewOptions?.other}
|
||||||
selection={listProvider.current($focusStore)}
|
selection={listProvider.current($focusStore)}
|
||||||
on:row-focus={(evt) => {
|
on:row-focus={(evt) => {
|
||||||
listProvider.updateFocus(evt.detail)
|
listProvider.updateFocus(evt.detail)
|
||||||
|
@ -22,12 +22,18 @@
|
|||||||
const preferenceQuery = createQuery()
|
const preferenceQuery = createQuery()
|
||||||
const objectConfigurations = createQuery()
|
const objectConfigurations = createQuery()
|
||||||
let preference: ViewletPreference[] = []
|
let preference: ViewletPreference[] = []
|
||||||
let loading = true
|
|
||||||
|
let configurationsLoading = true
|
||||||
|
let preferencesLoading = true
|
||||||
|
$: loading = configurationsLoading || preferencesLoading
|
||||||
|
|
||||||
let configurationRaw: Viewlet[] = []
|
let configurationRaw: Viewlet[] = []
|
||||||
let configurations: Record<Ref<Class<Doc>>, Viewlet['config']> = {}
|
let configurations: Record<Ref<Class<Doc>>, Viewlet['config']> = {}
|
||||||
|
|
||||||
$: viewlet &&
|
function fetchConfigurations (viewlet: Viewlet): void {
|
||||||
|
configurationsLoading = true
|
||||||
|
configurations = {}
|
||||||
|
|
||||||
objectConfigurations.query(
|
objectConfigurations.query(
|
||||||
view.class.Viewlet,
|
view.class.Viewlet,
|
||||||
{
|
{
|
||||||
@ -37,11 +43,13 @@
|
|||||||
},
|
},
|
||||||
(res) => {
|
(res) => {
|
||||||
configurationRaw = res
|
configurationRaw = res
|
||||||
loading = false
|
configurationsLoading = false
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
$: viewlet &&
|
function fetchPreferences (viewlet: Viewlet): void {
|
||||||
|
preferencesLoading = true
|
||||||
preferenceQuery.query(
|
preferenceQuery.query(
|
||||||
view.class.ViewletPreference,
|
view.class.ViewletPreference,
|
||||||
{
|
{
|
||||||
@ -50,9 +58,10 @@
|
|||||||
},
|
},
|
||||||
(res) => {
|
(res) => {
|
||||||
preference = res
|
preference = res
|
||||||
loading = false
|
preferencesLoading = false
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function updateConfiguration (configurationRaw: Viewlet[], preference: ViewletPreference[]): void {
|
function updateConfiguration (configurationRaw: Viewlet[], preference: ViewletPreference[]): void {
|
||||||
const newConfigurations: Record<Ref<Class<Doc>>, Viewlet['config']> = {}
|
const newConfigurations: Record<Ref<Class<Doc>>, Viewlet['config']> = {}
|
||||||
@ -74,6 +83,9 @@
|
|||||||
configurations = newConfigurations
|
configurations = newConfigurations
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: fetchConfigurations(viewlet)
|
||||||
|
$: fetchPreferences(viewlet)
|
||||||
|
|
||||||
$: updateConfiguration(configurationRaw, preference)
|
$: updateConfiguration(configurationRaw, preference)
|
||||||
|
|
||||||
$: config = preference.find((it) => it.attachedTo === viewlet._id)?.config ?? viewlet.config
|
$: config = preference.find((it) => it.attachedTo === viewlet._id)?.config ?? viewlet.config
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
export ACCOUNTS_URL=http://localhost:3333
|
export ACCOUNTS_URL=http://localhost:3333
|
||||||
export UPLOAD_URL=http://localhost:3333/files
|
export UPLOAD_URL=http://localhost:3333/files
|
||||||
export ELASTIC_URL=http://elastic:9200
|
|
||||||
export COLLABORATOR_URL=ws://localhost:3078
|
export COLLABORATOR_URL=ws://localhost:3078
|
||||||
export MINIO_ENDPOINT=minio
|
export MINIO_ENDPOINT=minio
|
||||||
export MINIO_ACCESS_KEY=minioadmin
|
export MINIO_ACCESS_KEY=minioadmin
|
||||||
|
@ -99,7 +99,6 @@ services:
|
|||||||
- ACCOUNTS_URL=http://host.docker.internal:3003
|
- ACCOUNTS_URL=http://host.docker.internal:3003
|
||||||
- MONGO_URL=mongodb://mongodb:27018
|
- MONGO_URL=mongodb://mongodb:27018
|
||||||
- UPLOAD_URL=/files
|
- UPLOAD_URL=/files
|
||||||
- ELASTIC_URL=http://elastic:9200
|
|
||||||
- GMAIL_URL=http://host.docker.internal:8088
|
- GMAIL_URL=http://host.docker.internal:8088
|
||||||
- CALENDAR_URL=http://host.docker.internal:8095
|
- CALENDAR_URL=http://host.docker.internal:8095
|
||||||
- REKONI_URL=http://rekoni:4007
|
- REKONI_URL=http://rekoni:4007
|
||||||
|
@ -3,7 +3,6 @@ export MINIO_ACCESS_KEY=minioadmin
|
|||||||
export MINIO_SECRET_KEY=minioadmin
|
export MINIO_SECRET_KEY=minioadmin
|
||||||
export MINIO_ENDPOINT=localhost:9000
|
export MINIO_ENDPOINT=localhost:9000
|
||||||
export MONGO_URL=mongodb://localhost:27017
|
export MONGO_URL=mongodb://localhost:27017
|
||||||
export ELASTIC_URL=http://localhost:9200
|
|
||||||
export SERVER_SECRET=secret
|
export SERVER_SECRET=secret
|
||||||
|
|
||||||
# Restore workspace contents in mongo/elastic
|
# Restore workspace contents in mongo/elastic
|
||||||
|
@ -7,7 +7,6 @@ export DB_URL=mongodb://localhost:27017
|
|||||||
export ACCOUNT_DB_URL=mongodb://localhost:27017
|
export ACCOUNT_DB_URL=mongodb://localhost:27017
|
||||||
export ACCOUNTS_URL=http://localhost:3000
|
export ACCOUNTS_URL=http://localhost:3000
|
||||||
export TRANSACTOR_URL=ws://localhost:3333
|
export TRANSACTOR_URL=ws://localhost:3333
|
||||||
export ELASTIC_URL=http://localhost:9200
|
|
||||||
export SERVER_SECRET=secret
|
export SERVER_SECRET=secret
|
||||||
|
|
||||||
# Restore workspace contents in mongo/elastic
|
# Restore workspace contents in mongo/elastic
|
||||||
|
@ -8,7 +8,6 @@ export TRANSACTOR_URL=ws://localhost:3334
|
|||||||
export MONGO_URL=mongodb://localhost:27018
|
export MONGO_URL=mongodb://localhost:27018
|
||||||
export ACCOUNT_DB_URL=mongodb://localhost:27018
|
export ACCOUNT_DB_URL=mongodb://localhost:27018
|
||||||
export DB_URL=mongodb://localhost:27018
|
export DB_URL=mongodb://localhost:27018
|
||||||
export ELASTIC_URL=http://localhost:9201
|
|
||||||
export SERVER_SECRET=secret
|
export SERVER_SECRET=secret
|
||||||
export STORAGE_CONFIG="minio|localhost:9002?accessKey=minioadmin&secretKey=minioadmin"
|
export STORAGE_CONFIG="minio|localhost:9002?accessKey=minioadmin&secretKey=minioadmin"
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ export async function OnStateUpdate (txes: TxCUD<Doc>[], control: TriggerControl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return []
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||||
|
@ -405,7 +405,7 @@ export async function OnToDoUpdate (txes: Tx[], control: TriggerControl): Promis
|
|||||||
)
|
)
|
||||||
if (funcs !== undefined) {
|
if (funcs !== undefined) {
|
||||||
const func = await getResource(funcs.onDone)
|
const func = await getResource(funcs.onDone)
|
||||||
const todoRes = await func(control, resEvents, todo)
|
const todoRes = await func(control, resEvents, todo, tx.space === core.space.DerivedTx)
|
||||||
await control.apply(control.ctx, todoRes)
|
await control.apply(control.ctx, todoRes)
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
@ -459,7 +459,12 @@ export async function IssueToDoFactory (actualTx: TxCUD<Issue>, control: Trigger
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export async function IssueToDoDone (control: TriggerControl, workslots: WorkSlot[], todo: ToDo): Promise<Tx[]> {
|
export async function IssueToDoDone (
|
||||||
|
control: TriggerControl,
|
||||||
|
workslots: WorkSlot[],
|
||||||
|
todo: ToDo,
|
||||||
|
isDerived: boolean
|
||||||
|
): Promise<Tx[]> {
|
||||||
const res: Tx[] = []
|
const res: Tx[] = []
|
||||||
let total = 0
|
let total = 0
|
||||||
for (const workslot of workslots) {
|
for (const workslot of workslots) {
|
||||||
@ -470,45 +475,47 @@ export async function IssueToDoDone (control: TriggerControl, workslots: WorkSlo
|
|||||||
await control.findAll<Issue>(control.ctx, todo.attachedToClass, { _id: todo.attachedTo as Ref<Issue> })
|
await control.findAll<Issue>(control.ctx, todo.attachedToClass, { _id: todo.attachedTo as Ref<Issue> })
|
||||||
)[0]
|
)[0]
|
||||||
if (issue !== undefined) {
|
if (issue !== undefined) {
|
||||||
const project = (await control.findAll(control.ctx, task.class.Project, { _id: issue.space }))[0]
|
if (!isDerived) {
|
||||||
if (project !== undefined) {
|
const project = (await control.findAll(control.ctx, task.class.Project, { _id: issue.space }))[0]
|
||||||
const type = (await control.modelDb.findAll(task.class.ProjectType, { _id: project.type }))[0]
|
if (project !== undefined) {
|
||||||
if (type?.classic) {
|
const type = (await control.modelDb.findAll(task.class.ProjectType, { _id: project.type }))[0]
|
||||||
const taskType = (await control.modelDb.findAll(task.class.TaskType, { _id: issue.kind }))[0]
|
if (type?.classic) {
|
||||||
if (taskType !== undefined) {
|
const taskType = (await control.modelDb.findAll(task.class.TaskType, { _id: issue.kind }))[0]
|
||||||
const index = taskType.statuses.findIndex((p) => p === issue.status)
|
if (taskType !== undefined) {
|
||||||
|
const index = taskType.statuses.findIndex((p) => p === issue.status)
|
||||||
|
|
||||||
const helpers = await control.modelDb.findAll<TodoAutomationHelper>(time.class.TodoAutomationHelper, {})
|
const helpers = await control.modelDb.findAll<TodoAutomationHelper>(time.class.TodoAutomationHelper, {})
|
||||||
const testers = await Promise.all(helpers.map((it) => getResource(it.onDoneTester)))
|
const testers = await Promise.all(helpers.map((it) => getResource(it.onDoneTester)))
|
||||||
let allowed = true
|
let allowed = true
|
||||||
for (const tester of testers) {
|
for (const tester of testers) {
|
||||||
if (!(await tester(control, todo))) {
|
if (!(await tester(control, todo))) {
|
||||||
allowed = false
|
allowed = false
|
||||||
break
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (index !== -1 && allowed) {
|
||||||
if (index !== -1 && allowed) {
|
const nextStatus = taskType.statuses[index + 1]
|
||||||
const nextStatus = taskType.statuses[index + 1]
|
if (nextStatus !== undefined) {
|
||||||
if (nextStatus !== undefined) {
|
const currentStatus = taskType.statuses[index]
|
||||||
const currentStatus = taskType.statuses[index]
|
const current = (await control.modelDb.findAll(core.class.Status, { _id: currentStatus }))[0]
|
||||||
const current = (await control.modelDb.findAll(core.class.Status, { _id: currentStatus }))[0]
|
const next = (await control.modelDb.findAll(core.class.Status, { _id: nextStatus }))[0]
|
||||||
const next = (await control.modelDb.findAll(core.class.Status, { _id: nextStatus }))[0]
|
if (
|
||||||
if (
|
current.category !== task.statusCategory.Lost &&
|
||||||
current.category !== task.statusCategory.Lost &&
|
next.category !== task.statusCategory.Lost &&
|
||||||
next.category !== task.statusCategory.Lost &&
|
current.category !== task.statusCategory.Won
|
||||||
current.category !== task.statusCategory.Won
|
) {
|
||||||
) {
|
const innerTx = factory.createTxUpdateDoc(issue._class, issue.space, issue._id, {
|
||||||
const innerTx = factory.createTxUpdateDoc(issue._class, issue.space, issue._id, {
|
status: nextStatus
|
||||||
status: nextStatus
|
})
|
||||||
})
|
const outerTx = factory.createTxCollectionCUD(
|
||||||
const outerTx = factory.createTxCollectionCUD(
|
issue.attachedToClass,
|
||||||
issue.attachedToClass,
|
issue.attachedTo,
|
||||||
issue.attachedTo,
|
issue.space,
|
||||||
issue.space,
|
issue.collection,
|
||||||
issue.collection,
|
innerTx
|
||||||
innerTx
|
)
|
||||||
)
|
res.push(outerTx)
|
||||||
res.push(outerTx)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ export interface ToDoFactory extends Class<Task> {
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export interface OnToDo extends Class<Doc> {
|
export interface OnToDo extends Class<Doc> {
|
||||||
onDone: Resource<(control: TriggerControl, workslots: WorkSlot[], todo: ToDo) => Promise<Tx[]>>
|
onDone: Resource<(control: TriggerControl, workslots: WorkSlot[], todo: ToDo, isDerived: boolean) => Promise<Tx[]>>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,7 +49,9 @@ export default plugin(serverTimeId, {
|
|||||||
},
|
},
|
||||||
function: {
|
function: {
|
||||||
IssueToDoFactory: '' as Resource<(tx: Tx, control: TriggerControl) => Promise<Tx[]>>,
|
IssueToDoFactory: '' as Resource<(tx: Tx, control: TriggerControl) => Promise<Tx[]>>,
|
||||||
IssueToDoDone: '' as Resource<(control: TriggerControl, workslots: WorkSlot[], todo: ToDo) => Promise<Tx[]>>
|
IssueToDoDone: '' as Resource<
|
||||||
|
(control: TriggerControl, workslots: WorkSlot[], todo: ToDo, isDerived: boolean) => Promise<Tx[]>
|
||||||
|
>
|
||||||
},
|
},
|
||||||
trigger: {
|
trigger: {
|
||||||
OnTask: '' as Resource<TriggerFunc>,
|
OnTask: '' as Resource<TriggerFunc>,
|
||||||
|
@ -6,7 +6,6 @@ Front service is suited to deliver application bundles and resource assets, it a
|
|||||||
|
|
||||||
* SERVER_PORT: Specifies the port number on which the server will listen.
|
* SERVER_PORT: Specifies the port number on which the server will listen.
|
||||||
* MONGO_URL: Specifies the URL of the MongoDB database.
|
* MONGO_URL: Specifies the URL of the MongoDB database.
|
||||||
* ELASTIC_URL: Specifies the URL of the Elasticsearch service.
|
|
||||||
* ACCOUNTS_URL: Specifies the URL of the accounts service.
|
* ACCOUNTS_URL: Specifies the URL of the accounts service.
|
||||||
* UPLOAD_URL: Specifies the URL for uploading files.
|
* UPLOAD_URL: Specifies the URL for uploading files.
|
||||||
* GMAIL_URL: Specifies the URL of the Gmail service.
|
* GMAIL_URL: Specifies the URL of the Gmail service.
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
export ACCOUNTS_URL=http://localhost:3333
|
export ACCOUNTS_URL=http://localhost:3333
|
||||||
export UPLOAD_URL=http://localhost:3333/files
|
export UPLOAD_URL=http://localhost:3333/files
|
||||||
export ELASTIC_URL=http://elastic:9200
|
|
||||||
export MINIO_ENDPOINT=minio
|
export MINIO_ENDPOINT=minio
|
||||||
export MINIO_ACCESS_KEY=minioadmin
|
export MINIO_ACCESS_KEY=minioadmin
|
||||||
export MINIO_SECRET_KEY=minioadmin
|
export MINIO_SECRET_KEY=minioadmin
|
||||||
|
@ -243,7 +243,6 @@ async function getFile (
|
|||||||
export function start (
|
export function start (
|
||||||
ctx: MeasureContext,
|
ctx: MeasureContext,
|
||||||
config: {
|
config: {
|
||||||
elasticUrl: string
|
|
||||||
storageAdapter: StorageAdapter
|
storageAdapter: StorageAdapter
|
||||||
accountsUrl: string
|
accountsUrl: string
|
||||||
uploadUrl: string
|
uploadUrl: string
|
||||||
|
@ -24,12 +24,6 @@ import { start } from '.'
|
|||||||
export function startFront (ctx: MeasureContext, extraConfig?: Record<string, string | undefined>): void {
|
export function startFront (ctx: MeasureContext, extraConfig?: Record<string, string | undefined>): void {
|
||||||
const SERVER_PORT = parseInt(process.env.SERVER_PORT ?? '8080')
|
const SERVER_PORT = parseInt(process.env.SERVER_PORT ?? '8080')
|
||||||
|
|
||||||
const elasticUrl = process.env.ELASTIC_URL
|
|
||||||
if (elasticUrl === undefined) {
|
|
||||||
console.error('please provide elastic url')
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
const storageConfig: StorageConfiguration = storageConfigFromEnv()
|
const storageConfig: StorageConfiguration = storageConfigFromEnv()
|
||||||
const storageAdapter = buildStorageFromConfig(storageConfig)
|
const storageAdapter = buildStorageFromConfig(storageConfig)
|
||||||
|
|
||||||
@ -120,7 +114,6 @@ export function startFront (ctx: MeasureContext, extraConfig?: Record<string, st
|
|||||||
const disableSignUp = process.env.DISABLE_SIGNUP
|
const disableSignUp = process.env.DISABLE_SIGNUP
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
elasticUrl,
|
|
||||||
storageAdapter,
|
storageAdapter,
|
||||||
accountsUrl,
|
accountsUrl,
|
||||||
uploadUrl,
|
uploadUrl,
|
||||||
|
@ -49,17 +49,20 @@ export class QueryJoiner {
|
|||||||
): Promise<FindResult<T>> {
|
): Promise<FindResult<T>> {
|
||||||
// Will find a query or add + 1 to callbacks
|
// Will find a query or add + 1 to callbacks
|
||||||
const q = this.findQuery(_class, query, options) ?? this.createQuery(_class, query, options)
|
const q = this.findQuery(_class, query, options) ?? this.createQuery(_class, query, options)
|
||||||
if (q.result === undefined) {
|
try {
|
||||||
q.result = this._findAll(ctx, _class, query, options)
|
if (q.result === undefined) {
|
||||||
}
|
q.result = this._findAll(ctx, _class, query, options)
|
||||||
if (q.result instanceof Promise) {
|
}
|
||||||
q.result = await q.result
|
if (q.result instanceof Promise) {
|
||||||
}
|
q.result = await q.result
|
||||||
q.callbacks--
|
}
|
||||||
|
|
||||||
this.removeFromQueue(q)
|
return q.result as FindResult<T>
|
||||||
|
} finally {
|
||||||
|
q.callbacks--
|
||||||
|
|
||||||
return q.result as FindResult<T>
|
this.removeFromQueue(q)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private findQuery<T extends Doc>(
|
private findQuery<T extends Doc>(
|
||||||
|
@ -576,21 +576,24 @@ abstract class PostgresAdapterBase implements DbAdapter {
|
|||||||
}
|
}
|
||||||
sqlChunks.push(`WHERE ${this.buildQuery(_class, domain, query, joins, options)}`)
|
sqlChunks.push(`WHERE ${this.buildQuery(_class, domain, query, joins, options)}`)
|
||||||
|
|
||||||
|
const totalSqlChunks = [...sqlChunks]
|
||||||
|
|
||||||
|
if (options?.sort !== undefined) {
|
||||||
|
sqlChunks.push(this.buildOrder(_class, domain, options.sort, joins))
|
||||||
|
}
|
||||||
|
if (options?.limit !== undefined) {
|
||||||
|
sqlChunks.push(`LIMIT ${options.limit}`)
|
||||||
|
}
|
||||||
|
|
||||||
return (await this.mgr.read(ctx.id, async (connection) => {
|
return (await this.mgr.read(ctx.id, async (connection) => {
|
||||||
let total = options?.total === true ? 0 : -1
|
let total = options?.total === true ? 0 : -1
|
||||||
if (options?.total === true) {
|
if (options?.total === true) {
|
||||||
const totalReq = `SELECT COUNT(${domain}._id) as count FROM ${domain}`
|
const totalReq = `SELECT COUNT(${domain}._id) as count FROM ${domain}`
|
||||||
const totalSql = [totalReq, ...sqlChunks].join(' ')
|
const totalSql = [totalReq, ...totalSqlChunks].join(' ')
|
||||||
const totalResult = await connection.unsafe(totalSql)
|
const totalResult = await connection.unsafe(totalSql)
|
||||||
const parsed = Number.parseInt(totalResult[0].count)
|
const parsed = Number.parseInt(totalResult[0].count)
|
||||||
total = Number.isNaN(parsed) ? 0 : parsed
|
total = Number.isNaN(parsed) ? 0 : parsed
|
||||||
}
|
}
|
||||||
if (options?.sort !== undefined) {
|
|
||||||
sqlChunks.push(this.buildOrder(_class, domain, options.sort, joins))
|
|
||||||
}
|
|
||||||
if (options?.limit !== undefined) {
|
|
||||||
sqlChunks.push(`LIMIT ${options.limit}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
const finalSql: string = [select, ...sqlChunks].join(' ')
|
const finalSql: string = [select, ...sqlChunks].join(' ')
|
||||||
fquery = finalSql
|
fquery = finalSql
|
||||||
|
@ -50,7 +50,7 @@ export async function withPostgres<T> (
|
|||||||
fn: (db: BlobDB) => Promise<T>
|
fn: (db: BlobDB) => Promise<T>
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
const sql = metrics.withSync('db.connect', () => {
|
const sql = metrics.withSync('db.connect', () => {
|
||||||
return postgres(env.DB_URL, {
|
return postgres(env.HYPERDRIVE.connectionString, {
|
||||||
connection: {
|
connection: {
|
||||||
application_name: 'datalake'
|
application_name: 'datalake'
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user