mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 12:25:17 +00:00
allow adding columns to table in MyApplications (#3286)
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
parent
5bb826a15b
commit
9e0a69d8be
@ -18,7 +18,15 @@
|
|||||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||||
import tags, { selectedTagElements, TagCategory, TagElement } from '@hcengineering/tags'
|
import tags, { selectedTagElements, TagCategory, TagElement } from '@hcengineering/tags'
|
||||||
import { DoneState, Task } from '@hcengineering/task'
|
import { DoneState, Task } from '@hcengineering/task'
|
||||||
import { Component, IModeSelector, Label, resolvedLocationStore, SearchEdit, ModeSelector } from '@hcengineering/ui'
|
import {
|
||||||
|
Component,
|
||||||
|
IModeSelector,
|
||||||
|
Label,
|
||||||
|
resolvedLocationStore,
|
||||||
|
SearchEdit,
|
||||||
|
ModeSelector,
|
||||||
|
Loading
|
||||||
|
} from '@hcengineering/ui'
|
||||||
import {
|
import {
|
||||||
activeViewlet,
|
activeViewlet,
|
||||||
FilterButton,
|
FilterButton,
|
||||||
@ -31,7 +39,7 @@
|
|||||||
import task from '../plugin'
|
import task from '../plugin'
|
||||||
import { IntlString } from '@hcengineering/platform'
|
import { IntlString } from '@hcengineering/platform'
|
||||||
import ViewletSettingButton from '@hcengineering/view-resources/src/components/ViewletSettingButton.svelte'
|
import ViewletSettingButton from '@hcengineering/view-resources/src/components/ViewletSettingButton.svelte'
|
||||||
import view, { Viewlet } from '@hcengineering/view'
|
import view, { Viewlet, ViewletPreference } from '@hcengineering/view'
|
||||||
import { onDestroy } from 'svelte'
|
import { onDestroy } from 'svelte'
|
||||||
import FilterBar from '@hcengineering/view-resources/src/components/filter/FilterBar.svelte'
|
import FilterBar from '@hcengineering/view-resources/src/components/filter/FilterBar.svelte'
|
||||||
|
|
||||||
@ -58,6 +66,8 @@
|
|||||||
const client = getClient()
|
const client = getClient()
|
||||||
|
|
||||||
let category: Ref<TagCategory> | undefined = undefined
|
let category: Ref<TagCategory> | undefined = undefined
|
||||||
|
let loading = true
|
||||||
|
let preference: ViewletPreference | undefined
|
||||||
|
|
||||||
let documentIds: Ref<Task>[] = []
|
let documentIds: Ref<Task>[] = []
|
||||||
function updateResultQuery (search: string, documentIds: Ref<Task>[], doneStates: DoneState[]): void {
|
function updateResultQuery (search: string, documentIds: Ref<Task>[], doneStates: DoneState[]): void {
|
||||||
@ -129,10 +139,20 @@
|
|||||||
$: viewlet = viewlets && updateActiveViewlet(viewlets, active)
|
$: viewlet = viewlets && updateActiveViewlet(viewlets, active)
|
||||||
$: active = $activeViewlet[key]
|
$: active = $activeViewlet[key]
|
||||||
const viewletQuery = createQuery()
|
const viewletQuery = createQuery()
|
||||||
viewletQuery.query(view.class.Viewlet, { attachTo: _class }, (res) => (viewlets = res), {
|
const preferenceQuery = createQuery()
|
||||||
lookup: {
|
viewletQuery.query(view.class.Viewlet, { attachTo: _class, descriptor: task.viewlet.StatusTable }, (res) => {
|
||||||
descriptor: view.class.ViewletDescriptor
|
viewlets = res
|
||||||
}
|
preferenceQuery.query(
|
||||||
|
view.class.ViewletPreference,
|
||||||
|
{
|
||||||
|
attachedTo: res[0]._id
|
||||||
|
},
|
||||||
|
(pref) => {
|
||||||
|
preference = pref[0]
|
||||||
|
loading = false
|
||||||
|
},
|
||||||
|
{ limit: 1 }
|
||||||
|
)
|
||||||
})
|
})
|
||||||
$: viewOptions = getViewOptions(viewlet, $viewOptionStore)
|
$: viewOptions = getViewOptions(viewlet, $viewOptionStore)
|
||||||
|
|
||||||
@ -174,9 +194,16 @@
|
|||||||
|
|
||||||
<Component is={tags.component.TagsCategoryBar} props={{ targetClass: _class, category }} on:change={handleChange} />
|
<Component is={tags.component.TagsCategoryBar} props={{ targetClass: _class, category }} on:change={handleChange} />
|
||||||
|
|
||||||
<TableBrowser
|
{#if viewlet}
|
||||||
{_class}
|
{#if loading}
|
||||||
config={['', 'attachedTo', 'assignee', 'state', 'doneState', 'attachments', 'comments', 'modifiedOn']}
|
<Loading />
|
||||||
query={resultQuery}
|
{:else}
|
||||||
showNotification
|
<TableBrowser
|
||||||
/>
|
{_class}
|
||||||
|
config={preference?.config ?? viewlet.config}
|
||||||
|
options={viewlet.options}
|
||||||
|
query={resultQuery}
|
||||||
|
showNotification
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
Loading…
Reference in New Issue
Block a user