Fix workspace create

Fix workspace create

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2021-12-03 12:49:00 +07:00
parent 15ec138a80
commit 13d8b6195b
No known key found for this signature in database
GPG Key ID: BD80F68D68D8F7F2
7 changed files with 48 additions and 45 deletions

View File

@ -35,7 +35,6 @@
"@anticrm/model-workbench": "~0.6.1",
"@anticrm/model-contact": "~0.6.1",
"@anticrm/task": "~0.6.0",
"@anticrm/task-resources": "~0.6.0",
"@anticrm/model-chunter": "~0.6.0",
"@anticrm/workbench": "~0.6.1"
}

View File

@ -23,7 +23,7 @@ import view from '@anticrm/model-view'
import workbench from '@anticrm/model-workbench'
import type { IntlString } from '@anticrm/platform'
import type { Project, Task } from '@anticrm/task'
import { createProjectKanban } from '@anticrm/task-resources'
import { createProjectKanban } from '@anticrm/task'
import task from './plugin'
@Model(task.class.Project, core.class.SpaceWithStates)

View File

@ -19,7 +19,7 @@
import { EditBox, Grid, IconFolder, ToggleWithLabel } from '@anticrm/ui'
import { createEventDispatcher } from 'svelte'
import task from '../plugin'
import { createProjectKanban } from '../utils'
import { createProjectKanban } from '@anticrm/task'
const dispatch = createEventDispatcher()

View File

@ -21,8 +21,6 @@ import CreateProject from './components/CreateProject.svelte'
import TaskPresenter from './components/TaskPresenter.svelte'
import KanbanCard from './components/KanbanCard.svelte'
export { createProjectKanban } from './utils'
export default async (): Promise<Resources> => ({
component: {
CreateTask,

View File

@ -43,41 +43,3 @@ export async function uploadFile (space: Ref<Space>, file: File, attachedTo: Ref
console.log(uuid)
return uuid
}
export async function createProjectKanban (
projectId: Ref<Project>,
factory: <T extends Doc>(_class: Ref<Class<T>>, space: Ref<Space>, data: Data<T>, id: Ref<T>) => Promise<void>
): Promise<void> {
const states = [
{ color: '#7C6FCD', name: 'Open' },
{ color: '#6F7BC5', name: 'In Progress' },
{ color: '#77C07B', name: 'Under review' },
{ color: '#A5D179', name: 'Done' },
{ color: '#F28469', name: 'Invalid' }
]
const ids: Array<Ref<State>> = []
for (const st of states) {
const sid = (projectId + '.state.' + st.name.toLowerCase().replace(' ', '_')) as Ref<State>
await factory(
core.class.State,
projectId,
{
title: st.name,
color: st.color
},
sid
)
ids.push(sid)
}
await factory(
view.class.Kanban,
projectId,
{
attachedTo: projectId,
states: ids,
order: []
},
(projectId + '.kanban.') as Ref<Kanban>
)
}

View File

@ -28,6 +28,7 @@
"dependencies": {
"@anticrm/platform": "~0.6.5",
"@anticrm/core": "~0.6.11",
"@anticrm/contact": "~0.6.2"
"@anticrm/contact": "~0.6.2",
"@anticrm/view": "~0.6.0"
}
}

View File

@ -14,9 +14,11 @@
//
import type { Employee } from '@anticrm/contact'
import type { Class, Doc, Ref, Space } from '@anticrm/core'
import type { Class, Data, Doc, Ref, Space, State } from '@anticrm/core'
import type { Asset, Plugin } from '@anticrm/platform'
import { plugin } from '@anticrm/platform'
import core from '@anticrm/core'
import view, { Kanban } from '@anticrm/view'
/**
* @public
@ -52,3 +54,44 @@ export default plugin(taskId, {
Task: '' as Asset
}
})
/**
* @public
*/
export async function createProjectKanban (
projectId: Ref<Project>,
factory: <T extends Doc>(_class: Ref<Class<T>>, space: Ref<Space>, data: Data<T>, id: Ref<T>) => Promise<void>
): Promise<void> {
const states = [
{ color: '#7C6FCD', name: 'Open' },
{ color: '#6F7BC5', name: 'In Progress' },
{ color: '#77C07B', name: 'Under review' },
{ color: '#A5D179', name: 'Done' },
{ color: '#F28469', name: 'Invalid' }
]
const ids: Array<Ref<State>> = []
for (const st of states) {
const sid = (projectId + '.state.' + st.name.toLowerCase().replace(' ', '_')) as Ref<State>
await factory(
core.class.State,
projectId,
{
title: st.name,
color: st.color
},
sid
)
ids.push(sid)
}
await factory(
view.class.Kanban,
projectId,
{
attachedTo: projectId,
states: ids,
order: []
},
(projectId + '.kanban.') as Ref<Kanban>
)
}