diff --git a/src/renderer/declare/dva.d.ts b/src/renderer/declare/dva.d.ts index 9119d64..95b8178 100644 --- a/src/renderer/declare/dva.d.ts +++ b/src/renderer/declare/dva.d.ts @@ -1,12 +1,11 @@ -import { Action, AnyAction, Reducer } from 'redux'; +import { Action, AnyAction, Reducer } from "redux"; import { EffectsCommandMap, Model } from "dva"; declare type Effect = ( - action: AnyAction, + action: AnyAction & { payload: any }, effects: EffectsCommandMap & { select: (func: (state: S) => T) => T } -) => void; +) => any; -// @ts-ignore declare interface ModelType extends Model { namespace: string; state?: S; diff --git a/src/renderer/global.css b/src/renderer/global.css index 5c30393..d9324a9 100644 --- a/src/renderer/global.css +++ b/src/renderer/global.css @@ -1,108 +1,82 @@ html, body, #root { - height: 100%; + height: 100%; } body { - margin: 0; - -webkit-user-select: none; + margin: 0; + -webkit-user-select: none; } ::-webkit-scrollbar { - /*滚动条整体样式*/ - width: 8px; /*高宽分别对应横竖滚动条的尺寸*/ - height: 8px; + /*滚动条整体样式*/ + width: 8px; /*高宽分别对应横竖滚动条的尺寸*/ + height: 8px; } ::-webkit-scrollbar-thumb { - /*滚动条里面小方块*/ - border-radius: 5px; - /*-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);*/ - background: #e0e0e0; + /*滚动条里面小方块*/ + border-radius: 5px; + /*-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);*/ + background: #e0e0e0; } ::-webkit-scrollbar-track { - /*滚动条里面轨道*/ - /*-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);*/ - border-radius: 0; - background: #f7f7f7; + /*滚动条里面轨道*/ + /*-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);*/ + border-radius: 0; + background: #f7f7f7; } .Resizer { - background: #000; - opacity: 0.2; - z-index: 1; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - -moz-background-clip: padding; - -webkit-background-clip: padding; - background-clip: padding-box; + background: #000; + opacity: 0.2; + z-index: 1; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + -moz-background-clip: padding; + -webkit-background-clip: padding; + background-clip: padding-box; } .Resizer:hover { - -webkit-transition: all 2s ease; - transition: all 2s ease; + -webkit-transition: all 2s ease; + transition: all 2s ease; } .Resizer.horizontal { - height: 11px; - margin: -5px 0; - border-top: 5px solid rgba(255, 255, 255, 0); - border-bottom: 5px solid rgba(255, 255, 255, 0); - cursor: row-resize; - width: 100%; + height: 11px; + margin: -5px 0; + border-top: 5px solid rgba(255, 255, 255, 0); + border-bottom: 5px solid rgba(255, 255, 255, 0); + cursor: row-resize; + width: 100%; } .Resizer.horizontal:hover { - border-top: 5px solid rgba(0, 0, 0, 0.5); - border-bottom: 5px solid rgba(0, 0, 0, 0.5); + border-top: 5px solid rgba(0, 0, 0, 0.5); + border-bottom: 5px solid rgba(0, 0, 0, 0.5); } .Resizer.vertical { - width: 11px; - margin: 0 -5px; - border-left: 5px solid rgba(255, 255, 255, 0); - border-right: 5px solid rgba(255, 255, 255, 0); - cursor: col-resize; + width: 11px; + margin: 0 -5px; + border-left: 5px solid rgba(255, 255, 255, 0); + border-right: 5px solid rgba(255, 255, 255, 0); + cursor: col-resize; } .Resizer.vertical:hover { - border-left: 5px solid rgba(0, 0, 0, 0.5); - border-right: 5px solid rgba(0, 0, 0, 0.5); + border-left: 5px solid rgba(0, 0, 0, 0.5); + border-right: 5px solid rgba(0, 0, 0, 0.5); } .Resizer.disabled { - cursor: not-allowed; + cursor: not-allowed; } .Resizer.disabled:hover { - border-color: transparent; + border-color: transparent; } - -/*.card-container > .ant-tabs-card > .ant-tabs-content {*/ -/* !*height: 120px;*!*/ -/* margin-top: -16px;*/ -/*}*/ - -/*.card-container > .ant-tabs-card > .ant-tabs-content > .ant-tabs-tabpane {*/ -/* background: #fff !important;*/ -/* !*padding: 16px !important;*!*/ -/*}*/ - -/*.card-container > .ant-tabs-card > .ant-tabs-bar {*/ -/* border-color: #fff !important;*/ -/*}*/ - -/*.card-container > .ant-tabs-card > .ant-tabs-bar .ant-tabs-tab {*/ -/* border-color: transparent !important;*/ -/* background: transparent !important;*/ -/*}*/ - -/*.card-container > .ant-tabs-card > .ant-tabs-bar .ant-tabs-tab-active {*/ -/* border-color: #fff !important;*/ -/* background: #fff !important;*/ -/*}*/ - - diff --git a/src/renderer/pages/home/components/CreateNodeForm.tsx b/src/renderer/pages/home/components/CreateNodeForm.tsx index 791d2c2..78c9149 100644 --- a/src/renderer/pages/home/components/CreateNodeForm.tsx +++ b/src/renderer/pages/home/components/CreateNodeForm.tsx @@ -6,18 +6,23 @@ import TextArea from "antd/lib/input/TextArea"; const { Item } = Form; +export interface CreateData { + zkNodeName: string; + nodeData: string; +} + export interface CreateNodeFormProps extends FormComponentProps { visible: boolean; parentNode: string; onCancel: ModalProps["onCancel"]; - onCreate: (values: any) => void; + onCreate: (values: CreateData) => void; } const CreateNodeForm: React.ComponentType = props => { const { visible, parentNode, onCancel, onCreate, form } = props; - const { getFieldDecorator } = form; + const { getFieldDecorator, validateFields } = form; const onOk = () => { - form.validateFields((err: any, values: any) => { + validateFields((err: any, values: CreateData) => { if (err) return; onCreate(values); }); @@ -45,12 +50,12 @@ const CreateNodeForm: React.ComponentType = props => {
{parentNode} - {getFieldDecorator("zkNodeName", { + {getFieldDecorator("zkNodeName", { rules: [{ required: true, message: "请输入节点名称" }] })()} - {getFieldDecorator("nodeData")( + {getFieldDecorator("nodeData")(