Skip to content

Commit 288687d

Browse files
Fix frontend domain inference
The frontend seems to be expecting the domain pattern to be different than it currently is, expose the inferred domain via gql and fix fe code accordingly
1 parent bd85d21 commit 288687d

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

apps/graphql/lib/graphql/resolvers/cloud.ex

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ defmodule GraphQl.Resolvers.Cloud do
1515
ok(Clusters.get_cluster_by_url("https://#{url}") || Clusters.get_cluster_by_url(url))
1616
end
1717

18+
def resolve_domain(%ConsoleInstance{} = inst, _, _) do
19+
case Cloud.domain(inst) do
20+
"https://" <> domain -> {:ok, domain}
21+
_ -> {:error, "No valid domain for this instance"}
22+
end
23+
end
24+
1825
def list_instances(args, %{context: %{current_user: user}}) do
1926
ConsoleInstance.for_account(user.account_id)
2027
|> ConsoleInstance.ordered()

apps/graphql/lib/graphql/schema/cloud.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ defmodule GraphQl.Schema.Cloud do
5252
field :network, :console_instance_network, description: "the network configuration for this instance"
5353
field :oidc, :console_instance_oidc, description: "custom oidc configuration for this instance"
5454

55+
field :domain, :string, description: "the domain of this instance", resolve: &Cloud.resolve_domain/3
56+
5557
field :status, non_null(:console_instance_status),
5658
description: "the provisioning status of this instance, liveness is fetched through the console field"
5759

schema/schema.graphql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,9 @@ type ConsoleInstance {
665665
"custom oidc configuration for this instance"
666666
oidc: ConsoleInstanceOidc
667667

668+
"the domain of this instance"
669+
domain: String
670+
668671
"the provisioning status of this instance, liveness is fetched through the console field"
669672
status: ConsoleInstanceStatus!
670673

www/src/generated/graphql.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,8 @@ export type ConsoleInstance = {
581581
console?: Maybe<Cluster>;
582582
/** the time this instance was deleted on */
583583
deletedAt?: Maybe<Scalars['DateTime']['output']>;
584+
/** the domain of this instance */
585+
domain?: Maybe<Scalars['String']['output']>;
584586
id: Scalars['ID']['output'];
585587
insertedAt?: Maybe<Scalars['DateTime']['output']>;
586588
/** the name of this instance (globally unique) */

0 commit comments

Comments
 (0)