mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 19:58:09 +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.
|
||||
-->
|
||||
<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 { selectionStore } from '@hcengineering/view-resources'
|
||||
import type { TestCase, TestProject } from '@hcengineering/test-management'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
|
||||
import testManagement from '../../plugin'
|
||||
import { showCreateTestRunPopup } from '../../utils'
|
||||
@ -24,6 +25,19 @@
|
||||
export let query: DocumentQuery<Doc> = {}
|
||||
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 handleRun = async (): Promise<void> => {
|
||||
@ -42,5 +56,6 @@
|
||||
justify={'left'}
|
||||
kind={'primary'}
|
||||
label={testManagement.string.RunTestCases}
|
||||
disabled={!haveTestCases}
|
||||
on:click={handleRun}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user