UBERF-8889: Fix test suite selection (#7454)
Some checks are pending
CI / test (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions

Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
Artyom Savchenko 2024-12-13 21:52:58 +07:00 committed by GitHub
parent c9bf99e07f
commit 5b1f0a6c35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 37 additions and 14 deletions

View File

@ -104,6 +104,7 @@
on:valid on:valid
on:validate on:validate
on:submit on:submit
on:select
> >
<slot /> <slot />
</svelte:component> </svelte:component>
@ -123,6 +124,7 @@
on:valid on:valid
on:validate on:validate
on:submit on:submit
on:select
/> />
{/if} {/if}
</ErrorBoundary> </ErrorBoundary>

View File

@ -77,12 +77,12 @@
titleKey: 'name', titleKey: 'name',
parentKey: 'parent', parentKey: 'parent',
noParentId: testManagement.ids.NoParent, noParentId: testManagement.ids.NoParent,
getFolderLink: testManagement.function.GetTestSuiteLink,
allObjectsLabel: testManagement.string.AllTestSuites, allObjectsLabel: testManagement.string.AllTestSuites,
allObjectsIcon: testManagement.icon.TestSuites, allObjectsIcon: testManagement.icon.TestSuites,
space space
}} }}
mainComponentProps={{ space }} mainComponentProps={{ space }}
syncWithLocationQuery={false}
{space} {space}
/> />
<svelte:fragment slot="footerRight"> <svelte:fragment slot="footerRight">

View File

@ -21,13 +21,18 @@
import testManagement from '../../plugin' import testManagement from '../../plugin'
export let baseQuery: DocumentQuery<Doc> = {} export let query: DocumentQuery<Doc> = {}
let testCases: number let testCases: number
const query = createQuery() const docQuery = createQuery()
$: query.query(testManagement.class.TestCase, baseQuery, (res) => { $: docQuery.query(
testCases = res.length testManagement.class.TestCase,
}) query,
(res) => {
testCases = res.length
},
{ total: true, limit: 1 }
)
let viewlet: Viewlet | undefined let viewlet: Viewlet | undefined
let preference: ViewletPreference | undefined let preference: ViewletPreference | undefined
@ -59,7 +64,7 @@
<TableBrowser <TableBrowser
_class={testManagement.class.TestCase} _class={testManagement.class.TestCase}
config={preference?.config ?? viewlet.config} config={preference?.config ?? viewlet.config}
query={baseQuery} {query}
loadingProps={{ length: testCases }} loadingProps={{ length: testCases }}
enableChecking={true} enableChecking={true}
readonly={true} readonly={true}

View File

@ -14,6 +14,8 @@
--> -->
<script lang="ts"> <script lang="ts">
import { createEventDispatcher } from 'svelte'
import { Class, Doc, DocumentQuery, Ref, SortingOrder } from '@hcengineering/core' import { Class, Doc, DocumentQuery, Ref, SortingOrder } from '@hcengineering/core'
import { createQuery, getClient } from '@hcengineering/presentation' import { createQuery, getClient } from '@hcengineering/presentation'
import { Action, IconEdit, navigate, type Location, Scroller, location, getLocation } from '@hcengineering/ui' import { Action, IconEdit, navigate, type Location, Scroller, location, getLocation } from '@hcengineering/ui'
@ -29,11 +31,13 @@
export let titleKey: string = 'title' export let titleKey: string = 'title'
export let parentKey: string = 'parent' export let parentKey: string = 'parent'
export let noParentId: Ref<Doc> export let noParentId: Ref<Doc>
export let getFolderLink: Resource<(doc: Ref<Doc> | undefined) => Location> export let getFolderLink: Resource<(doc: Ref<Doc> | undefined) => Location> | undefined
export let allObjectsIcon: Asset export let allObjectsIcon: Asset
export let allObjectsLabel: IntlString export let allObjectsLabel: IntlString
export let plainList: boolean = false export let plainList: boolean = false
const dispatch = createEventDispatcher()
const getFolderId = (): Ref<Doc> => { const getFolderId = (): Ref<Doc> => {
return (getLocation()?.query?.attachedTo as Ref<Doc>) ?? noParentId return (getLocation()?.query?.attachedTo as Ref<Doc>) ?? noParentId
} }
@ -77,8 +81,13 @@
) )
async function handleFolderSelected (_id: Ref<Doc>): Promise<void> { async function handleFolderSelected (_id: Ref<Doc>): Promise<void> {
const getFolderLinkFunction = await getResource(getFolderLink) if (getFolderLink !== undefined) {
navigate(getFolderLinkFunction(_id)) const getFolderLinkFunction = await getResource(getFolderLink)
navigate(getFolderLinkFunction(_id))
} else {
selected = _id
}
dispatch('select', _id)
} }
async function handleAllItemsSelected (): Promise<void> { async function handleAllItemsSelected (): Promise<void> {

View File

@ -53,25 +53,31 @@
export let mainComponent: AnyComponent | AnySvelteComponent export let mainComponent: AnyComponent | AnySvelteComponent
export let mainComponentProps = {} export let mainComponentProps = {}
export let showNavigator: boolean = false export let showNavigator: boolean = false
export let parentKey: string = 'attachedTo'
const FLOAT_LIMIT = 760 const FLOAT_LIMIT = 760
let container: HTMLDivElement let container: HTMLDivElement
let locationQuery: DocumentQuery<Doc> = {} let parentQuery: DocumentQuery<Doc> = {}
let resultQuery: DocumentQuery<Doc> = {} let resultQuery: DocumentQuery<Doc> = {}
let spaceQuery: DocumentQuery<Doc> = {} let spaceQuery: DocumentQuery<Doc> = {}
$: spaceQuery = space !== undefined ? { space } : {} $: spaceQuery = space !== undefined ? { space } : {}
$: resultQuery = mergeQueries(query, mergeQueries(spaceQuery, locationQuery)) ?? {} $: resultQuery = mergeQueries(query, mergeQueries(spaceQuery, parentQuery)) ?? {}
if (syncWithLocationQuery) { if (syncWithLocationQuery) {
locationQuery = getLocation()?.query as any parentQuery = getLocation()?.query as any
onDestroy( onDestroy(
resolvedLocationStore.subscribe((newLocation) => { resolvedLocationStore.subscribe((newLocation) => {
locationQuery = newLocation?.query ?? {} parentQuery = newLocation?.query ?? {}
}) })
) )
} }
function onSelected (e: CustomEvent<any>): void {
if (syncWithLocationQuery) return
parentQuery = { [parentKey]: e.detail }
}
function showCreateDialog (): void { function showCreateDialog (): void {
if (createComponent === undefined) return if (createComponent === undefined) return
showPopup(createComponent, { ...createComponentProps, space }, 'top') showPopup(createComponent, { ...createComponentProps, space }, 'top')
@ -147,6 +153,7 @@
...navigationComponentProps, ...navigationComponentProps,
query: spaceQuery query: spaceQuery
}} }}
on:select={onSelected}
/> />
</div> </div>
<Separator <Separator