mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-23 18:15:03 +02:00
@@ -0,0 +1,41 @@
|
||||
<!--
|
||||
// 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 type { Ref, Space, State } from '@anticrm/core'
|
||||
import { Dialog } from '@anticrm/ui'
|
||||
import { createQuery } from '@anticrm/presentation'
|
||||
|
||||
import core from '@anticrm/core'
|
||||
|
||||
export let _id: Ref<Space>
|
||||
|
||||
let states: State[] = []
|
||||
|
||||
const query = createQuery()
|
||||
$: query.query(core.class.State, { machine: _id }, result => { states = result })
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<Dialog label="Edit Statuses">
|
||||
|
||||
{#each states as state}
|
||||
<div>{state.title}</div>
|
||||
{/each}
|
||||
</Dialog>
|
||||
@@ -16,12 +16,11 @@
|
||||
<script lang="ts">
|
||||
import { onDestroy } from 'svelte'
|
||||
|
||||
import type { Asset } from '@anticrm/platform'
|
||||
import type { Ref, Space } from '@anticrm/core'
|
||||
import type { Asset, IntlString } from '@anticrm/platform'
|
||||
import type { Ref, Space, Doc } from '@anticrm/core'
|
||||
import type { SpacesNavModel } from '@anticrm/workbench'
|
||||
import { Action, navigate, getCurrentLocation, location } from '@anticrm/ui'
|
||||
import { Action, navigate, getCurrentLocation, location, IconAdd } from '@anticrm/ui'
|
||||
|
||||
import { IconAdd } from '@anticrm/ui'
|
||||
import { getClient, createQuery } from '@anticrm/presentation'
|
||||
import { showPopup } from '@anticrm/ui'
|
||||
|
||||
@@ -30,6 +29,8 @@
|
||||
import TreeNode from './TreeNode.svelte'
|
||||
import TreeItem from './TreeItem.svelte'
|
||||
|
||||
import EditStatuses from '../EditStatuses.svelte'
|
||||
|
||||
export let model: SpacesNavModel
|
||||
|
||||
const client = getClient()
|
||||
@@ -47,6 +48,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
const editStatuses: Action = {
|
||||
label: 'Edit Statuses' as IntlString,
|
||||
icon: IconAdd,
|
||||
action: async (_id: Ref<Doc>): Promise<void> => {
|
||||
showPopup(EditStatuses, { _id }, 'right')
|
||||
}
|
||||
}
|
||||
|
||||
function selectSpace(id: Ref<Space>) {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[2] = id
|
||||
@@ -62,7 +71,7 @@
|
||||
<div>
|
||||
<TreeNode label={model.label} actions={[addSpace]}>
|
||||
{#each spaces as space}
|
||||
<TreeItem title={space.name} icon={classIcon(client, space._class)} selected={selected === space._id} on:click={() => { selectSpace(space._id) }}/>
|
||||
<TreeItem _id={space._id} title={space.name} icon={classIcon(client, space._class)} selected={selected === space._id} actions={[editStatuses]} on:click={() => { selectSpace(space._id) }}/>
|
||||
{/each}
|
||||
</TreeNode>
|
||||
</div>
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
import Collapsed from '../icons/Collapsed.svelte'
|
||||
import Expanded from '../icons/Expanded.svelte'
|
||||
|
||||
import type { Asset, IntlString } from '@anticrm/status'
|
||||
import type { Asset, IntlString } from '@anticrm/platform'
|
||||
import type { Action } from '@anticrm/ui'
|
||||
import type { Ref, Space } from '@anticrm/core'
|
||||
import { Icon, Label, ActionIcon } from '@anticrm/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
|
||||
export let _id: Ref<Space> | undefined = undefined
|
||||
export let icon: Asset | undefined = undefined
|
||||
export let label: IntlString | undefined = undefined
|
||||
export let title: string | undefined = undefined
|
||||
@@ -52,7 +54,7 @@
|
||||
</span>
|
||||
{#each actions as action}
|
||||
<div class="tool">
|
||||
<ActionIcon label={action.label} icon={action.icon} size={'small'} action={action.action} />
|
||||
<ActionIcon label={action.label} icon={action.icon} size={'small'} action={() => { action.action(_id) }} />
|
||||
</div>
|
||||
{/each}
|
||||
{#if notifications > 0 && collapsed}
|
||||
|
||||
@@ -15,16 +15,20 @@
|
||||
|
||||
<script lang="ts">
|
||||
import TreeElement from './TreeElement.svelte'
|
||||
import type { Asset } from '@anticrm/status'
|
||||
import type { Asset } from '@anticrm/platform'
|
||||
import type { Ref, Space } from '@anticrm/core'
|
||||
import type { Action } from '@anticrm/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
|
||||
export let _id: Ref<Space>
|
||||
export let icon: Asset
|
||||
export let title: string
|
||||
export let notifications = 0
|
||||
export let actions: Action[] = []
|
||||
export let selected: boolean = false
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
</script>
|
||||
|
||||
<TreeElement {icon} {title} {notifications} {selected} collapsed on:click={() => {dispatch('click')}}/>
|
||||
<TreeElement {_id} {icon} {title} {notifications} {selected} {actions} collapsed on:click={() => {dispatch('click')}}/>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import type { IntlString } from '@anticrm/status'
|
||||
import type { IntlString } from '@anticrm/platform'
|
||||
import type { Action } from '@anticrm/ui'
|
||||
import TreeElement from './TreeElement.svelte'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user