From 444db6a5ca147ad5e1fd442af4e44dae819c4ab1 Mon Sep 17 00:00:00 2001 From: Andrey Platov Date: Fri, 17 Sep 2021 10:28:15 +0200 Subject: [PATCH] EditStatuses Signed-off-by: Andrey Platov --- models/core/src/security.ts | 6 ++- packages/core/src/classes.ts | 4 +- packages/ui/src/types.ts | 2 +- .../src/components/CreateVacancy.svelte | 17 ++++++-- .../src/components/KanbanView.svelte | 10 +---- .../src/components/StatePresenter.svelte | 5 +-- .../src/components/EditStatuses.svelte | 41 +++++++++++++++++++ .../src/components/navigator/SpacesNav.svelte | 19 ++++++--- .../components/navigator/TreeElement.svelte | 6 ++- .../src/components/navigator/TreeItem.svelte | 8 +++- .../src/components/navigator/TreeNode.svelte | 2 +- 11 files changed, 91 insertions(+), 29 deletions(-) create mode 100644 plugins/workbench-resources/src/components/EditStatuses.svelte diff --git a/models/core/src/security.ts b/models/core/src/security.ts index 98be63b0b9..7b9e6f848a 100644 --- a/models/core/src/security.ts +++ b/models/core/src/security.ts @@ -13,7 +13,7 @@ // limitations under the License. // -import type { Account, Arr, Ref, Space, Domain, UXObject } from '@anticrm/core' +import type { Account, Arr, Ref, Space, Domain, State } from '@anticrm/core' import { DOMAIN_MODEL } from '@anticrm/core' import { Model } from '@anticrm/model' import core from './component' @@ -37,6 +37,8 @@ export class TAccount extends TDoc implements Account { } @Model(core.class.State, core.class.Doc, DOMAIN_STATE) -export class TState extends TDoc implements UXObject { +export class TState extends TDoc implements State { machine!: Ref + title!: string + color!: string } diff --git a/packages/core/src/classes.ts b/packages/core/src/classes.ts index 26ad0d9ac2..e7870023b6 100644 --- a/packages/core/src/classes.ts +++ b/packages/core/src/classes.ts @@ -199,6 +199,8 @@ export interface Account extends Doc { /** * @public */ -export interface State extends Doc, UXObject { +export interface State extends Doc { machine: Ref + title: string + color: string } diff --git a/packages/ui/src/types.ts b/packages/ui/src/types.ts index 767f00a728..ebdf3dae33 100644 --- a/packages/ui/src/types.ts +++ b/packages/ui/src/types.ts @@ -33,7 +33,7 @@ export type AnyComponent = Resource export interface Action { label: IntlString icon: Asset | AnySvelteComponent - action: () => Promise + action: (props: any) => Promise } export interface IPopupItem { diff --git a/plugins/recruit-resources/src/components/CreateVacancy.svelte b/plugins/recruit-resources/src/components/CreateVacancy.svelte index 6dced5d429..9fc5d245f3 100644 --- a/plugins/recruit-resources/src/components/CreateVacancy.svelte +++ b/plugins/recruit-resources/src/components/CreateVacancy.svelte @@ -30,6 +30,14 @@ const client = getClient() + const colors = [ + '#7C6FCD', + '#6F7BC5', + '#A5D179', + '#77C07B', + '#F28469' + ] + async function createVacancy() { const id = await client.createDoc(recruit.class.Vacancy, core.space.Model, { name, @@ -39,15 +47,18 @@ }) await client.createDoc(core.class.State, id, { machine: id, - label: 'Initial' + title: 'Initial', + color: colors[0] }) await client.createDoc(core.class.State, id, { machine: id, - label: 'Interview' + title: 'Interview', + color: colors[1] }) await client.createDoc(core.class.State, id, { machine: id, - label: 'Final' + title: 'Final', + color: colors[2] }) } diff --git a/plugins/view-resources/src/components/KanbanView.svelte b/plugins/view-resources/src/components/KanbanView.svelte index a3ef6e1c95..4ff1edbc57 100644 --- a/plugins/view-resources/src/components/KanbanView.svelte +++ b/plugins/view-resources/src/components/KanbanView.svelte @@ -65,14 +65,6 @@ showPopup(open, { object, space }, 'float') } - const colors = [ - '#7C6FCD', - '#6F7BC5', - '#A5D179', - '#77C07B', - '#F28469' - ] - let dragCard: (Doc & { state: Ref}) | undefined async function cardPresenter(_class: Ref>): Promise { @@ -90,7 +82,7 @@
{#each states as state, i} - { event.preventDefault() }} diff --git a/plugins/view-resources/src/components/StatePresenter.svelte b/plugins/view-resources/src/components/StatePresenter.svelte index fdf0d7fa0e..aefd8201f1 100644 --- a/plugins/view-resources/src/components/StatePresenter.svelte +++ b/plugins/view-resources/src/components/StatePresenter.svelte @@ -19,11 +19,10 @@ export let value: State - const bgColor: string = '#7C6FCD' -
- {value.label} +
+ {value.title}