mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-22 16:27:22 +00:00
Fix workspace create
Fix workspace create Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
15ec138a80
commit
13d8b6195b
@ -35,7 +35,6 @@
|
|||||||
"@anticrm/model-workbench": "~0.6.1",
|
"@anticrm/model-workbench": "~0.6.1",
|
||||||
"@anticrm/model-contact": "~0.6.1",
|
"@anticrm/model-contact": "~0.6.1",
|
||||||
"@anticrm/task": "~0.6.0",
|
"@anticrm/task": "~0.6.0",
|
||||||
"@anticrm/task-resources": "~0.6.0",
|
|
||||||
"@anticrm/model-chunter": "~0.6.0",
|
"@anticrm/model-chunter": "~0.6.0",
|
||||||
"@anticrm/workbench": "~0.6.1"
|
"@anticrm/workbench": "~0.6.1"
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ import view from '@anticrm/model-view'
|
|||||||
import workbench from '@anticrm/model-workbench'
|
import workbench from '@anticrm/model-workbench'
|
||||||
import type { IntlString } from '@anticrm/platform'
|
import type { IntlString } from '@anticrm/platform'
|
||||||
import type { Project, Task } from '@anticrm/task'
|
import type { Project, Task } from '@anticrm/task'
|
||||||
import { createProjectKanban } from '@anticrm/task-resources'
|
import { createProjectKanban } from '@anticrm/task'
|
||||||
import task from './plugin'
|
import task from './plugin'
|
||||||
|
|
||||||
@Model(task.class.Project, core.class.SpaceWithStates)
|
@Model(task.class.Project, core.class.SpaceWithStates)
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
import { EditBox, Grid, IconFolder, ToggleWithLabel } from '@anticrm/ui'
|
import { EditBox, Grid, IconFolder, ToggleWithLabel } from '@anticrm/ui'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
import task from '../plugin'
|
import task from '../plugin'
|
||||||
import { createProjectKanban } from '../utils'
|
import { createProjectKanban } from '@anticrm/task'
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
|
@ -21,8 +21,6 @@ import CreateProject from './components/CreateProject.svelte'
|
|||||||
import TaskPresenter from './components/TaskPresenter.svelte'
|
import TaskPresenter from './components/TaskPresenter.svelte'
|
||||||
import KanbanCard from './components/KanbanCard.svelte'
|
import KanbanCard from './components/KanbanCard.svelte'
|
||||||
|
|
||||||
export { createProjectKanban } from './utils'
|
|
||||||
|
|
||||||
export default async (): Promise<Resources> => ({
|
export default async (): Promise<Resources> => ({
|
||||||
component: {
|
component: {
|
||||||
CreateTask,
|
CreateTask,
|
||||||
|
@ -43,41 +43,3 @@ export async function uploadFile (space: Ref<Space>, file: File, attachedTo: Ref
|
|||||||
console.log(uuid)
|
console.log(uuid)
|
||||||
return 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>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@anticrm/platform": "~0.6.5",
|
"@anticrm/platform": "~0.6.5",
|
||||||
"@anticrm/core": "~0.6.11",
|
"@anticrm/core": "~0.6.11",
|
||||||
"@anticrm/contact": "~0.6.2"
|
"@anticrm/contact": "~0.6.2",
|
||||||
|
"@anticrm/view": "~0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,11 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import type { Employee } from '@anticrm/contact'
|
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 type { Asset, Plugin } from '@anticrm/platform'
|
||||||
import { plugin } from '@anticrm/platform'
|
import { plugin } from '@anticrm/platform'
|
||||||
|
import core from '@anticrm/core'
|
||||||
|
import view, { Kanban } from '@anticrm/view'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -52,3 +54,44 @@ export default plugin(taskId, {
|
|||||||
Task: '' as Asset
|
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>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user