From 187ccfa53bd860a7fc113e881880cb2826619e83 Mon Sep 17 00:00:00 2001 From: daitingting Date: Mon, 26 Jun 2023 06:26:56 +0000 Subject: [PATCH] * Refactore the automation view. --- module/testcase/js/automation.ui.js | 22 +++++ module/testcase/ui/automation.html.php | 111 +++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 module/testcase/js/automation.ui.js create mode 100644 module/testcase/ui/automation.html.php diff --git a/module/testcase/js/automation.ui.js b/module/testcase/js/automation.ui.js new file mode 100644 index 0000000000..6b8bc2a788 --- /dev/null +++ b/module/testcase/js/automation.ui.js @@ -0,0 +1,22 @@ +function loadProduct() +{ + $('#shell').val(''); + $('#scriptPath').val(''); + + var productID = $('#product').val(); + var url = createLink('zanode', 'ajaxGetZTFScript', "type=product&objectID=" + productID) + $.get(url, function(result) + { + if(result.result == 'success') + { + data = result.data; + if(!data) return false; + + $('#node').val(data.node) + $('#shell').val(data.shell); + $('#scriptPath').val(data.scriptPath); + + if($('[name=id]').length) $('[name=id]').val(data.id); + } + }, 'json'); +} diff --git a/module/testcase/ui/automation.html.php b/module/testcase/ui/automation.html.php new file mode 100644 index 0000000000..3a78458caf --- /dev/null +++ b/module/testcase/ui/automation.html.php @@ -0,0 +1,111 @@ + + * @package testcase + * @link https://www.zentao.net + */ +namespace zin; + +jsVar('automationTip', $lang->zanode->automationTips); +js +( + <<testcase->automation, + set::class('article-h1'), + ), + icon + ( + 'help', + set::class('text-gray'), + set::id('automationTip'), + set('data-toggle', 'tooltip'), + set('title', 'tooltip'), + ) +); + +form +( + !$productID ? formGroup + ( + set::label($lang->testcase->product), + set::required(true), + select + ( + set::name('product'), + set::items($products), + on::change('#product', 'loadProduct'), + ) + ) : null, + formGroup + ( + set::label($lang->zanode->common), + set::required(true), + inputGroup + ( + select + ( + set::name('node'), + set::items($nodeList), + set::value(zget($automation, 'node', '')), + ), + div + ( + set::class('input-group-btn'), + a + ( + set::class('btn'), + $lang->zanode->create, + set::href(createLink('zanode', 'create')), + set::target('_blank'), + ) + ) + ) + ), + formGroup + ( + set::label($lang->zanode->scriptPath), + set::required(true), + set::name('scriptPath'), + set::value(zget($automation, 'scriptPath', '')), + set::placeholder($lang->zanode->scriptTips), + ), + formGroup + ( + set::label($lang->zanode->shell), + editor + ( + set::name('shell'), + set::value(zget($automation, 'shell', '')), + set::rows(6), + set::placeholder($lang->zanode->shellTips), + ) + ), + $productID ? input + ( + set::type('hidden'), + set::name('product'), + set::value($productID), + ) : null, + $automation ? input + ( + set::type('hidden'), + set::name('id'), + set::value($automation->id), + ) : null, + set::actions(array('submit')), + set::submitBtnText($lang->save), +); + +render('modalDialog');