feat: remove backend for now

This commit is contained in:
Michal Szczepanski 2024-07-21 22:27:35 +02:00
parent 39f3f679f3
commit 27f77ba8ae
8 changed files with 211 additions and 79 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
tmp
old
data
.venv

View File

@ -1,2 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

View File

@ -1,64 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from enum import IntEnum
log = logging.getLogger(__name__)
class NodeStatus(IntEnum):
ERROR_PREPARING = -201
ERROR_STARTING = -202
ERROR_BUSY = -301
ERROR_STOPPING = -401
STALE = 101
PREPARING = 201
PREPARED = 202
STARTING = 203
READY = 204
BUSY = 301
STOPPING = 401
class Task:
data: any
error: any
result: any
class Queue:
def __init__(self, path: str, nodes: list[Node]):
self.path = path
def add(self, task):
class Node:
def __init__(self, name):
self.name = name
self._state: NodeStatus = NodeStatus.STALE
async def prepare(self, data):
if self._state != NodeStatus.STALE:
return
try:
self._state = NodeStatus.PREPARING
log.debug("preparing")
self._state = NodeStatus.READY
except:
self._state = NodeStatus.ERROR_PREPARING
async def run(self, task: Task):
try:
self._state = NodeStatus.BUSY
log.debug("running")
except:
self._state = NodeStatus.ERROR_BUSY
async def stop(self):
try:
self._state = NodeStatus.STOPPING
log.debug("stopping")
self._state = NodeStatus.STALE
except:
self._state = NodeStatus.ERROR_STOPPING

View File

@ -1,9 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
log = logging.getLogger(__name__)
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
log.debug('start')

View File

@ -20,6 +20,7 @@
"@angular/platform-browser-dynamic": "^18.1.0",
"@angular/router": "^18.1.0",
"@codemirror/lang-python": "^6.1.6",
"@xyflow/system": "^0.0.37",
"codemirror": "^6.0.1",
"codemirror-extension-inline-suggestion": "^0.0.3",
"rxjs": "~7.8.0",
@ -6057,6 +6058,55 @@
"@types/node": "*"
}
},
"node_modules/@types/d3-color": {
"version": "3.1.3",
"resolved": "https://npm.fnexe.com/@types/d3-color/-/d3-color-3.1.3.tgz",
"integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==",
"license": "MIT"
},
"node_modules/@types/d3-drag": {
"version": "3.0.7",
"resolved": "https://npm.fnexe.com/@types/d3-drag/-/d3-drag-3.0.7.tgz",
"integrity": "sha512-HE3jVKlzU9AaMazNufooRJ5ZpWmLIoc90A37WU2JMmeq28w1FQqCZswHZ3xR+SuxYftzHq6WU6KJHvqxKzTxxQ==",
"license": "MIT",
"dependencies": {
"@types/d3-selection": "*"
}
},
"node_modules/@types/d3-interpolate": {
"version": "3.0.4",
"resolved": "https://npm.fnexe.com/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz",
"integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==",
"license": "MIT",
"dependencies": {
"@types/d3-color": "*"
}
},
"node_modules/@types/d3-selection": {
"version": "3.0.10",
"resolved": "https://npm.fnexe.com/@types/d3-selection/-/d3-selection-3.0.10.tgz",
"integrity": "sha512-cuHoUgS/V3hLdjJOLTT691+G2QoqAjCVLmr4kJXR4ha56w1Zdu8UUQ5TxLRqudgNjwXeQxKMq4j+lyf9sWuslg==",
"license": "MIT"
},
"node_modules/@types/d3-transition": {
"version": "3.0.8",
"resolved": "https://npm.fnexe.com/@types/d3-transition/-/d3-transition-3.0.8.tgz",
"integrity": "sha512-ew63aJfQ/ms7QQ4X7pk5NxQ9fZH/z+i24ZfJ6tJSfqxJMrYLiK01EAs2/Rtw/JreGUsS3pLPNV644qXFGnoZNQ==",
"license": "MIT",
"dependencies": {
"@types/d3-selection": "*"
}
},
"node_modules/@types/d3-zoom": {
"version": "3.0.8",
"resolved": "https://npm.fnexe.com/@types/d3-zoom/-/d3-zoom-3.0.8.tgz",
"integrity": "sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw==",
"license": "MIT",
"dependencies": {
"@types/d3-interpolate": "*",
"@types/d3-selection": "*"
}
},
"node_modules/@types/eslint": {
"version": "8.56.10",
"resolved": "https://npm.fnexe.com/@types/eslint/-/eslint-8.56.10.tgz",
@ -6696,6 +6746,21 @@
"dev": true,
"license": "Apache-2.0"
},
"node_modules/@xyflow/system": {
"version": "0.0.37",
"resolved": "https://npm.fnexe.com/@xyflow/system/-/system-0.0.37.tgz",
"integrity": "sha512-hSIhezhxgftPUpC+xiQVIorcRILZUOWlLjpYPTyGWRu8s4RJvM4GqvrsFmD5OnMKXLgpU7/PqqUibDVO67oWQQ==",
"license": "MIT",
"dependencies": {
"@types/d3-drag": "^3.0.7",
"@types/d3-selection": "^3.0.10",
"@types/d3-transition": "^3.0.8",
"@types/d3-zoom": "^3.0.8",
"d3-drag": "^3.0.0",
"d3-selection": "^3.0.0",
"d3-zoom": "^3.0.0"
}
},
"node_modules/@yarnpkg/lockfile": {
"version": "1.1.0",
"resolved": "https://npm.fnexe.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz",
@ -8417,6 +8482,111 @@
"dev": true,
"license": "MIT"
},
"node_modules/d3-color": {
"version": "3.1.0",
"resolved": "https://npm.fnexe.com/d3-color/-/d3-color-3.1.0.tgz",
"integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==",
"license": "ISC",
"engines": {
"node": ">=12"
}
},
"node_modules/d3-dispatch": {
"version": "3.0.1",
"resolved": "https://npm.fnexe.com/d3-dispatch/-/d3-dispatch-3.0.1.tgz",
"integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==",
"license": "ISC",
"engines": {
"node": ">=12"
}
},
"node_modules/d3-drag": {
"version": "3.0.0",
"resolved": "https://npm.fnexe.com/d3-drag/-/d3-drag-3.0.0.tgz",
"integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==",
"license": "ISC",
"dependencies": {
"d3-dispatch": "1 - 3",
"d3-selection": "3"
},
"engines": {
"node": ">=12"
}
},
"node_modules/d3-ease": {
"version": "3.0.1",
"resolved": "https://npm.fnexe.com/d3-ease/-/d3-ease-3.0.1.tgz",
"integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=12"
}
},
"node_modules/d3-interpolate": {
"version": "3.0.1",
"resolved": "https://npm.fnexe.com/d3-interpolate/-/d3-interpolate-3.0.1.tgz",
"integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==",
"license": "ISC",
"dependencies": {
"d3-color": "1 - 3"
},
"engines": {
"node": ">=12"
}
},
"node_modules/d3-selection": {
"version": "3.0.0",
"resolved": "https://npm.fnexe.com/d3-selection/-/d3-selection-3.0.0.tgz",
"integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==",
"license": "ISC",
"engines": {
"node": ">=12"
}
},
"node_modules/d3-timer": {
"version": "3.0.1",
"resolved": "https://npm.fnexe.com/d3-timer/-/d3-timer-3.0.1.tgz",
"integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==",
"license": "ISC",
"engines": {
"node": ">=12"
}
},
"node_modules/d3-transition": {
"version": "3.0.1",
"resolved": "https://npm.fnexe.com/d3-transition/-/d3-transition-3.0.1.tgz",
"integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==",
"license": "ISC",
"dependencies": {
"d3-color": "1 - 3",
"d3-dispatch": "1 - 3",
"d3-ease": "1 - 3",
"d3-interpolate": "1 - 3",
"d3-timer": "1 - 3"
},
"engines": {
"node": ">=12"
},
"peerDependencies": {
"d3-selection": "2 - 3"
}
},
"node_modules/d3-zoom": {
"version": "3.0.0",
"resolved": "https://npm.fnexe.com/d3-zoom/-/d3-zoom-3.0.0.tgz",
"integrity": "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==",
"license": "ISC",
"dependencies": {
"d3-dispatch": "1 - 3",
"d3-drag": "2 - 3",
"d3-interpolate": "1 - 3",
"d3-selection": "2 - 3",
"d3-transition": "2 - 3"
},
"engines": {
"node": ">=12"
}
},
"node_modules/date-format": {
"version": "4.0.14",
"resolved": "https://npm.fnexe.com/date-format/-/date-format-4.0.14.tgz",

View File

@ -32,6 +32,7 @@
"@angular/platform-browser-dynamic": "^18.1.0",
"@angular/router": "^18.1.0",
"@codemirror/lang-python": "^6.1.6",
"@xyflow/system": "^0.0.37",
"codemirror": "^6.0.1",
"codemirror-extension-inline-suggestion": "^0.0.3",
"rxjs": "~7.8.0",
@ -56,4 +57,4 @@
"typescript": "~5.5.2",
"typescript-eslint": "8.0.0-alpha.38"
}
}
}

