mirror of https://github.com/portainer/portainer
fix(home): link to correct env route [EE-4877] (#8295)
parent
329e8bcad5
commit
d3bed3072b
|
@ -23,6 +23,8 @@ export function EnvironmentBrowseButtons({
|
||||||
}) {
|
}) {
|
||||||
const isEdgeAsync = checkEdgeAsync(environment);
|
const isEdgeAsync = checkEdgeAsync(environment);
|
||||||
const browseStatus = getStatus(isActive, isEdgeAsync);
|
const browseStatus = getStatus(isActive, isEdgeAsync);
|
||||||
|
|
||||||
|
const dashboardRoute = getDashboardRoute(environment);
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-1 justify-center [&>*]:h-1/3 h-24">
|
<div className="flex flex-col gap-1 justify-center [&>*]:h-1/3 h-24">
|
||||||
{isBE && (
|
{isBE && (
|
||||||
|
@ -44,10 +46,8 @@ export function EnvironmentBrowseButtons({
|
||||||
title="Live connection is not available for async environments"
|
title="Live connection is not available for async environments"
|
||||||
icon={Wifi}
|
icon={Wifi}
|
||||||
disabled={isEdgeAsync || browseStatus === 'connected'}
|
disabled={isEdgeAsync || browseStatus === 'connected'}
|
||||||
to={getDashboardRoute(environment)}
|
to={dashboardRoute.to}
|
||||||
params={{
|
params={dashboardRoute.params}
|
||||||
endpointId: environment.Id,
|
|
||||||
}}
|
|
||||||
onClick={onClickBrowse}
|
onClick={onClickBrowse}
|
||||||
color="primary"
|
color="primary"
|
||||||
className="w-full !py-0 !m-0"
|
className="w-full !py-0 !m-0"
|
||||||
|
|
|
@ -47,15 +47,13 @@ export function EnvironmentItem({
|
||||||
const snapshotTime = getSnapshotTime(environment);
|
const snapshotTime = getSnapshotTime(environment);
|
||||||
|
|
||||||
const tags = useEnvironmentTagNames(environment.TagIds);
|
const tags = useEnvironmentTagNames(environment.TagIds);
|
||||||
|
const dashboardRoute = getDashboardRoute(environment);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Link
|
<Link
|
||||||
to={getDashboardRoute(environment)}
|
to={dashboardRoute.to}
|
||||||
params={{
|
params={dashboardRoute.params}
|
||||||
endpointId: environment.Id,
|
|
||||||
environmentId: environment.Id,
|
|
||||||
}}
|
|
||||||
className="no-link"
|
className="no-link"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
|
|
|
@ -70,24 +70,38 @@ export function isLocalEnvironment(environment: Environment) {
|
||||||
export function getDashboardRoute(environment: Environment) {
|
export function getDashboardRoute(environment: Environment) {
|
||||||
if (isEdgeEnvironment(environment.Type)) {
|
if (isEdgeEnvironment(environment.Type)) {
|
||||||
if (!environment.EdgeID) {
|
if (!environment.EdgeID) {
|
||||||
return 'portainer.endpoints.endpoint';
|
return {
|
||||||
|
to: 'portainer.endpoints.endpoint',
|
||||||
|
params: { id: environment.Id },
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEdgeAsync(environment)) {
|
if (isEdgeAsync(environment)) {
|
||||||
return 'edge.browse.dashboard';
|
return {
|
||||||
|
to: 'edge.browse.dashboard',
|
||||||
|
params: { environmentId: environment.EdgeID },
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const platform = getPlatformType(environment.Type);
|
const params = { endpointId: environment.Id };
|
||||||
|
const to = getPlatformRoute();
|
||||||
|
|
||||||
switch (platform) {
|
return { to, params };
|
||||||
case PlatformType.Azure:
|
|
||||||
return 'azure.dashboard';
|
function getPlatformRoute() {
|
||||||
case PlatformType.Docker:
|
const platform = getPlatformType(environment.Type);
|
||||||
return 'docker.dashboard';
|
switch (platform) {
|
||||||
case PlatformType.Kubernetes:
|
case PlatformType.Azure:
|
||||||
return 'kubernetes.dashboard';
|
return 'azure.dashboard';
|
||||||
default:
|
case PlatformType.Docker:
|
||||||
return '';
|
return 'docker.dashboard';
|
||||||
|
case PlatformType.Kubernetes:
|
||||||
|
return 'kubernetes.dashboard';
|
||||||
|
case PlatformType.Nomad:
|
||||||
|
return 'nomad.dashboard';
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported platform ${platform}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue