Compare commits

..

2 Commits

Author SHA1 Message Date
oguzhankoral 886ede61e1 Enrich selected account info and fix same user id issue 2024-02-12 11:31:02 +03:00
oguzhankoral 5a42ea39ce Disable reload 2024-02-12 11:30:39 +03:00
9 changed files with 19 additions and 24 deletions
@@ -15,7 +15,7 @@ module SpeckleConnector
Sketchup::ComponentInstance => INCLUDE_COMPONENT_ENTITY_ATTRIBUTES,
Sketchup::Group => INCLUDE_GROUP_ENTITY_ATTRIBUTES,
Sketchup::Face => INCLUDE_FACE_ENTITY_ATTRIBUTES,
Sketchup::Edge => INCLUDE_EDGE_ENTITY_ATTRIBUTES
Sketchup::Face => INCLUDE_EDGE_ENTITY_ATTRIBUTES
}.freeze
LEVEL_SHIFT_VALUE = SpeckleObjects::Geometry.length_to_native(1.5, 'm')
@@ -84,7 +84,7 @@ module SpeckleConnector
speckle_state = new_speckle_state
dictionaries = SketchupModel::Dictionary::BaseDictionaryHandler
.attribute_dictionaries_to_speckle(component_instance, preferences[:model])
.attribute_dictionaries_to_speckle(component_instance, preferences)
att = dictionaries.any? ? { dictionaries: dictionaries } : {}
speckle_schema = SketchupModel::Dictionary::SpeckleSchemaDictionaryHandler
.speckle_schema_to_speckle(component_instance)
+8 -4
View File
@@ -59,7 +59,7 @@
<b>{{ user.email }}</b>
</div>
<div class="caption">
<b>{{ activeAccount().serverInfo.url }}</b>
<b>{{ serverInfo.canonicalUrl }}</b>
</div>
</v-card-text>
<v-card-text v-if="accounts()">
@@ -155,8 +155,10 @@ global.loadAccounts = function (accounts) {
var account = accounts.find((acct) => acct['userInfo']['id'] === uuid)
if (account){
global.setSelectedAccount(account)
return
}else{
global.setSelectedAccount(accounts.find((acct) => acct['isDefault']))
}
} else {
global.setSelectedAccount(accounts.find((acct) => acct['isDefault']))
}
}
@@ -248,17 +250,19 @@ export default {
return JSON.parse(localStorage.getItem('localAccounts'))
},
activeAccount(){
return JSON.parse(localStorage.getItem('selectedAccount'))
return this.accounts().find((account) => account['isDefault'])
},
switchAccount(account) {
this.$mixpanel.track('Connector Action', { name: 'Account Select' })
global.setSelectedAccount(account)
// Force pushes to reload page to create ApolloClient from scratch
// setTimeout(() => {
// // timeout to wait a bit for potential sketchup.exec in the mean time calls
// location.reload()
// }, 200);
this.$apollo.queries.user.refetch()
this.$apollo.queries.serverInfo.refetch()
},
requestRefresh() {
sketchup.exec({name: 'reload_accounts', data: {}})
+1 -2
View File
@@ -145,8 +145,7 @@ export default {
prefetch: true,
variables() {
return {
id: this.sourceStreamId,
limit: 100
id: this.sourceStreamId
}
},
skip() {
+1 -2
View File
@@ -221,8 +221,7 @@ export default {
query: streamQuery,
variables() {
return {
id: this.streamId,
limit: 100
id: this.streamId
}
}
},
@@ -205,7 +205,7 @@ export default {
},
async getStream(){
try {
const streamWrapper = new StreamWrapper(this.createStreamByIdText, this.accountId, this.serverUrl)
const streamWrapper = new StreamWrapper(this.createStreamByIdText, this.accountId, this.serverUrl, localStorage.getItem('frontend2') === 'true')
let res = await this.$apollo.query({
query: gql`
query Stream($id: String!){
+2 -2
View File
@@ -1,4 +1,4 @@
query Stream($id: String!, $limit: Int!) {
query Stream($id: String!) {
stream(id: $id) {
id
name
@@ -27,7 +27,7 @@ query Stream($id: String!, $limit: Int!) {
referencedObject
}
}
branches (limit: $limit) {
branches {
totalCount
items {
id
+3 -9
View File
@@ -1,12 +1,12 @@
require('url')
export class StreamWrapper {
constructor(streamIdOrUrl, accountId, serverUrl) {
this.isFE2 = this.checkIsFE2(streamIdOrUrl)
constructor(streamIdOrUrl, accountId, serverUrl, isFE2) {
this.isFE2 = isFE2
this.streamsKey = this.isFE2 ? 'projects/': 'streams/'
this.branchesKey = this.isFE2 ? 'models/': 'branches/'
this.commitsKey = this.isFE2 ? 'versions/': 'commits/'
this.originalOutput = streamIdOrUrl
this.originalOutput = streamIdOrUrl
try {
this.streamWrapperFromUrl(streamIdOrUrl)
}
@@ -17,12 +17,6 @@ export class StreamWrapper {
}
}
checkIsFE2(streamUrl){
const fe2UrlRegex = /\/projects\/(?<projectId>[\w\d]+)(?:\/models\/(?<model>[\w\d]+(?:@[\w\d]+)?)(?:,(?<additionalModels>[\w\d]+(?:@[\w\d]+)?))*)?/
const match = fe2UrlRegex.exec(streamUrl);
return match !== null;
}
streamWrapperFromUrl(streamUrl){
this.url = new URL(streamUrl)
this.segments = this.url.pathname.split('/').map((segment) => segment + '/')
+1 -2
View File
@@ -124,13 +124,12 @@ export default {
if (!this.savedStreams){
this.savedStreams = []
this.savedStreams.push(streamId)
sketchup.exec({name: "save_stream", data: {stream_id: streamId}})
} else {
if (!this.savedStreams.includes(streamId)){
this.savedStreams.push(streamId)
sketchup.exec({name: "save_stream", data: {stream_id: streamId}})
}
}
sketchup.exec({name: "save_stream", data: {stream_id: streamId}})
})
sketchup.exec({name: "load_saved_streams", data: {}})
console.log('LAUNCHED')