View File

@ -1,6 +1,21 @@
<div>
<h1>Slow things</h1>
<app-graph-component></app-graph-component>
<svg width="500" height="300" style="border:1px red solid" xmlns="http://www.w3.org/2000/svg">
<foreignObject width="100%" height="100%">
<xhtml:div>
<xhtml:div #source style="border:1px green solid;width: fit-content;margin-left:200px;margin-top:50px;">
I'm a div inside a SVG.
</xhtml:div>
<xhtml:p #target style="border:1px green solid;width: fit-content;margin-left:10px;margin-top:120px">
I'm a second div inside a SVG.
</xhtml:p>
</xhtml:div>
</foreignObject>
<g x="0" y="0">
<path #path stroke="black" stroke-width="2" fill="transparent"/>
</g>
</svg>
</div>
<router-outlet />

View File

@ -1,6 +1,7 @@
import { Component } from '@angular/core';
import {AfterViewInit, Component, ViewChild} from '@angular/core';
import { RouterOutlet } from '@angular/router';
import {GraphModule} from "./view/graph/graph.module";
import { getBezierPath } from '@xyflow/system';
@Component({
selector: 'app-root',
@ -9,6 +10,25 @@ import {GraphModule} from "./view/graph/graph.module";
templateUrl: './app.component.html',
styleUrl: './app.component.scss'
})
export class AppComponent {
title = 'slow-shit';
export class AppComponent implements AfterViewInit {
@ViewChild('source') source: any
@ViewChild('target') target: any
@ViewChild('path') path: any
ngAfterViewInit() {
const source = this.source.nativeElement;
const target = this.target.nativeElement;
console.log(source, source.offsetLeft, source.offsetTop, source.width)
console.log(target, target.offsetLeft)
const sourceRect = source.getBoundingClientRect()
const targetRect = target.getBoundingClientRect()
const path = getBezierPath({
sourceX: source.offsetLeft + (sourceRect.width / 2),
sourceY: source.offsetTop + sourceRect.height,
targetX: target.offsetLeft + (targetRect.width / 2),
targetY: target.offsetTop
})
console.log('path', path)
this.path.nativeElement.setAttribute('d', path[0])
}
}