Saving of nodes
This commit is contained in:
parent
c5bec0afa6
commit
08fd2cf4e9
16 changed files with 852 additions and 42 deletions
|
|
@ -4,6 +4,12 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/main.css">
|
||||
<script type="text/javascript">
|
||||
function showError(err) {
|
||||
console.error(err)
|
||||
alert(err)
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">{{ block "page" . }}{{ end }}</div>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,56 @@
|
|||
{{ define "page" }}
|
||||
<script type="module" defer>
|
||||
import { TreeNode } from '/js/{{ .VERSION }}/app.mjs'
|
||||
window._VERSION = '{{ .VERSION }}'
|
||||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"@editor": "/js/{{ .VERSION }}/editor.mjs",
|
||||
"@mbus": "/js/{{ .VERSION }}/mbus.mjs"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
fetch('/nodes/tree/0?depth=2')
|
||||
.then(data => data.json())
|
||||
.then(json => {
|
||||
const top = document.getElementById('nodes')
|
||||
const topNode = new TreeNode(top, json)
|
||||
topNode.render()
|
||||
})
|
||||
<script src="/js/{{ .VERSION }}/lib/jsoneditor.js"></script>
|
||||
<!--<script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>-->
|
||||
<script type="module" defer>
|
||||
import {App, TreeNode} from '/js/{{ .VERSION }}/app.mjs'
|
||||
window._VERSION = '{{ .VERSION }}'
|
||||
window._app = new App()
|
||||
|
||||
fetch('/nodes/tree/0?depth=2')
|
||||
.then(data => data.json())
|
||||
.then(json => {
|
||||
if (!json.OK) {
|
||||
showError(json.Error)
|
||||
return
|
||||
}
|
||||
|
||||
const top = document.getElementById('nodes')
|
||||
const topNode = new TreeNode(top, json.Nodes)
|
||||
topNode.render()
|
||||
})
|
||||
|
||||
</script>
|
||||
<div id="nodes"></div>
|
||||
|
||||
<div id="layout">
|
||||
<div class="section" id="menu">
|
||||
<div class="item" id="logo"><img src="/images/{{ .VERSION }}/logo.svg" /></div>
|
||||
<div class="item" data-section='node' onclick="mbus.dispatch('MENU_ITEM_SELECTED', 'node')">Nodes</div>
|
||||
<div class="item" data-section='type' onclick="mbus.dispatch('MENU_ITEM_SELECTED', 'type')">Types</div>
|
||||
</div>
|
||||
|
||||
<div class="section" id="nodes"></div>
|
||||
<div class="section" id="editor-node">
|
||||
<div class="editor"></div>
|
||||
<div class="controls">
|
||||
<button onclick="mbus.dispatch('EDITOR_NODE_SAVE')">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section" id="types"></div>
|
||||
<div class="section" id="editor-type-schema"></div>
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet" href="/css/{{ .VERSION }}/spectre.min.css">
|
||||
<link rel="stylesheet" href="/css/{{ .VERSION }}/spectre-exp.min.css">
|
||||
<link rel="stylesheet" href="/css/{{ .VERSION }}/spectre-icons.min.css">
|
||||
|
||||
{{ end }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue