Skip to content

Commit 7ccd861

Browse files
bump version to 0.0.14 in package.json; add user and connection management with WebSocket support
1 parent c23dcf1 commit 7ccd861

14 files changed

+321
-12
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ratio-gui",
3-
"version": "0.0.13",
3+
"version": "0.0.14",
44
"type": "module",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

settings.json.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"protocol": "@API_PROTOCOL@",
3+
"hostname": "@API_HOSTNAME@",
4+
"port": "@API_PORT@",
5+
"ws_path": "@API_WS_PATH@"
6+
}

src/app.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { ConnectionListener } from "./utils/connection";
2+
13
export class App implements AppListener {
24

35
private static instance: App;
@@ -95,7 +97,7 @@ export abstract class ListComponent<P, E extends HTMLElement, L extends HTMLElem
9597
}
9698
}
9799

98-
export class AppComponent extends Component<App, HTMLDivElement> implements AppListener {
100+
export class AppComponent extends Component<App, HTMLDivElement> implements AppListener, ConnectionListener {
99101

100102
private main: HTMLDivElement;
101103

@@ -146,6 +148,11 @@ export class AppComponent extends Component<App, HTMLDivElement> implements AppL
146148
this.main.appendChild(component.element);
147149
}
148150

151+
connected(info: any): void { }
152+
received_message(message: any): void { }
153+
disconnected(): void { }
154+
error(error: any): void { }
155+
149156
populate_navbar(container: HTMLDivElement): void { }
150157

151158
unmounting(): void { App.get_instance().remove_app_listener(this); }
@@ -156,6 +163,11 @@ export class AnchorComponent<P> extends Component<P, HTMLAnchorElement> {
156163
constructor(payload: P) { super(payload, document.createElement('a')); }
157164
}
158165

166+
export class ButtonComponent<P> extends Component<P, HTMLButtonElement> {
167+
168+
constructor(payload: P) { super(payload, document.createElement('button')); }
169+
}
170+
159171
export class UListComponent<P> extends ListComponent<P, HTMLLIElement, HTMLUListElement> {
160172

161173
constructor(payload: Component<P, HTMLLIElement>[], compareFn?: (a: P, b: P) => number) {

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import cytoscapePopper, { RefElement } from 'cytoscape-popper';
77
import tippy from 'tippy.js';
88

99
export * from './app';
10-
export { solver } from './solver';
11-
export { SolverGraph } from './solver_graph';
12-
export { TimelinesChart } from './solver_timelines';
13-
export * from './solver_components';
10+
export { solver } from './solver/solver';
11+
export { SolverGraph } from './solver/solver_graph';
12+
export { TimelinesChart } from './solver/solver_timelines';
13+
export * from './solver/solver_components';
1414

1515
function tippyFactory(ref: RefElement, content: HTMLElement) {
1616
// Since tippy constructor requires DOM element/elements, create a placeholder

src/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"protocol": "http",
3+
"hostname": "localhost",
4+
"port": "80",
5+
"ws_path": "ws"
6+
}
File renamed without changes.

src/solver_components.ts renamed to src/solver/solver_components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { App, Component, AnchorComponent, UListComponent } from './app';
1+
import { App, Component, AnchorComponent, UListComponent } from '../app';
22
import { solver } from "./solver";
33
import { library, icon } from '@fortawesome/fontawesome-svg-core'
44
import { faBrain, faPauseCircle, faPlayCircle, faCheckCircle, faXmarkCircle } from '@fortawesome/free-solid-svg-icons'

src/solver_graph.ts renamed to src/solver/solver_graph.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component } from "./app";
1+
import { Component } from "../app";
22
import { solver } from "./solver";
33
import cytoscape from 'cytoscape';
44
import { interpolateRgb } from 'd3-interpolate';

src/solver_timelines.ts renamed to src/solver/solver_timelines.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component } from "./app";
1+
import { Component } from "../app";
22
import { solver } from "./solver";
33
import Plotly, { Shape } from 'plotly.js-dist-min';
44
export class TimelinesChart extends Component<solver.Solver, HTMLDivElement> implements solver.SolverListener {

0 commit comments

Comments
 (0)