Status filters in table view (#693)

Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
Denis Bykhov
2021-12-21 10:36:50 +01:00
committed by GitHub
parent f5aa8249dc
commit cb011b50af
18 changed files with 766 additions and 490 deletions
+40 -23
View File
@@ -14,7 +14,19 @@
//
import type { Employee } from '@anticrm/contact'
import { AttachedDoc, Class, Client, Data, Doc, Interface, Mixin, Ref, Space, Timestamp, TxOperations } from '@anticrm/core'
import {
AttachedDoc,
Class,
Client,
Data,
Doc,
Interface,
Mixin,
Ref,
Space,
Timestamp,
TxOperations
} from '@anticrm/core'
import type { Asset, Plugin } from '@anticrm/platform'
import { plugin } from '@anticrm/platform'
import type { AnyComponent } from '@anticrm/ui'
@@ -80,8 +92,7 @@ export interface TodoItem extends AttachedDoc {
/**
* @public
*/
export interface SpaceWithStates extends Space {
}
export interface SpaceWithStates extends Space {}
/**
* @public
@@ -130,23 +141,23 @@ export interface Sequence extends Doc {
export interface StateTemplate extends AttachedDoc, State {}
/**
* @public
*/
* @public
*/
export interface DoneStateTemplate extends AttachedDoc, DoneState {}
/**
* @public
*/
* @public
*/
export interface WonStateTemplate extends DoneStateTemplate, WonState {}
/**
* @public
*/
* @public
*/
export interface LostStateTemplate extends DoneStateTemplate, LostState {}
/**
* @public
*/
* @public
*/
export interface KanbanTemplate extends Doc {
title: string
statesC: number
@@ -154,8 +165,8 @@ export interface KanbanTemplate extends Doc {
}
/**
* @public
*/
* @public
*/
export interface KanbanTemplateSpace extends Space {
icon: AnyComponent
}
@@ -195,7 +206,8 @@ const task = plugin(taskId, {
TodoItem: '' as Ref<Class<TodoItem>>
},
viewlet: {
Kanban: '' as Ref<ViewletDescriptor>
Kanban: '' as Ref<ViewletDescriptor>,
StatusTable: '' as Ref<ViewletDescriptor>
},
icon: {
Task: '' as Asset,
@@ -288,7 +300,11 @@ export async function createProjectKanban (
/**
* @public
*/
export async function createKanban (client: Client & TxOperations, attachedTo: Ref<Space>, templateId?: Ref<KanbanTemplate>): Promise<Ref<Kanban>> {
export async function createKanban (
client: Client & TxOperations,
attachedTo: Ref<Space>,
templateId?: Ref<KanbanTemplate>
): Promise<Ref<Kanban>> {
if (templateId === undefined) {
const ranks = [...genRanks(2)]
await Promise.all([
@@ -314,14 +330,15 @@ export async function createKanban (client: Client & TxOperations, attachedTo: R
const tmplStates = await client.findAll(task.class.StateTemplate, { attachedTo: template._id })
await Promise.all(
tmplStates.map(async (state) => await client.createDoc(
task.class.State,
attachedTo,
{
color: state.color,
title: state.title,
rank: state.rank
})))
tmplStates.map(
async (state) =>
await client.createDoc(task.class.State, attachedTo, {
color: state.color,
title: state.title,
rank: state.rank
})
)
)
const doneClassMap = new Map<Ref<Class<DoneStateTemplate>>, Ref<Class<DoneState>>>([
[task.class.WonStateTemplate, task.class.WonState],