Fix applications view (#2537)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2023-01-25 00:35:42 +07:00
committed by GitHub
parent e8d5739847
commit cdfb8d8e95
4 changed files with 45 additions and 14 deletions
@@ -14,7 +14,7 @@
// limitations under the License.
-->
<script lang="ts">
import { Class, DocumentQuery, FindOptions, Ref, SortingOrder } from '@hcengineering/core'
import { Class, DocumentQuery, FindOptions, Ref, SortingOrder, Space } from '@hcengineering/core'
import { createQuery, getClient } from '@hcengineering/presentation'
import { DoneState, SpaceWithStates, State, Task } from '@hcengineering/task'
import { TabList } from '@hcengineering/ui'
@@ -54,9 +54,11 @@
const doneStateQuery = createQuery()
doneStateQuery.query(
task.class.DoneState,
{
space
},
space != null
? {
space
}
: {},
(res) => {
doneStates = res
itemsDS = doneStates.map((s) => {
@@ -79,10 +81,16 @@
const client = getClient()
async function updateQuery (query: DocumentQuery<Task>, selectedDoneStates: Set<Ref<DoneState>>): Promise<void> {
async function updateQuery (
query: DocumentQuery<Task>,
selectedDoneStates: Set<Ref<DoneState>>,
space?: Ref<Space>
): Promise<void> {
resConfig = updateConfig(config)
const result = client.getHierarchy().clone(query)
result.space = space
if (result.space) {
result.space = space
}
if (state) {
result.state = state
}
@@ -107,17 +115,17 @@
selectedDS = ['NoDoneState']
withoutDone = true
}
updateQuery(query, selectedDoneStates)
updateQuery(query, selectedDoneStates, space)
}
function noDoneClick (): void {
withoutDone = true
selectedDS = ['NoDoneState']
selectedDoneStates.clear()
updateQuery(query, selectedDoneStates)
updateQuery(query, selectedDoneStates, space)
}
$: updateQuery(query, selectedDoneStates)
$: updateQuery(query, selectedDoneStates, space)
const handleSelect = (result: any) => {
if (result.type === 'select') {
const res = result.detail
@@ -126,12 +134,12 @@
state = undefined
withoutDone = false
selectedDoneStates.clear()
updateQuery(query, selectedDoneStates)
updateQuery(query, selectedDoneStates, space)
} else if (res.id === 'DoneStates') {
doneStatusesView = true
state = undefined
selectedDoneStates.clear()
updateQuery(query, selectedDoneStates)
updateQuery(query, selectedDoneStates, space)
}
}
}
@@ -157,7 +165,7 @@
{#if doneStatusesView}
<TabList items={itemsDS} bind:selected={selectedDS} multiselect on:select={handleDoneSelect} size={'small'} />
{:else}
<StatesBar bind:state {space} gap={'none'} on:change={() => updateQuery(query, selectedDoneStates)} />
<StatesBar bind:state {space} gap={'none'} on:change={() => updateQuery(query, selectedDoneStates, space)} />
{/if}
</div>
<div class="statustableview-container">