Skip to content

Commit c68a7d9

Browse files
committed
add base path
1 parent ee8b777 commit c68a7d9

File tree

7 files changed

+26
-15
lines changed

7 files changed

+26
-15
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iyp-browser",
3-
"version": "0.3.9",
3+
"version": "0.3.10",
44
"private": true,
55
"type": "module",
66
"scripts": {

src/components/Iframe.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<script setup>
2-
import { ref, watch } from 'vue'
2+
import { ref, watch, inject } from 'vue'
33
import hljs from 'highlight.js'
44
import 'highlight.js/scss/vs.scss'
55
import { copyToClipboard } from 'quasar'
66
7+
const GlobalVariables = inject('GlobalVariables')
8+
79
const props = defineProps(['query'])
810
911
const showIframeDialog = ref(false)
@@ -15,7 +17,11 @@ watch(
1517
const query = {
1618
query: props.query
1719
}
18-
iFrameCode.value = `<iframe src="${window.location.origin}/embed/?session=[${encodeURIComponent(JSON.stringify(query))}]" width="100%" height="500px"></iframe>`
20+
const pathName =
21+
GlobalVariables.basePath.slice(-1) === '/'
22+
? GlobalVariables.basePath
23+
: `${GlobalVariables.basePath}/`
24+
iFrameCode.value = `<iframe src="${window.location.origin}${pathName}embed/?session=[${encodeURIComponent(JSON.stringify(query))}]" width="100%" height="500px"></iframe>`
1925
}
2026
)
2127
</script>

src/components/InputPanel.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ onMounted(() => {
167167
// Captures alias + path variable in "n IN nodes(p)".
168168
const nodeInPathMatch = textUtilPosition.match(/\b(\w+)\s+IN\s+nodes\(\s*(\w+)\s*\)/)
169169
170-
// Gives the most recent node typed
170+
// Gives the most recent node typed
171171
const activeNodeLabel = matchNodes.length ? matchNodes[matchNodes.length - 1][1] : null
172172
173173
// Gives the most recent relationship typed
@@ -199,7 +199,7 @@ onMounted(() => {
199199
targetNodes = [...new Set(targetNodes)] // Adds all unique nodes connected to the detected node type
200200
}
201201
if (justOpenedBlock) {
202-
return { suggestions: [] }
202+
return { suggestions: [] }
203203
}
204204
if (genericNodeMatch) {
205205
const allProps = Object.values(schema.node_properties || {}).flat()
@@ -235,8 +235,8 @@ onMounted(() => {
235235
}
236236
properties = relTypes.flatMap((type) => schema.relationship_properties[type] || [])
237237
properties = [...new Set(properties)]
238-
}
239-
// Case 2: Node alias in path context (n IN nodes(p))
238+
}
239+
// Case 2: Node alias in path context (n IN nodes(p))
240240
else if (nodeInPathMatch && alias === nodeInPathMatch[1]) {
241241
const pathVar = nodeInPathMatch[2]
242242
let nodeLabels = []

src/components/output/GraphOutput.vue

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const fetchConnectedNodes = async (nodeId) => {
9494
const nodeExpansion = async (nodeId) => {
9595
const { nodes: newNodes, relationships: newRels } = await fetchConnectedNodes(nodeId)
9696
97-
// Fetches the existing nodes and relationships present in the graph
97+
// Fetches the existing nodes and relationships present in the graph
9898
const existingNodeIds = new Set(nvl.getNodes().map((n) => n.id))
9999
const existingRelIds = new Set(nvl.getRelationships().map((r) => r.id))
100100
@@ -127,7 +127,6 @@ const nodeExpansion = async (nodeId) => {
127127
expandedState: expandedNodesMap.value
128128
})
129129
} else {
130-
131130
// Notifies if the node isnt expandable or it is already expanded
132131
q.notify({
133132
message: 'Node is not expandable',
@@ -156,7 +155,7 @@ const nodeUnexpand = (nodeId) => {
156155
.map((n) => n.id)
157156
const relIds = expansion.relationships.map((r) => r.id)
158157
159-
// Removes the nodes and relationships connected to the specified node that are not already expanded
158+
// Removes the nodes and relationships connected to the specified node that are not already expanded
160159
nvl.removeNodesWithIds(nodeIds)
161160
nvl.removeRelationshipsWithIds(relIds)
162161
expandedNodesMap.value.delete(nodeId)
@@ -168,7 +167,6 @@ const nodeUnexpand = (nodeId) => {
168167
expandedState: expandedNodesMap.value
169168
})
170169
} else {
171-
172170
// Notifies if the node isn't unexpandable
173171
q.notify({
174172
message: 'Node is not un-expandable',
@@ -182,7 +180,6 @@ const nodeUnexpand = (nodeId) => {
182180
183181
// Deletes the specified node and removes it from the graph
184182
const nodeDeletion = (nodeId) => {
185-
186183
// Gets all relationships connected to the node being deleted
187184
const relIds = props.relationships
188185
.filter((r) => r.from === nodeId || r.to === nodeId)

src/plugins/GlobalVariables.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
const basePath = '/browser' // default value: '/'
2+
13
const GlobalVariables = {
24
install: (app) => {
35
const GlobalVariables = {
6+
basePath: basePath,
47
outputPanelHeight: 580,
58
graphOverviewPanelWidth: 250,
69
disableOutputPanelResizer: false,
@@ -10,4 +13,4 @@ const GlobalVariables = {
1013
}
1114
}
1215

13-
export { GlobalVariables }
16+
export { GlobalVariables, basePath }

src/views/BrowserView.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ const clearQuery = (uuid) => {
2323
}
2424
2525
const shareQuery = (query) => {
26-
const urlToShare = `${window.location.origin}/?session=[${JSON.stringify(query)}]`
26+
const pathName =
27+
GlobalVariables.basePath.slice(-1) === '/'
28+
? GlobalVariables.basePath
29+
: `${GlobalVariables.basePath}/`
30+
const urlToShare = `${window.location.origin}${pathName}?session=[${JSON.stringify(query)}]`
2731
copyToClipboard(urlToShare)
2832
}
2933

vite.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { fileURLToPath, URL } from 'node:url'
2-
2+
import { basePath } from './src/plugins/GlobalVariables'
33
import { defineConfig } from 'vite'
44
import vue from '@vitejs/plugin-vue'
55
import vueDevTools from 'vite-plugin-vue-devtools'
@@ -8,6 +8,7 @@ import monacoEditorPlugin from 'vite-plugin-monaco-editor'
88

99
// https://vite.dev/config/
1010
export default defineConfig({
11+
base: basePath,
1112
plugins: [
1213
vue({
1314
template: { transformAssetUrls }

0 commit comments

Comments
 (0)