Skip to content

Commit

Permalink
UBERF-8889: Fix test suite selection (#7454)
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Savchenko <[email protected]>
  • Loading branch information
ArtyomSavchenko authored Dec 13, 2024
1 parent c9bf99e commit 5b1f0a6
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 14 deletions.
2 changes: 2 additions & 0 deletions packages/ui/src/components/Component.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
on:valid
on:validate
on:submit
on:select
>
<slot />
</svelte:component>
Expand All @@ -123,6 +124,7 @@
on:valid
on:validate
on:submit
on:select
/>
{/if}
</ErrorBoundary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@
titleKey: 'name',
parentKey: 'parent',
noParentId: testManagement.ids.NoParent,
getFolderLink: testManagement.function.GetTestSuiteLink,
allObjectsLabel: testManagement.string.AllTestSuites,
allObjectsIcon: testManagement.icon.TestSuites,
space
}}
mainComponentProps={{ space }}
syncWithLocationQuery={false}
{space}
/>
<svelte:fragment slot="footerRight">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@
import testManagement from '../../plugin'
export let baseQuery: DocumentQuery<Doc> = {}
export let query: DocumentQuery<Doc> = {}
let testCases: number
const query = createQuery()
$: query.query(testManagement.class.TestCase, baseQuery, (res) => {
testCases = res.length
})
const docQuery = createQuery()
$: docQuery.query(
testManagement.class.TestCase,
query,
(res) => {
testCases = res.length
},
{ total: true, limit: 1 }
)
let viewlet: Viewlet | undefined
let preference: ViewletPreference | undefined
Expand Down Expand Up @@ -59,7 +64,7 @@
<TableBrowser
_class={testManagement.class.TestCase}
config={preference?.config ?? viewlet.config}
query={baseQuery}
{query}
loadingProps={{ length: testCases }}
enableChecking={true}
readonly={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
-->

<script lang="ts">
import { createEventDispatcher } from 'svelte'
import { Class, Doc, DocumentQuery, Ref, SortingOrder } from '@hcengineering/core'
import { createQuery, getClient } from '@hcengineering/presentation'
import { Action, IconEdit, navigate, type Location, Scroller, location, getLocation } from '@hcengineering/ui'
Expand All @@ -29,11 +31,13 @@
export let titleKey: string = 'title'
export let parentKey: string = 'parent'
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 allObjectsLabel: IntlString
export let plainList: boolean = false
const dispatch = createEventDispatcher()
const getFolderId = (): Ref<Doc> => {
return (getLocation()?.query?.attachedTo as Ref<Doc>) ?? noParentId
}
Expand Down Expand Up @@ -77,8 +81,13 @@
)
async function handleFolderSelected (_id: Ref<Doc>): Promise<void> {
const getFolderLinkFunction = await getResource(getFolderLink)
navigate(getFolderLinkFunction(_id))
if (getFolderLink !== undefined) {
const getFolderLinkFunction = await getResource(getFolderLink)
navigate(getFolderLinkFunction(_id))
} else {
selected = _id
}
dispatch('select', _id)
}
async function handleAllItemsSelected (): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,31 @@
export let mainComponent: AnyComponent | AnySvelteComponent
export let mainComponentProps = {}
export let showNavigator: boolean = false
export let parentKey: string = 'attachedTo'
const FLOAT_LIMIT = 760
let container: HTMLDivElement
let locationQuery: DocumentQuery<Doc> = {}
let parentQuery: DocumentQuery<Doc> = {}
let resultQuery: DocumentQuery<Doc> = {}
let spaceQuery: DocumentQuery<Doc> = {}
$: spaceQuery = space !== undefined ? { space } : {}
$: resultQuery = mergeQueries(query, mergeQueries(spaceQuery, locationQuery)) ?? {}
$: resultQuery = mergeQueries(query, mergeQueries(spaceQuery, parentQuery)) ?? {}
if (syncWithLocationQuery) {
locationQuery = getLocation()?.query as any
parentQuery = getLocation()?.query as any
onDestroy(
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 {
if (createComponent === undefined) return
showPopup(createComponent, { ...createComponentProps, space }, 'top')
Expand Down Expand Up @@ -147,6 +153,7 @@
...navigationComponentProps,
query: spaceQuery
}}
on:select={onSelected}
/>
</div>
<Separator
Expand Down

0 comments on commit 5b1f0a6

Please sign in to comment.