-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restrict teams features based on org status #2897
Open
wojtekmach
wants to merge
4
commits into
main
Choose a base branch
from
wm-disable-when-not-active
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,15 @@ defmodule LivebookWeb.Hub.Edit.TeamComponent do | |
{Provider.connection_status(@hub)} | ||
</LayoutComponents.topbar> | ||
|
||
<LayoutComponents.topbar :if={[email protected]} variant="warning"> | ||
<h2> | ||
Workspace disabled: your organization doesn't have an active subscription. Please contact your <.link | ||
href={org_url(@hub, "/users")} | ||
class="underline" | ||
>org's admin</.link>. | ||
</h2> | ||
</LayoutComponents.topbar> | ||
|
||
<div class="p-4 md:px-12 md:py-7 max-w-screen-md mx-auto"> | ||
<div id={"#{@id}-component"}> | ||
<div class="mb-8 flex flex-col space-y-2"> | ||
|
@@ -176,10 +185,15 @@ 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} | ||
/> | ||
|
||
<div> | ||
<.button patch={~p"/hub/#{@hub.id}/secrets/new"} id="add-secret"> | ||
<.button | ||
patch={~p"/hub/#{@hub.id}/secrets/new"} | ||
id="add-secret" | ||
disabled={not @hub.active} | ||
> | ||
Add secret | ||
</.button> | ||
</div> | ||
|
@@ -200,6 +214,7 @@ defmodule LivebookWeb.Hub.Edit.TeamComponent do | |
hub_id={@hub.id} | ||
file_systems={@file_systems} | ||
target={@myself} | ||
disabled={not @hub.active} | ||
/> | ||
</div> | ||
|
||
|
@@ -233,7 +248,11 @@ defmodule LivebookWeb.Hub.Edit.TeamComponent do | |
</div> | ||
|
||
<div> | ||
<.button patch={~p"/hub/#{@hub.id}/groups/new"} id="add-deployment-group"> | ||
<.button | ||
patch={~p"/hub/#{@hub.id}/groups/new"} | ||
id="add-deployment-group" | ||
disabled={not @hub.active} | ||
> | ||
Add deployment group | ||
</.button> | ||
</div> | ||
|
@@ -289,6 +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} | ||
/> | ||
</.modal> | ||
|
||
|
@@ -303,6 +323,7 @@ defmodule LivebookWeb.Hub.Edit.TeamComponent do | |
module={LivebookWeb.Hub.FileSystemFormComponent} | ||
id="file-systems" | ||
hub={@hub} | ||
disabled={not @hub.active} | ||
file_system={@file_system} | ||
file_system_id={@file_system_id} | ||
return_to={~p"/hub/#{@hub.id}"} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
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 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, we have a dependency issue here. We need to either:
org_disabled : bool
or something likeorg_status : active | disabled
The reason is the default value for booleans is
false
so if Teams is not sending this value it is consideredfalse
which would block Teams features. The DSL allows adefault: true
, which would be my preference, but that is not available on proto3.I guess option 1 is fine, option 2 with
:org_status
could be more future proof though. @jonatanklosko @josevalim @hugobarauna Thoughts?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making it an enum is probably going to be better in the long term?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josevalim
livebook/proto/messages.proto
Lines 164 to 174 in 04a93c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are going to deploy Teams first anyway (1.), otherwise the new Livebook release would probably have issues, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, correct. We always need to deploy Livebook Teams first before we release a new Livebook. But if anyone uses main or nightly build, then it will be fully broken saying they need to pay. That's why we may also want to have an enum with better defaults? Or the enum would be broken as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why couldn't we return more values in the future? Is that Protobuf limitation or it's depend on us how we treat incoming values (e.g. exhaustive case/2 on exact values)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So let's ship with the inverse for now:
inactive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The protobuf library would keep an unknown value, but it would be an integer (see commit message in elixir-protobuf/protobuf@6b8f40f). Leaking the integer to the rest of the application is probably a bad idea, so we would need to account for the unknown value early. In some cases this could be as simple as picking a default value, but here I'm not sure if that's clear. Using strings has the benefit that it's safer to keep them around, but it mostly pushes the catch all and default behaviour problem to other parts of the app.
I don't remember if there was a specific scenario behind the
AppDeploymentStatusType
comment though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im gonna go with inactive bool flag then. Though if anyone prefers can call it
disabled
, lmk. Thanks everyone!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me!