提交 50c16f53 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

Merge remote-tracking branch 'origin/main'

......@@ -48,16 +48,16 @@ func RunFile(filePath, workspacePath string, conf commDomain.WorkspaceConf,
}
if scriptInterpreter != "" {
if strings.Index(strings.ToLower(scriptInterpreter), "autoit") > -1 {
cmd = exec.Command("cmd", "/C", scriptInterpreter, filePath, "|", "more")
cmd = exec.CommandContext(ctxt, "cmd", "/C", scriptInterpreter, filePath, "|", "more")
} else {
if command, ok := commConsts.LangMap[lang]["CompiledCommand"]; ok && command != "" {
cmd = exec.Command("cmd", "/C", scriptInterpreter, command, filePath)
cmd = exec.CommandContext(ctxt, "cmd", "/C", scriptInterpreter, command, filePath)
} else {
cmd = exec.Command("cmd", "/C", scriptInterpreter, filePath)
cmd = exec.CommandContext(ctxt, "cmd", "/C", scriptInterpreter, filePath)
}
}
} else if strings.ToLower(lang) == "bat" {
cmd = exec.Command("cmd", "/C", filePath)
cmd = exec.CommandContext(ctxt, "cmd", "/C", filePath)
} else {
msg := i118Utils.I118Prt.Sprintf("no_interpreter_for_run", lang, filePath)
if commConsts.ExecFrom != commConsts.FromCmd {
......@@ -140,7 +140,12 @@ func RunFile(filePath, workspacePath string, conf commDomain.WorkspaceConf,
}
cmd.Start()
go func() {
time.AfterFunc(time.Second*time.Duration(timeout), func() {
stdout.Close()
stderr.Close()
})
}()
isTerminal := false
reader1 := bufio.NewReader(stdout)
stdOutputArr := make([]string, 0)
......
......@@ -6,7 +6,7 @@
@onOk="submit"
:okTitle="okTitle"
:title="t('sync-from-zentao')"
:contentStyle="{ width: '600px', overflow: 'hidden' }"
:contentStyle="{ width: '50vw', overflow: 'hidden' }"
>
<Form>
<FormItem labelWidth="140px" :label="t('module')">
......@@ -260,7 +260,7 @@ const setColumns = () => {
{
label: t("title"),
field: "Title",
width: "60px",
width: "400px",
},
{
label: t("type"),
......
......@@ -32,6 +32,14 @@
:workspaceId="syncFromZentaoWorkspaceId"
ref="syncFromZentaoRef"
/>
<FormWorkspace
v-if="showWorkspaceModal"
:show="showWorkspaceModal"
@submit="createWorkSpace"
@cancel="modalWorkspaceClose"
ref="formWorkspace"
:workspaceId="currentNode.workspaceId"
/>
</div>
</template>
......@@ -49,6 +57,7 @@ import { computed, defineExpose, onMounted, onUnmounted, ref, watch } from "vue"
import Button from '@/components/Button.vue';
import TreeContextMenu from './TreeContextMenu.vue';
import FormSyncFromZentao from "./FormSyncFromZentao.vue";
import FormWorkspace from "@/views/workspace/FormWorkspace.vue";
import bus from "@/utils/eventBus";
import {getExpandedKeys, getScriptDisplayBy, getScriptFilters, setExpandedKeys } from "@/utils/cache";
......@@ -116,6 +125,9 @@ const onToolbarClicked = (e) => {
showModal.value = true;
toolbarAction.value = e.event.key;
break;
case 'editWorkspace':
showWorkspaceModal.value = true;
break;
case 'deleteWorkspace':
Modal.confirm({
title: t('delete'),
......@@ -610,6 +622,22 @@ const clearMenu = () => {
contextNode.value = ref(null)
}
const showWorkspaceModal = ref(false)
const formWorkspace = ref({} as any)
const createWorkSpace = (formData) => {
store.dispatch('Workspace/save', formData).then((response) => {
if (response) {
formWorkspace.value.clearFormData()
notification.success({message: t('save_success')});
showWorkspaceModal.value = false;
loadScripts()
}
})
};
const modalWorkspaceClose = () => {
showWorkspaceModal.value = false;
}
defineExpose({
get isCheckable() {
return checkable.value;
......
......@@ -251,6 +251,7 @@ export function scriptTreeAddAttr(treeData) {
}
if (item.type === "workspace") {
item.toolbarItems.push({hint:'edit', icon:'edit', key: 'editWorkspace'})
item.toolbarItems.push({hint:'delete', icon:'delete', key: 'deleteWorkspace'})
}
if (item.children != undefined && item.children.length > 0) {
......
<template>
<ZModal
id="workspaceFormModal"
:showModal="showModalRef"
@onCancel="cancel"
@onOk="submit"
:title="t('create_workspace')"
:contentStyle="{width: '600px'}"
>
<Form>
<ZModal
id="workspaceFormModal"
:showModal="showModalRef"
@onCancel="cancel"
@onOk="submit"
:title="props.workspaceId ? t('edit_workspace') : t('create_workspace')"
:contentStyle="{width: '600px'}"
>
<Form>
<FormItem name="name" :label="t('name')" :info="validateInfos.name">
<input type="text" v-model="modelRef.name" />
</FormItem>
......@@ -65,27 +65,52 @@ import FormItem from "@/components/FormItem.vue";
import {arrToMap} from "@/utils/array";
import settings from "@/config/settings";
import Button from "@/components/Button.vue";
export interface FormWorkspaceProps {
show?: boolean;
}
const { t } = useI18n();
const props = withDefaults(defineProps<FormWorkspaceProps>(), {
show: false,
});
watch(props, () => {
if(!props.show){
setTimeout(() => {
validateInfos.value = {};
}, 200);
}
})
const showModalRef = computed(() => {
return props.show;
});
import { get as getWorkspace } from "@/views/workspace/service";
import Icon from '@/components/Icon.vue';
export interface FormWorkspaceProps {
show?: boolean;
workspaceId?: number;
}
const { t } = useI18n();
const props = withDefaults(defineProps<FormWorkspaceProps>(), {
show: false,
workspaceId: 0,
});
watch(props, () => {
if(!props.show){
setTimeout(() => {
validateInfos.value = {};
}, 200);
}
})
const showModalRef = computed(() => {
return props.show;
});
const info = ref({} as any);
const loadInfo = async () => {
if(props.workspaceId === undefined || !props.workspaceId) return;
await getWorkspace(props.workspaceId).then((json) => {
if (json.code === 0) {
info.value = json.data;
modelRef.value = {
id: info.value.id,
name: info.value.name,
path: info.value.path,
type: info.value.type,
lang: info.value.lang,
cmd: info.value.cmd,
};
selectType()
}
});
}
loadInfo();
const testTypes = ref([...ztfTestTypesDef, ...unitTestTypesDef]);
const store = useStore<{ Zentao: ZentaoData }>();
const langs = computed<any[]>(() => store.state.Zentao.langs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册