Skip to content

Commit

Permalink
add general module
Browse files Browse the repository at this point in the history
  • Loading branch information
VillanCh committed Mar 20, 2022
1 parent 34b1288 commit 07e2280
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 59 deletions.
6 changes: 2 additions & 4 deletions app/renderer/src/main/src/components/HTTPFlowTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1034,9 +1034,7 @@ export const HTTPFlowTable: React.FC<HTTPFlowTableProp> = (props) => {
headRender: () => "操作",
cellRender: ({rowData}: any) => {
return (
<Button
size={"small"}
type={"link"}
<a
onClick={(e) => {
let m = showDrawer({
width: "80%",
Expand All @@ -1048,7 +1046,7 @@ export const HTTPFlowTable: React.FC<HTTPFlowTableProp> = (props) => {
}}
>
详情
</Button>
</a>
)
}
}
Expand Down
73 changes: 43 additions & 30 deletions app/renderer/src/main/src/pages/invoker/YakScriptCreator.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, {useEffect, useState} from "react";
import {Button, Card, Form, List, Popconfirm, Space, Tag} from "antd";
import {Button, Card, Checkbox, Form, List, Popconfirm, Space, Tag, Tooltip} from "antd";
import {InputItem, ManyMultiSelectForString, ManySelectOne, SelectOne, SwitchItem} from "../../utils/inputUtil";
import {YakScript, YakScriptParam} from "./schema";
import {HTTPPacketEditor, YakCodeEditor, YakEditor} from "../../utils/editors";
import {PlusOutlined} from "@ant-design/icons";
import {PlusOutlined, QuestionCircleOutlined} from "@ant-design/icons";
import {showDrawer, showModal} from "../../utils/showModal";
import {failed, info} from "../../utils/notification";
import {putValueToParams, YakScriptParamsSetter} from "./YakScriptParamsSetter";
Expand Down Expand Up @@ -31,7 +31,8 @@ export const YakScriptCreatorForm: React.FC<YakScriptCreatorFormProp> = (props)
Id: 0,
Params: [],
ScriptName: "",
Type: "yak"
Type: "yak",
IsGeneralModule: false,
});
const [paramsLoading, setParamsLoading] = useState(false);
const [modified, setModified] = useState<YakScript | undefined>(props.modified);
Expand Down Expand Up @@ -230,33 +231,45 @@ export const YakScriptCreatorForm: React.FC<YakScriptCreatorFormProp> = (props)
</List>
</Form.Item> : ""}
<Form.Item label={"源码"} help={<>
<Button icon={<FullscreenOutlined/>}
onClick={() => {
setFullscreen(true)
let m = showDrawer({
title: "Edit Code",
width: "100%",
closable: false,
keyboard: false,
content: <>
<YakScriptLargeEditor
script={params}
onExit={(data) => {
m.destroy()
setFullscreen(false)
ipcRenderer.invoke("QueryYakScript", {})
}}
onUpdate={(data: YakScript) => {
props.onChanged && props.onChanged(data)
setParams({...data})
}}
/>
</>
})
}}
type={"link"} style={{
marginBottom: 12, marginTop: 6
}}>大屏模式</Button>
<Space>
<Button icon={<FullscreenOutlined/>}
onClick={() => {
setFullscreen(true)
let m = showDrawer({
title: "Edit Code",
width: "100%",
closable: false,
keyboard: false,
content: <>
<YakScriptLargeEditor
script={params}
onExit={(data) => {
m.destroy()
setFullscreen(false)
ipcRenderer.invoke("QueryYakScript", {})
}}
onUpdate={(data: YakScript) => {
props.onChanged && props.onChanged(data)
setParams({...data})
}}
/>
</>
})
}}
type={"link"} style={{
marginBottom: 12, marginTop: 6
}}>大屏模式</Button>
<Checkbox name={"默认启动"} style={{
marginBottom: 12, marginTop: 6
}} checked={params.IsGeneralModule}
onChange={() => setParams({...params, IsGeneralModule: !params.IsGeneralModule})}>
默认启动 <Tooltip
title={"设置默认启动后,将在恰当时候启动启动该插件,同时将会自动增加到【明显】位置"}
>
<Button type={"link"} icon={<QuestionCircleOutlined/>}/>
</Tooltip>
</Checkbox>
</Space>
</>}>
{!fullscreen && <div style={{height: 400}}>
<YakEditor
Expand Down
25 changes: 0 additions & 25 deletions app/renderer/src/main/src/pages/yakitStore/PluginOperator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -355,31 +355,6 @@ export const PluginManagement: React.FC<PluginManagementProps> = React.memo<Plug

return (
<Space style={{...style}} direction={props.vertical ? "vertical" : "horizontal"}>
{/* <Button
type={"link"}
onClick={(e) => {
let m = showDrawer({
title: `修改插件: ${script?.ScriptName}`,
width: "100%",
content: (
<>
<YakScriptCreatorForm
modified={script}
onChanged={(i) => update()}
onCreated={() => {
m.destroy()
}}
/>
</>
),
keyboard: false
})
}}
icon={<EditOutlined />}
size={"small"}
>
修改插件
</Button> */}
<Popover
title={`添加到左侧菜单栏中[${script?.Id}]`}
content={<>{script && <AddToMenuActionForm script={script} updateGroups={updateGroups}/>}</>}
Expand Down

0 comments on commit 07e2280

Please sign in to comment.