mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 16:56:07 +00:00
UBERF-8628: Disable run button if there is nothing to run (#7277)
Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
parent
596185bd5c
commit
34daf3a7f5
@ -13,10 +13,11 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Doc, DocumentQuery, Ref, Space } from '@hcengineering/core'
|
import { Doc, DocumentQuery, Ref, Space, mergeQueries } from '@hcengineering/core'
|
||||||
import { Button } from '@hcengineering/ui'
|
import { Button } from '@hcengineering/ui'
|
||||||
import { selectionStore } from '@hcengineering/view-resources'
|
import { selectionStore } from '@hcengineering/view-resources'
|
||||||
import type { TestCase, TestProject } from '@hcengineering/test-management'
|
import type { TestCase, TestProject } from '@hcengineering/test-management'
|
||||||
|
import { createQuery } from '@hcengineering/presentation'
|
||||||
|
|
||||||
import testManagement from '../../plugin'
|
import testManagement from '../../plugin'
|
||||||
import { showCreateTestRunPopup } from '../../utils'
|
import { showCreateTestRunPopup } from '../../utils'
|
||||||
@ -24,6 +25,19 @@
|
|||||||
export let query: DocumentQuery<Doc> = {}
|
export let query: DocumentQuery<Doc> = {}
|
||||||
export let space: Ref<Space>
|
export let space: Ref<Space>
|
||||||
|
|
||||||
|
const docQuery = createQuery()
|
||||||
|
let haveTestCases = false
|
||||||
|
|
||||||
|
$: resultQuery = mergeQueries(query, { space })
|
||||||
|
$: docQuery.query(
|
||||||
|
testManagement.class.TestCase,
|
||||||
|
resultQuery,
|
||||||
|
(res) => {
|
||||||
|
haveTestCases = res.length > 0
|
||||||
|
},
|
||||||
|
{ limit: 1 }
|
||||||
|
)
|
||||||
|
|
||||||
const project: Ref<TestProject> = space as any
|
const project: Ref<TestProject> = space as any
|
||||||
|
|
||||||
const handleRun = async (): Promise<void> => {
|
const handleRun = async (): Promise<void> => {
|
||||||
@ -42,5 +56,6 @@
|
|||||||
justify={'left'}
|
justify={'left'}
|
||||||
kind={'primary'}
|
kind={'primary'}
|
||||||
label={testManagement.string.RunTestCases}
|
label={testManagement.string.RunTestCases}
|
||||||
|
disabled={!haveTestCases}
|
||||||
on:click={handleRun}
|
on:click={handleRun}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user