mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 00:09:40 +02:00
fix(ui): mark resources system correctly [EE-6558] (#10996)
* fix(ui): mark resources system correctly [EE-6558] * address review comments
This commit is contained in:
parent
85ae705833
commit
f7840e0407
17 changed files with 110 additions and 75 deletions
|
@ -4,6 +4,7 @@ import { Pod } from 'kubernetes-types/core/v1';
|
|||
|
||||
import { Authorized } from '@/react/hooks/useUser';
|
||||
import { useStackFile } from '@/react/common/stacks/stack.service';
|
||||
import { useNamespaceQuery } from '@/react/kubernetes/namespaces/queries/useNamespaceQuery';
|
||||
|
||||
import { Widget, WidgetBody } from '@@/Widget';
|
||||
import { Button } from '@@/buttons';
|
||||
|
@ -14,7 +15,6 @@ import {
|
|||
useApplication,
|
||||
useApplicationServices,
|
||||
} from '../../application.queries';
|
||||
import { isSystemNamespace } from '../../../namespaces/utils';
|
||||
import { applicationIsKind, isExternalApplication } from '../../utils';
|
||||
import { appStackIdLabel } from '../../constants';
|
||||
|
||||
|
@ -39,6 +39,9 @@ export function ApplicationDetailsWidget() {
|
|||
},
|
||||
} = stateAndParams;
|
||||
|
||||
const namespaceData = useNamespaceQuery(environmentId, namespace);
|
||||
const isSystemNamespace = namespaceData.data?.IsSystem;
|
||||
|
||||
// get app info
|
||||
const { data: app } = useApplication(
|
||||
environmentId,
|
||||
|
@ -61,7 +64,7 @@ export function ApplicationDetailsWidget() {
|
|||
<div className="col-sm-12">
|
||||
<Widget>
|
||||
<WidgetBody>
|
||||
{!isSystemNamespace(namespace) && (
|
||||
{!isSystemNamespace && (
|
||||
<div className="mb-4 flex flex-wrap gap-2">
|
||||
<Authorized authorizations="K8sApplicationDetailsW">
|
||||
<Link to="kubernetes.applications.application.edit">
|
||||
|
|
|
@ -18,7 +18,6 @@ import { InlineLoader } from '@@/InlineLoader';
|
|||
import { Icon } from '@@/Icon';
|
||||
import { Note } from '@@/Note';
|
||||
|
||||
import { isSystemNamespace } from '../../namespaces/utils';
|
||||
import {
|
||||
appStackNameLabel,
|
||||
appKindToDeploymentTypeMap,
|
||||
|
@ -39,6 +38,7 @@ import {
|
|||
usePatchApplicationMutation,
|
||||
} from '../application.queries';
|
||||
import { Application, ApplicationPatch } from '../types';
|
||||
import { useNamespaceQuery } from '../../namespaces/queries/useNamespaceQuery';
|
||||
|
||||
export function ApplicationSummaryWidget() {
|
||||
const stateAndParams = useCurrentStateAndParams();
|
||||
|
@ -56,7 +56,9 @@ export function ApplicationSummaryWidget() {
|
|||
name,
|
||||
resourceType
|
||||
);
|
||||
const systemNamespace = isSystemNamespace(namespace);
|
||||
const namespaceData = useNamespaceQuery(environmentId, namespace);
|
||||
const isSystemNamespace = namespaceData.data?.IsSystem;
|
||||
|
||||
const externalApplication = application && isExternalApplication(application);
|
||||
const applicationRequests = application && getResourceRequests(application);
|
||||
const applicationOwner = application?.metadata?.labels?.[appOwnerLabel];
|
||||
|
@ -124,7 +126,7 @@ export function ApplicationSummaryWidget() {
|
|||
data-cy="k8sAppDetail-appName"
|
||||
>
|
||||
{name}
|
||||
{externalApplication && !systemNamespace && (
|
||||
{externalApplication && !isSystemNamespace && (
|
||||
<Badge type="info">external</Badge>
|
||||
)}
|
||||
</div>
|
||||
|
@ -154,7 +156,7 @@ export function ApplicationSummaryWidget() {
|
|||
>
|
||||
{namespace}
|
||||
</Link>
|
||||
{systemNamespace && <Badge type="info">system</Badge>}
|
||||
{isSystemNamespace && <Badge type="info">system</Badge>}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -231,7 +233,7 @@ export function ApplicationSummaryWidget() {
|
|||
application?.metadata?.creationTimestamp
|
||||
).format('YYYY-MM-DD HH:mm:ss')}
|
||||
</span>
|
||||
{(!externalApplication || systemNamespace) && (
|
||||
{(!externalApplication || isSystemNamespace) && (
|
||||
<span
|
||||
className="flex items-center gap-1"
|
||||
data-cy="k8sAppDetail-creationMethod"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue