mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-20 09:42:26 +03:00
Fix test suite and test run default selection (#7250)
Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
parent
163c8ec373
commit
e0f2c87ed3
@ -107,7 +107,7 @@
|
|||||||
throw new Error('Failed to create test run')
|
throw new Error('Failed to create test run')
|
||||||
} else {
|
} else {
|
||||||
Analytics.handleEvent(TestManagementEvents.TestRunCreated, { id })
|
Analytics.handleEvent(TestManagementEvents.TestRunCreated, { id })
|
||||||
navigate(getTestRunsLink(id))
|
navigate(getTestRunsLink(space, id))
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
@ -79,10 +79,12 @@ export function getTestSuiteIdFromLocation (): Ref<TestSuite> {
|
|||||||
return (location?.query?.[SUITE_KEY] as Ref<TestSuite>) ?? testManagement.ids.NoParent
|
return (location?.query?.[SUITE_KEY] as Ref<TestSuite>) ?? testManagement.ids.NoParent
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTestRunsLink (parentDoc: Ref<Doc>): Location {
|
export function getTestRunsLink (space: Ref<TestProject>, parentDoc: Ref<Doc>): Location {
|
||||||
const loc = getCurrentResolvedLocation()
|
const loc = getCurrentResolvedLocation()
|
||||||
loc.path.length = 4
|
loc.path.length = 5
|
||||||
loc.path[3] = 'testRuns'
|
loc.path[2] = testManagementId
|
||||||
|
loc.path[3] = space
|
||||||
|
loc.path[4] = 'testRuns'
|
||||||
loc.fragment = undefined
|
loc.fragment = undefined
|
||||||
loc.query = parentDoc === undefined ? undefined : { attachedTo: parentDoc }
|
loc.query = parentDoc === undefined ? undefined : { attachedTo: parentDoc }
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
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 } from '@hcengineering/ui'
|
import { Action, IconEdit, navigate, type Location, Scroller, location, getLocation } from '@hcengineering/ui'
|
||||||
import { getResource, type Resource } from '@hcengineering/platform'
|
import { getResource, type Resource } from '@hcengineering/platform'
|
||||||
import { IntlString, Asset } from '@hcengineering/platform'
|
import { IntlString, Asset } from '@hcengineering/platform'
|
||||||
|
|
||||||
@ -34,6 +34,10 @@
|
|||||||
export let allObjectsLabel: IntlString
|
export let allObjectsLabel: IntlString
|
||||||
export let plainList: boolean = false
|
export let plainList: boolean = false
|
||||||
|
|
||||||
|
const getFolderId = (): Ref<Doc> => {
|
||||||
|
return (getLocation()?.query?.attachedTo as Ref<Doc>) ?? noParentId
|
||||||
|
}
|
||||||
|
|
||||||
export let forciblyСollapsed: boolean = false
|
export let forciblyСollapsed: boolean = false
|
||||||
|
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
@ -46,17 +50,23 @@
|
|||||||
foldersState = newState
|
foldersState = newState
|
||||||
})
|
})
|
||||||
|
|
||||||
let selected: Ref<Doc> = noParentId
|
let selected: Ref<Doc> = getFolderId()
|
||||||
let visibleItem: Doc | undefined
|
let visibleItem: Doc | undefined = foldersState.folderById.get(selected)
|
||||||
|
location.subscribe(() => {
|
||||||
|
selected = getFolderId()
|
||||||
|
visibleItem = foldersState.folderById.get(selected)
|
||||||
|
})
|
||||||
|
|
||||||
const q = createQuery()
|
const q = createQuery()
|
||||||
q.query(
|
q.query(
|
||||||
_class,
|
_class,
|
||||||
query ?? {},
|
query ?? {},
|
||||||
(result) => {
|
async (result) => {
|
||||||
foldersManager.setFolders(result)
|
foldersManager.setFolders(result)
|
||||||
if (plainList && foldersState.folders?.length > 0) {
|
if (plainList && foldersState.folders?.length > 0) {
|
||||||
handleFolderSelected(foldersState.folders[0])
|
if (selected === undefined) {
|
||||||
|
await handleFolderSelected(foldersState.folders[0])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -67,17 +77,12 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
async function handleFolderSelected (_id: Ref<Doc>): Promise<void> {
|
async function handleFolderSelected (_id: Ref<Doc>): Promise<void> {
|
||||||
selected = _id
|
|
||||||
visibleItem = selected !== undefined ? foldersState.folderById.get(selected) : undefined
|
|
||||||
const getFolderLinkFunction = await getResource(getFolderLink)
|
const getFolderLinkFunction = await getResource(getFolderLink)
|
||||||
navigate(getFolderLinkFunction(_id))
|
navigate(getFolderLinkFunction(_id))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleAllItemsSelected (): Promise<void> {
|
async function handleAllItemsSelected (): Promise<void> {
|
||||||
selected = noParentId
|
await handleFolderSelected(noParentId)
|
||||||
visibleItem = undefined
|
|
||||||
const getFolderLinkFunction = await getResource(getFolderLink)
|
|
||||||
navigate(getFolderLinkFunction(undefined))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getFolderActions (obj: Doc): Promise<Action[]> {
|
async function getFolderActions (obj: Doc): Promise<Action[]> {
|
||||||
@ -119,8 +124,8 @@
|
|||||||
descendants={foldersState.descendants}
|
descendants={foldersState.descendants}
|
||||||
folderById={foldersState.folderById}
|
folderById={foldersState.folderById}
|
||||||
{selected}
|
{selected}
|
||||||
on:selected={(ev) => {
|
on:selected={async (ev) => {
|
||||||
handleFolderSelected(ev.detail)
|
await handleFolderSelected(ev.detail)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<svelte:fragment slot="visible">
|
<svelte:fragment slot="visible">
|
||||||
@ -147,8 +152,8 @@
|
|||||||
descendants={foldersState.descendants}
|
descendants={foldersState.descendants}
|
||||||
folderById={foldersState.folderById}
|
folderById={foldersState.folderById}
|
||||||
{selected}
|
{selected}
|
||||||
on:selected={(ev) => {
|
on:selected={async (ev) => {
|
||||||
handleFolderSelected(ev.detail)
|
await handleFolderSelected(ev.detail)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
Loading…
Reference in New Issue
Block a user