提交 5340c115 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

update ui

上级 b96165eb
package page
import (
commConsts "github.com/aaronchen2k/deeptest/internal/comm/consts"
"github.com/aaronchen2k/deeptest/internal/command/ui"
"github.com/aaronchen2k/deeptest/internal/command/ui/widget"
"github.com/aaronchen2k/deeptest/internal/pkg/consts"
"github.com/awesome-gocui/gocui"
"log"
)
func InitMainPage() error {
maxX, maxY := commConsts.Cui.Size()
if maxX < consts.MinWidth {
maxX = consts.MinWidth
}
if maxY < consts.MinHeight {
maxY = consts.MinHeight
}
commConsts.MainViewHeight = maxY - consts.CmdViewHeight
mainView := widget.NewPanelWidget("main", 0, 0, maxX-2, commConsts.MainViewHeight, "")
ui.ViewMap["root"] = append(ui.ViewMap["root"], mainView.Name())
cmdView := widget.NewPanelWidget("cmd", 0, commConsts.MainViewHeight, maxX-2, consts.CmdViewHeight-1, "")
ui.ViewMap["root"] = append(ui.ViewMap["root"], cmdView.Name())
widget.NewHelpWidget()
MainPageKeyBindings()
return nil
}
func MainPageKeyBindings() error {
if err := commConsts.Cui.SetKeybinding("", gocui.KeyCtrlH, gocui.ModNone, widget.ShowHelpFromView); err != nil {
log.Panicln(err)
}
if err := commConsts.Cui.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, ui.Quit); err != nil {
return err
}
ui.SupportScroll("cmd")
v, _ := commConsts.Cui.View("cmd")
v.Autoscroll = true
return nil
}
......@@ -122,7 +122,7 @@ func IgnoreFile(path string) bool {
if strings.Index(path, ".") == 0 ||
path == "bin" || path == "release" || path == "logs" || path == "xdoc" ||
path == "log" || path == "conf" {
path == "log" || path == "logbak" || path == "conf" {
return true
} else {
return false
......
......@@ -11,7 +11,7 @@
"svgo": "svgo -f src/assets/iconsvg --config=src/assets/iconsvg/svgo.yml"
},
"dependencies": {
"@highlightjs/vue-plugin": "^2.1.0",
"@highlightjs/vue-plugin": "2.0.1",
"@toast-ui/editor": "^2.5.3",
"ant-design-vue": "^2.2.8",
"axios": "^0.21.4",
......@@ -19,6 +19,7 @@
"echarts": "^4.9.0",
"localforage": "^1.10.0",
"lodash.debounce": "^4.0.8",
"lodash.throttle": "^4.1.1",
"neffos.js": "^0.1.25",
"nprogress": "^0.2.0",
"vue": "^3.2.18",
......
import { onMounted, onBeforeUnmount, Ref, ref } from 'vue';
import debounce from 'lodash.debounce';
import echarts, { ECharts, EChartOption } from 'echarts';
import 'echarts/theme/macarons';
export default function useEcharts(
labRef: Ref<HTMLDivElement | HTMLCanvasElement | undefined>,
initOption: EChartOption,
theme= 'macarons'
): Ref<echarts.ECharts | undefined> {
let ec: ECharts;
const chart = ref<ECharts>();
const resizeHandler = debounce(() => {
ec.resize();
}, 100);
onMounted(()=> {
if(labRef.value) {
ec = echarts.init(labRef.value, theme);
ec.setOption(initOption);
chart.value = ec;
}
window.addEventListener('resize', resizeHandler);
})
onBeforeUnmount(()=> {
ec.dispose();
window.removeEventListener('resize', resizeHandler);
});
return chart;
}
\ No newline at end of file
/**
* 重置 Antd Form VaildateInfos 为 I18n
* @author LiQingSong
*/
import { computed, ComputedRef } from 'vue';
import { useI18n } from 'vue-i18n';
import { validateInfos } from 'ant-design-vue/lib/form/useForm';
export default function useI18nAntdFormVaildateInfos(infos: validateInfos): ComputedRef<validateInfos> {
const{ t } = useI18n();
const infosNew = computed<validateInfos>(() => {
const vInfos: validateInfos = {};
for (const index in infos) {
vInfos[index] = JSON.parse(JSON.stringify(infos[index]));
if(vInfos[index] && vInfos[index]['help']) {
vInfos[index]['help'] = vInfos[index]['help'].map((item: any)=> typeof(item)=='string' ? t(item) : item.map((item2: any)=> item2 ? t(item2):''));
}
}
return vInfos;
});
return infosNew;
}
\ No newline at end of file
......@@ -35,7 +35,6 @@ import { computed, ComputedRef, defineComponent, onMounted, PropType, Ref, toRef
import { useI18n } from "vue-i18n";
import { BreadcrumbType, RoutesDataItem } from '@/utils/routes';
import BreadCrumbs from '@/components/BreadCrumbs/index.vue';
import SelectLang from '@/components/SelectLang/index.vue';
import ALink from '@/components/ALink/index.vue';
import useTopMenuWidth from "../composables/useTopMenuWidth";
......
......@@ -145,7 +145,7 @@ export default defineComponent({
#indexlayout-right {
position: relative;
flex: 1;
overflow: auto;
overflow: hidden;
background-color: @mainBgColor;
&.fiexd-header {
display: flex;
......
......@@ -5,6 +5,7 @@ export default {
'ztf_name_full': 'ZTF Automated Tool',
'no': 'NO.',
'scope': 'Scope', //
'name': 'Name', //
'path': 'Path',
......
......@@ -5,6 +5,7 @@ export default {
'ztf_name_full': 'ZTF自动化测试工具',
'no': '编号',
'scope': '范围', //
'name': '名称', //
'path': '路径',
......
......@@ -92,7 +92,7 @@ import {
setInterpreter,
} from "@/utils/testing";
import IconSvg from "@/components/IconSvg/index";
import throttle from "lodash.debounce";
import throttle from "lodash.throttle";
interface ConfigFormSetupData {
t: (key: string | number) => string;
......
......@@ -89,7 +89,7 @@ import {WebSocket, WsEventName} from "@/services/websocket";
import {PrefixSpace, resizeWidth, scroll} from "@/utils/dom";
import {genExecInfo, get, getCaseIdsFromReport} from "@/views/exec/service";
import {WsMsg} from "@/views/exec/data";
import throttle from "lodash.debounce";
import throttle from "lodash.throttle";
import {useI18n} from "vue-i18n";
const useForm = Form.useForm;
......
......@@ -81,7 +81,6 @@ import settings from "@/config/settings";
import {WebSocket, WsEventName} from "@/services/websocket";
import {resizeWidth, scroll} from "@/utils/dom";
import {genExecInfo} from "@/views/exec/service";
import throttle from "lodash.debounce";
import {useI18n} from "vue-i18n";
import IconSvg from "@/components/IconSvg/index";
......
......@@ -81,7 +81,6 @@ import settings from "@/config/settings";
import {WebSocket, WsEventName} from "@/services/websocket";
import {resizeWidth, scroll} from "@/utils/dom";
import {genExecInfo} from "@/views/exec/service";
import throttle from "lodash.debounce";
import {useI18n} from "vue-i18n";
import IconSvg from "@/components/IconSvg/index";
......
......@@ -80,7 +80,6 @@ import settings from "@/config/settings";
import {WebSocket, WsEventName} from "@/services/websocket";
import {resizeWidth, scroll} from "@/utils/dom";
import {genExecInfo} from "@/views/exec/service";
import throttle from "lodash.debounce";
import {useI18n} from "vue-i18n";
import IconSvg from "@/components/IconSvg/index";
......
......@@ -96,7 +96,6 @@ import {WebSocket, WsEventName} from "@/services/websocket";
import {resizeWidth, scroll} from "@/utils/dom";
import {genExecInfo} from "@/views/exec/service";
import {getUnitTestFrameworks, getUnitTestTools} from "@/utils/testing";
import throttle from "lodash.debounce";
import {useI18n} from "vue-i18n";
import IconSvg from "@/components/IconSvg/index";
......
......@@ -110,7 +110,7 @@ import {momentTimeDef, percentDef} from "@/utils/datetime";
import {execByDef} from "@/utils/testing";
import {ProjectData} from "@/store/project";
import {hideMenu} from "@/utils/dom";
import throttle from "lodash.debounce";
import throttle from "lodash.throttle";
import {useI18n} from "vue-i18n";
import IconSvg from "@/components/IconSvg/index";
......@@ -158,20 +158,14 @@ export default defineComponent({
const columns = [
{
title: t('index'),
dataIndex: 'index',
width: 150,
customRender: ({text, index}: { text: any; index: number }) => index + 1,
title: t('no'),
dataIndex: 'seq',
},
{
title: t('exec_type'),
dataIndex: 'execBy',
slots: {customRender: 'execBy'},
},
{
title: t('exec_type'),
dataIndex: 'seq',
},
{
title: t('start_time'),
dataIndex: 'startTime',
......
......@@ -45,7 +45,7 @@
<a-button @click="extract" type="primary">{{ t('extract_step') }}</a-button>
</div>
<div class="panel">
<pre><code>{{ script.code }}</code></pre>
<highlightjs v-if="scriptCode" autodetect :code="scriptCode" />
</div>
</div>
</div>
......@@ -59,9 +59,11 @@ import IconSvg from "@/components/IconSvg";
import {ProjectData} from "@/store/project";
import {ScriptData} from "../store";
import {resizeWidth} from "@/utils/dom";
import throttle from "lodash.debounce";
import {Empty, message, notification} from "ant-design-vue";
import {useI18n} from "vue-i18n";
import 'highlight.js/lib/common';
import hljsVuePlugin from "@highlightjs/vue-plugin";
import 'highlight.js/styles/googlecode.css'
interface ListScriptPageSetupData {
t: (key: string | number) => string;
......@@ -69,7 +71,8 @@ interface ListScriptPageSetupData {
treeData: ComputedRef<any[]>;
replaceFields: any,
tree: Ref;
script: any
script: ComputedRef
scriptCode: Ref<string>;
isExpand: Ref<boolean>;
expandNode: (expandedKeys: string[], e: any) => void;
......@@ -84,7 +87,8 @@ interface ListScriptPageSetupData {
export default defineComponent({
name: 'ScriptListPage',
components: {
IconSvg
IconSvg,
highlightjs: hljsVuePlugin.component
},
setup(): ListScriptPageSetupData {
const { t } = useI18n();
......@@ -100,16 +104,15 @@ export default defineComponent({
const treeData = computed<any>(() => store.state.project.scriptTree);
const expandedKeys = ref<string[]>([]);
const getOpenKeys = throttle((treeNode, isAll) => {
const getOpenKeys = (treeNode, isAll) => {
if (!treeNode) return
expandedKeys.value.push(treeNode.path)
if (treeNode.children && isAll) {
treeNode.children.forEach((item, index) => {
getOpenKeys(item, isAll)
})
}
}, 600)
}
expandedKeys.value = []
getOpenKeys(treeData.value[0], false)
......@@ -121,7 +124,8 @@ export default defineComponent({
let tree = ref(null)
const storeScript = useStore<{ script: ScriptData }>();
const script = computed<any>(() => storeScript.state.script.detail);
let script = computed<any>(() => storeScript.state.script.detail);
let scriptCode = ref('')
onMounted(() => {
console.log('onMounted', tree)
......@@ -137,7 +141,11 @@ export default defineComponent({
if (e.selectedNodes.length === 0) return
selectedNode = e.selectedNodes[0]
storeScript.dispatch('script/getScript', selectedNode.props)
scriptCode.value = ''
storeScript.dispatch('script/getScript', selectedNode.props).then(() => {
console.log('===', script)
scriptCode.value = script.value.code
})
}
const expandAll = (e) => {
......@@ -175,6 +183,7 @@ export default defineComponent({
tree,
expandedKeys,
script,
scriptCode,
simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
}
}
......@@ -254,7 +263,7 @@ export default defineComponent({
}
.panel {
padding: 16px;
padding: 0 16px 0 12px;
height: calc(100% - 46px);
overflow: auto;
}
......
......@@ -87,7 +87,7 @@ import {useStore} from "vuex";
import {ProjectData} from "@/store/project";
import {ZentaoData} from "@/store/zentao";
import {syncFromZentao, syncToZentao} from "@/views/sync/service";
import throttle from "lodash.debounce";
import throttle from "lodash.throttle";
import {useRouter} from "vue-router";
const useForm = Form.useForm;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册