Skip to content

Commit

Permalink
Rename active to disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmach committed Dec 23, 2024
1 parent c324d38 commit 7a654e8
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/livebook/hubs/team.ex
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ defmodule Livebook.Hubs.Team do
field :session_token, :string, redact: true
field :hub_name, :string
field :hub_emoji, :string
field :active, :boolean, default: true
field :disabled, :boolean, default: false

embeds_one :offline, Offline
end
Expand Down
8 changes: 4 additions & 4 deletions lib/livebook/hubs/team_client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -801,12 +801,12 @@ defmodule Livebook.Hubs.TeamClient do
state
end

defp update_hub(state, %LivebookProto.UserConnected{org_active: active}) do
update_hub(state, &put_in(&1.active, active))
defp update_hub(state, %LivebookProto.UserConnected{org_disabled: disabled}) do
update_hub(state, &put_in(&1.disabled, disabled))
end

defp update_hub(state, %LivebookProto.OrgUpdated{active: active}) do
update_hub(state, &put_in(&1.active, active))
defp update_hub(state, %LivebookProto.OrgUpdated{disabled: disabled}) do
update_hub(state, &put_in(&1.disabled, disabled))
end

defp update_hub(state, %LivebookProto.AgentConnected{public_key: org_public_key}) do
Expand Down
14 changes: 7 additions & 7 deletions lib/livebook_web/live/hub/edit/team_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ defmodule LivebookWeb.Hub.Edit.TeamComponent do
{Provider.connection_status(@hub)}
</LayoutComponents.topbar>
<LayoutComponents.topbar :if={!@hub.active} variant="warning">
<LayoutComponents.topbar :if={@hub.disabled} variant="warning">
<h2>
Workspace disabled: your organization doesn't have an active subscription. Please contact your <.link
href={org_url(@hub, "/users")}
Expand Down Expand Up @@ -185,14 +185,14 @@ defmodule LivebookWeb.Hub.Edit.TeamComponent do
secrets={@secrets}
edit_path={"hub/#{@hub.id}/secrets/edit"}
return_to={~p"/hub/#{@hub.id}"}
disabled={not @hub.active}
disabled={@hub.disabled}
/>
<div>
<.button
patch={~p"/hub/#{@hub.id}/secrets/new"}
id="add-secret"
disabled={not @hub.active}
disabled={@hub.disabled}
>
Add secret
</.button>
Expand All @@ -214,7 +214,7 @@ defmodule LivebookWeb.Hub.Edit.TeamComponent do
hub_id={@hub.id}
file_systems={@file_systems}
target={@myself}
disabled={not @hub.active}
disabled={@hub.disabled}
/>
</div>
Expand Down Expand Up @@ -251,7 +251,7 @@ defmodule LivebookWeb.Hub.Edit.TeamComponent do
<.button
patch={~p"/hub/#{@hub.id}/groups/new"}
id="add-deployment-group"
disabled={not @hub.active}
disabled={@hub.disabled}
>
Add deployment group
</.button>
Expand Down Expand Up @@ -308,7 +308,7 @@ defmodule LivebookWeb.Hub.Edit.TeamComponent do
secret_name={@secret_name}
secret_value={@secret_value}
return_to={~p"/hub/#{@hub.id}"}
disabled={not @hub.active}
disabled={@hub.disabled}
/>
</.modal>
Expand All @@ -323,7 +323,7 @@ defmodule LivebookWeb.Hub.Edit.TeamComponent do
module={LivebookWeb.Hub.FileSystemFormComponent}
id="file-systems"
hub={@hub}
disabled={not @hub.active}
disabled={@hub.disabled}
file_system={@file_system}
file_system_id={@file_system_id}
return_to={~p"/hub/#{@hub.id}"}
Expand Down
2 changes: 1 addition & 1 deletion lib/livebook_web/live/hub/secret_form_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ defmodule LivebookWeb.Hub.SecretFormComponent do
<.hidden_field field={f[:hub_id]} value={@hub.id} />
<.hidden_field field={f[:deployment_group_id]} value={@deployment_group_id} />
<div class="flex space-x-2">
<.button type="submit" disabled={not @changeset.valid? or @disabled}>
<.button type="submit" disabled={@disabled or not @changeset.valid?}>
<.remix_icon icon={@button.icon} />
<span class="font-normal">{@button.label}</span>
</.button>
Expand Down
2 changes: 1 addition & 1 deletion proto/lib/livebook_proto/agent_connected.pb.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ defmodule LivebookProto.AgentConnected do
json_name: "appDeployments"

field :agents, 9, repeated: true, type: LivebookProto.Agent
field :org_active, 10, type: :bool, json_name: "orgActive"
field :org_disabled, 10, type: :bool, json_name: "orgDisabled"
end
2 changes: 1 addition & 1 deletion proto/lib/livebook_proto/org_updated.pb.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ defmodule LivebookProto.OrgUpdated do
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3

field :id, 1, type: :string
field :active, 2, type: :bool
field :disabled, 2, type: :bool
end
2 changes: 1 addition & 1 deletion proto/lib/livebook_proto/user_connected.pb.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ defmodule LivebookProto.UserConnected do
json_name: "appDeployments"

field :agents, 6, repeated: true, type: LivebookProto.Agent
field :org_active, 7, type: :bool, json_name: "orgActive"
field :org_disabled, 7, type: :bool, json_name: "orgDisabled"
end
6 changes: 3 additions & 3 deletions proto/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ message UserConnected {
repeated DeploymentGroup deployment_groups = 4;
repeated AppDeployment app_deployments = 5;
repeated Agent agents = 6;
bool org_active = 7;
bool org_disabled = 7;
}

message AgentConnected {
Expand All @@ -119,7 +119,7 @@ message AgentConnected {
repeated DeploymentGroup deployment_groups = 7;
repeated AppDeployment app_deployments = 8;
repeated Agent agents = 9;
bool org_active = 10;
bool org_disabled = 10;
}

message AppDeployment {
Expand Down Expand Up @@ -158,7 +158,7 @@ message AgentLeft {

message OrgUpdated {
string id = 1;
bool active = 2;
bool disabled = 2;
}

message Agent {
Expand Down

0 comments on commit 7a654e8

Please sign in to comment.