diff --git a/banner.svg b/banner.svg new file mode 100644 index 0000000..e21cd10 --- /dev/null +++ b/banner.svg @@ -0,0 +1,166 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + Rail Signal + + + + + + + diff --git a/quasar-app/src/api/components.js b/quasar-app/src/api/components.js index 36ca6e9..af285c6 100644 --- a/quasar-app/src/api/components.js +++ b/quasar-app/src/api/components.js @@ -98,6 +98,18 @@ export function removeComponent(rs, id) { }); } +export function updateComponent(rs, component) { + return new Promise((resolve, reject) => { + axios.patch(`${API_URL}/rs/${rs.id}/c/${component.id}`, component) + .then(() => { + refreshComponents(rs) + .then(resolve) + .catch(reject); + }) + .catch(reject); + }); +} + export function updateSwitchConfiguration(rs, sw, configId) { return new Promise((resolve, reject) => { axios.post( diff --git a/quasar-app/src/api/railSystems.js b/quasar-app/src/api/railSystems.js index 4f77eee..d0bcd65 100644 --- a/quasar-app/src/api/railSystems.js +++ b/quasar-app/src/api/railSystems.js @@ -62,7 +62,7 @@ export function removeRailSystem(rsStore, id) { axios.delete(`${API_URL}/rs/${id}`) .then(() => { if (rsStore.selectedRailSystem !== null && rsStore.selectedRailSystem.id === id) { - rsStore.selectRailSystem(null); + rsStore.selectedRailSystem = null; } refreshRailSystems(rsStore) .then(resolve) diff --git a/quasar-app/src/components/rs/MapView.vue b/quasar-app/src/components/rs/MapView.vue index cc0251d..1e5e9a9 100644 --- a/quasar-app/src/components/rs/MapView.vue +++ b/quasar-app/src/components/rs/MapView.vue @@ -1,14 +1,14 @@ + + diff --git a/quasar-app/src/components/rs/component_views/LabelComponentView.vue b/quasar-app/src/components/rs/component_views/LabelComponentView.vue new file mode 100644 index 0000000..4568977 --- /dev/null +++ b/quasar-app/src/components/rs/component_views/LabelComponentView.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/quasar-app/src/components/rs/component_views/PathNodeItem.vue b/quasar-app/src/components/rs/component_views/PathNodeItem.vue new file mode 100644 index 0000000..a4ff2a1 --- /dev/null +++ b/quasar-app/src/components/rs/component_views/PathNodeItem.vue @@ -0,0 +1,125 @@ + + + + + diff --git a/quasar-app/src/components/rs/component_views/SegmentBoundaryComponentView.vue b/quasar-app/src/components/rs/component_views/SegmentBoundaryComponentView.vue new file mode 100644 index 0000000..316497d --- /dev/null +++ b/quasar-app/src/components/rs/component_views/SegmentBoundaryComponentView.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/quasar-app/src/components/rs/component_views/SignalComponentView.vue b/quasar-app/src/components/rs/component_views/SignalComponentView.vue new file mode 100644 index 0000000..76a4bb7 --- /dev/null +++ b/quasar-app/src/components/rs/component_views/SignalComponentView.vue @@ -0,0 +1,25 @@ + + + + + diff --git a/quasar-app/src/components/rs/component_views/SwitchComponentView.vue b/quasar-app/src/components/rs/component_views/SwitchComponentView.vue new file mode 100644 index 0000000..25013f2 --- /dev/null +++ b/quasar-app/src/components/rs/component_views/SwitchComponentView.vue @@ -0,0 +1,200 @@ + + + + + diff --git a/quasar-app/src/layouts/MainLayout.vue b/quasar-app/src/layouts/MainLayout.vue index 15dbbf7..3425400 100644 --- a/quasar-app/src/layouts/MainLayout.vue +++ b/quasar-app/src/layouts/MainLayout.vue @@ -26,22 +26,12 @@ bordered > - + Home - + About @@ -68,7 +58,6 @@ export default defineComponent({ setup () { const rsStore = useRailSystemsStore() const leftDrawerOpen = ref(false) - return { rsStore, leftDrawerOpen, diff --git a/quasar-app/src/render/mapRenderer.js b/quasar-app/src/render/mapRenderer.js index 450334b..f6b5d4e 100644 --- a/quasar-app/src/render/mapRenderer.js +++ b/quasar-app/src/render/mapRenderer.js @@ -71,8 +71,11 @@ function drawDebugInfo(ctx) { "Scale factor: " + getScaleFactor(), `(x = ${lastWorldPoint.x.toFixed(2)}, y = ${lastWorldPoint.y.toFixed(2)}, z = ${lastWorldPoint.z.toFixed(2)})`, `Components: ${railSystem.components.length}`, - `Hovered elements: ${hoveredElements.length}` + `Hovered components: ${hoveredElements.length}` ] + for (let i = 0; i < hoveredElements.length; i++) { + lines.push(" " + hoveredElements[i].name); + } for (let i = 0; i < lines.length; i++) { ctx.fillText(lines[i], 10, 20 + (i * 15)); } diff --git a/quasar-app/src/stores/railSystemsStore.js b/quasar-app/src/stores/railSystemsStore.js index 31488df..095b64e 100644 --- a/quasar-app/src/stores/railSystemsStore.js +++ b/quasar-app/src/stores/railSystemsStore.js @@ -1,10 +1,4 @@ -import { defineStore } from "pinia"; -import { refreshSegments } from "../api/segments"; -import { refreshComponents } from "../api/components"; -import { closeWebsocketConnection, establishWebsocketConnection } from "../api/websocket"; -import { refreshRailSystems } from "src/api/railSystems"; -import { refreshLinkTokens } from "src/api/linkTokens"; -import { refreshSettings } from "src/api/settings"; +import {defineStore} from "pinia"; export const useRailSystemsStore = defineStore('RailSystemsStore', { state: () => ({ @@ -16,45 +10,5 @@ export const useRailSystemsStore = defineStore('RailSystemsStore', { * @type {RailSystem | null} */ selectedRailSystem: null - }), - actions: { - /** - * Updates the selected rail system. - * @param rsId {Number | null} The new rail system id. - * @returns {Promise} A promise that resolves when the new rail system is - * fully loaded and ready. - */ - selectRailSystem(rsId) { - // Close any existing websocket connections prior to refreshing. - const wsClosePromises = []; - if (this.selectedRailSystem !== null) { - wsClosePromises.push(closeWebsocketConnection(this.selectedRailSystem)); - } - if (rsId === null) return Promise.all(wsClosePromises); - return new Promise(resolve => { - Promise.all(wsClosePromises).then(() => { - refreshRailSystems(this).then(() => { - const rs = this.railSystems.find(r => r.id === rsId); - console.log(rs); - const updatePromises = []; - updatePromises.push(refreshSegments(rs)); - updatePromises.push(refreshComponents(rs)); - updatePromises.push(refreshLinkTokens(rs)); - updatePromises.push(refreshSettings(rs)); - updatePromises.push(establishWebsocketConnection(rs)); - Promise.all(updatePromises).then(() => { - this.selectedRailSystem = rs; - resolve(); - }); - }); - }); - }); - } - }, - getters: { - rsId() { - if (this.selectedRailSystem === null) return null; - return this.selectedRailSystem.id; - } - } + }) });