Compare commits

...

3 Commits

Author SHA1 Message Date
oguzhankoral 32f41108f6 Check regex match 2024-02-12 20:40:04 +03:00
oguzhankoral e64f7454ce Increase number of branches limit to 100 2024-02-12 19:28:15 +03:00
oguzhankoral 9d2ef1e26e Fix activeAccount 2024-02-12 18:44:04 +03:00
6 changed files with 20 additions and 16 deletions
+4 -8
View File
@@ -59,7 +59,7 @@
<b>{{ user.email }}</b>
</div>
<div class="caption">
<b>{{ serverInfo.canonicalUrl }}</b>
<b>{{ activeAccount().serverInfo.url }}</b>
</div>
</v-card-text>
<v-card-text v-if="accounts()">
@@ -155,10 +155,8 @@ global.loadAccounts = function (accounts) {
var account = accounts.find((acct) => acct['userInfo']['id'] === uuid)
if (account){
global.setSelectedAccount(account)
}else{
global.setSelectedAccount(accounts.find((acct) => acct['isDefault']))
return
}
} else {
global.setSelectedAccount(accounts.find((acct) => acct['isDefault']))
}
}
@@ -250,19 +248,17 @@ export default {
return JSON.parse(localStorage.getItem('localAccounts'))
},
activeAccount(){
return this.accounts().find((account) => account['isDefault'])
return JSON.parse(localStorage.getItem('selectedAccount'))
},
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: {}})
+2 -1
View File
@@ -145,7 +145,8 @@ export default {
prefetch: true,
variables() {
return {
id: this.sourceStreamId
id: this.sourceStreamId,
limit: 100
}
},
skip() {
+2 -1
View File
@@ -221,7 +221,8 @@ export default {
query: streamQuery,
variables() {
return {
id: this.streamId
id: this.streamId,
limit: 100
}
}
},
@@ -205,7 +205,7 @@ export default {
},
async getStream(){
try {
const streamWrapper = new StreamWrapper(this.createStreamByIdText, this.accountId, this.serverUrl, localStorage.getItem('frontend2') === 'true')
const streamWrapper = new StreamWrapper(this.createStreamByIdText, this.accountId, this.serverUrl)
let res = await this.$apollo.query({
query: gql`
query Stream($id: String!){
+2 -2
View File
@@ -1,4 +1,4 @@
query Stream($id: String!) {
query Stream($id: String!, $limit: Int!) {
stream(id: $id) {
id
name
@@ -27,7 +27,7 @@ query Stream($id: String!) {
referencedObject
}
}
branches {
branches (limit: $limit) {
totalCount
items {
id
+9 -3
View File
@@ -1,12 +1,12 @@
require('url')
export class StreamWrapper {
constructor(streamIdOrUrl, accountId, serverUrl, isFE2) {
this.isFE2 = isFE2
constructor(streamIdOrUrl, accountId, serverUrl) {
this.isFE2 = this.checkIsFE2(streamIdOrUrl)
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,6 +17,12 @@ 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 + '/')