Skip to content

Commit

Permalink
Add workspace id to model cards (#391)
Browse files Browse the repository at this point in the history
Co-authored-by: Oguzhan Koral <[email protected]>
  • Loading branch information
oguzhankoral and Oguzhan Koral authored Sep 16, 2024
1 parent bc55543 commit 1f45902
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 7 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added speckle_connector_3/.DS_Store
Binary file not shown.
Binary file added speckle_connector_3/src/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class AddReceiveModelCard < Action
def self.update_state(state, resolve_id, data)
model_card_id = data['modelCardId']
account_id = data['accountId']
workspace_id = data['workspaceId']
project_id = data['projectId']
model_id = data['modelId']
project_name = data['projectName']
Expand All @@ -31,7 +32,7 @@ def self.update_state(state, resolve_id, data)
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,
receive_card = Cards::ReceiveCard.new(model_card_id, account_id, workspace_id,
project_id, model_id,
project_name, model_name,
selected_version_id, selected_version_source_app, selected_version_user_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def self.update_state(state, resolve_id, data)
send_card = Cards::SendCard.new(
data['modelCardId'],
data['accountId'],
data['workspaceId'],
data['projectId'],
data['projectName'],
data['modelId'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def self.update_state(state, resolve_id)
send_card = Cards::SendCard.new(
id,
card['account_id'],
card['workspace_id'],
card['project_id'],
card['project_name'],
card['model_id'],
Expand All @@ -35,6 +36,7 @@ def self.update_state(state, resolve_id)
{
modelCardId: send_card.model_card_id,
accountId: send_card.account_id,
workspaceId: send_card.workspace_id,
projectId: send_card.project_id,
modelId: send_card.model_id,
sendFilter: send_card.send_filter,
Expand All @@ -49,7 +51,7 @@ def self.update_state(state, resolve_id)

# 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['project_id'], card['model_id'],
receive_card = Cards::ReceiveCard.new(id, card['account_id'], card['workspace_id'], 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'],
Expand All @@ -61,6 +63,7 @@ def self.update_state(state, resolve_id)
{
modelCardId: receive_card.model_card_id,
accountId: receive_card.account_id,
workspaceId: receive_card.workspace_id,
projectId: receive_card.project_id,
modelId: receive_card.model_id,
projectName: receive_card.project_name,
Expand Down
7 changes: 6 additions & 1 deletion speckle_connector_3/src/cards/card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,26 @@ class Card < Hash
# @return [String] model name of the card.
attr_reader :model_name

# @return [String] workspace id of the card.
attr_reader :workspace_id

# @return [Boolean] card is valid or not.
attr_reader :valid

# rubocop:disable Metrics/ParameterLists
def initialize(model_card_id, account_id, project_id, project_name, model_id, model_name)
def initialize(model_card_id, account_id, workspace_id, project_id, project_name, model_id, model_name)
super()
@model_card_id = model_card_id
@account_id = account_id
@workspace_id = workspace_id
@project_id = project_id
@project_name = project_name
@model_id = model_id
@model_name = model_name
@valid = true
self[:model_card_id] = model_card_id
self[:account_id] = account_id
self[:workspace_id] = workspace_id
self[:project_id] = project_id
self[:project_name] = project_name
self[:model_id] = model_id
Expand Down
3 changes: 2 additions & 1 deletion speckle_connector_3/src/cards/receive_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ReceiveCard < Card
def initialize(
model_card_id,
account_id,
workspace_id,
project_id,
model_id,
project_name,
Expand All @@ -62,7 +63,7 @@ def initialize(
expired,
baked_object_ids = nil
)
super(model_card_id, account_id, project_id, project_name, model_id, model_name)
super(model_card_id, account_id, workspace_id, 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
Expand Down
3 changes: 2 additions & 1 deletion speckle_connector_3/src/cards/send_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class SendCard < Card
def initialize(
model_card_id,
account_id,
workspace_id,
project_id,
project_name,
model_id,
Expand All @@ -34,7 +35,7 @@ def initialize(
send_filter,
send_settings
)
super(model_card_id, account_id, project_id, project_name, model_id, model_name)
super(model_card_id, account_id, workspace_id, project_id, project_name, model_id, model_name)
@send_filter = send_filter
@send_settings = send_settings
@latest_created_version_id = latest_created_version_id
Expand Down
4 changes: 2 additions & 2 deletions speckle_connector_3/src/ui/dui3_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def init_dialog
true
end
# File.exist?(@htm_file) ? dialog.set_file(@htm_file) : dialog.set_url('http://localhost:9091')
# dialog.set_url('http://localhost:8082') # uncomment this line if you want to use your local version of ui
dialog.set_url('https://boisterous-douhua-e3cefb.netlify.app/') # uncomment this line if you want to use deployed ui on netlify
dialog.set_url('http://localhost:8082') # uncomment this line if you want to use your local version of ui
# dialog.set_url('https://boisterous-douhua-e3cefb.netlify.app/') # uncomment this line if you want to use deployed ui on netlify
add_exec_callback(dialog)
dialog
end
Expand Down

0 comments on commit 1f45902

Please sign in to comment.