Separate Board Kanban view (#1318)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-04-07 17:31:30 +07:00 committed by GitHub
parent 30976696f9
commit a53277f7aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 72 additions and 3 deletions

View File

@ -146,7 +146,7 @@ export function createModel (builder: Builder): void {
builder.createDoc(view.class.Viewlet, core.space.Model, {
attachTo: board.class.Card,
descriptor: task.viewlet.Kanban,
descriptor: board.viewlet.Kanban,
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
options: {
lookup: {}
@ -176,6 +176,17 @@ export function createModel (builder: Builder): void {
},
board.space.BoardTemplates
)
builder.createDoc(
view.class.ViewletDescriptor,
core.space.Model,
{
label: task.string.Kanban,
icon: task.icon.Kanban,
component: board.component.KanbanView
},
board.viewlet.Kanban
)
}
export { createDeps } from './creation'

View File

@ -20,6 +20,7 @@ import type { Ref, Space } from '@anticrm/core'
import { mergeIds } from '@anticrm/platform'
import { KanbanTemplate, Sequence } from '@anticrm/task'
import type { AnyComponent } from '@anticrm/ui'
import { ViewletDescriptor } from '@anticrm/view'
export default mergeIds(boardId, board, {
component: {
@ -28,7 +29,8 @@ export default mergeIds(boardId, board, {
KanbanCard: '' as AnyComponent,
CardPresenter: '' as AnyComponent,
TemplatesIcon: '' as AnyComponent,
Cards: '' as AnyComponent
Cards: '' as AnyComponent,
KanbanView: '' as AnyComponent
},
space: {
DefaultBoard: '' as Ref<Space>
@ -38,5 +40,8 @@ export default mergeIds(boardId, board, {
},
ids: {
Sequence: '' as Ref<Sequence>
},
viewlet: {
Kanban: '' as Ref<ViewletDescriptor>
}
})

View File

@ -37,6 +37,7 @@
"@anticrm/chunter-resources": "~0.6.0",
"@anticrm/contact": "~0.6.5",
"@anticrm/contact-resources": "~0.6.0",
"@anticrm/task-resources": "~0.6.0",
"@anticrm/core": "~0.6.16",
"@anticrm/notification": "~0.6.0",
"@anticrm/panel": "~0.6.0",

View File

@ -0,0 +1,48 @@
<!--
// 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.
-->
<script lang="ts">
import { Card } from '@anticrm/board'
import { Class, FindOptions, Ref, SortingOrder } from '@anticrm/core'
import { createQuery } from '@anticrm/presentation'
import type { Kanban, SpaceWithStates, State } from '@anticrm/task'
import task from '@anticrm/task'
import { Kanban as KanbanUI } from '@anticrm/task-resources'
export let _class: Ref<Class<Card>>
export let space: Ref<SpaceWithStates>
export let search: string
export let options: FindOptions<Card> | undefined
let kanban: Kanban
let states: State[] = []
const kanbanQuery = createQuery()
$: kanbanQuery.query(task.class.Kanban, { attachedTo: space }, result => { kanban = result[0] })
const statesQuery = createQuery()
$: if (kanban !== undefined) {
statesQuery.query(task.class.State, { space: kanban.space }, result => { states = result }, {
sort: {
rank: SortingOrder.Ascending
}
})
}
</script>
<KanbanUI {_class} {space} {search} {options} stateQuery={{ doneState: null }} states={states}>
// eslint-disable-next-line no-undef
</KanbanUI>

View File

@ -21,6 +21,7 @@ import CreateCard from './components/CreateCard.svelte'
import EditCard from './components/EditCard.svelte'
import KanbanCard from './components/KanbanCard.svelte'
import TemplatesIcon from './components/TemplatesIcon.svelte'
import KanbanView from './components/KanbanView.svelte'
export default async (): Promise<Resources> => ({
component: {
@ -29,6 +30,7 @@ export default async (): Promise<Resources> => ({
EditCard,
KanbanCard,
CardPresenter,
TemplatesIcon
TemplatesIcon,
KanbanView
}
})

View File

@ -43,6 +43,8 @@ import TodoStatePresenter from './components/todos/TodoStatePresenter.svelte'
import AssignedTasks from './components/AssignedTasks.svelte'
import task from './plugin'
export { default as Kanban } from './components/kanban/Kanban.svelte'
async function createTask (object: Doc): Promise<void> {
showPopup(CreateTask, { parent: object._id, space: object.space })
}