Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
bnussman committed Nov 5, 2024
2 parents f8d33b5 + 5c9feb0 commit 7adb6cf
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 27 deletions.
7 changes: 7 additions & 0 deletions packages/manager/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## [2024-11-05] - v1.131.2


### Fixed:

- APL summary panel not being loaded consistently ([#11207](https://github.com/linode/manager/pull/11207))

## [2024-10-29] - v1.131.1


Expand Down
2 changes: 1 addition & 1 deletion packages/manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "linode-manager",
"author": "Linode",
"description": "The Linode Manager website",
"version": "1.131.1",
"version": "1.131.2",
"private": true,
"type": "module",
"bugs": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const CreateCluster = () => {
const regionsData = data ?? [];
const history = useHistory();
const { data: account } = useAccount();
const showAPL = useAPLAvailability();
const { showAPL } = useAPLAvailability();
const { showHighAvailability } = getKubeHighAvailability(account);
const { showControlPlaneACL } = getKubeControlPlaneACL(account);
const [ipV4Addr, setIPv4Addr] = React.useState<ExtendedIP[]>([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,21 @@ const checkConsoleURL = async (
setStatus: React.Dispatch<React.SetStateAction<StatusState>>
) => {
const consoleURL = `https://console.lke${cluster.id}.akamai-apl.net`;

const healthCheckURL = `https://auth.lke${cluster.id}.akamai-apl.net/ready`;
const pollURL = async () => {
try {
const response = await axios.get(consoleURL);
const response = await axios.get(healthCheckURL);

if (response.status === 200) {
if (response.status === 302 || response.status === 200) {
clearInterval(interval); // Stop the polling
setStatus({ resolved: true, url: consoleURL });
}
} catch (error) {
if (error.response && error.response.status === 404) {
setStatus({
message:
'Installation still in progress; please check back in a minute.',
resolved: false,
});
}
setStatus({
message:
'Installation still in progress; please check back in a minute.',
resolved: false,
});
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const KubernetesClusterDetail = () => {
const { clusterID } = useParams<{ clusterID: string }>();
const id = Number(clusterID);
const location = useLocation();
const showAPL = useAPLAvailability();
const { showAPL } = useAPLAvailability();

const { data: cluster, error, isLoading } = useKubernetesClusterQuery(id);
const { data: regionsData } = useRegionsQuery();
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/features/Kubernetes/kubeUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('helper functions', () => {
wrapper: (ui) => wrapWithTheme(ui, { flags: { apl: true } }),
});
await waitFor(() => {
expect(result.current).toBe(true);
expect(result.current.showAPL).toBe(true);
});
});
});
Expand Down
13 changes: 6 additions & 7 deletions packages/manager/src/features/Kubernetes/kubeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,14 @@ export const useAPLAvailability = () => {
const flags = useFlags();

// Only fetch the account beta if the APL flag is enabled
const { data: beta } = useAccountBetaQuery('apl', Boolean(flags.apl));

if (!beta) {
return false;
}
const { data: beta, isLoading } = useAccountBetaQuery(
'apl',
Boolean(flags.apl)
);

const betaStatus = getBetaStatus(beta);
const showAPL = beta !== undefined && getBetaStatus(beta) === 'active';

return betaStatus === 'active';
return { isLoading: flags.apl && isLoading, showAPL };
};

export const getKubeControlPlaneACL = (
Expand Down
1 change: 1 addition & 0 deletions packages/manager/src/queries/account/betas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const useCreateAccountBetaMutation = () => {
export const useAccountBetaQuery = (id: string, enabled: boolean = false) => {
return useQuery<AccountBeta, APIError[]>({
enabled,
retry: false,
...accountQueries.betas._ctx.beta(id),
});
};
25 changes: 19 additions & 6 deletions packages/manager/src/queries/kubernetes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ export const kubernetesQueries = createQueryKeys('kubernetes', {
queryFn: () => getKubernetesClusterControlPlaneACL(id),
queryKey: [id],
},
cluster: (useBetaEndpoint: boolean = false) => ({
queryFn: useBetaEndpoint
? () => getKubernetesClusterBeta(id)
: () => getKubernetesCluster(id),
queryKey: [useBetaEndpoint],
}),
dashboard: {
queryFn: () => getKubernetesClusterDashboard(id),
queryKey: null,
Expand Down Expand Up @@ -109,12 +115,11 @@ export const kubernetesQueries = createQueryKeys('kubernetes', {
});

export const useKubernetesClusterQuery = (id: number) => {
const showAPL = useAPLAvailability();
const { isLoading: isAPLAvailabilityLoading, showAPL } = useAPLAvailability();

return useQuery<KubernetesCluster, APIError[]>({
...kubernetesQueries.cluster(id),
queryFn: showAPL
? () => getKubernetesClusterBeta(id) // necessary to call BETA_API_ROOT in a seperate function based on feature flag
: () => getKubernetesCluster(id),
...kubernetesQueries.cluster(id)._ctx.cluster(showAPL),
enabled: !isAPLAvailabilityLoading,
});
};

Expand Down Expand Up @@ -142,7 +147,15 @@ export const useKubernetesClusterMutation = (id: number) => {
queryClient.invalidateQueries({
queryKey: kubernetesQueries.cluster(id)._ctx.acl.queryKey,
});
queryClient.setQueryData(kubernetesQueries.cluster(id).queryKey, data);
// queryClient.setQueryData<KubernetesCluster>(
// kubernetesQueries.cluster(id).queryKey,
// data
// );
// Temporary cache update logic for APL
queryClient.setQueriesData<KubernetesCluster>(
{ queryKey: kubernetesQueries.cluster(id)._ctx.cluster._def },
(oldData) => ({ ...oldData, ...data })
);
},
}
);
Expand Down

0 comments on commit 7adb6cf

Please sign in to comment.