提交 23c3a3fc 编写于 作者: Z zhaoke

* Add toolbar icon.

上级 2e454115
......@@ -83,6 +83,8 @@ export default {
'edit_workspace': 'Edit WorkDir',
'create_file': 'Create file',
'del_file': 'Delete File',
'execCase': 'Execute By Case',
'execUnit': 'Execute UnitTest',
'duration': 'Duration',
'duration_sec': 'Duration(sec)',
......
......@@ -91,6 +91,8 @@ export default {
'edit_workspace': '编辑工作目录',
'create_file': '新建脚本',
'del_file': '删除脚本',
'execCase': '执行用例',
'execUnit': '执行单元测试',
'duration': '耗时',
'duration_sec': '耗时(秒)',
......
......@@ -46,6 +46,7 @@ import throttle from "lodash.debounce";
import Modal from "@/utils/modal"
import FormNode from "./FormNode.vue";
import { key } from "localforage";
import settings from "@/config/settings";
const { t } = useI18n();
......@@ -90,29 +91,46 @@ const onToolbarClicked = (e) => {
{ id: node.workspaceId, type: node.workspaceType })
currentNode.value = node;
if (e.event.key == 'runTest') {
runTest(currentNode);
} else if (e.event.key == 'createFile' || e.event.key == 'createWorkspace' || e.event.key == 'createDir') {
showModal.value = true;
toolbarAction.value = e.event.key;
} else if (e.event.key === 'deleteWorkspace') {
Modal.confirm({
title: t('delete'),
content: t('confirm_to_delete_workspace', { p: node.title }),
showOkBtn: true
},
{
"onOk": () => {
store.dispatch('Workspace/removeWorkspace', node.path)
.then((response) => {
switch (e.event.key) {
case 'runTest':
runTest(currentNode);
break;
case 'createFile':
case 'createWorkspace':
case 'createDir':
showModal.value = true;
toolbarAction.value = e.event.key;
break;
case 'deleteWorkspace':
Modal.confirm({
title: t('delete'),
content: t('confirm_to_delete_workspace', { p: node.title }),
showOkBtn: true
},
{
"onOk": () => {
store.dispatch('Workspace/removeWorkspace', node.path)
.then((response) => {
if (response) {
notification.success({ message: t('delete_success') });
loadScripts()
}
})
}
}
}
)
);
break;
case 'runScript':
console.log('run script', currentNode.value);
bus.emit(settings.eventExec,
{execType: currentNode.value.workspaceType === 'ztf' ? 'ztf' : 'unit', scripts: currentNode.value.isLeaf ? [currentNode.value] : currentNode.value.children});
break;
case 'checkinCase':
console.log('checkin case', currentNode.value);
break;
case 'checkoutCase':
console.log('checkout case', currentNode.value);
break;
}
}
......
......@@ -235,10 +235,15 @@ export function scriptTreeAddAttr(treeData) {
item.checkable = item.workspaceType == 'ztf' ? true : false;
if (item.isLeaf) {
item.toolbarItems = [
// { hint: 'create_file', icon: 'file-add', key: 'createFile'},
{hint: 'execCase', icon: 'play', key: 'runScript'},
{hint: 'checkin_case', icon: 'arrow-up', key: 'checkinCase'},
{hint: 'checkout_case', icon: 'arrow-down', key: 'checkoutCase'},
];
} else {
item.toolbarItems = [
{hint: item.checkable ? 'exec_all' : 'execUnit', icon: 'play', key: 'runScript'},
{hint: 'checkin_case', icon: 'arrow-up', key: 'checkinCase'},
{hint: 'checkout_case', icon: 'arrow-down', key: 'checkoutCase'},
{hint: 'create_workspace', icon: 'folder-add', key: 'createDir'},
{ hint: 'create_file', icon: 'file-add', key: 'createFile'},
];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册