Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e4c53f536d |
@@ -47,20 +47,11 @@ module SpeckleConnector
|
||||
|
||||
# Return Direct Shape itself if multiple kinds of element are selected like Edge and Face.
|
||||
# OR single type is equal to only direct shape supports.
|
||||
return multiple_supported_selection_info(selection) if supported_entity_count > 1
|
||||
|
||||
# FIXME: Distinguish selection info according to selection elegantly!!!
|
||||
if grouped_by_type.keys.first == Sketchup::ComponentInstance
|
||||
return component_selection_info(selection, source_exist)
|
||||
end
|
||||
|
||||
return group_selection_info(selection) if grouped_by_type.keys.first == Sketchup::Group
|
||||
|
||||
if supported_entity_count > 1 ||
|
||||
(supported_entity_count == 1 &&
|
||||
MAPPER_DIRECT_SHAPE_SUPPORTED_ENTITY_TYPES.include?(grouped_by_type.keys.first))
|
||||
if source_exist
|
||||
return direct_shape_selection_info_with_source(selection, [])
|
||||
return direct_shape_selection_info_with_source(state, selection, [])
|
||||
else
|
||||
return direct_shape_selection_info(selection, source_exist)
|
||||
end
|
||||
@@ -91,34 +82,6 @@ module SpeckleConnector
|
||||
mappingMethods: []
|
||||
}.freeze
|
||||
|
||||
def multiple_supported_selection_info(selection)
|
||||
{
|
||||
selection: SketchupModel::Reader::MapperReader.entities_schema_details(selection),
|
||||
mappingMethods: ['Direct Shape']
|
||||
}.freeze
|
||||
end
|
||||
|
||||
def component_selection_info(selection, source_exist)
|
||||
if source_exist
|
||||
{
|
||||
selection: SketchupModel::Reader::MapperReader.entities_schema_details(selection),
|
||||
mappingMethods: ['Direct Shape', 'New Revit Family', 'Family Instance']
|
||||
}.freeze
|
||||
else
|
||||
{
|
||||
selection: SketchupModel::Reader::MapperReader.entities_schema_details(selection),
|
||||
mappingMethods: ['Direct Shape', 'New Revit Family']
|
||||
}.freeze
|
||||
end
|
||||
end
|
||||
|
||||
def group_selection_info(selection)
|
||||
{
|
||||
selection: SketchupModel::Reader::MapperReader.entities_schema_details(selection),
|
||||
mappingMethods: ['Direct Shape']
|
||||
}.freeze
|
||||
end
|
||||
|
||||
def direct_shape_selection_info(selection, source_exist)
|
||||
methods = ['Direct Shape', 'New Revit Family']
|
||||
methods.append('Family Instance') if source_exist
|
||||
@@ -135,7 +98,9 @@ module SpeckleConnector
|
||||
}.freeze
|
||||
end
|
||||
|
||||
def direct_shape_selection_info_with_source(filtered_selection, methods)
|
||||
def direct_shape_selection_info_with_source(state, filtered_selection, methods)
|
||||
types = state.speckle_state.speckle_mapper_state.mapper_source.types
|
||||
levels = state.speckle_state.speckle_mapper_state.mapper_source.levels
|
||||
instances = @selection.grep(Sketchup::ComponentInstance)
|
||||
selected_level = instances.find do |i|
|
||||
DICTIONARY::SpeckleEntityDictionaryHandler
|
||||
@@ -147,8 +112,10 @@ module SpeckleConnector
|
||||
end
|
||||
{
|
||||
selection: READER::MapperReader.entities_schema_details(filtered_selection),
|
||||
mappingMethods: ['Direct Shape'] + methods,
|
||||
mappingMethods: ['Direct Shape', 'Family Instance'] + methods,
|
||||
categories: Mapper::Category::RevitCategory.to_a,
|
||||
types: types,
|
||||
levels: levels,
|
||||
selectedLevelName: selected_level_name
|
||||
}.freeze
|
||||
end
|
||||
@@ -161,9 +128,9 @@ module SpeckleConnector
|
||||
|
||||
if source_exist
|
||||
if grouped_by_verticality.keys.first
|
||||
direct_shape_selection_info_with_source(faces, ['Wall'])
|
||||
direct_shape_selection_info_with_source(state, faces, ['Wall'])
|
||||
else
|
||||
direct_shape_selection_info_with_source(faces, ['Floor'])
|
||||
direct_shape_selection_info_with_source(state, faces, ['Floor'])
|
||||
end
|
||||
else
|
||||
if grouped_by_verticality.keys.first
|
||||
@@ -179,7 +146,7 @@ module SpeckleConnector
|
||||
|
||||
if source_exist
|
||||
methods = ['Column', 'Beam', 'Pipe', 'Duct']
|
||||
direct_shape_selection_info_with_source(edges, methods)
|
||||
direct_shape_selection_info_with_source(state, edges, methods)
|
||||
else
|
||||
default_methods = ['Default Column', 'Default Beam', 'Default Pipe', 'Default Duct']
|
||||
direct_shape_selection_info_with_default(edges, default_methods)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative 'action'
|
||||
require_relative '../constants/type_constants'
|
||||
require_relative '../mapper/mapper_source'
|
||||
require_relative '../speckle_objects/built_elements/revit/revit_element_type'
|
||||
|
||||
@@ -21,15 +20,13 @@ module SpeckleConnector
|
||||
def update_state(state)
|
||||
levels = convert_levels(state, @base['@Levels'])
|
||||
types = convert_types(@base['@Types'])
|
||||
family_instances = convert_family_instance_types(@base['@Types'])
|
||||
mapper_source = Mapper::MapperSource.new(@stream_id, @commit_id, levels, types)
|
||||
new_speckle_state = state.speckle_state.with_mapper_source(mapper_source)
|
||||
state = state.with_speckle_state(new_speckle_state)
|
||||
|
||||
state.with_add_queue('mapperSourceUpdated', @stream_id, [
|
||||
{ is_string: false, val: levels.to_json },
|
||||
{ is_string: false, val: types.to_json },
|
||||
{ is_string: false, val: family_instances.to_json }
|
||||
{ is_string: false, val: types.to_json }
|
||||
])
|
||||
end
|
||||
|
||||
@@ -46,27 +43,6 @@ module SpeckleConnector
|
||||
end.compact.to_h
|
||||
end
|
||||
|
||||
def convert_family_instance_types(types)
|
||||
family_instance_types = {}
|
||||
types.each do |type, type_elements|
|
||||
next if type_elements.nil? || !type_elements.is_a?(Array) || type == '__closure'
|
||||
|
||||
# skip type if there is no any revit symbol element type
|
||||
symbol_element_types = type_elements.select do |t|
|
||||
t['speckle_type'] == OBJECTS_BUILTELEMENTS_REVIT_REVITSYMBOLELEMENTTYPE &&
|
||||
t['placementType'] == 'OneLevelBased'
|
||||
end
|
||||
next if symbol_element_types.empty?
|
||||
|
||||
elements = type_elements.map do |type_element|
|
||||
SpeckleObjects::BuiltElements::Revit::RevitElementType.to_native(type_element)
|
||||
end
|
||||
elements = elements.group_by { |e| e[:family] }
|
||||
family_instance_types.merge!(elements)
|
||||
end
|
||||
family_instance_types
|
||||
end
|
||||
|
||||
def convert_levels(state, levels)
|
||||
levels.collect do |level|
|
||||
SpeckleObjects::BuiltElements::Level.to_native(state, level, @stream_id)
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative 'command'
|
||||
require_relative '../states/initial_state'
|
||||
require_relative '../ui/vue_view'
|
||||
require_relative '../actions/initialize_speckle'
|
||||
require_relative '../observers/factory'
|
||||
|
||||
module SpeckleConnector
|
||||
module Commands
|
||||
# Command to reset Speckle UI window location onto center of SketchUp window.
|
||||
class ResetWindowLocation < Command
|
||||
|
||||
private
|
||||
|
||||
def _run
|
||||
app = self.app
|
||||
vue_view = app.ui_controller.user_interfaces[Ui::SPECKLE_UI_ID]
|
||||
if vue_view
|
||||
vue_view.dialog.reset_dialog_location
|
||||
else
|
||||
puts "Speckle UI didn't initialized!"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -3,7 +3,6 @@
|
||||
require_relative 'menu_command_handler'
|
||||
require_relative 'action_command'
|
||||
require_relative 'initialize_speckle'
|
||||
require_relative 'reset_window_location'
|
||||
require_relative '../actions/one_click_send'
|
||||
|
||||
module SpeckleConnector
|
||||
@@ -11,7 +10,6 @@ module SpeckleConnector
|
||||
# Speckle menu commands that adds them to Sketchup menu and toolbar.
|
||||
class SpeckleMenuCommands
|
||||
CMD_INITIALIZE_SPECKLE = :initialize_speckle
|
||||
CMD_RESET_WINDOW_LOCATION_SPECKLE = :reset_window_location_speckle
|
||||
CMD_SEND_TO_SPECKLE = :send_to_speckle
|
||||
CMD_RECEIVE_FROM_SPECKLE = :receive_from_speckle
|
||||
|
||||
@@ -28,9 +26,6 @@ module SpeckleConnector
|
||||
commands.add_to_menu!(CMD_INITIALIZE_SPECKLE, speckle_menu)
|
||||
commands.add_to_toolbar!(CMD_INITIALIZE_SPECKLE, speckle_toolbar)
|
||||
|
||||
commands[CMD_RESET_WINDOW_LOCATION_SPECKLE] = reset_window_location_command(app)
|
||||
commands.add_to_menu!(CMD_RESET_WINDOW_LOCATION_SPECKLE, speckle_menu)
|
||||
|
||||
# commands[CMD_SEND_TO_SPECKLE] = send_command(app)
|
||||
# commands.add_to_menu!(CMD_SEND_TO_SPECKLE, speckle_menu)
|
||||
# commands.add_to_toolbar!(CMD_SEND_TO_SPECKLE, speckle_toolbar)
|
||||
@@ -47,17 +42,6 @@ module SpeckleConnector
|
||||
cmd
|
||||
end
|
||||
|
||||
def self.reset_window_location_command(app)
|
||||
cmd = MenuCommandHandler.sketchup_command(
|
||||
ResetWindowLocation.new(app), 'Reset Window Location'
|
||||
)
|
||||
cmd.tooltip = 'Bring Speckle window onto center of SketchUp window'
|
||||
cmd.status_bar_text = 'Bring Speckle window onto center of SketchUp window'
|
||||
cmd.small_icon = '../../img/s2logo.png'
|
||||
cmd.large_icon = '../../img/s2logo.png'
|
||||
cmd
|
||||
end
|
||||
|
||||
def self.send_command(app)
|
||||
cmd = MenuCommandHandler.sketchup_command(
|
||||
ActionCommand.new(app, Actions::OneClickSend), 'Send to Speckle'
|
||||
|
||||
@@ -14,10 +14,8 @@ module SpeckleConnector
|
||||
OBJECTS_BUILTELEMENTS_DEFAULT_WALL = 'Objects.BuiltElements.Wall'
|
||||
OBJECTS_BUILTELEMENTS_REVIT_WALL = 'Objects.BuiltElements.Wall:Objects.BuiltElements.Revit.RevitWall'
|
||||
OBJECTS_BUILTELEMENTS_REVIT_DIRECTSHAPE = 'Objects.BuiltElements.Revit.DirectShape'
|
||||
OBJECTS_BUILTELEMENTS_REVIT_FAMILY_INSTANCE = 'Objects.BuiltElements.Revit.FamilyInstance'
|
||||
OBJECTS_BUILTELEMENTS_REVIT_PARAMETER = 'Objects.BuiltElements.Revit.Parameter'
|
||||
OBJECTS_BUILTELEMENTS_REVIT_REVITELEMENTTYPE = 'Objects.BuiltElements.Revit.RevitElementType'
|
||||
OBJECTS_BUILTELEMENTS_REVIT_REVITSYMBOLELEMENTTYPE = 'Objects.BuiltElements.Revit.RevitElementType:Objects.BuiltElements.Revit.RevitSymbolElementType'
|
||||
|
||||
OBJECTS_GEOMETRY_LINE = 'Objects.Geometry.Line'
|
||||
OBJECTS_GEOMETRY_POLYLINE = 'Objects.Geometry.Polyline'
|
||||
|
||||
@@ -64,8 +64,7 @@ module SpeckleConnector
|
||||
def convert(entity, preferences, speckle_state, parent = :base)
|
||||
convert = method(:convert)
|
||||
|
||||
unless SketchupModel::Reader::MapperReader.mapped_with_schema?(entity) &&
|
||||
!entity.is_a?(Sketchup::ComponentDefinition)
|
||||
unless SketchupModel::Reader::MapperReader.mapped_with_schema?(entity)
|
||||
return from_native_to_speckle(entity, preferences, speckle_state, parent, &convert)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../base'
|
||||
require_relative '../../../constants/type_constants'
|
||||
|
||||
module SpeckleConnector
|
||||
module SpeckleObjects
|
||||
module BuiltElements
|
||||
module Revit
|
||||
# Family instance for Revit mappings.
|
||||
class FamilyInstance < Base
|
||||
SPECKLE_TYPE = OBJECTS_BUILTELEMENTS_REVIT_FAMILY_INSTANCE
|
||||
READER = SketchupModel::Reader
|
||||
QUERY = SketchupModel::Query
|
||||
DICTIONARY = SketchupModel::Dictionary
|
||||
|
||||
# rubocop:disable Metrics/ParameterLists
|
||||
def initialize(family:, type:, level:, units:, base_point:, rotation:, application_id: nil)
|
||||
super(
|
||||
speckle_type: SPECKLE_TYPE,
|
||||
total_children_count: 0,
|
||||
application_id: application_id,
|
||||
id: nil
|
||||
)
|
||||
self[:family] = family
|
||||
self[:type] = type
|
||||
self[:level] = level
|
||||
self[:units] = units
|
||||
self[:basePoint] = base_point
|
||||
self[:rotation] = rotation
|
||||
end
|
||||
# rubocop:enable Metrics/ParameterLists
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -6,7 +6,6 @@ require_relative 'block_definition'
|
||||
require_relative '../base'
|
||||
require_relative '../geometry/bounding_box'
|
||||
require_relative '../other/mapped_block_wrapper'
|
||||
require_relative '../built_elements/revit/family_instance'
|
||||
require_relative '../../sketchup_model/dictionary/base_dictionary_handler'
|
||||
require_relative '../../sketchup_model/dictionary/speckle_schema_dictionary_handler'
|
||||
require_relative '../../sketchup_model/query/layer'
|
||||
@@ -89,11 +88,6 @@ module SpeckleConnector
|
||||
speckle_schema = SketchupModel::Dictionary::SpeckleSchemaDictionaryHandler
|
||||
.speckle_schema_to_speckle(component_instance)
|
||||
|
||||
if speckle_schema.empty?
|
||||
speckle_schema = SketchupModel::Dictionary::SpeckleSchemaDictionaryHandler
|
||||
.speckle_schema_to_speckle(component_instance.definition)
|
||||
end
|
||||
|
||||
# transform into global if any path provided
|
||||
transformation = component_instance.transformation
|
||||
transformation = SketchupModel::Query::Entity.global_transformation(component_instance, path) if path
|
||||
@@ -127,22 +121,7 @@ module SpeckleConnector
|
||||
application_id: component_instance.persistent_id.to_s
|
||||
)
|
||||
when 'Family Instance'
|
||||
level = speckle_state.speckle_mapper_state.mapper_source
|
||||
.levels.find { |l| l[:name] == speckle_schema['level'] }
|
||||
family = speckle_schema['family']
|
||||
type = speckle_schema['family_type']
|
||||
block_instance['@SpeckleSchema'] = SpeckleObjects::BuiltElements::Revit::FamilyInstance.new(
|
||||
family: family,
|
||||
type: type,
|
||||
level: level,
|
||||
units: units,
|
||||
base_point: SpeckleObjects::Geometry::Point.from_vertex(
|
||||
component_instance.definition.insertion_point.transform(transformation),
|
||||
units
|
||||
),
|
||||
rotation: calculate_rotation(transformation.to_a),
|
||||
application_id: component_instance.persistent_id.to_s
|
||||
)
|
||||
puts 'not there yet'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -271,26 +250,6 @@ module SpeckleConnector
|
||||
instance_transform = instance.transformation
|
||||
instance.transform!(instance_transform * transform.inverse * instance_transform.inverse)
|
||||
end
|
||||
|
||||
def self.calculate_rotation(matrix)
|
||||
# Ensure the matrix is a flat array with 16 elements
|
||||
unless matrix.is_a?(Array) && matrix.size == 16
|
||||
raise ArgumentError, 'Matrix must be an array with 16 elements'
|
||||
end
|
||||
|
||||
# Extract the elements of the 2x2 rotation sub-matrix
|
||||
cos_theta = matrix[0] # First column, first row
|
||||
sin_theta = matrix[1] # Second column, first row
|
||||
|
||||
# Calculate the rotation angle in radians
|
||||
theta = Math.atan2(sin_theta, cos_theta)
|
||||
|
||||
# Ensure the angle is between -π and π
|
||||
theta -= 2 * Math::PI while theta > Math::PI
|
||||
theta += 2 * Math::PI while theta < -Math::PI
|
||||
|
||||
theta
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -89,9 +89,6 @@ module SpeckleConnector
|
||||
entity = entity_with_path[0]
|
||||
path = entity_with_path[1..-1]
|
||||
method = SPECKLE_SCHEMA_DICTIONARY_HANDLER.get_attribute(entity, 'method')
|
||||
if entity.is_a?(Sketchup::ComponentInstance) && method.nil?
|
||||
method = SPECKLE_SCHEMA_DICTIONARY_HANDLER.get_attribute(entity.definition, 'method')
|
||||
end
|
||||
|
||||
if !method.nil? && (method.include?('Floor') || method.include?('Wall')) && entity.is_a?(Sketchup::Face)
|
||||
global_transformation = QUERY::Entity.global_transformation(entity, path)
|
||||
@@ -106,7 +103,7 @@ module SpeckleConnector
|
||||
return [direct_shape, [entity]]
|
||||
end
|
||||
|
||||
if ['New Revit Family', 'Family Instance'].include?(method)
|
||||
if method == 'New Revit Family'
|
||||
_speckle_state, block_instance = SpeckleObjects::Other::BlockInstance.from_component_instance(
|
||||
entity, units, preferences, speckle_state, path: path, &convert
|
||||
)
|
||||
|
||||
@@ -57,10 +57,6 @@ module SpeckleConnector
|
||||
html_dialog.execute_script(data)
|
||||
end
|
||||
|
||||
def reset_dialog_location
|
||||
html_dialog.center
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# @return [UI::HtmlDialog] the Sketchup interface to dialog
|
||||
|
||||
+8
-30
@@ -48,25 +48,21 @@
|
||||
<v-img v-if="user.avatar" :src="user.avatar" />
|
||||
<v-img v-else :src="`https://robohash.org/` + user.id + `.png?size=40x40`" />
|
||||
</v-avatar>
|
||||
<div>
|
||||
<b>{{ user.name }}</b>
|
||||
</div>
|
||||
<div class="caption">
|
||||
{{ user.company }}
|
||||
<br />
|
||||
{{ user.bio ? 'Bio: ' + user.bio : '' }}
|
||||
</div>
|
||||
<div>
|
||||
<b>{{ user.name }}</b>
|
||||
<br />
|
||||
<b>{{ user.email }}</b>
|
||||
</div>
|
||||
<div class="caption">
|
||||
<b>{{ serverInfo.canonicalUrl }}</b>
|
||||
</div>
|
||||
</v-card-text>
|
||||
<v-card-text v-if="accounts()">
|
||||
<v-divider class="my-3" />
|
||||
|
||||
<div v-for="account in accounts()" :key="account.id">
|
||||
<v-btn
|
||||
v-if="account.id != activeAccount().id"
|
||||
v-if="account.userInfo.id != user.id"
|
||||
rounded
|
||||
large
|
||||
class="my-1 elevation-0"
|
||||
@@ -105,12 +101,12 @@
|
||||
</v-container>
|
||||
<create-stream-dialog
|
||||
v-if="accounts().length !== 0"
|
||||
:is-f-e2-terms="preferences && preferences.user && preferences.user.fe2"
|
||||
:is-f-e2="preferences && preferences.user && preferences.user.fe2"
|
||||
:account-id="activeAccount().userInfo.id"
|
||||
:server-url="activeAccount().serverInfo.url"
|
||||
/>
|
||||
<v-container v-if="accounts().length !== 0" fluid>
|
||||
<router-view :stream-search-query="streamSearchQuery"/>
|
||||
<router-view :stream-search-query="streamSearchQuery" />
|
||||
</v-container>
|
||||
<v-container v-else>
|
||||
<login/>
|
||||
@@ -132,7 +128,6 @@
|
||||
/*global sketchup*/
|
||||
import { bus } from './main'
|
||||
import userQuery from './graphql/user.gql'
|
||||
import serverInfoQuery from './graphql/serverInfo.gql'
|
||||
import { onLogin } from './vue-apollo'
|
||||
import Login from "@/views/Login";
|
||||
|
||||
@@ -152,12 +147,7 @@ global.loadAccounts = function (accounts) {
|
||||
let uuid = localStorage.getItem('uuid')
|
||||
if (accounts.length !== 0){
|
||||
if (uuid) {
|
||||
var account = accounts.find((acct) => acct['userInfo']['id'] === uuid)
|
||||
if (account){
|
||||
global.setSelectedAccount(account)
|
||||
}else{
|
||||
global.setSelectedAccount(accounts.find((acct) => acct['isDefault']))
|
||||
}
|
||||
global.setSelectedAccount(accounts.find((acct) => acct['userInfo']['id'] === uuid))
|
||||
} else {
|
||||
global.setSelectedAccount(accounts.find((acct) => acct['isDefault']))
|
||||
}
|
||||
@@ -169,7 +159,6 @@ global.setSelectedAccount = function (account) {
|
||||
localStorage.setItem('serverUrl', account['serverInfo']['url'])
|
||||
localStorage.setItem('SpeckleSketchup.AuthToken', account['token'])
|
||||
localStorage.setItem('uuid', account['userInfo']['id'])
|
||||
localStorage.setItem('frontend2', account['serverInfo']['frontend2'])
|
||||
bus.$emit('selected-account-reloaded')
|
||||
}
|
||||
|
||||
@@ -210,9 +199,6 @@ export default {
|
||||
apollo: {
|
||||
user: {
|
||||
query: userQuery
|
||||
},
|
||||
serverInfo: {
|
||||
query: serverInfoQuery
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -255,14 +241,6 @@ export default {
|
||||
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: {}})
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
class="pt-0"
|
||||
label="Family"
|
||||
:disabled="!entitySelected"
|
||||
:items="inputFamilies"
|
||||
:items="families"
|
||||
density="compact"
|
||||
clearable
|
||||
@change="onSelectedFamilyChange"
|
||||
@@ -282,9 +282,8 @@ import {groupBy} from "@/utils/groupBy";
|
||||
import MappingSource from "@/components/MapperSource.vue";
|
||||
import {sourceMap} from "@vue/cli-service/lib/config/terserOptions";
|
||||
|
||||
global.mapperSourceUpdated = function (streamId, levels, types, familyInstances) {
|
||||
global.mapperSourceUpdated = function (streamId, levels, types) {
|
||||
console.log(`Mapper source updated for ${streamId}.`)
|
||||
bus.$emit('mapper-source-updated', JSON.stringify(levels), JSON.stringify(types), JSON.stringify(familyInstances))
|
||||
}
|
||||
|
||||
global.entitySelected = function (selectionParameters) {
|
||||
@@ -348,7 +347,7 @@ export default {
|
||||
entitySelected: false,
|
||||
selectedEntityCount: 0,
|
||||
selectedEntities: [],
|
||||
|
||||
allFamilyTypes: {},
|
||||
familyTypes: [],
|
||||
lastSelectedEntity: null,
|
||||
|
||||
@@ -363,14 +362,9 @@ export default {
|
||||
categories: [],
|
||||
familyCategories: [],
|
||||
|
||||
inputCategories: [],
|
||||
inputFamilies: [],
|
||||
inputFamilyTypes: {},
|
||||
|
||||
// comes from source
|
||||
types: {},
|
||||
families: [],
|
||||
allTypes: {},
|
||||
levels: [],
|
||||
familyInstanceTypes: {}, // comes from source as filtered
|
||||
|
||||
mappedEntityCount: 0,
|
||||
mappedEntities: [],
|
||||
@@ -546,11 +540,6 @@ export default {
|
||||
else if (this.selectedMethod === 'New Revit Family'){
|
||||
this.categorySelectionActive = true
|
||||
}
|
||||
else if (this.selectedMethod === 'Family Instance'){
|
||||
this.typeSelectionActive = true
|
||||
this.familySelectionActive = true
|
||||
this.levelSelectionActive = true
|
||||
}
|
||||
else if (nativeDefaultMethods.includes(this.selectedMethod)){
|
||||
this.typeSelectionActive = false
|
||||
this.familySelectionActive = false
|
||||
@@ -565,60 +554,54 @@ export default {
|
||||
}
|
||||
},
|
||||
getTypesFromSelectedFamily(){
|
||||
// There is no sense to set selected family type if method is not selected
|
||||
if (this.selectedMethod){
|
||||
if (this.sourceState !== 'Not Set'){
|
||||
this.familyTypes = this.inputFamilyTypes[this.selectedFamily]
|
||||
if (this.sourceState !== 'Not Set'){
|
||||
this.familyTypes = this.allFamilyTypes[this.selectedFamily]
|
||||
this.selectedFamilyType = this.familyTypes[0].type
|
||||
if (this.selectedFamilyType === null || this.selectedFamilyType === undefined){
|
||||
this.selectedFamilyType = this.familyTypes[0].type
|
||||
if (this.selectedFamilyType === null || this.selectedFamilyType === undefined){
|
||||
this.selectedFamilyType = this.familyTypes[0].type
|
||||
}
|
||||
}
|
||||
if (this.selectedFamily === null || this.selectedFamily === undefined){
|
||||
this.selectedFamily = this.inputFamilies[0]
|
||||
}
|
||||
if (this.familyTypes === null ||this.familyTypes === undefined){
|
||||
this.familyTypes = this.inputFamilyTypes[this.selectedFamily]
|
||||
}
|
||||
}
|
||||
if (this.selectedFamily === null || this.selectedFamily === undefined){
|
||||
this.selectedFamily = this.families[0]
|
||||
}
|
||||
if (this.familyTypes === null ||this.familyTypes === undefined){
|
||||
this.familyTypes = this.allFamilyTypes[this.selectedFamily]
|
||||
}
|
||||
|
||||
},
|
||||
getFamiliesFromSelectedMethod(){
|
||||
switch (this.selectedMethod) {
|
||||
case 'Floor':
|
||||
this.inputFamilies = Object.keys(this.types['Floors']);
|
||||
this.inputFamilyTypes = this.types['Floors']
|
||||
this.families = Object.keys(this.allTypes['Floors']);
|
||||
this.allFamilyTypes = this.allTypes['Floors']
|
||||
break;
|
||||
case 'Wall':
|
||||
this.inputFamilies = Object.keys(this.types['Walls']);
|
||||
this.inputFamilyTypes = this.types['Walls']
|
||||
this.families = Object.keys(this.allTypes['Walls']);
|
||||
this.allFamilyTypes = this.allTypes['Walls']
|
||||
break;
|
||||
case 'Column':
|
||||
this.inputFamilies = Object.keys(this.types['Columns']);
|
||||
this.inputFamilyTypes = this.types['Columns']
|
||||
this.families = Object.keys(this.allTypes['Columns']);
|
||||
this.allFamilyTypes = this.allTypes['Columns']
|
||||
break;
|
||||
case 'Beam':
|
||||
this.inputFamilies = Object.keys(this.types['Beams']);
|
||||
this.inputFamilyTypes = this.types['Beams']
|
||||
this.families = Object.keys(this.allTypes['Beams']);
|
||||
this.allFamilyTypes = this.allTypes['Beams']
|
||||
break;
|
||||
case 'Pipe':
|
||||
this.inputFamilies = Object.keys(this.types['Piping System']);
|
||||
this.inputFamilyTypes = this.types['Piping System']
|
||||
this.families = Object.keys(this.allTypes['Piping System']);
|
||||
this.allFamilyTypes = this.allTypes['Piping System']
|
||||
break;
|
||||
case 'Duct':
|
||||
this.inputFamilies = Object.keys(this.types['Duct System']);
|
||||
this.inputFamilyTypes = this.types['Duct System']
|
||||
break;
|
||||
case 'Family Instance':
|
||||
this.inputFamilies = Object.keys(this.familyInstanceTypes);
|
||||
this.inputFamilyTypes = this.familyInstanceTypes
|
||||
this.families = Object.keys(this.allTypes['Duct System']);
|
||||
this.allFamilyTypes = this.allTypes['Duct System']
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (this.selectedMethod){
|
||||
if (this.selectedFamily === null || this.selectedFamily === undefined){
|
||||
this.selectedFamily = this.inputFamilies[0]
|
||||
}
|
||||
if (this.selectedFamily === null || this.selectedFamily === undefined){
|
||||
this.selectedFamily = this.families[0]
|
||||
}
|
||||
if (this.sourceState === 'Set'){
|
||||
if (this.selectedLevel === null || this.selectedLevel === undefined){
|
||||
this.selectedLevel = this.levels[0].name
|
||||
}
|
||||
@@ -650,6 +633,8 @@ export default {
|
||||
this.selectedLevel = null
|
||||
this.selectedFamily = null
|
||||
this.selectedFamilyType = null
|
||||
this.allTypes = null
|
||||
this.familyTypes = null
|
||||
},
|
||||
getSelectionTableData(){
|
||||
let groupByClass = groupBy('entityType')
|
||||
@@ -711,11 +696,6 @@ export default {
|
||||
}
|
||||
this.selectedMethod = this.lastSelectedEntity['definition']['schema']['method']
|
||||
this.selectedCategory = this.lastSelectedEntity['definition']['schema']['category']
|
||||
this.selectedFamily = this.lastSelectedEntity['definition']['schema']['family']
|
||||
this.getFamiliesFromSelectedMethod()
|
||||
this.getTypesFromSelectedFamily()
|
||||
this.selectedFamilyType = this.lastSelectedEntity['definition']['schema']['family_type']
|
||||
this.selectedLevel = this.lastSelectedEntity['definition']['schema']['level']
|
||||
this.updateMappingInputs()
|
||||
}
|
||||
}
|
||||
@@ -846,11 +826,16 @@ export default {
|
||||
this.selectedFamily = null
|
||||
this.selectedFamilyType = null
|
||||
this.selectedLevel = null
|
||||
this.familyTypes = null
|
||||
this.levels = null
|
||||
this.availableMethods = null
|
||||
this.allTypes = null
|
||||
},
|
||||
getDataFromSelection(selectionParameters){
|
||||
this.availableMethods = selectionParameters.mappingMethods
|
||||
this.selectedEntities = selectionParameters.selection
|
||||
this.allTypes = selectionParameters.types
|
||||
this.levels = selectionParameters.levels
|
||||
this.selectedLevel = selectionParameters.selectedLevelName
|
||||
},
|
||||
updateStatesFromSelectionData(){
|
||||
@@ -872,13 +857,6 @@ export default {
|
||||
this.familyCategories = initPars.familyCategories
|
||||
})
|
||||
|
||||
bus.$on('mapper-source-updated', async (levels, types, familyInstances) => {
|
||||
// Parse data to json object
|
||||
this.familyInstanceTypes = JSON.parse(familyInstances)
|
||||
this.levels = JSON.parse(levels)
|
||||
this.types = JSON.parse(types)
|
||||
})
|
||||
|
||||
bus.$on('entities-selected', async (selectionParameters) => {
|
||||
// Parse data to json object
|
||||
const selectionPars = JSON.parse(selectionParameters)
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<template>
|
||||
<v-card v-if="stream" :class="`mb-3 rounded-lg grey ${$vuetify.theme.dark ? 'darken-4' : 'lighten-4'}`"
|
||||
@mouseenter="hover = true" @mouseleave="hover = false">
|
||||
<v-card
|
||||
v-if="stream"
|
||||
:class="`mb-3 rounded-lg grey ${$vuetify.theme.dark ? 'darken-4' : 'lighten-4'}`"
|
||||
@mouseenter="hover = true"
|
||||
@mouseleave="hover = false"
|
||||
>
|
||||
<v-toolbar flat height="70" :color="getColor(invalid)">
|
||||
<v-btn v-tooptip="''" icon small outlined class="delta-btn" v-if="invalid" @click="activateDiffing">
|
||||
<v-icon v-if="!diffing" class="toggleUpDown" :class='{ "rotate": diffing }' small>mdi-eye-off-outline</v-icon>
|
||||
@@ -8,8 +12,12 @@
|
||||
</v-btn>
|
||||
<v-toolbar-title class="ml-0" style="position: relative; left: -10px">
|
||||
<!-- Uncomment when pinning is in place and add style="position: relative; left: -10px" to the element above :) -->
|
||||
<v-btn v-tooltip="`Pin this ${streamText.toLowerCase()} - it will be saved to this file.`" icon x-small
|
||||
@click="toggleSavedStream">
|
||||
<v-btn
|
||||
v-tooltip="`Pin this ${streamText.toLowerCase()} - it will be saved to this file.`"
|
||||
icon
|
||||
x-small
|
||||
@click="toggleSavedStream"
|
||||
>
|
||||
<v-icon v-if="saved" x-small>mdi-pin</v-icon>
|
||||
<v-icon v-else x-small>mdi-pin-outline</v-icon>
|
||||
</v-btn>
|
||||
@@ -21,12 +29,24 @@
|
||||
<v-btn v-tooltip="'View online'" icon small class="mr-3" @click="openInWeb">
|
||||
<v-icon small>mdi-open-in-new</v-icon>
|
||||
</v-btn>
|
||||
<v-btn v-tooltip="'Send'" icon class="mr-3 elevation-2" :loading="loadingSend" @click="send">
|
||||
<v-btn
|
||||
v-tooltip="'Send'"
|
||||
icon
|
||||
class="mr-3 elevation-2"
|
||||
:loading="loadingSend"
|
||||
@click="send"
|
||||
>
|
||||
<!-- <v-icon>mdi-upload</v-icon> -->
|
||||
<v-img v-if="$vuetify.theme.dark" src="@/assets/SenderWhite.png" max-width="30" />
|
||||
<v-img v-else src="@/assets/Sender.png" max-width="30" />
|
||||
</v-btn>
|
||||
<v-btn v-tooltip="'Receive'" icon class="elevation-2" :loading="loadingReceive" @click="receive">
|
||||
<v-btn
|
||||
v-tooltip="'Receive'"
|
||||
icon
|
||||
class="elevation-2"
|
||||
:loading="loadingReceive"
|
||||
@click="receive"
|
||||
>
|
||||
<!-- <v-icon>mdi-download</v-icon> -->
|
||||
<v-img v-if="$vuetify.theme.dark" src="@/assets/ReceiverWhite.png" max-width="30" />
|
||||
<v-img v-else src="@/assets/Receiver.png" max-width="30" />
|
||||
@@ -46,8 +66,11 @@
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-slide-x-transition>
|
||||
<div v-show="hover">
|
||||
<create-branch-dialog :is-f-e2="preferences && preferences.user && preferences.user.fe2"
|
||||
:stream-name="stream.name" :stream-id="streamId" />
|
||||
<create-branch-dialog
|
||||
:is-f-e2="preferences && preferences.user && preferences.user.fe2"
|
||||
:stream-name="stream.name"
|
||||
:stream-id="streamId"
|
||||
/>
|
||||
</div>
|
||||
</v-slide-x-transition>
|
||||
<v-chip v-if="stream.branches" small v-bind="attrs" class="mr-1" v-on="on">
|
||||
@@ -57,30 +80,42 @@
|
||||
</template>
|
||||
<!-- Branch list -->
|
||||
<v-list dense>
|
||||
<v-list-item v-for="(branch, index) in stream.branches.items" :key="index" link
|
||||
@click="switchBranch(branch.name)">
|
||||
<v-list-item
|
||||
v-for="(branch, index) in stream.branches.items"
|
||||
:key="index"
|
||||
link
|
||||
@click="switchBranch(branch.name)"
|
||||
>
|
||||
<v-list-item-title class="text-caption font-weight-regular">
|
||||
<v-icon v-if="branch.name === branchName" small class="mr-1 float-left">
|
||||
mdi-check
|
||||
</v-icon>
|
||||
<v-icon v-else small class="mr-1 float-left">mdi-source-branch</v-icon>
|
||||
{{ branch.name }} ({{ branch && branch.commits ? branch.commits.totalCount : 0 }})
|
||||
{{ branch.name }} ({{ branch.commits.totalCount }})
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-menu offset-y>
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-chip v-if="stream && stream.commits" small v-bind="attrs" v-on="on">
|
||||
<v-chip v-if="stream.commits" small v-bind="attrs" v-on="on">
|
||||
<v-icon small class="mr-1 float-left">mdi-source-commit</v-icon>
|
||||
{{ selectedBranch.commits.items.length ? commitId : 'no commits' }}
|
||||
</v-chip>
|
||||
</template>
|
||||
<v-list v-if="selectedBranch && selectedBranch.commits" dense>
|
||||
<v-list-item v-for="(commit, index) in selectedBranch.commits.items" :key="index" link
|
||||
@click="switchCommit(commit.id)">
|
||||
<v-list dense>
|
||||
<v-list-item
|
||||
v-for="(commit, index) in selectedBranch.commits.items"
|
||||
:key="index"
|
||||
link
|
||||
@click="switchCommit(commit.id)"
|
||||
>
|
||||
<v-list-item-title class="text-caption font-weight-regular">
|
||||
<v-icon v-if="(commitId == 'latest' && index == 0) || commit.id == commitId" small class="mr-1 float-left">
|
||||
<v-icon
|
||||
v-if="(commitId == 'latest' && index == 0) || commit.id == commitId"
|
||||
small
|
||||
class="mr-1 float-left"
|
||||
>
|
||||
mdi-check
|
||||
</v-icon>
|
||||
<v-icon v-else small class="mr-1 float-left">mdi-source-commit</v-icon>
|
||||
@@ -96,14 +131,24 @@
|
||||
<div class="flex-grow-1 px-4">
|
||||
<v-slide-y-transition>
|
||||
<div v-show="hover">
|
||||
<v-text-field v-model="commitMessage" xxxclass="small-text-field" hide-details dense flat
|
||||
:placeholder="`Write your ${commitText.toLowerCase()} message here`" />
|
||||
<v-text-field
|
||||
v-model="commitMessage"
|
||||
xxxclass="small-text-field"
|
||||
hide-details
|
||||
dense
|
||||
flat
|
||||
:placeholder="`Write your ${commitText.toLowerCase()} message here`"
|
||||
/>
|
||||
</div>
|
||||
</v-slide-y-transition>
|
||||
</div>
|
||||
</v-card-text>
|
||||
<v-progress-linear v-if="(loadingSend || loadingReceive) && loadingStage" key="progress-bar" height="14"
|
||||
indeterminate>
|
||||
<v-progress-linear
|
||||
v-if="(loadingSend || loadingReceive) && loadingStage"
|
||||
key="progress-bar"
|
||||
height="14"
|
||||
indeterminate
|
||||
>
|
||||
<div class="text-caption">
|
||||
{{ loadingStage }}
|
||||
</div>
|
||||
@@ -119,9 +164,8 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { bus } from '../main'
|
||||
import streamQuery from '../graphql/stream.gql'
|
||||
import projectQuery from '../graphql/project.gql'
|
||||
import ObjectLoader from '@speckle/objectloader'
|
||||
import { HostApplications } from '@/utils/hostApplications'
|
||||
import {HostApplications} from '@/utils/hostApplications'
|
||||
|
||||
global.convertedFromSketchup = function (streamId, batches, commitId, totalChildrenCount) {
|
||||
bus.$emit(`sketchup-objects-${streamId}`, batches, commitId, totalChildrenCount)
|
||||
@@ -168,8 +212,7 @@ export default {
|
||||
streamText: '',
|
||||
branchText: '',
|
||||
commitText: '',
|
||||
preferences: {},
|
||||
filterBranchIds: []
|
||||
preferences: {}
|
||||
}
|
||||
},
|
||||
apollo: {
|
||||
@@ -182,18 +225,6 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
project: {
|
||||
prefetch: true,
|
||||
query: projectQuery,
|
||||
variables() {
|
||||
return {
|
||||
projectId: this.streamId,
|
||||
filter: {
|
||||
ids: this.filterBranchIds
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
$subscribe: {
|
||||
commitCreated: {
|
||||
query: gql`
|
||||
@@ -271,39 +302,7 @@ export default {
|
||||
this.commitText = pref.user.fe2 ? 'Version' : 'Commit'
|
||||
})
|
||||
// Collect preferences to render UI according to it
|
||||
sketchup.exec({ name: "collect_preferences", data: {} })
|
||||
|
||||
bus.$on(`set-stream-branch-commit-${this.streamId}`, async (branchId, commitId) => {
|
||||
console.log(branchId, "branchId");
|
||||
let res = await this.$apollo.query({
|
||||
query: gql`
|
||||
query Project($projectId: String!, $filter: ProjectModelsFilter) {
|
||||
project(id: $projectId) {
|
||||
id
|
||||
name
|
||||
models (filter: $filter) {
|
||||
items {
|
||||
id
|
||||
name
|
||||
versions {
|
||||
items {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
projectId: this.streamId,
|
||||
filter: {
|
||||
ids: [branchId]
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(res.data);
|
||||
})
|
||||
sketchup.exec({name: "collect_preferences", data: {}})
|
||||
|
||||
bus.$on(`deactivate-diffing-${this.streamId}`, () => {
|
||||
this.diffing = false
|
||||
@@ -348,11 +347,11 @@ export default {
|
||||
this.$mixpanel.track('Send', { method: 'OneClick' })
|
||||
})
|
||||
|
||||
if (this.saved) sketchup.exec({ name: "notify_connected", data: { stream_id: this.streamId } })
|
||||
if (this.saved) sketchup.exec({name: "notify_connected", data: {stream_id: this.streamId}})
|
||||
},
|
||||
methods: {
|
||||
getColor(invalid) {
|
||||
if (invalid) {
|
||||
getColor(invalid){
|
||||
if(invalid){
|
||||
return "#ffdfdf"
|
||||
} else {
|
||||
return ""
|
||||
@@ -362,9 +361,7 @@ export default {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms))
|
||||
},
|
||||
openInWeb() {
|
||||
var url = localStorage.getItem('frontend2') === "true" ? `${localStorage.getItem('serverUrl')}/projects/${this.streamId}` : `${localStorage.getItem('serverUrl')}/streams/${this.streamId}`
|
||||
window.open(url)
|
||||
|
||||
window.open(`${localStorage.getItem('serverUrl')}/streams/${this.streamId}`)
|
||||
this.$mixpanel.track('Connector Action', { name: 'Open In Web' })
|
||||
},
|
||||
switchBranch(branchName) {
|
||||
@@ -376,22 +373,22 @@ export default {
|
||||
this.$mixpanel.track('Connector Action', { name: 'Commit Switch' })
|
||||
this.commitId = commitId
|
||||
},
|
||||
activateDiffing() {
|
||||
if (this.diffing) {
|
||||
activateDiffing(){
|
||||
if (this.diffing){
|
||||
this.diffing = false
|
||||
sketchup.exec({ name: "deactivate_diffing", data: {} })
|
||||
sketchup.exec({name: "deactivate_diffing", data: {}})
|
||||
return
|
||||
}
|
||||
this.diffing = true
|
||||
bus.$emit("deactivate-diffing-except", (this.streamId))
|
||||
sketchup.exec({ name: "activate_diffing", data: { stream_id: this.streamId } })
|
||||
sketchup.exec({name: "activate_diffing", data: {stream_id: this.streamId}})
|
||||
},
|
||||
toggleSavedStream() {
|
||||
if (this.saved) {
|
||||
sketchup.exec({ name: "remove_stream", data: { stream_id: this.streamId } })
|
||||
sketchup.exec({name: "remove_stream", data: {stream_id: this.streamId}})
|
||||
this.$mixpanel.track('Connector Action', { name: 'Stream Remove' })
|
||||
} else {
|
||||
sketchup.exec({ name: "save_stream", data: { stream_id: this.streamId } })
|
||||
sketchup.exec({name: "save_stream", data: {stream_id: this.streamId}})
|
||||
this.$mixpanel.track('Connector Action', { name: 'Stream Save' })
|
||||
}
|
||||
},
|
||||
@@ -402,7 +399,7 @@ export default {
|
||||
const isMultiplayer = this.selectedCommit.authorId !== selectedAccount['userInfo']['id']
|
||||
const sourceApp = this.selectedCommit.sourceApplication
|
||||
const sourceAppSlug = HostApplications.GetHostAppFromString(sourceApp).slug
|
||||
this.$mixpanel.track('Receive', { isMultiplayer: isMultiplayer, sourceHostApp: sourceAppSlug, sourceHostAppVersion: sourceApp })
|
||||
this.$mixpanel.track('Receive', { isMultiplayer: isMultiplayer, sourceHostApp: sourceAppSlug, sourceHostAppVersion: sourceApp})
|
||||
const refId = this.selectedCommit?.referencedObject
|
||||
if (!refId) {
|
||||
this.loadingReceive = false
|
||||
@@ -419,16 +416,14 @@ export default {
|
||||
|
||||
let rootObj = await loader.getAndConstructObject(this.updateLoadingStage)
|
||||
|
||||
sketchup.exec({
|
||||
name: "receive_objects", data: {
|
||||
sketchup.exec({name:"receive_objects" , data: {
|
||||
base: rootObj,
|
||||
stream_name: this.stream.name,
|
||||
stream_id: this.streamId,
|
||||
branch_name: this.selectedCommit.branchName,
|
||||
branch_id: this.selectedCommit.id,
|
||||
source_app: this.selectedCommit.sourceApplication
|
||||
}
|
||||
})
|
||||
}})
|
||||
|
||||
await this.$apollo.mutate({
|
||||
mutation: gql`
|
||||
@@ -454,7 +449,7 @@ export default {
|
||||
this.loadingStage = 'converting'
|
||||
this.loadingSend = true
|
||||
this.$mixpanel.track('Send')
|
||||
sketchup.exec({ name: "send_selection", data: { stream_id: this.streamId } })
|
||||
sketchup.exec({name:"send_selection" , data: {stream_id: this.streamId}})
|
||||
console.log('>>> SpeckleSketchUp: Objects requested from SketchUp')
|
||||
await this.sleep(2000)
|
||||
},
|
||||
@@ -484,7 +479,7 @@ export default {
|
||||
}
|
||||
|
||||
const t1 = Date.now()
|
||||
const elapsedTime = (t1 - t0) / 1000
|
||||
const elapsedTime = (t1-t0) / 1000
|
||||
console.log(`Upload time: ${elapsedTime} second`)
|
||||
|
||||
let commit = {
|
||||
@@ -506,12 +501,13 @@ export default {
|
||||
}
|
||||
})
|
||||
console.log('>>> SpeckleSketchUp: Sent to stream: ' + this.streamId, commit)
|
||||
const url = localStorage.getItem('frontend2') === 'true' ? `${localStorage.getItem('serverUrl')}/projects/${this.streamId}/models/${this.selectedBranch.id}@${res.data.commitCreate}` : `${localStorage.getItem('serverUrl')}/streams/${this.streamId}/commits/${res.data.commitCreate}`
|
||||
this.$eventHub.$emit('notification', {
|
||||
text: 'Model selection sent!\n',
|
||||
action: {
|
||||
name: 'View in Web',
|
||||
url: url
|
||||
url: `${localStorage.getItem('serverUrl')}/streams/${this.streamId}/commits/${
|
||||
res.data.commitCreate
|
||||
}`
|
||||
}
|
||||
})
|
||||
this.$apollo.queries.stream.refetch()
|
||||
@@ -559,7 +555,6 @@ export default {
|
||||
.fade-leave-active {
|
||||
transition: opacity 0.2s ease-in;
|
||||
}
|
||||
|
||||
.fade-enter,
|
||||
.fade-leave-to {
|
||||
opacity: 0;
|
||||
@@ -570,31 +565,27 @@ export default {
|
||||
max-height: 1200px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.expand-leave-active {
|
||||
transition: all 0.3s ease;
|
||||
max-height: 1200px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.expand-enter,
|
||||
.expand-leave-to {
|
||||
max-height: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.v-text-field>>>input {
|
||||
.v-text-field >>> input {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.v-text-field>>>label {
|
||||
.v-text-field >>> label {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.btn-fix:focus::before {
|
||||
opacity: 0 !important;
|
||||
}
|
||||
|
||||
.btn-fix:hover::before {
|
||||
opacity: 0.08 !important;
|
||||
}
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
>
|
||||
mdi-plus-circle
|
||||
</v-icon>
|
||||
{{ `Create New ${isFE2Terms ? 'Project': 'Stream'}` }}
|
||||
{{ `Create New ${isFE2 ? 'Project': 'Stream'}` }}
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-card>
|
||||
<v-card-title class="text-h5">
|
||||
{{ `Create a New ${isFE2Terms ? 'Project' : 'Stream'}` }}
|
||||
{{ `Create a New ${isFE2 ? 'Project' : 'Stream'}` }}
|
||||
</v-card-title>
|
||||
<v-container class="px-6" pb-0>
|
||||
<!--
|
||||
@@ -56,7 +56,7 @@
|
||||
hide-details
|
||||
dense
|
||||
flat
|
||||
:placeholder="`${isFE2Terms ? 'Project' : 'Stream'} Name (Optional)`"
|
||||
:placeholder="`${isFE2 ? 'Project' : 'Stream'} Name (Optional)`"
|
||||
/>
|
||||
<v-text-field
|
||||
v-model="description"
|
||||
@@ -68,7 +68,7 @@
|
||||
/>
|
||||
<v-switch
|
||||
v-model="privateStream"
|
||||
:label="`Private ${isFE2Terms ? 'Project' : 'Stream'}`"
|
||||
:label="`Private ${isFE2 ? 'Project' : 'Stream'}`"
|
||||
></v-switch>
|
||||
</v-container>
|
||||
|
||||
@@ -171,7 +171,7 @@ export default {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
isFE2Terms: {
|
||||
isFE2: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
@@ -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, this.isFE2)
|
||||
let res = await this.$apollo.query({
|
||||
query: gql`
|
||||
query Stream($id: String!){
|
||||
@@ -250,9 +250,7 @@ export default {
|
||||
this.$eventHub.$emit('notification', {
|
||||
text: 'Stream Added by URL!\n',
|
||||
})
|
||||
console.log(streamWrapper);
|
||||
console.log(streamWrapper.branchName.slice(0, -1), "stream-added-by-id-or-url");
|
||||
await bus.$emit('stream-added-by-id-or-url', stream.id, streamWrapper.branchName.slice(0, -1), streamWrapper.commitId)
|
||||
bus.$emit('stream-added-by-id-or-url', stream.id)
|
||||
this.$mixpanel.track('Connector Action', { name: 'Stream Add From URL' })
|
||||
}
|
||||
catch (e){
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
query Project($projectId: String!, $filter: ProjectModelsFilter) {
|
||||
project(id: $projectId) {
|
||||
id
|
||||
name
|
||||
models (filter: $filter) {
|
||||
items {
|
||||
id
|
||||
name
|
||||
versions {
|
||||
items {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
query{
|
||||
serverInfo {
|
||||
name
|
||||
canonicalUrl
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
</div>
|
||||
<div v-if="allStreamsList" class="mt-5">
|
||||
<div v-for="stream in allStreamsList" :key="stream.id">
|
||||
<stream-card :stream-id="stream.id"/>
|
||||
<stream-card :stream-id="stream.id" />
|
||||
</div>
|
||||
<div class="actions text-center">
|
||||
<v-btn
|
||||
@@ -59,10 +59,7 @@ export default {
|
||||
StreamCard: () => import('@/components/StreamCard')
|
||||
},
|
||||
props: {
|
||||
streamSearchQuery: {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
streamSearchQuery: { type: String, default: null }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -120,19 +117,16 @@ export default {
|
||||
bus.$on('set-saved-streams', (streamIds) => {
|
||||
this.savedStreams = streamIds
|
||||
})
|
||||
bus.$on('stream-added-by-id-or-url', async(streamId, branchId, commitId) => {
|
||||
bus.$on('stream-added-by-id-or-url', (streamId) => {
|
||||
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}})
|
||||
}
|
||||
}
|
||||
await bus.$emit(`set-stream-branch-commit-${streamId}`, branchId, commitId)
|
||||
sketchup.exec({name: "save_stream", data: {stream_id: streamId}})
|
||||
})
|
||||
sketchup.exec({name: "load_saved_streams", data: {}})
|
||||
console.log('LAUNCHED')
|
||||
|
||||
Reference in New Issue
Block a user