connect to ide when portal

This commit is contained in:
Brandon Fergerson 2022-05-18 19:55:27 +04:00
parent 7a640495a5
commit 3b21cc35a6
6 changed files with 749 additions and 628 deletions

1337
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,9 @@
}, },
"dependencies": { "dependencies": {
"@types/jquery": "^3.5.14", "@types/jquery": "^3.5.14",
"@types/sockjs-client": "^1.5.1",
"@types/vertx3-eventbus-client": "^3.5.1",
"@vertx/eventbus-bridge-client.js": "^1.0.0-3-SNAPSHOT",
"axios": "^0.24.0", "axios": "^0.24.0",
"d3": "^7.3.0", "d3": "^7.3.0",
"d3-flame-graph": "^4.1.3", "d3-flame-graph": "^4.1.3",
@ -20,6 +23,9 @@
"jquery": "^3.6.0", "jquery": "^3.6.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"pinia": "^2.0.5", "pinia": "^2.0.5",
"sockjs": "^0.3.24",
"sockjs-client": "^1.6.0",
"vertx3-eventbus-client": "^3.9.4",
"vis-timeline": "^7.5.1", "vis-timeline": "^7.5.1",
"vue": "^3.0.0", "vue": "^3.0.0",
"vue-grid-layout": "^3.0.0-beta1", "vue-grid-layout": "^3.0.0-beta1",

View File

@ -38,6 +38,7 @@ import { useDashboardStore } from "@/store/modules/dashboard";
import Configuration from "../views/dashboard/configuration"; import Configuration from "../views/dashboard/configuration";
import controls from "../views/dashboard/controls/index"; import controls from "../views/dashboard/controls/index";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import connect from "../hooks/useIDE";
let isScrolling = false; let isScrolling = false;
function scrollStop(callback: { (): void; (): void }, refresh = 66) { function scrollStop(callback: { (): void; (): void }, refresh = 66) {
@ -160,6 +161,10 @@ export default defineComponent({
onMounted(() => { onMounted(() => {
observeItems(); observeItems();
initScroller(); initScroller();
if (query["portal"] === "true") {
connect();
}
}); });
onBeforeUnmount(() => { onBeforeUnmount(() => {
scrollWrapRef?.value?.removeEventListener("wheel", wheelGraphScroll); scrollWrapRef?.value?.removeEventListener("wheel", wheelGraphScroll);

27
src/hooks/useIDE.ts Normal file
View File

@ -0,0 +1,27 @@
import * as EventBus from "vertx3-eventbus-client";
import router from "@/router";
import { useAppStoreWithOut } from "@/store/modules/app";
const appStore = useAppStoreWithOut();
export default function connect(idePort = 8080) {
console.log("Connecting to IDE...");
const eb = new EventBus(`http://localhost:${idePort}/eventbus`);
eb.onopen = () => {
console.log("EventBus connected");
appStore.setAutoRefresh(true);
eb.registerHandler(
"portal.SetCurrentPage",
(error: Error, message: any) => {
console.log("Setting current page:" + JSON.stringify(message));
router.push(message.body.page);
}
);
eb.registerHandler("portal.SetSettings", (error: Error, message: any) => {
console.log("Setting config:" + JSON.stringify(message));
});
};
}

1
src/types/sockjs.d.ts vendored Normal file
View File

@ -0,0 +1 @@
declare module "sockjs-client";

1
src/types/vertx-eventbus.d.ts vendored Normal file
View File

@ -0,0 +1 @@
declare module "vertx3-eventbus-client";