Add serverUrl and workspaceSlug to model cards (#427)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled

This commit is contained in:
Oğuzhan Koral
2025-04-21 15:06:19 +03:00
committed by GitHub
parent aa12b7b11b
commit 69bde5539c
7 changed files with 48 additions and 24 deletions
@@ -17,7 +17,9 @@ module SpeckleConnector3
def self.update_state(state, resolve_id, data)
model_card_id = data['modelCardId']
account_id = data['accountId']
server_url = data['serverUrl']
workspace_id = data['workspaceId']
workspace_slug = data['workspaceSlug']
project_id = data['projectId']
model_id = data['modelId']
project_name = data['projectName']
@@ -32,7 +34,7 @@ module SpeckleConnector3
has_dismissed_update_warning = data['hasDismissedUpdateWarning']
baked_object_ids = data['bakedObjectIds'].nil? ? nil : data['bakedObjectIds'].values
receive_card = Cards::ReceiveCard.new(model_card_id, account_id, workspace_id,
receive_card = Cards::ReceiveCard.new(model_card_id, account_id, server_url, workspace_id, workspace_slug,
project_id, model_id,
project_name, model_name,
selected_version_id, selected_version_source_app, selected_version_user_id,
@@ -22,7 +22,9 @@ module SpeckleConnector3
send_card = Cards::SendCard.new(
data['modelCardId'],
data['accountId'],
data['serverUrl'],
data['workspaceId'],
data['workspaceSlug'],
data['projectId'],
data['projectName'],
data['modelId'],
@@ -21,7 +21,9 @@ module SpeckleConnector3
send_card = Cards::SendCard.new(
id,
card['account_id'],
card['server_url'],
card['workspace_id'],
card['workspace_slug'],
card['project_id'],
card['project_name'],
card['model_id'],
@@ -36,7 +38,9 @@ module SpeckleConnector3
{
modelCardId: send_card.model_card_id,
accountId: send_card.account_id,
serverUrl: send_card.server_url,
workspaceId: send_card.workspace_id,
workspaceSlug: send_card.workspace_slug,
projectId: send_card.project_id,
modelId: send_card.model_id,
sendFilter: send_card.send_filter,
@@ -51,7 +55,7 @@ module SpeckleConnector3
# TODO: CONVERTER_V2: Extract into new actions
receive_cards = receive_cards_hash.collect do |id, card|
receive_card = Cards::ReceiveCard.new(id, card['account_id'], card['workspace_id'], card['project_id'], card['model_id'],
receive_card = Cards::ReceiveCard.new(id, card['account_id'], card['server_url'], card['workspace_id'], card['workspace_slug'], card['project_id'], card['model_id'],
card['project_name'], card['model_name'], card['selected_version_id'],
card['selected_version_source_app'], card['selected_version_user_id'],
card['latest_version_id'], card['latest_version_source_app'],
@@ -63,7 +67,9 @@ module SpeckleConnector3
{
modelCardId: receive_card.model_card_id,
accountId: receive_card.account_id,
serverUrl: receive_card.server_url,
workspaceId: receive_card.workspace_id,
workspaceSlug: receive_card.workspace_slug,
projectId: receive_card.project_id,
modelId: receive_card.model_id,
projectName: receive_card.project_name,
+11 -1
View File
@@ -27,27 +27,37 @@ module SpeckleConnector3
# @return [String] workspace id of the card.
attr_reader :workspace_id
# @return [String] workspace slug of the card.
attr_reader :workspace_slug
# @return [String] server url of the card.
attr_reader :server_url
# @return [Boolean] card is valid or not.
attr_reader :valid
# rubocop:disable Metrics/ParameterLists
def initialize(model_card_id, account_id, workspace_id, project_id, project_name, model_id, model_name)
def initialize(model_card_id, account_id, server_url, workspace_id, workspace_slug, project_id, project_name, model_id, model_name)
super()
@model_card_id = model_card_id
@account_id = account_id
@workspace_id = workspace_id
@workspace_slug = workspace_slug
@project_id = project_id
@project_name = project_name
@model_id = model_id
@model_name = model_name
@server_url = server_url
@valid = true
self[:model_card_id] = model_card_id
self[:account_id] = account_id
self[:workspace_id] = workspace_id
self[:workspace_slug] = workspace_slug
self[:project_id] = project_id
self[:project_name] = project_name
self[:model_id] = model_id
self[:model_name] = model_name
self[:server_url] = server_url
self[:valid] = @valid
end
# rubocop:enable Metrics/ParameterLists
@@ -48,7 +48,9 @@ module SpeckleConnector3
def initialize(
model_card_id,
account_id,
server_url,
workspace_id,
workspace_slug,
project_id,
model_id,
project_name,
@@ -63,7 +65,7 @@ module SpeckleConnector3
expired,
baked_object_ids = nil
)
super(model_card_id, account_id, workspace_id, project_id, project_name, model_id, model_name)
super(model_card_id, account_id, server_url, workspace_id, workspace_slug, project_id, project_name, model_id, model_name)
@selected_version_id = selected_version_id
@selected_version_source_app = selected_version_source_app
@selected_version_user_id = selected_version_user_id
+3 -1
View File
@@ -26,7 +26,9 @@ module SpeckleConnector3
def initialize(
model_card_id,
account_id,
server_url,
workspace_id,
workspace_slug,
project_id,
project_name,
model_id,
@@ -35,7 +37,7 @@ module SpeckleConnector3
send_filter,
send_settings
)
super(model_card_id, account_id, workspace_id, project_id, project_name, model_id, model_name)
super(model_card_id, account_id, server_url, workspace_id, workspace_slug, project_id, project_name, model_id, model_name)
@send_filter = send_filter
@send_settings = send_settings
@latest_created_version_id = latest_created_version_id
@@ -1,19 +1,19 @@
# frozen_string_literal: true
require_relative 'card'
module SpeckleConnector3
module Cards
# Send card for sketchup connector to communicate speckle.
class SendCardMultipleFilters < Card
# @return [Hash{String=>Filter}] filters of the card.
attr_reader :filters
def initialize(card_id, account_id, project_id, model_id, filters)
super(card_id, account_id, project_id, model_id)
@filters = filters
self[:filters] = filters
end
end
end
end
# # frozen_string_literal: true
#
# require_relative 'card'
#
# module SpeckleConnector3
# module Cards
# # Send card for sketchup connector to communicate speckle.
# class SendCardMultipleFilters < Card
# # @return [Hash{String=>Filter}] filters of the card.
# attr_reader :filters
#
# def initialize(card_id, account_id, project_id, model_id, filters)
# super(card_id, account_id, project_id, model_id)
# @filters = filters
# self[:filters] = filters
# end
# end
# end
# end