diff --git a/packages/frontend/src/views/EmbedViewer.vue b/packages/frontend/src/views/EmbedViewer.vue index 5f3a8a510..0198dd6c7 100644 --- a/packages/frontend/src/views/EmbedViewer.vue +++ b/packages/frontend/src/views/EmbedViewer.vue @@ -2,9 +2,9 @@
-
+
Powered by - + Speckle
-
-
- - View - - - {{ stream.name | truncate }} - - - in - {{ serverInfo.name }} - -
+
- + Stream - {{ input.stream }} + {{ stream.name }} - + {{ displayType }} @@ -51,7 +33,24 @@ {{ input[displayType] | truncate }} + + + View stream in {{ serverInfo.name }} +
+
@@ -73,10 +72,11 @@ export default { data() { return { error: null, + objectId: this.$route.query.object, input: { stream: this.$route.query.stream, object: this.$route.query.object, - branch: this.$route.query.branch, + branch: this.$route.query.branch || 'main', commit: this.$route.query.commit } } @@ -104,7 +104,7 @@ export default { variables() { return { id: this.input.stream, - branch: this.input.branch || 'main' + branch: this.input.branch } }, error(err) { @@ -117,7 +117,8 @@ export default { this.error = 'No commit for this branch' return data.stream } - if (this.input.object == undefined) this.input.object = latestCommit.referencedObject + if (this.input.object == undefined) this.objectId = latestCommit.referencedObject + else this.objectId = this.input.object return data.stream }, skip() { @@ -149,12 +150,9 @@ export default { this.error = err.message }, update(data) { - var latestCommit = data.stream.commit || data.stream.branch.commits.items[0] - if (!latestCommit) { - this.error = 'No commit for this branch' - return data.stream - } - if (this.input.object == undefined) this.input.object = latestCommit.referencedObject + console.log('received specific comit', data, this.input.object) + var latestCommit = data.stream.commit + if (this.input.object === undefined) this.objectId = latestCommit.referencedObject return data.stream }, skip() { @@ -181,9 +179,9 @@ export default { return 'error' } - if (this.input.branch) return 'branch' if (this.input.commit) return 'commit' if (this.input.object) return 'object' + if (this.input.branch) return 'branch' return 'stream' }, @@ -191,20 +189,21 @@ export default { return this.lastCommit || this.specificCommit }, objectUrl() { - return `${window.location.protocol}//${window.location.host}/streams/${this.input.stream}/objects/${this.input.object}` + return `${window.location.protocol}//${window.location.host}/streams/${this.input.stream}/objects/${this.objectId}` }, goToServerUrl() { var stream = this.input.stream var base = `${window.location.origin}/streams/${stream}/` - var branch = this.input.branch - if (branch) return base + `branches/${encodeURI(branch)}` - var commit = this.input.commit if (commit) return base + `commits/${commit}` - var object = this.input.object + var object = this.objectId if (object) return base + `objects/${object}` + + var branch = this.input.branch + if (branch) return base + `branches/${encodeURI(branch)}` + return base } },