Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
Update abstra-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
abstra-bot committed Apr 20, 2023
1 parent b545e0b commit 3a29ff2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
18 changes: 18 additions & 0 deletions abstra_cli/apis/workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ def get_workspace_id():
)


def get_workspace_subdomain(wid):
query = """
query GetWorkspaceSubdomain($wid: uuid!) {
workspaces(where: {id: {_eq: $wid}}) {
subdomain {
name
}
}
}
"""
return (
api_main.hf_hasura_runner(query, {"wid": wid})
.get("workspaces", [{"subdomain": {"name": None}}])[0]
.get("subdomain", {"name": None})
.get("name", None)
)


def update_workspace(wid, data):
workspace_data = update_workspace_data(data)

Expand Down
10 changes: 10 additions & 0 deletions abstra_cli/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,13 @@ def no_vars_to_deploy():

def error_getting_workspace_id():
print("Failed to get workspace id")


def workspace_url(workspace_subdomain):
print(f"Your workspace: https://{workspace_subdomain}.abstra.run")


def subdomain_helper():
print(
"You can set the subdomain of your workspace using `abstra update subdomain [new-subdomain]`"
)
3 changes: 3 additions & 0 deletions abstra_cli/resources/workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ def update(*args, **kwargs):
if workspace_data:
try:
workspaces_api.update_workspace(wid, workspace_data)
subdomain_name = workspaces_api.get_workspace_subdomain(wid)
messages.updated_message("Workspace", wid)
messages.workspace_url(subdomain_name)
messages.subdomain_helper()
except Exception as e:
print(e)
messages.update_failed("Workspace", wid)
Expand Down

0 comments on commit 3a29ff2

Please sign in to comment.