|
@@ -3,71 +3,121 @@
|
|
|
<div class="app-header">
|
|
|
Flow
|
|
|
</div>
|
|
|
- <div class="app-flow-container">
|
|
|
- <div class="app-info">
|
|
|
- <h4>TODO:</h4>
|
|
|
- <ul>
|
|
|
- <li>Load the functions from server registry</li>
|
|
|
- <li>Create session based collaboration</li>
|
|
|
- <li>Build the graph on the server</li>
|
|
|
- <li>Create training mechanism</li>
|
|
|
- <li>matrix pooling</li>
|
|
|
- <li>Group nodes into a single box, exposing inputs and outputs</li>
|
|
|
- </ul>
|
|
|
+ <div class="app-horizontal">
|
|
|
+ <div class="app-flow-container">
|
|
|
+ <div class="app-watermark">PROTOTYPE</div>
|
|
|
+ <div class="app-info">
|
|
|
+ <h4>HELP</h4>
|
|
|
+ <ul>
|
|
|
+ <li><b>Pan</b>: Drag with Middle Mouse button</li>
|
|
|
+ <li><b>Zoom</b>: Mouse wheel up and down to zoom in and out</li>
|
|
|
+ <li><b>New Node</b>: Create a node by clicking on fn: buttons</li>
|
|
|
+ <li><b>Remove Node</b>: Middle click in a node to remove a node</li>
|
|
|
+ <li><b>Drag Node</b>: Mouse click and drag</li>
|
|
|
+ <li><b>Link two nodes</b>: Drag from any slot to any compatible in another node (in green)</li>
|
|
|
+ <li><b>Remove Link</b>: Simple click on the link when it turns red</li>
|
|
|
+ </ul>
|
|
|
|
|
|
- </div>
|
|
|
+ <h4>TODO:</h4>
|
|
|
+ <ul>
|
|
|
+ <li>Data visualizer: Special nodes with display capabilities</li>
|
|
|
+ <li>Visualiser: Group nodes into a single box, exposing inputs and outputs</li>
|
|
|
+ <li>Visualiser: Implement touch</li>
|
|
|
+ <li>Registry: Synchronize registry with server(GET)</li>
|
|
|
+ <li>Collaboration: Better concurrent editing/message passing</li>
|
|
|
+ <li>Collaboration: Improve document synchronization</li>
|
|
|
+ <li>FlowServer: Build the graph on the server and run</li>
|
|
|
+ <li>FlowPkg: Create training mechanism</li>
|
|
|
+ <li>FlowPkg: matrix pooling function example</li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!--:value="nodeData"
|
|
|
+ @input="documentUpdate"-->
|
|
|
+ <flow-manager
|
|
|
+ :registry="registry"
|
|
|
+ v-model="nodeData"
|
|
|
+
|
|
|
+ @linkUpdate="sendFlowEvent('linkUpdate',$event)"
|
|
|
+ @linkRemove="sendFlowEvent('linkRemove',$event)"
|
|
|
|
|
|
- <div class="app-watermark">PROTOTYPE</div>
|
|
|
- <flow-manager
|
|
|
- :registry="registry"
|
|
|
- :value="nodeData"
|
|
|
- @input="documentUpdate"
|
|
|
- width="100%"
|
|
|
- height="100%"/>
|
|
|
+ @nodeUpdate="sendFlowEvent('nodeUpdate',$event)"
|
|
|
+ @nodeRemove="sendFlowEvent('nodeRemove',$event)"
|
|
|
+ @shouldPersist="sendDocumentUpdate"
|
|
|
+
|
|
|
+ width="100%"
|
|
|
+ height="100%"/>
|
|
|
+ </div>
|
|
|
+ <div class="app-chat">
|
|
|
+ <app-chat/>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import AppChat from '@/components/chat'
|
|
|
import FlowManager from '@/components/flow/manager'
|
|
|
import 'reset-css/reset.css'
|
|
|
import '@/assets/style.css'
|
|
|
-import nodeData from './nodedata'
|
|
|
+// import nodeData from './nodedata'
|
|
|
|
|
|
export default {
|
|
|
- components: {FlowManager},
|
|
|
+ components: {FlowManager, AppChat},
|
|
|
data () {
|
|
|
return {
|
|
|
- registry: nodeData.registry,
|
|
|
+ registry: {
|
|
|
+ 'MatMul': { inputs: [ '[]float32', '[]float32' ], output: '[]float32', style: { 'color': '#789', 'textColor': '#fff' } },
|
|
|
+ 'Weights': { inputs: [], output: '[]float32' },
|
|
|
+ 'Input': { inputs: [], output: '[]float32', style: { 'color': '#686', 'textColor': '#fff' } },
|
|
|
+ 'Activator': { inputs: [ '[]float32' ], output: '[]float32', 'type': 'circle', style: { 'color': '#a44', 'textColor': 'white' } },
|
|
|
+ 'test': { inputs: [ '[]float32', 'string' ], output: 'string' },
|
|
|
+ 'reverse': { inputs: [ 'string' ], output: 'string' }
|
|
|
+ },
|
|
|
nodeData: {nodes: [], links: []}
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
mounted () {
|
|
|
- // Make this in a service
|
|
|
- this.$ws.recv((msg) => {
|
|
|
- switch (msg.op) {
|
|
|
- case 'sessionSwitch':
|
|
|
- this.$router.push('/' + msg.data) // Swap to ID
|
|
|
- break
|
|
|
- case 'document':
|
|
|
- // Transform here
|
|
|
- if (!msg.data) break
|
|
|
- this.nodeData = {
|
|
|
- nodes: msg.data.nodes || this.nodeData.nodes,
|
|
|
- links: msg.data.links || this.nodeData.links
|
|
|
- }
|
|
|
- break
|
|
|
+ // Handle incoming things
|
|
|
+ this.$flowService.on('sessionJoin', (v) => {
|
|
|
+ if (v.id !== this.$route.params.sessId) {
|
|
|
+ this.$router.push('/' + v.id) // Swap to ID
|
|
|
}
|
|
|
})
|
|
|
- if (this.$route.params.sessId === undefined) {
|
|
|
- this.$ws.send({op: 'sessionNew'})
|
|
|
- return
|
|
|
- }
|
|
|
- this.$ws.send({op: 'sessionLoad', data: this.$route.params.sessId})
|
|
|
+ this.$flowService.on('document', (v) => {
|
|
|
+ if (!v.data) return
|
|
|
+ this.nodeData = {
|
|
|
+ nodes: v.data.nodes || [],
|
|
|
+ links: v.data.links || []
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ this.$flowService.on('nodeUpdate', (v) => {
|
|
|
+ const node = v.data
|
|
|
+ const nd = this.nodeData
|
|
|
+ const idx = nd.nodes.findIndex(n => n.id === node.id)
|
|
|
+ if (idx === -1) { // new node
|
|
|
+ nd.nodes.push(node)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$set(nd.nodes, idx, node) // new Node
|
|
|
+ })
|
|
|
+ // Connected
|
|
|
+ this.$flowService.connected(() => {
|
|
|
+ // Make this in a service
|
|
|
+ if (this.$route.params.sessId === undefined) {
|
|
|
+ this.$flowService.sessionNew()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$flowService.sessionLoad(undefined, this.$route.params.sessId)
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
- documentUpdate (nodeData) {
|
|
|
- this.$ws.send({op: 'documentUpdate', data: nodeData})
|
|
|
+ sendFlowEvent (type, param) {
|
|
|
+ this.$flowService[type](param)
|
|
|
+ },
|
|
|
+ // Update individual nodes/links
|
|
|
+ sendDocumentUpdate (nodeData) {
|
|
|
+ this.$flowService.documentUpdate(this.nodeData, this.$route.params.sessId)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -99,14 +149,13 @@ export default {
|
|
|
font-weight:bold;
|
|
|
}
|
|
|
.flow-main .app-info {
|
|
|
- box-shadow:0px 1px 1px rgba(150,150,0,0.2);
|
|
|
- color: #999;
|
|
|
- background: #FfFfdd;
|
|
|
+ color: #aaa;
|
|
|
+ font-size:10px;
|
|
|
margin:20px;
|
|
|
padding:20px;
|
|
|
position:absolute;
|
|
|
left:0;
|
|
|
- bottom:10%;
|
|
|
+ bottom:3%;
|
|
|
}
|
|
|
|
|
|
.flow-main .app-watermark {
|
|
@@ -117,7 +166,20 @@ export default {
|
|
|
font-size:100px;
|
|
|
color: #f4f4f4;
|
|
|
text-shadow: 1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.05);
|
|
|
-
|
|
|
+}
|
|
|
+.app-horizontal {
|
|
|
+ height:100%;
|
|
|
+ max-height:100%;
|
|
|
+ display:flex;
|
|
|
+ position:relative;
|
|
|
+ flex-flow:row;
|
|
|
+ overflow:hidden;
|
|
|
+}
|
|
|
+.app-chat {
|
|
|
+ position:absolute;
|
|
|
+ top:0px;
|
|
|
+ right:0px;
|
|
|
+ height:100%;
|
|
|
}
|
|
|
|
|
|
</style>
|