提交 6f8bad60 编写于 作者: Z zhaoke

Merge branch 'main' into ztf-35_zhaoke

......@@ -36,3 +36,4 @@ logs/
/product1/
/gui/
/ui/report.json
......@@ -12,4 +12,4 @@ ZTF is an automated testing framework written in Golang.
2. Type 'ztf\ztf.exe help' to get the help doc.
## Licenses
All source code is licensed under the [GPLv3 License](LICENSE.md).
All source code is licensed under the [GPLv3 License](LICENSE.md).
\ No newline at end of file
......@@ -3,7 +3,7 @@ import {app, BrowserWindow, ipcMain, Menu, shell, dialog, globalShortcut} from '
import {DEBUG, electronMsg, electronMsgReplay, minimumSizeHeight, minimumSizeWidth} from './utils/consts';
import {IS_MAC_OSX, IS_LINUX, IS_WINDOWS_OS} from './utils/env';
import {logInfo, logErr} from './utils/log';
import Config, {updateConfig} from './utils/config';
import Config from './utils/config';
import Lang, {initLang} from './core/lang';
import {startUIService} from "./core/ui";
import {startZtfServer, killZtfServer} from "./core/ztf";
......@@ -12,7 +12,7 @@ const cp = require('child_process');
const fs = require('fs');
const pth = require('path');
export default class ZtfApp {
export class ZtfApp {
constructor() {
app.name = Lang.string('app.title', Config.pkg.displayName);
......@@ -24,7 +24,6 @@ export default class ZtfApp {
}).catch((err) => {
logErr('>> ztf server started failed, err: ' + err);
process.exit(1);
return;
})
}
......@@ -63,10 +62,8 @@ export default class ZtfApp {
const url = await startUIService()
await mainWin.loadURL(url);
const { ipcMain } = require('electron')
ipcMain.on(electronMsg, (event, arg) => {
logInfo('msg from renderer: ' + arg)
const mainWin = this._windows.get('main');
switch (arg) {
case 'selectDir':
......@@ -103,11 +100,7 @@ export default class ZtfApp {
this.openInTerminal(arg.path)
}
})
// if (DEBUG) {
// mainWin.webContents.openDevTools({mode: 'bottom'});
// }
};
}
async openOrCreateWindow() {
const mainWin = this._windows.get('main');
......@@ -163,8 +156,7 @@ export default class ZtfApp {
this.buildAppMenu();
// 在 OS X 系统上,可能存在所有应用窗口关闭了,但是程序还没关闭,此时如果收到激活应用请求,需要重新打开应用窗口并创建应用菜单。
this.openOrCreateWindow().then(() => {
})
this.openOrCreateWindow()
});
}
......@@ -172,9 +164,7 @@ export default class ZtfApp {
dialog.showOpenDialog({
properties: ['openFile']
}).then(result => {
if (result.filePaths && result.filePaths.length > 0) {
event.reply(electronMsgReplay, result.filePaths[0]);
}
this.reply(event, result)
}).catch(err => {
logErr(err)
})
......@@ -184,14 +174,18 @@ export default class ZtfApp {
dialog.showOpenDialog({
properties: ['openDirectory']
}).then(result => {
if (result.filePaths && result.filePaths.length > 0) {
event.reply(electronMsgReplay, result.filePaths[0]);
}
this.reply(event, result)
}).catch(err => {
logErr(err)
})
}
reply(event, result) {
if (result.filePaths && result.filePaths.length > 0) {
event.reply(electronMsgReplay, result.filePaths[0]);
}
}
openInExplore(path) {
shell.showItemInFolder(path);
}
......@@ -206,7 +200,7 @@ export default class ZtfApp {
if (IS_WINDOWS_OS) {
cp.exec('start cmd.exe /K cd /D ' + path);
} else if (IS_LINUX) {
// TODO: support other terminal types
// support other terminal types
cp.spawn ('gnome-terminal', [], { cwd: path });
} else if (IS_MAC_OSX) {
cp.exec('open -a Terminal ' + path);
......@@ -222,12 +216,15 @@ export default class ZtfApp {
if (!app.setAboutPanelOptions) {
return;
}
let version = Config.pkg.buildTime ? 'build at ' + new Date(Config.pkg.buildTime).toLocaleString() : ''
version += DEBUG ? '[debug]' : ''
app.setAboutPanelOptions({
applicationName: Lang.string(Config.pkg.name) || Config.pkg.displayName,
applicationVersion: Config.pkg.version,
copyright: `${Config.pkg.copyright} ${Config.pkg.company}`,
credits: `Licence: ${Config.pkg.license}`,
version: `${Config.pkg.buildTime ? `build at ${new Date(Config.pkg.buildTime).toLocaleString()}` : ''}${DEBUG ? '[debug]' : ''}`
version: version
});
}
......
......@@ -4,7 +4,7 @@ const fs = require('fs');
import {DEBUG} from '../utils/consts';
import {logInfo} from "../utils/log";
import LangHelper from '../utils/lang';
import {LangHelper} from '../utils/lang';
const langHelper = new LangHelper();
......@@ -42,8 +42,7 @@ const loadLangData = (langName) => {
logInfo(`load language res from ${pth}`)
const buf = fs.readFileSync(pth)
const data = JSON.parse(buf.toString())
return data
return JSON.parse(buf.toString())
}
if (DEBUG) {
......
......@@ -49,8 +49,7 @@ export async function startZtfServer() {
cmd.stdout.on('data', data => {
const dataString = String(data);
const lines = dataString.split('\n');
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
for (let line of lines) {
if (DEBUG) {
logInfo('\t' + line);
}
......@@ -93,8 +92,7 @@ export async function startZtfServer() {
cmd.stdout.on('data', data => {
const dataString = String(data);
const lines = dataString.split('\n');
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
for (let line of lines) {
if (DEBUG) {
logInfo('\t' + line);
}
......@@ -120,11 +118,10 @@ export async function startZtfServer() {
}
export function killZtfServer() {
let cmd = ''
if (!IS_WINDOWS_OS) {
logInfo(`>> not windows`);
cmd = `ps -ef | grep ${uuid} | grep -v "grep" | awk '{print $2}' | xargs kill -9`
const cmd = `ps -ef | grep ${uuid} | grep -v "grep" | awk '{print $2}' | xargs kill -9`
logInfo(`>> exit cmd: ${cmd}`);
const cp = require('child_process');
......
import TextMap from './text-map';
import {formatString} from './string';
export default class LangHelper extends TextMap {
export class LangHelper extends TextMap {
constructor(name, langData) {
super(langData);
this._name = name;
......
......@@ -108,7 +108,7 @@ export const ifEmptyStringThen = (str, thenStr) => (isEmptyString(str) ? thenStr
*/
export const limitStringLength = (str, length, suffix) => {
if (str.length > length) {
str = str.substr(0, length);
str = str.substring(0, length);
if (suffix) {
str = `${str}${suffix}`;
}
......
import {app} from 'electron';
import {DEBUG} from './app/utils/consts';
import ZtfApp from "./app/app";
import {ZtfApp} from "./app/app";
import {logInfo} from "./app/utils/log";
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
......
sonar.projectKey=ztf
sonar.sources=.
sonar.exclusions=bin/**,demo/**,log/**,xdoc/**,client/node_modules/**,client/ui/**,client/out/**,client/bin/**,ui/node_modules/**
sonar.host.url=http://localhost:59001
sonar.login=sqp_fbda64ddf414b8ec8ad53f0b5cc02925e52383b0
sonar.issue.ignore.multicriteria=e1,e2,e3
sonar.issue.ignore.multicriteria.e1.ruleKey=typescript:S3358
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.vue
sonar.issue.ignore.multicriteria.e2.ruleKey=typescript:S3358
sonar.issue.ignore.multicriteria.e2.resourceKey=**/*.ts
sonar.issue.ignore.multicriteria.e3.ruleKey=javascript:S3358
sonar.issue.ignore.multicriteria.e3.resourceKey=**/*.js
sonar.eslint.reportPaths=ui/report.json
\ No newline at end of file
此差异已折叠。
<template>
<Toolbar>
<!-- <Button class="rounded pure" icon="search" iconSize="1.5em" :hint="t('search')" />-->
<Button class="rounded pure" icon="settings" iconSize="1.5em" :hint="t('settings')" @click="openSettings" />
</Toolbar>
<SettingsModal
<SettingsModal
:show="showSettingsModal"
@cancel="settingsModalClose"
:showOkBtn="false"
......
......@@ -42,10 +42,10 @@ const buttonPropsList = computed(() => {
let item: (ButtonProps | Record<string, any>) & {key: string | number | symbol};
if (props.replaceFields && Button.props) {
item = Object.keys(Button.props).reduce((item, propName) => {
item = Object.keys(Button.props).reduce((item2, propName) => {
const replacePropName = props.replaceFields ? props.replaceFields[propName] : null;
item[propName] = x[typeof replacePropName === 'string' ? replacePropName : propName];
return item;
item2[propName] = x[typeof replacePropName === 'string' ? replacePropName : propName];
return item2;
}, {key: x.key !== undefined ? x.key : i});
} else {
item = {
......
......@@ -9,7 +9,6 @@ import {useI18n} from "vue-i18n";
const { t } = useI18n();
import {computed, defineProps, inject} from "vue";
import {ButtonProps} from "@/components/Button.vue";
export interface ColumnProps {
width?: string,
......@@ -20,7 +19,7 @@ export interface ColumnProps {
const props = defineProps<ColumnProps>();
let gutter = inject('gutter');
let gutter = inject('gutter') as any;
const colClass = computed(() => {
const classes: string[] = [];
......@@ -30,7 +29,7 @@ const colClass = computed(() => {
classes.push(`z-col-${span}`);
}
if (props.offset > 0) {
if (props.offset && props.offset > 0) {
classes.push(`z-col-offset-${props.offset}`);
}
......
......@@ -40,7 +40,7 @@ defineProps<{
keyName?: string,
checkedKey?: ListItemKey,
activeKey?: ListItemKey,
replaceFields?: Record<string, string>, // {title: 'name'}
replaceFields?: Record<string, string>,
listClass?: string,
listCompact?: boolean,
listDivider?: boolean,
......
......@@ -39,7 +39,7 @@ const props = withDefaults(defineProps<{
keyName?: string,
checkedKey?: ListItemKey,
activeKey?: ListItemKey,
replaceFields?: Record<string, string>, // {title: 'name'}
replaceFields?: Record<string, string>,
listClass?: string,
listCompact?: boolean,
listDivider?: boolean,
......@@ -89,7 +89,7 @@ function _handleClickMenu(event: MouseEvent) {
const emit = defineEmits<{(type: 'click', event: {originalEvent: Event, key: ListItemKey, item: ListItemProps | Record<string, any>}) : void}>();
onClickOutside(menuRef, event => {
onClickOutside(menuRef, _event => {
if (props.hideOnClickAway && state.showed) {
_toggle(false);
}
......@@ -200,7 +200,7 @@ onMounted(() => {
}
const triggerEvent = props.triggerEvent ?? 'click';
const handler = (event: Event) => {
const handler = (_event) => {
if (state.showed) {
_toggle(false);
} else if (!state.show) {
......
......@@ -6,7 +6,6 @@
<script setup lang="ts">
import {defineProps, provide} from "vue";
import {FormItemProps} from "@/components/FormItem.vue";
import {useI18n} from "vue-i18n";
const { t } = useI18n();
......
......@@ -67,7 +67,7 @@
</template>
<script setup lang="ts">
import {defineProps, computed, ref} from "vue";
import {defineProps} from "vue";
import Icon from '@/components/Icon.vue';
export interface FormItemProps {
......
......@@ -27,7 +27,7 @@ const props = defineProps<{
keyName?: string,
checkedKey?: ListItemKey,
activeKey?: ListItemKey,
replaceFields?: Record<string, string>, // {title: 'name'}
replaceFields?: Record<string, string>,
}>();
const keyItemMap = ref<Record<NonNullable<ListItemKey>, ListItemProps | Record<string, any>>>({});
......@@ -39,10 +39,10 @@ const itemList = computed(() => {
return props.items.map((x, i) => {
let item: (ListItemProps | Record<string, any>) & {key: NonNullable<ListItemKey>};
if (props.replaceFields && ListItem.props) {
item = Object.keys(ListItem.props).reduce((item, propName) => {
item = Object.keys(ListItem.props).reduce((item2, propName) => {
const replacePropName = props.replaceFields ? props.replaceFields[propName] : null;
item[propName] = x[typeof replacePropName === 'string' ? replacePropName : propName];
return item;
item2[propName] = x[typeof replacePropName === 'string' ? replacePropName : propName];
return item2;
}, {key: x.key !== undefined ? x.key : i});
} else {
item = {
......
......@@ -3,7 +3,7 @@
</template>
<script setup lang="ts">
import { defineProps, onBeforeUnmount, computed, CSSProperties, watch, shallowRef, defineEmits, onMounted, defineExpose, toRaw } from 'vue';
import { defineProps, onBeforeUnmount, computed, CSSProperties, watch, shallowRef, defineEmits, onMounted, defineExpose } from 'vue';
import * as monaco from 'monaco-editor';
import { useElementSize } from '@vueuse/core'
......@@ -38,7 +38,7 @@ const style = computed(()=>{
const {height: containerHeight} = useElementSize(elRef);
watch(containerHeight, (newVal, oldValue) => {
watch(containerHeight, (_newVal, _oldValue) => {
if (editorRef.value) {
editorRef.value.layout();
}
......@@ -91,9 +91,6 @@ onMounted(() => {
editor.onDidChangeModelContent(event => {
const editorValue = editor.getValue()
emit('change', editorValue, event);
// if (props.value !== editorValue) {
// emit('change', editorValue, event)
// }
});
emit('editorDidMount', editor);
......
......@@ -29,7 +29,7 @@
<script setup lang="ts">
import {defineProps, reactive} from 'vue';
import Button, {ButtonProps} from './Button.vue';
import {ButtonProps} from './Button.vue';
import Toolbar from './Toolbar.vue';
import {useI18n} from "vue-i18n";
const { t } = useI18n();
......
......@@ -12,7 +12,6 @@ import TabPageScript from '@/views/script/TabPageScript.vue';
import TabPageExecUnit from '@/views/exec/TabPageExecUnit.vue';
import TabPageUnknown from './TabPageUnknown.vue';
import {useI18n} from "vue-i18n";
import { SaveFilledIconType } from "@ant-design/icons-vue/lib/icons/SaveFilled";
const {t} = useI18n();
......
......@@ -102,7 +102,7 @@ function getNodeCheckState(id: string): boolean | 'indeterminate' {
return checked;
}
function _convertNodeData(node: TreeNodeData, parent: TreeNodeData | undefined, index: number) {
function _convertNodeData(node: TreeNodeData, parent: TreeNodeData | undefined, _index: number) {
node = {
...node,
level: parent ? ((parent.level ?? 0) + 1) : 0
......
......@@ -25,7 +25,7 @@
<script setup lang="ts">
import Button from './Button.vue';
import Toolbar from './Toolbar.vue';
import {defineComponent, ref} from "vue";
import {ref} from "vue";
import {useI18n} from "vue-i18n";
import {useRouter} from "vue-router";
import {getElectron} from "@/utils/comm";
......
......@@ -9,7 +9,7 @@ import { getLocale, setLocale, importAllLocales, defaultLang } from "@/utils/i18
/**
* 框架 多语言 配置
*/
export const messages = importAllLocales();
export const messages = importAllLocales() as any;
const sysLocale = getLocale();
const i18n = createI18n({
legacy: false,
......
......@@ -16,9 +16,7 @@ interface ProductInfo {
export default function useCurrentProduct(): ComputedRef<ProductInfo> {
const store = useStore<{ Zentao: ZentaoData }>();
const curr = computed<any>(() => {
return computed<any>(() => {
return store.state.Zentao.currProduct;
});
return curr;
}
......@@ -16,10 +16,8 @@ interface SiteInfo {
export default function useCurrentSite(): ComputedRef<SiteInfo> {
const store = useStore<{ Zentao: ZentaoData }>();
const currSite = computed<any>(() => {
return computed<any>(() => {
const site = store.state.Zentao.currSite;
return site.username ? site : null;
});
return currSite;
}
import { createApp } from 'vue';
import App from '@/App.vue';
import router from '@/config/routes';
import router from '@/config/router';
import store from '@/config/store';
import i18n from '@/config/i18n';
......
......@@ -81,7 +81,7 @@ export const setLocale = (lang: string, callback: () => void, realReload = true)
* @author LiQingSong
*/
export function importAllLocales(): LocaleMessages<VueMessageType> {
const modules: LocaleMessages<VueMessageType> = {};
const modules: any = {};
try {
// 导入 @/views 下文件,包含子目录,文件名为:[/\\]locales[/\\]([a-z]{2})-?([A-Z]{2})?\.ts
const viewsRequireContext: __WebpackModuleApi.RequireContext = require.context('../views', true, /[/\\]locales[/\\]([a-z]{2})-?([A-Z]{2})?\.ts$/);
......
......@@ -89,18 +89,14 @@ function _handleDropDownMenuClick(event) {
bus.emit(settings.eventExec, { execType: 'ztf', scripts: arr });
}
return
}
const getOpenedScripts = () => {
const openedScripts = tabs.value.filter((item, index) => {
return tabs.value.filter((item) => {
return item.type === 'script'
}).map((script: any) => {
return { path: script.data, workspaceId: currWorkspace.value.id }
});
return openedScripts
}
</script>
......
......@@ -138,7 +138,7 @@ const selectInterpreter = async () => {
modelRef.value.path = selectedInterpreter.value;
};
const selectLang = async (item) => {
const selectLang = async () => {
console.log("selectLang", modelRef.value.lang);
modelRef.value.path = "";
......@@ -212,9 +212,8 @@ const selectFile = () => {
const { ipcRenderer } = window.require('electron')
ipcRenderer.send(settings.electronMsg, 'selectFile')
ipcRenderer.on(settings.electronMsgReplay, (event, arg) => {
console.log(arg)
modelRef.value.path = arg
ipcRenderer.on(settings.electronMsgReplay, (_event, arg) => {
modelRef.value.path = arg
})
}
defineExpose({
......
......@@ -82,18 +82,11 @@ import { useI18n } from "vue-i18n";
import { useStore } from "vuex";
import { ZentaoData } from "@/store/zentao";
import { unitTestTypesDef, ztfTestTypesDef } from "@/utils/const";
import {
computed,
defineExpose,
onMounted,
withDefaults,
ref,
defineProps, reactive,
} from "vue";
import { computed, defineExpose, withDefaults, ref, defineProps, reactive } from "vue";
import { useForm } from "@/utils/form";
import Form from "@/components/Form.vue";
import FormItem from "@/components/FormItem.vue";
import {queryBugFields, queryTask} from "@/services/zentao";
import {queryBugFields} from "@/services/zentao";
import notification from "@/utils/notification";
import {prepareBugData, submitBugToZentao} from "@/services/bug";
......
......@@ -29,17 +29,8 @@
import { useI18n } from "vue-i18n";
import { useStore } from "vuex";
import { ZentaoData } from "@/store/zentao";
import { ScriptData } from "@/views/script/store";
import { unitTestTypesDef, ztfTestTypesDef } from "@/utils/const";
import {
computed,
defineExpose,
onMounted,
withDefaults,
ref,
defineProps,
defineEmits, reactive, PropType,
} from "vue";
import {computed, defineExpose, withDefaults, ref, defineProps } from "vue";
import { useForm } from "@/utils/form";
import Form from "@/components/Form.vue";
import FormItem from "@/components/FormItem.vue";
......
......@@ -57,9 +57,9 @@ const refreshExec = async (item): Promise<void> => {
const failedCases: object[] = [];
reportVal.funcResult.forEach(cs => {
const item = {path: cs.path, workspaceId: reportVal.workspaceId}
allCases.push(item)
if (cs.status === 'fail') failedCases.push(item)
const item2 = {path: cs.path, workspaceId: reportVal.workspaceId}
allCases.push(item2)
if (cs.status === 'fail') failedCases.push(item2)
})
return {all: allCases, fail: failedCases}
......
......@@ -11,7 +11,6 @@
<script setup lang="ts">
import Panel from '@/components/Panel.vue';
import Button from '@/components/Button.vue';
import ResultList from '@/views/result/ResultList.vue';
import ResultStatistic from '@/views/result/ResultStatistic.vue';
import {useI18n} from "vue-i18n";
......
......@@ -183,7 +183,7 @@
</template>
<script setup lang="ts">
import {computed, defineProps, onMounted, reactive, ref, toRefs, watch} from "vue";
import {computed, defineProps, onMounted, reactive, ref, toRefs} from "vue";
import {PageTab} from "@/store/tabs";
import {useI18n} from "vue-i18n";
import {useStore} from "vuex";
......@@ -253,13 +253,13 @@ function toggleItemCollapsed(item) {
}
const exec = (scope): void => {
const testType = report.value.testType;
if (testType === "func") {
const testType2 = report.value.testType;
if (testType2 === "func") {
const caseMap = getCaseIdsInReport(report.value)
const cases = caseMap[scope]
bus.emit(settings.eventExec, {execType: 'ztf', scripts: cases});
} else if (testType === "unit") {
} else if (testType2 === "unit") {
const data = {
execType: 'unit',
cmd: report.value.testCommand,
......
......@@ -45,7 +45,7 @@ import {
defineEmits,
} from "vue";
import { useWindowSize, onClickOutside } from "@vueuse/core";
import { ListItemKey, ListItemProps } from "./ListItem.vue";
import { ListItemKey, ListItemProps } from "@/components/ListItem.vue";
import List from "@/components/List.vue";
export type PopperPosition =
......@@ -74,7 +74,7 @@ const props = withDefaults(
keyName?: string;
checkedKey?: ListItemKey;
checkedTab?: ListItemKey;
replaceFields?: Record<string, string>; // {title: 'name'}
replaceFields?: Record<string, string>;
defaultShow?: boolean;
}>(),
{}
......@@ -127,7 +127,7 @@ const emit = defineEmits<{
): void;
}>();
onClickOutside(menuRef, (event) => {
onClickOutside(menuRef, (_event) => {
if (state.showed) {
_toggle(false);
}
......@@ -237,7 +237,7 @@ onMounted(() => {
}
const triggerEvent = props.triggerEvent ?? "click";
const handler = (event: Event) => {
const handler = (_event) => {
if (state.showed) {
_toggle(false);
} else if (!state.show) {
......@@ -256,7 +256,7 @@ onMounted(() => {
const activeKey = computed(() => props.checkedTab);
const tabRef = ref(null);
const onTabClick = (event, tab, index) => {
const onTabClick = (_event, tab) => {
emit("tabChanged", tab);
};
......
......@@ -19,7 +19,6 @@ import { useI18n } from "vue-i18n";
import {
computed,
defineExpose,
onMounted,
withDefaults,
ref,
defineProps,
......
......@@ -88,17 +88,16 @@ import {
} from "vue";
import { useI18n } from "vue-i18n";
import { useStore } from "vuex";
import { WorkspaceData } from "../../workspace/store";
import { WorkspaceData } from "../workspace/store";
import { isWindows } from "@/utils/comm";
import { get as getWorkspace } from "@/views/workspace/service";
import Form from "@/components/Form.vue";
import FormItem from "@/components/FormItem.vue";
import notification from "@/utils/notification";
import { useForm } from "@/utils/form";
import Switch from "@/components/Switch.vue";
import { ZentaoData } from "@/store/zentao";
import {queryCase} from "@/services/zentao";
import notification from "@/utils/notification";
import Table from "@/components/Table.vue";
export interface FormWorkspaceProps {
......
......@@ -9,13 +9,12 @@
<script setup lang="ts">
import notification from "@/utils/notification";
import { defineProps, defineExpose } from "vue";
import { defineProps, defineExpose, computed, ref, watch, onMounted, onBeforeUnmount } from "vue";
import { PageTab } from "@/store/tabs";
import { useStore } from "vuex";
import { ScriptData } from "@/views/script/store";
import { computed, ref, watch, onMounted, onBeforeUnmount } from "vue";
import { MonacoOptions, ScriptFileNotExist } from "@/utils/const";
import { resizeHeight, resizeWidth } from "@/utils/dom";
import { resizeHeight } from "@/utils/dom";
import { useI18n } from "vue-i18n";
import MonacoEditor from "@/components/MonacoEditor.vue";
import bus from "@/utils/eventBus";
......
......@@ -51,26 +51,14 @@ import TreeContextMenu from './TreeContextMenu.vue';
import FormSyncFromZentao from "./FormSyncFromZentao.vue";
import bus from "@/utils/eventBus";
import {
getExpandedKeys,
getScriptDisplayBy,
getScriptFilters,
setExpandedKeys,
} from "@/utils/cache";
import {
getCaseIdsFromReport,
getNodeMap,
listFilterItems,
} from "@/views/script/service";
import {getExpandedKeys, getScriptDisplayBy, getScriptFilters, setExpandedKeys } from "@/utils/cache";
import {getCaseIdsFromReport, getNodeMap, listFilterItems, getFileNodesUnderParent, genWorkspaceToScriptsMap } from "@/views/script/service";
import { useRouter } from "vue-router";
import { isWindows } from "@/utils/comm";
import debounce from "lodash.debounce";
import throttle from "lodash.debounce";
import Modal from "@/utils/modal"
import FormNode from "./FormNode.vue";
import { key } from "localforage";
import settings from "@/config/settings";
import {getFileNodesUnderParent, genWorkspaceToScriptsMap} from "@/views/script/service";
const { t } = useI18n();
......@@ -208,7 +196,7 @@ watch(currProduct, () => {
initData()
}, { deep: true })
watch(treeData, (currConfig) => {
watch(treeData, () => {
console.log('watch treeData', treeData.value)
onTreeDataChanged()
}, { deep: true })
......@@ -230,12 +218,6 @@ const onTreeDataChanged = async () => {
console.log('cachedKeys', currSite.value.id, currProduct.value.id)
if (cachedKeys) expandedKeys.value = cachedKeys
if (!cachedKeys || cachedKeys.length === 0) {
// 修改
// getOpenKeys(treeData.value[0], false) // expend first level folder
// await setExpandedKeys(currSite.value.id, currProduct.value.id, expandedKeys.value)
}
})
}
......@@ -292,7 +274,7 @@ const getOpenKeys = (treeNode: any, openAll: boolean) => { // expand top one lev
expandedKeys.value.push(treeNode.path)
if (treeNode.children && openAll) {
treeNode.children.forEach((item, index) => {
treeNode.children.forEach((item) => {
getOpenKeys(item, openAll)
})
}
......@@ -351,14 +333,12 @@ const checkNode = (keys) => {
console.log('checkNode', keys.checked)
store.dispatch('Script/setCheckedNodes', keys.checked)
let checkedKeysTmp:string[] = [];
for(let key in keys.checked){
if(keys.checked[key] === true){
checkedKeysTmp.push(key)
for(let checkedKey in keys.checked){
if(keys.checked[checkedKey] === true){
checkedKeysTmp.push(checkedKey)
}
}
checkedKeys.value = checkedKeysTmp;
// scriptStore.dispatch('Script/changeWorkspace',
// {id: e.node.dataRef.workspaceId, type: e.node.dataRef.workspaceType})
}
const checkNothing = () => {
......@@ -367,9 +347,9 @@ const checkNothing = () => {
const execSelected = () => {
let arr = [] as string[]
checkedKeys.value.forEach(item => {
if (treeDataMap.value[item]?.type === 'file') {
arr.push(treeDataMap.value[item])
checkedKeys.value.forEach(checkedKey => {
if (treeDataMap.value[checkedKey]?.type === 'file') {
arr.push(treeDataMap.value[checkedKey])
}
})
bus.emit(settings.eventExec, { execType: 'ztf', scripts: arr });
......@@ -378,7 +358,7 @@ const execSelected = () => {
const nameFormVisible = ref(false)
const treeDataMap = computed<any>(() => store.state.Script.treeDataMap);
const getNodeMapCall = throttle(async () => {
const getNodeMapCall = debounce(async () => {
treeData.value.forEach(item => {
getNodeMap(item, treeDataMap.value)
})
......@@ -658,21 +638,21 @@ onUnmounted(() => {
<style lang="less" scoped>
.left-pannel-contain{
text-align: center;
.workdir {
height: calc(100vh - 80px);
overflow: auto;
text-align: left;
}
.workdir-with-btn {
height: calc(100vh - 120px);
overflow: auto;
text-align: left;
}
.run-selected{
max-width: 100px;
margin: auto;
text-align: center;
margin-top: 10px;
}
.workdir {
height: calc(100vh - 80px);
overflow: auto;
text-align: left;
}
.workdir-with-btn {
height: calc(100vh - 120px);
overflow: auto;
text-align: left;
}
.run-selected{
max-width: 100px;
margin: auto;
text-align: center;
margin-top: 10px;
}
}
</style>
......@@ -67,7 +67,7 @@
</template>
<script setup lang="ts">
import {computed, defineComponent, onMounted, onUnmounted, ref, watch} from "vue";
import {computed, ref, watch} from "vue";
import Panel from '@/components/Panel.vue';
import Button from '@/components/Button.vue';
......@@ -80,12 +80,7 @@ import {ZentaoData} from "@/store/zentao";
import debounce from "lodash.debounce";
import {useI18n} from "vue-i18n";
import {ScriptData} from "@/views/script/store";
import {
genWorkspaceToScriptsMap,
listFilterItems,
getCaseIdsFromReport,
getSyncFromInfoFromMenu, getNodeMap, getFileNodesUnderParent, updateNameReq
} from "@/views/script/service";
import { listFilterItems } from "@/views/script/service";
import FormWorkspace from "@/views/workspace/FormWorkspace.vue";
import notification from "@/utils/notification";
import FilterModal from "./FilterModal.vue";
......
......@@ -57,27 +57,16 @@
</template>
<script setup lang="ts">
import { defineProps, defineEmits } from "vue";
import { defineProps, defineEmits, computed, onMounted, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
import {
computed,
onMounted,
ref,
watch,
} from "vue";
import { momentUtcDef } from "@/utils/datetime";
import Table from "@/components/Table.vue";
import notification from "@/utils/notification";
import Modal from "@/utils/modal";
import Button from "@/components/Button.vue";
import LanguageSettings from "./LanguageSettings.vue";
import {saveInterpreter} from "@/views/interpreter/service";
import {
listInterpreter,
removeInterpreter,
} from "@/views/interpreter/service";
import {saveInterpreter,listInterpreter, removeInterpreter, getLangSettings} from "@/views/interpreter/service";
import FormInterpreter from "@/views/interpreter/FormInterpreter.vue";
import { getLangSettings } from "@/views/interpreter/service";
const props = defineProps<{
show: boolean;
......@@ -196,7 +185,6 @@ const createInterpreter = (formData) => {
saveInterpreter(formData).then((json) => {
if (json.code === 0) {
formInterpreter.value.clearFormData();
// notification.success({ message: t("save_success") });
showCreateInterpreterModal.value = false;
list();
}
......
......@@ -34,16 +34,7 @@
<script setup lang="ts">
import { useI18n } from "vue-i18n";
import { useStore } from "vuex";
import {
computed,
defineExpose,
onMounted,
withDefaults,
ref,
defineProps,
defineEmits,
watch,
} from "vue";
import {computed, defineExpose, withDefaults, ref, defineProps, defineEmits, watch} from "vue";
import { useForm } from "@/utils/form";
import Form from "@/components/Form.vue";
import FormItem from "@/components/FormItem.vue";
......
......@@ -43,7 +43,7 @@
@click="selectProduct"
:replaceFields="replaceFields"
/>
<SitesModal
<SitesModal
:show="showSitesModal"
@cancel="sitesModalClose"
:showOkBtn="false"
......@@ -111,7 +111,7 @@ const showZentaoMsg = (payload): void => {
}
}
const openSiteManagementTab = (showCreateSiteModal?: boolean) => {
const openSiteManagementTab = () => {
console.log('openSiteManagementModal');
showSitesModal.value = true;
};
......
......@@ -70,10 +70,8 @@
</template>
<script setup lang="ts">
import { defineProps, defineEmits } from "vue";
import { PageTab } from "@/store/tabs";
import { defineProps, defineEmits, ref } from "vue";
import { useI18n } from "vue-i18n";
import { ref, computed } from "vue";
import { useStore } from "vuex";
import { StateType } from "@/views/site/store";
import { momentUtcDef } from "@/utils/datetime";
......@@ -81,7 +79,6 @@ import { momentUtcDef } from "@/utils/datetime";
import List from "@/components/List.vue";
import ListItem from "@/components/ListItem.vue";
import Icon from "@/components/Icon.vue";
import notification from "@/utils/notification";
import Modal from "@/utils/modal";
import Button from "@/components/Button.vue";
import FormSite from "@/views/site/FormSite.vue";
......@@ -124,9 +121,8 @@ const remove = (item) => {
okText: t("confirm"),
cancelText: t("cancel"),
onOk: async () => {
store.dispatch("Site/delete", item.id).then((success) => {
store.dispatch("Zentao/fetchSitesAndProduct").then((success) => {
// notification.success(t("delete_success"));
store.dispatch("Site/delete", item.id).then((_success) => {
store.dispatch("Zentao/fetchSitesAndProduct").then((_success2) => {
fetchSites();
});
});
......@@ -145,12 +141,11 @@ const createSite = (formData) => {
if(formDataNew.url.indexOf("http") !== 0) {
formDataNew.url = "http://" + formDataNew.url;
}
store.dispatch('Site/save', formDataNew).then((response) => {
if (response) {
store.dispatch('Site/save', formDataNew).then((success) => {
if (success) {
formSite.value.clearFormData()
showCreateSiteModal.value = false;
store.dispatch('Zentao/fetchSitesAndProduct').then((success) => {
// notification.success({message: t('save_success')});
store.dispatch('Zentao/fetchSitesAndProduct').then((_success2) => {
fetchSites();
});
}
......
......@@ -57,16 +57,7 @@ import { useStore } from "vuex";
import { ZentaoData } from "@/store/zentao";
import { unitTestTypesDef, ztfTestTypesDef } from "@/utils/const";
import {
computed,
defineExpose,
onMounted,
withDefaults,
ref,
defineProps,
defineEmits,
watch,
} from "vue";
import {computed, defineExpose, withDefaults, ref, defineProps, defineEmits, watch,} from "vue";
import { useForm } from "@/utils/form";
import Form from "@/components/Form.vue";
import FormItem from "@/components/FormItem.vue";
......@@ -127,7 +118,7 @@ const rulesRef = ref({
cmd: [
{
trigger: 'blur',
validator: async (rule: any, value: string) => {
validator: async (_rule: any, value: string) => {
if (modelRef.value.type !== 'ztf' && (value === '' || !value)) {
throw new Error(t('pls_cmd'));
}
......@@ -159,9 +150,8 @@ const selectDir = () => {
const { ipcRenderer } = window.require('electron')
ipcRenderer.send(settings.electronMsg, 'selectDir')
ipcRenderer.on(settings.electronMsgReplay, (event, arg) => {
console.log(arg)
modelRef.value.path = arg
ipcRenderer.on(settings.electronMsgReplay, (_event, arg) => {
modelRef.value.path = arg
})
}
......
......@@ -12,20 +12,7 @@ module.exports = {
host: '0.0.0.0',//set minpc accessible
port: VUE_APP_PORT || 8000,
disableHostCheck: true,
// 配置反向代理
/*
proxy: {
'/api': {
target: '<url>',
ws: true,
changeOrigin: true
},
'/foo': {
target: '<other_url>'
}
},
*/
before: function(app, server) {
before: function(_app, _server) {
}
},
css: {
......
......@@ -62,8 +62,5 @@ sips -z 32 32 ztf.png --out tmp.iconset/icon_32x32.png
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 go build -ldflags "-X 'commConsts.appVersion=3.0.0' -X 'commConsts.buildTime=Mon Jul 25 09:31:39 2022 +0800' -X 'commConsts.goVersion=go version go1.17.1 darwin/amd64
' -X 'commConsts.gitHash=d118c05ae38d76231abfb6430e52ec517e080f50'" -x -v -ldflags "-s -w" -o client/bin/win32/ztf.exe cmd/command/main.go cmd/command/main.syso
sonar-scanner \
-Dsonar.projectKey=ztf \
-Dsonar.sources=. \
-Dsonar.host.url=http://localhost:59001 \
-Dsonar.login=sqp_94f2484e50b1cfea719eb791f4e5d544be887f87
cd ui && yarn lint && cd ..
sonar-scanner
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册