From c6aa4e74bb11809e83efd5d84a5c3dbe6c204355 Mon Sep 17 00:00:00 2001 From: Varun Dey Date: Thu, 10 Aug 2023 11:04:28 +0530 Subject: [PATCH] Read config state using computed field PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10089 GitOrigin-RevId: bad2152b9b2a3e1636c42967b1a9cf69fe0cb0ab --- .../Neon/useCreateHasuraCloudDatasource.ts | 10 +- .../ControlPlane/generatedGraphQLTypes.ts | 118 +++++++++++++++--- .../src/lib/features/ControlPlane/queries.ts | 8 +- 3 files changed, 107 insertions(+), 29 deletions(-) diff --git a/frontend/libs/console/legacy-ce/src/lib/components/Services/Data/DataSources/CreateDataSource/Neon/useCreateHasuraCloudDatasource.ts b/frontend/libs/console/legacy-ce/src/lib/components/Services/Data/DataSources/CreateDataSource/Neon/useCreateHasuraCloudDatasource.ts index 4946d0552bf..04a3f36fe02 100644 --- a/frontend/libs/console/legacy-ce/src/lib/components/Services/Data/DataSources/CreateDataSource/Neon/useCreateHasuraCloudDatasource.ts +++ b/frontend/libs/console/legacy-ce/src/lib/components/Services/Data/DataSources/CreateDataSource/Neon/useCreateHasuraCloudDatasource.ts @@ -182,17 +182,9 @@ export function useCreateHasuraCloudDatasource( tenantId: Globals.hasuraCloudTenantId, }, data => { - const configStatusData = data.hasura_worker - .map(config_status_obj => - config_status_obj.config_statuses.map( - config_data => config_data - ) - ) - .flat(1); - if ( // check if all workers are successfully configured with the new hash - configStatusData.every( + data.config_status.every( config => config.message === 'Service configured successfully' && config.hash !== oldConfigHash diff --git a/frontend/libs/console/legacy-ce/src/lib/features/ControlPlane/generatedGraphQLTypes.ts b/frontend/libs/console/legacy-ce/src/lib/features/ControlPlane/generatedGraphQLTypes.ts index 5091dff2f10..a52b563dd7b 100644 --- a/frontend/libs/console/legacy-ce/src/lib/features/ControlPlane/generatedGraphQLTypes.ts +++ b/frontend/libs/console/legacy-ce/src/lib/features/ControlPlane/generatedGraphQLTypes.ts @@ -4093,6 +4093,8 @@ export type Config_Status = { tenant_id: Scalars['uuid']; updated_at: Scalars['timestamptz']; worker_id: Scalars['uuid']; + /** A computed field, executes function "config_status_worker_state" */ + worker_state?: Maybe; }; /** aggregated selection of "config_status" */ @@ -4169,6 +4171,7 @@ export type Config_Status_Bool_Exp = { tenant_id?: Maybe; updated_at?: Maybe; worker_id?: Maybe; + worker_state?: Maybe; }; /** unique or primary key constraints on table "config_status" */ @@ -4251,6 +4254,7 @@ export type Config_Status_Order_By = { tenant_id?: Maybe; updated_at?: Maybe; worker_id?: Maybe; + worker_state?: Maybe; }; /** primary key columns input for table: config_status */ @@ -10017,6 +10021,17 @@ export type Ddn_Project_Entitlement_Access_Aggregate = { nodes: Array; }; +export type Ddn_Project_Entitlement_Access_Aggregate_Bool_Exp = { + count?: Maybe; +}; + +export type Ddn_Project_Entitlement_Access_Aggregate_Bool_Exp_Count = { + arguments?: Maybe>; + distinct?: Maybe; + filter?: Maybe; + predicate: Int_Comparison_Exp; +}; + /** aggregate fields of "ddn.project_entitlement_access" */ export type Ddn_Project_Entitlement_Access_Aggregate_Fields = { __typename?: 'ddn_project_entitlement_access_aggregate_fields'; @@ -10031,6 +10046,20 @@ export type Ddn_Project_Entitlement_Access_Aggregate_FieldsCountArgs = { distinct?: Maybe; }; +/** order by aggregate values of table "ddn.project_entitlement_access" */ +export type Ddn_Project_Entitlement_Access_Aggregate_Order_By = { + count?: Maybe; + max?: Maybe; + min?: Maybe; +}; + +/** input type for inserting array relation for remote table "ddn.project_entitlement_access" */ +export type Ddn_Project_Entitlement_Access_Arr_Rel_Insert_Input = { + data: Array; + /** upsert condition */ + on_conflict?: Maybe; +}; + /** * Boolean expression to filter rows from the table * "ddn.project_entitlement_access". All fields are combined with a logical 'AND'. @@ -10075,6 +10104,15 @@ export type Ddn_Project_Entitlement_Access_Max_Fields = { updated_at?: Maybe; }; +/** order by max() on columns of table "ddn.project_entitlement_access" */ +export type Ddn_Project_Entitlement_Access_Max_Order_By = { + created_at?: Maybe; + entitlement_id?: Maybe; + id?: Maybe; + project_id?: Maybe; + updated_at?: Maybe; +}; + /** aggregate min on columns */ export type Ddn_Project_Entitlement_Access_Min_Fields = { __typename?: 'ddn_project_entitlement_access_min_fields'; @@ -10085,6 +10123,15 @@ export type Ddn_Project_Entitlement_Access_Min_Fields = { updated_at?: Maybe; }; +/** order by min() on columns of table "ddn.project_entitlement_access" */ +export type Ddn_Project_Entitlement_Access_Min_Order_By = { + created_at?: Maybe; + entitlement_id?: Maybe; + id?: Maybe; + project_id?: Maybe; + updated_at?: Maybe; +}; + /** response of any mutation on the table "ddn.project_entitlement_access" */ export type Ddn_Project_Entitlement_Access_Mutation_Response = { __typename?: 'ddn_project_entitlement_access_mutation_response'; @@ -10186,7 +10233,7 @@ export type Ddn_Project_Entitlement_Catalogue = { created_at: Scalars['timestamp']; id: Scalars['uuid']; name: Scalars['String']; - type: Scalars['String']; + type: Ddn_Project_Entitlement_Types_Enum; updated_at: Scalars['timestamp']; }; @@ -10238,7 +10285,7 @@ export type Ddn_Project_Entitlement_Catalogue_Bool_Exp = { created_at?: Maybe; id?: Maybe; name?: Maybe; - type?: Maybe; + type?: Maybe; updated_at?: Maybe; }; @@ -10262,7 +10309,7 @@ export type Ddn_Project_Entitlement_Catalogue_Insert_Input = { created_at?: Maybe; id?: Maybe; name?: Maybe; - type?: Maybe; + type?: Maybe; updated_at?: Maybe; }; @@ -10273,7 +10320,6 @@ export type Ddn_Project_Entitlement_Catalogue_Max_Fields = { created_at?: Maybe; id?: Maybe; name?: Maybe; - type?: Maybe; updated_at?: Maybe; }; @@ -10284,7 +10330,6 @@ export type Ddn_Project_Entitlement_Catalogue_Min_Fields = { created_at?: Maybe; id?: Maybe; name?: Maybe; - type?: Maybe; updated_at?: Maybe; }; @@ -10352,7 +10397,7 @@ export type Ddn_Project_Entitlement_Catalogue_Set_Input = { created_at?: Maybe; id?: Maybe; name?: Maybe; - type?: Maybe; + type?: Maybe; updated_at?: Maybe; }; @@ -10389,7 +10434,7 @@ export type Ddn_Project_Entitlement_Catalogue_Stream_Cursor_Value_Input = { created_at?: Maybe; id?: Maybe; name?: Maybe; - type?: Maybe; + type?: Maybe; updated_at?: Maybe; }; @@ -10490,6 +10535,27 @@ export enum Ddn_Project_Entitlement_Types_Constraint { ProjectEntitlementTypesPkey = 'project_entitlement_types_pkey', } +export enum Ddn_Project_Entitlement_Types_Enum { + /** Maximum number of builds a v3 project can have at once */ + BuildLimit = 'build_limit', + /** Maximum number of builds a v3 project can have at once */ + EnvironmentLimit = 'environment_limit', + /** Maximum size in for a serialized metadata artifact */ + MetadataSizeLimit = 'metadata_size_limit', +} + +/** + * Boolean expression to compare columns of type + * "ddn_project_entitlement_types_enum". All fields are combined with logical 'AND'. + */ +export type Ddn_Project_Entitlement_Types_Enum_Comparison_Exp = { + _eq?: Maybe; + _in?: Maybe>; + _is_null?: Maybe; + _neq?: Maybe; + _nin?: Maybe>; +}; + /** input type for inserting data into table "ddn.project_entitlement_types" */ export type Ddn_Project_Entitlement_Types_Insert_Input = { comment?: Maybe; @@ -10589,6 +10655,10 @@ export type Ddn_Projects = { builds_aggregate: Ddn_Build_Aggregate; created_at: Scalars['timestamptz']; /** An array relationship */ + entitlements: Array; + /** An aggregate relationship */ + entitlements_aggregate: Ddn_Project_Entitlement_Access_Aggregate; + /** An array relationship */ environments: Array; /** An aggregate relationship */ environments_aggregate: Ddn_Environment_Aggregate; @@ -10618,6 +10688,24 @@ export type Ddn_ProjectsBuilds_AggregateArgs = { where?: Maybe; }; +/** columns and relationships of "ddn.projects" */ +export type Ddn_ProjectsEntitlementsArgs = { + distinct_on?: Maybe>; + limit?: Maybe; + offset?: Maybe; + order_by?: Maybe>; + where?: Maybe; +}; + +/** columns and relationships of "ddn.projects" */ +export type Ddn_ProjectsEntitlements_AggregateArgs = { + distinct_on?: Maybe>; + limit?: Maybe; + offset?: Maybe; + order_by?: Maybe>; + where?: Maybe; +}; + /** columns and relationships of "ddn.projects" */ export type Ddn_ProjectsEnvironmentsArgs = { distinct_on?: Maybe>; @@ -10665,6 +10753,8 @@ export type Ddn_Projects_Bool_Exp = { builds?: Maybe; builds_aggregate?: Maybe; created_at?: Maybe; + entitlements?: Maybe; + entitlements_aggregate?: Maybe; environments?: Maybe; environments_aggregate?: Maybe; id?: Maybe; @@ -10686,6 +10776,7 @@ export enum Ddn_Projects_Constraint { export type Ddn_Projects_Insert_Input = { builds?: Maybe; created_at?: Maybe; + entitlements?: Maybe; environments?: Maybe; id?: Maybe; name?: Maybe; @@ -10741,6 +10832,7 @@ export type Ddn_Projects_On_Conflict = { export type Ddn_Projects_Order_By = { builds_aggregate?: Maybe; created_at?: Maybe; + entitlements_aggregate?: Maybe; environments_aggregate?: Maybe; id?: Maybe; name?: Maybe; @@ -82461,13 +82553,9 @@ export type FetchConfigStatusSubscriptionVariables = Exact<{ export type FetchConfigStatusSubscription = { __typename?: 'subscription_root'; - hasura_worker: Array<{ - __typename?: 'hasura_worker'; - config_statuses: Array<{ - __typename?: 'config_status'; - hash: string; - message?: string | null; - worker_id: any; - }>; + config_status: Array<{ + __typename?: 'config_status'; + hash: string; + message?: string | null; }>; }; diff --git a/frontend/libs/console/legacy-ce/src/lib/features/ControlPlane/queries.ts b/frontend/libs/console/legacy-ce/src/lib/features/ControlPlane/queries.ts index ffebfd413b2..4ac8d79bc21 100644 --- a/frontend/libs/console/legacy-ce/src/lib/features/ControlPlane/queries.ts +++ b/frontend/libs/console/legacy-ce/src/lib/features/ControlPlane/queries.ts @@ -266,10 +266,8 @@ export const ADD_SCHEMA_REGISTRY_FEATURE_REQUEST = gql(` export const FETCH_CONFIG_STATUS = gql(` subscription FetchConfigStatus($tenantId: uuid!) { - hasura_worker(where: {config_statuses: {is_active: {_eq: true}, tenant_id: {_eq: $tenantId}}, status: {_eq: "live"}}) { - config_statuses(where: {is_active: {_eq: true}, tenant_id: {_eq: $tenantId}}) { - hash - message - } + config_status(where: {is_active: {_eq: true}, tenant_id: {_eq: $tenantId}, worker_state: {_eq: "live"}}) { + hash + message } }`);