mirror of
https://github.com/go-gost/gost-ui.git
synced 2024-08-11 17:53:29 +00:00
fix
This commit is contained in:
@@ -8,7 +8,8 @@ import {
|
||||
import { Button, Dropdown, Form, Space } from "antd";
|
||||
import { DownOutlined } from "@ant-design/icons";
|
||||
import { jsonFormat, jsonStringFormat, jsonParse } from "../../uitls";
|
||||
import { MonacoEditor } from "../../uitls/userMonacoWorker";
|
||||
import * as monaco from "monaco-editor";
|
||||
import { MonacoEditor, getModel, model, modelUri } from "../../uitls/userMonacoWorker";
|
||||
import { Template } from "../../templates";
|
||||
import { render } from "react-dom";
|
||||
import { useServerConfig } from "../../uitls/server";
|
||||
@@ -92,6 +93,7 @@ const JsonForm: React.FC<JsonFromProps> = (props) => {
|
||||
formRef={formRef}
|
||||
modalProps={{
|
||||
destroyOnClose: true,
|
||||
maskClosable: false,
|
||||
}}
|
||||
>
|
||||
{hasTemplate ? (
|
||||
@@ -193,7 +195,12 @@ const JsonForm: React.FC<JsonFromProps> = (props) => {
|
||||
// selectOnLineNumbers: true,
|
||||
minimap: { enabled: false },
|
||||
// readOnly: readOnly,
|
||||
// json 数据格式测试
|
||||
// model: monaco.editor.createModel('', "json", modelUri)
|
||||
// model: getModel('')
|
||||
// model: model
|
||||
}}
|
||||
|
||||
></MonacoEditor>
|
||||
</Form.Item>
|
||||
</ModalForm>
|
||||
|
||||
@@ -138,7 +138,7 @@ const PublicList: React.FC<PublicListProps> = (props) => {
|
||||
<div style={{ height: 348, overflow: "auto" }}>
|
||||
<Table
|
||||
rowKey={(obj) => obj._id_ || obj.name}
|
||||
scroll={{ y: 246 }}
|
||||
scroll={{ y: 290 }}
|
||||
size="small"
|
||||
dataSource={showList}
|
||||
columns={[
|
||||
@@ -275,6 +275,7 @@ const PublicList: React.FC<PublicListProps> = (props) => {
|
||||
},
|
||||
},
|
||||
]}
|
||||
pagination={false}
|
||||
></Table>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -16,7 +16,7 @@ export const getRedisTemplate = (name: string, type?: string) => {
|
||||
"addr": "127.0.0.1:6379",
|
||||
"db": "1",
|
||||
"password": "123456",
|
||||
${type ? `"type": "${type}"` : ""}
|
||||
${type ? `"type": "${type}",` : ""}
|
||||
"key": "gost:${name}-0"
|
||||
}
|
||||
}`;
|
||||
|
||||
@@ -30,12 +30,47 @@ self.MonacoEnvironment = {
|
||||
return new editorWorker();
|
||||
},
|
||||
};
|
||||
|
||||
var modelUri = monaco.Uri.parse("a://b/foo.json"); // a made up unique URI for our model
|
||||
var getModel = (value: string) => {
|
||||
return monaco.editor.createModel(value, "json", modelUri);
|
||||
};
|
||||
var model = getModel('');
|
||||
|
||||
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
||||
allowComments: true,
|
||||
trailingCommas: "warning",
|
||||
validate: true,
|
||||
// json 数据格式测试
|
||||
schemas: [
|
||||
{
|
||||
uri: "http://gost/config.json", // id of the first schema
|
||||
fileMatch: [modelUri.toString()], // associate with our model
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
p1: {
|
||||
enum: ["v1", "v2"],
|
||||
},
|
||||
p2: {
|
||||
$ref: "http://myserver/bar-schema.json", // reference the second schema
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
uri: "http://myserver/bar-schema.json", // id of the second schema
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
q1: {
|
||||
enum: ["x1", "x2"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
||||
|
||||
export {
|
||||
MonacoEditor
|
||||
}
|
||||
export { MonacoEditor, modelUri, getModel, model };
|
||||
|
||||
Reference in New Issue
Block a user