diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index 659ed03155..0965ccfcdb 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -209,6 +209,32 @@ export function createModel (builder: Builder): void { config: ['$lookup.attachedTo', '$lookup.state', '$lookup.attachedTo.city', '$lookup.attachedTo.channels'] }) + builder.createDoc(view.class.Viewlet, core.space.Model, { + attachTo: recruit.class.Applicant, + descriptor: task.viewlet.StatusTable, + open: contact.component.EditContact, + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + options: { + lookup: { + attachedTo: recruit.class.Candidate, + state: task.class.State, + assignee: contact.class.Employee, + doneState: task.class.DoneState + } + } as FindOptions, // TODO: fix + config: [ + '', + '$lookup.attachedTo', + '$lookup.assignee', + '$lookup.state', + '$lookup.doneState', + { presenter: attachment.component.AttachmentsPresenter, label: 'Files', sortingKey: 'attachments' }, + { presenter: chunter.component.CommentsPresenter, label: 'Comments', sortingKey: 'comments' }, + 'modifiedOn', + '$lookup.attachedTo.channels' + ] + }) + builder.mixin(recruit.class.Applicant, core.class.Class, task.mixin.KanbanCard, { card: recruit.component.KanbanCard }) diff --git a/models/task/src/index.ts b/models/task/src/index.ts index 5dfd9bdd2e..193d5d86cb 100644 --- a/models/task/src/index.ts +++ b/models/task/src/index.ts @@ -55,7 +55,7 @@ export const DOMAIN_TASK = 'task' as Domain export const DOMAIN_STATE = 'state' as Domain export const DOMAIN_KANBAN = 'kanban' as Domain @Model(task.class.State, core.class.Doc, DOMAIN_STATE, [task.interface.DocWithRank]) -@UX('State' as IntlString, undefined, undefined, 'title') +@UX('State' as IntlString, undefined, undefined, 'rank') export class TState extends TDoc implements State { @Prop(TypeString(), 'Title' as IntlString) title!: string @@ -246,6 +246,17 @@ export function createModel (builder: Builder): void { } }) + builder.createDoc( + view.class.ViewletDescriptor, + core.space.Model, + { + label: 'Status' as IntlString, + icon: task.icon.Status, + component: task.component.StatusTableView + }, + task.viewlet.StatusTable + ) + builder.createDoc( workbench.class.Application, core.space.Model, diff --git a/models/task/src/plugin.ts b/models/task/src/plugin.ts index 71585bfe44..03487e5895 100644 --- a/models/task/src/plugin.ts +++ b/models/task/src/plugin.ts @@ -56,7 +56,8 @@ export default mergeIds(taskId, task, { StateEditor: '' as AnyComponent, KanbanView: '' as AnyComponent, Todos: '' as AnyComponent, - TodoItemPresenter: '' as AnyComponent + TodoItemPresenter: '' as AnyComponent, + StatusTableView: '' as AnyComponent }, string: { Task: '' as IntlString, diff --git a/packages/theme/styles/_colors.scss b/packages/theme/styles/_colors.scss index 2864c569ef..1f100a6aa6 100644 --- a/packages/theme/styles/_colors.scss +++ b/packages/theme/styles/_colors.scss @@ -45,8 +45,6 @@ --primary-color-skyblue: #93CAF3; --primary-color-pink: #FA8DA1; - --dark-turquoise-01: #45AEA3; - --highlight-red: #F96E50; } diff --git a/packages/ui/src/components/StatusesBar.svelte b/packages/ui/src/components/StatusesBar.svelte deleted file mode 100644 index 659c763c6e..0000000000 --- a/packages/ui/src/components/StatusesBar.svelte +++ /dev/null @@ -1,104 +0,0 @@ - - - - -
- {#each items as item, i} -
{ if (item !== selected) selectItem(ev, item) }} - > - -
-
- -
- {/each} -
- - diff --git a/packages/ui/src/components/StatusesBarElement.svelte b/packages/ui/src/components/StatusesBarElement.svelte deleted file mode 100644 index f4e2221287..0000000000 --- a/packages/ui/src/components/StatusesBarElement.svelte +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - {#if side === 'left' && kind === 'arrow'} - - - {:else if side === 'left' && kind === 'round'} - - - {:else if side === 'right' && kind === 'arrow'} - - - {:else if side === 'right' && kind === 'round'} - - - {:else} - - {/if} - - - diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts index 8bfc0efd7b..b08e966816 100644 --- a/packages/ui/src/index.ts +++ b/packages/ui/src/index.ts @@ -62,7 +62,6 @@ export { default as TimeSince } from './components/TimeSince.svelte' export { default as Dropdown } from './components/Dropdown.svelte' export { default as DumbDropdown } from './components/DumbDropdown.svelte' export { default as ShowMore } from './components/ShowMore.svelte' -export { default as StatusesBar } from './components/StatusesBar.svelte' export { default as IconAdd } from './components/icons/Add.svelte' export { default as IconClose } from './components/icons/Close.svelte' diff --git a/plugins/task-resources/src/components/StatusTableView.svelte b/plugins/task-resources/src/components/StatusTableView.svelte new file mode 100644 index 0000000000..209ddb2fe9 --- /dev/null +++ b/plugins/task-resources/src/components/StatusTableView.svelte @@ -0,0 +1,209 @@ + + + +
+
+
+
{ + doneStatusesView = false + state = undefined + selectedDoneStates.clear() + updateQuery() + }} + > +
+
{ + doneStatusesView = true + state = undefined + selectedDoneStates.clear() + updateQuery() + }} + > +
+
+
+ {#if doneStatusesView} + {#each doneStates as state} +
{ + doneStateClick(state._id) + }} + > + {#if state._class === task.class.WonState} + + {:else} + + {/if} + + {state.title} + +
+ {/each} + {:else} + + {/if} +
+
+
+ + + + + + + diff --git a/plugins/task-resources/src/components/icons/Lost.svelte b/plugins/task-resources/src/components/icons/Lost.svelte new file mode 100644 index 0000000000..e1330d70c4 --- /dev/null +++ b/plugins/task-resources/src/components/icons/Lost.svelte @@ -0,0 +1,24 @@ + + + + + + + diff --git a/plugins/task-resources/src/components/icons/Won.svelte b/plugins/task-resources/src/components/icons/Won.svelte new file mode 100644 index 0000000000..a314eac348 --- /dev/null +++ b/plugins/task-resources/src/components/icons/Won.svelte @@ -0,0 +1,27 @@ + + + + + + diff --git a/plugins/task-resources/src/components/state/StatesBar.svelte b/plugins/task-resources/src/components/state/StatesBar.svelte new file mode 100644 index 0000000000..d6b25196fe --- /dev/null +++ b/plugins/task-resources/src/components/state/StatesBar.svelte @@ -0,0 +1,155 @@ + + + +
+ {#each states as item, i} +
{ + selectItem(ev, item) + }} + > + +
+ {item.title} +
+ +
+ {/each} +
+ + diff --git a/plugins/task-resources/src/components/state/StatesBarElement.svelte b/plugins/task-resources/src/components/state/StatesBarElement.svelte new file mode 100644 index 0000000000..50e4ed41db --- /dev/null +++ b/plugins/task-resources/src/components/state/StatesBarElement.svelte @@ -0,0 +1,67 @@ + + + + + {#if side === 'left' && kind === 'arrow'} + + + {:else if side === 'left' && kind === 'round'} + + + {:else if side === 'right' && kind === 'arrow'} + + + {:else if side === 'right' && kind === 'round'} + + + {:else} + + {/if} + + + diff --git a/plugins/task-resources/src/components/state/StatesPopup.svelte b/plugins/task-resources/src/components/state/StatesPopup.svelte index 607b3ea7b0..f4e7709df1 100644 --- a/plugins/task-resources/src/components/state/StatesPopup.svelte +++ b/plugins/task-resources/src/components/state/StatesPopup.svelte @@ -13,9 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. --> -
{#each states as state} -
{ dispatch('close', state) }}> -
+
{ + dispatch('close', state) + }} + > +
{state.title}
{/each} @@ -39,28 +53,30 @@ \ No newline at end of file + diff --git a/plugins/task-resources/src/index.ts b/plugins/task-resources/src/index.ts index 9e897206f6..15f1cb0a3a 100644 --- a/plugins/task-resources/src/index.ts +++ b/plugins/task-resources/src/index.ts @@ -35,6 +35,7 @@ import { SpaceWithStates, TodoItem } from '@anticrm/task' import Todos from './components/todos/Todos.svelte' import TodoItemPresenter from './components/todos/TodoItemPresenter.svelte' import TodoStatePresenter from './components/todos/TodoStatePresenter.svelte' +import StatusTableView from './components/StatusTableView.svelte' export { default as KanbanTemplateEditor } from './components/kanban/KanbanTemplateEditor.svelte' export { default as KanbanTemplateSelector } from './components/kanban/KanbanTemplateSelector.svelte' @@ -57,7 +58,8 @@ async function toggleDone (value: boolean, object: TodoItem): Promise { object._id, object.attachedTo, object.attachedToClass, - object.collection, { + object.collection, + { done: value } ) @@ -119,7 +121,8 @@ export default async (): Promise => ({ DoneStatePresenter, Todos, TodoItemPresenter, - TodoStatePresenter + TodoStatePresenter, + StatusTableView }, actionImpl: { CreateTask: createTask, diff --git a/plugins/task/src/index.ts b/plugins/task/src/index.ts index aa3c3043ba..2741ef06c9 100644 --- a/plugins/task/src/index.ts +++ b/plugins/task/src/index.ts @@ -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> }, viewlet: { - Kanban: '' as Ref + Kanban: '' as Ref, + StatusTable: '' as Ref }, icon: { Task: '' as Asset, @@ -288,7 +300,11 @@ export async function createProjectKanban ( /** * @public */ -export async function createKanban (client: Client & TxOperations, attachedTo: Ref, templateId?: Ref): Promise> { +export async function createKanban ( + client: Client & TxOperations, + attachedTo: Ref, + templateId?: Ref +): Promise> { 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>>([ [task.class.WonStateTemplate, task.class.WonState], diff --git a/plugins/view-resources/src/components/Table.svelte b/plugins/view-resources/src/components/Table.svelte index eb68a10c3d..3b7f3f2926 100644 --- a/plugins/view-resources/src/components/Table.svelte +++ b/plugins/view-resources/src/components/Table.svelte @@ -13,12 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. --> - + {#await buildModel({ client, _class, keys: config, options })} - + {:then model} -
+
- {#each model as attribute} - + {/if} + {#each objects as object, row (object._id)} - + {#each model as attribute, cell} {#if !cell} - + {#if enableChecking} + + {/if} + {:else} - + {/if} {/each} @@ -117,7 +182,9 @@ {/await} diff --git a/plugins/view-resources/src/components/TableView.svelte b/plugins/view-resources/src/components/TableView.svelte index 21917c53e6..9574d12d47 100644 --- a/plugins/view-resources/src/components/TableView.svelte +++ b/plugins/view-resources/src/components/TableView.svelte @@ -13,15 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. --> - -{#await buildModel({ client, _class, keys: config, options })} - -{:then model} -
- -
changeSorting(attribute.sortingKey)}> + {#each model as attribute, cellHead} + {#if enableChecking && !cellHead} + +
0}> + { + objects.map((o) => check(o._id, e)) + }} + /> +
+
changeSorting(attribute.sortingKey)} + >
-
- - -
+
+ { + check(object._id, e) + }} + /> +
+
+ + +
- - - {#each model as attribute, cellHead} - {#if !cellHead} - - {/if} - - {/each} - - - {#if objects} - - {#each objects as object, row (object._id)} - - {#each model as attribute, cell} - {#if !cell} - - - {:else} - - {/if} - {/each} - - {/each} - - {/if} -
-
0}> - { - objects.map((o) => check(o._id, e)) - }} - /> -
-
changeSorting(attribute.sortingKey)} - > -
-
-
- { - check(object._id, e) - }} - /> -
- - -
-
-
-{/await} +
+ + + + diff --git a/server/core/src/fulltext.ts b/server/core/src/fulltext.ts index ae7821474e..5d28315cb4 100644 --- a/server/core/src/fulltext.ts +++ b/server/core/src/fulltext.ts @@ -68,7 +68,8 @@ export class FullTextIndex extends TxProcessor implements Storage { options?: FindOptions ): Promise> { console.log('search', query) - const docs = await this.adapter.search(query) + const { _id, $search, ...mainQuery } = query + const docs = await this.adapter.search($search) console.log(docs) const ids: Ref[] = [] for (const doc of docs) { @@ -77,7 +78,7 @@ export class FullTextIndex extends TxProcessor implements Storage { ids.push(doc.attachedTo) } } - return await this.dbStorage.findAll(_class, { _id: { $in: ids as any } }, options) // TODO: remove `as any` + return await this.dbStorage.findAll(_class, { _id: { $in: ids as any }, ...mainQuery }, options) // TODO: remove `as any` } private getFullTextAttributes (clazz: Ref>): AnyAttribute[] | undefined {