Skip to content

Commit 727e525

Browse files
authored
fix app deployments pagination and feature flag (#7352)
1 parent 8ab6440 commit 727e525

File tree

3 files changed

+56
-5
lines changed

3 files changed

+56
-5
lines changed

.changeset/curly-birds-itch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'hive': patch
3+
---
4+
5+
Correctly check the global environment feature flag in for app deployments and fix app deployment pagination

packages/services/api/src/modules/organization/providers/organization-access-tokens.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
import * as GraphQLSchema from '../../../__generated__/types';
99
import { Organization, Project } from '../../../shared/entities';
1010
import { isUUID } from '../../../shared/is-uuid';
11+
import { APP_DEPLOYMENTS_ENABLED } from '../../app-deployments/providers/app-deployments-enabled-token';
1112
import { AuditLogRecorder } from '../../audit-logs/providers/audit-log-recorder';
1213
import {
1314
getPermissionGroup,
@@ -154,6 +155,7 @@ export class OrganizationAccessTokens {
154155
private members: OrganizationMembers,
155156
logger: Logger,
156157
@Inject(OTEL_TRACING_ENABLED) private otelTracingEnabled: boolean,
158+
@Inject(APP_DEPLOYMENTS_ENABLED) private appDeploymentsEnabled: boolean,
157159
) {
158160
this.logger = logger.child({
159161
source: 'OrganizationAccessTokens',
@@ -891,11 +893,12 @@ export class OrganizationAccessTokens {
891893
}
892894

893895
private createFeatureFlagPermissionFilter(organization: Organization) {
894-
const isAppDeplymentsEnabled = organization.featureFlags.appDeployments;
896+
const isAppDeploymentsEnabled =
897+
organization.featureFlags.appDeployments || this.appDeploymentsEnabled;
895898
const isOTELTracingEnabled = organization.featureFlags.otelTracing || this.otelTracingEnabled;
896899

897900
return (id: Permission) =>
898-
(!isAppDeplymentsEnabled && id.startsWith('appDeployment:')) ||
901+
(!isAppDeploymentsEnabled && id.startsWith('appDeployment:')) ||
899902
(!isOTELTracingEnabled && id.startsWith('traces:'))
900903
? false
901904
: true;

packages/web/app/src/pages/target-app-version.tsx

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const TargetAppsVersionQuery = graphql(`
4040
$appName: String!
4141
$appVersion: String!
4242
$first: Int
43-
$after: String
4443
$documentsFilter: AppDeploymentDocumentsFilterInput
4544
) {
4645
target(
@@ -58,6 +57,48 @@ const TargetAppsVersionQuery = graphql(`
5857
id
5958
name
6059
version
60+
documents(first: $first, filter: $documentsFilter) {
61+
pageInfo {
62+
hasNextPage
63+
endCursor
64+
}
65+
edges {
66+
node {
67+
hash
68+
body
69+
operationName
70+
insightsHash
71+
}
72+
}
73+
}
74+
}
75+
}
76+
}
77+
`);
78+
79+
const TargetAppsVersionFetchMoreQuery = graphql(`
80+
query TargetAppsVersionFetchMore(
81+
$organizationSlug: String!
82+
$projectSlug: String!
83+
$targetSlug: String!
84+
$appName: String!
85+
$appVersion: String!
86+
$first: Int
87+
$after: String
88+
$documentsFilter: AppDeploymentDocumentsFilterInput
89+
) {
90+
target(
91+
reference: {
92+
bySelector: {
93+
organizationSlug: $organizationSlug
94+
projectSlug: $projectSlug
95+
targetSlug: $targetSlug
96+
}
97+
}
98+
) {
99+
id
100+
appDeployment(appName: $appName, appVersion: $appVersion) {
101+
id
61102
documents(first: $first, after: $after, filter: $documentsFilter) {
62103
pageInfo {
63104
hasNextPage
@@ -108,7 +149,6 @@ function TargetAppVersionContent(props: {
108149
appName: props.appName,
109150
appVersion: props.appVersion,
110151
first: 20,
111-
after: null,
112152
documentsFilter: {
113153
operationName: debouncedSearch,
114154
},
@@ -335,14 +375,17 @@ function TargetAppVersionContent(props: {
335375
) {
336376
setIsLoadingMore(true);
337377
void client
338-
.query(TargetAppsVersionQuery, {
378+
.query(TargetAppsVersionFetchMoreQuery, {
339379
organizationSlug: props.organizationSlug,
340380
projectSlug: props.projectSlug,
341381
targetSlug: props.targetSlug,
342382
appName: props.appName,
343383
appVersion: props.appVersion,
344384
first: 20,
345385
after: data?.data?.target?.appDeployment?.documents.pageInfo?.endCursor,
386+
documentsFilter: {
387+
operationName: debouncedSearch,
388+
},
346389
})
347390
.toPromise()
348391
.finally(() => {

0 commit comments

Comments
 (0)