diff --git a/webui/react/src/components/ResourcePoolCard.module.scss b/webui/react/src/components/ResourcePoolCard.module.scss index 553ea4beea0..91a9b65adfb 100644 --- a/webui/react/src/components/ResourcePoolCard.module.scss +++ b/webui/react/src/components/ResourcePoolCard.module.scss @@ -1,33 +1,22 @@ -$font-size-content: 12px; - .base { - display: flex; - flex-direction: column; - font-size: 14px; + font-size: 12px; line-height: 22px; - overflow: hidden; - text-overflow: ellipsis; .body { - display: flex; - flex-direction: column; - flex-grow: 1; - .resoucePoolBoundContainer { align-items: center; - border-bottom: 1px solid var(--theme-stage-border); - border-top: 1px solid var(--theme-stage-border); - display: inline-flex; - font-size: $font-size-content; + border-block: 1px solid var(--theme-stage-border); + display: flex; font-weight: bold; justify-content: space-between; margin: 8px 0; padding: 8px 0; - } - .resoucePoolBoundCount { - align-items: center; - display: inline-flex; - gap: 4px; + + .resoucePoolBoundCount { + align-items: center; + display: flex; + gap: 4px; + } } } .header { @@ -37,37 +26,13 @@ $font-size-content: 12px; gap: 8px; padding-top: 8px; - .info { - margin: auto 0; - - .name { - font-weight: bold; - } + .name { + font-size: 14px; + font-weight: bold; } - .default { - color: var(--theme-surface-on); - - span { - font-size: $font-size-content; - margin-right: 4px; - } - i { - color: var(--theme-surface-on-weak); - font-weight: bold; - } + .details { + display: flex; + gap: 4px; } } - .empty { - color: var(--theme-surface-on-weak); - } -} -section.details { - display: flex; - flex-direction: column; - flex-grow: 1; - font-size: $font-size-content; - - ul { - flex-grow: 1; - } } diff --git a/webui/react/src/components/ResourcePoolCard.tsx b/webui/react/src/components/ResourcePoolCard.tsx index 583d5b61d68..7426b773631 100644 --- a/webui/react/src/components/ResourcePoolCard.tsx +++ b/webui/react/src/components/ResourcePoolCard.tsx @@ -28,6 +28,7 @@ import { useObservable } from 'utils/observable'; import { pluralizer } from 'utils/string'; import { DarkLight } from 'utils/themes'; +import { ConditionalWrapper } from './ConditionalWrapper'; import Json from './Json'; import ResourcePoolBindingModalComponent from './ResourcePoolBindingModal'; import css from './ResourcePoolCard.module.scss'; @@ -37,7 +38,8 @@ interface Props { poolStats?: V1RPQueueStat | undefined; resourcePool: ResourcePool; size?: ShirtSize; - descriptiveLabel?: string; + defaultAux?: boolean; + defaultCompute?: boolean; } const poolAttributes = [ @@ -94,24 +96,26 @@ export const PoolLogo: React.FC<{ type: V1ResourcePoolType }> = ({ type }) => { const ResourcePoolCard: React.FC = ({ resourcePool: pool, actionMenu, - descriptiveLabel, + defaultAux, + defaultCompute, }: Props) => { const rpBindingFlagOn = useFeature().isOn('rp_binding'); const { canManageResourcePoolBindings } = usePermissions(); const ResourcePoolBindingModal = useModal(ResourcePoolBindingModalComponent); - const isDefaultPool = pool.defaultAuxPool || pool.defaultComputePool; - const descriptionClasses = [css.description]; - const showDescriptiveLabel = !(canManageResourcePoolBindings && rpBindingFlagOn) ?? isDefaultPool; const resourcePoolBindingMap = useObservable(clusterStore.resourcePoolBindings); const resourcePoolBindings: number[] = resourcePoolBindingMap.get(pool.name, []); const workspaces = Loadable.getOrElse([], useObservable(workspaceStore.workspaces)); + const defaultLabel = useMemo(() => { + if (defaultAux && defaultCompute) return 'Default'; + if (defaultAux) return 'Default Aux'; + if (defaultCompute) return 'Default Compute'; + }, [defaultAux, defaultCompute]); + useEffect(() => { return clusterStore.fetchResourcePoolBindings(pool.name); }, [pool.name]); - if (!pool.description) descriptionClasses.push(css.empty); - const isAux = useMemo(() => { return pool.auxContainerCapacityPerAgent > 0; }, [pool]); @@ -166,19 +170,18 @@ const ResourcePoolCard: React.FC = ({ onDropdown={onDropdown}>
-
-
{pool.name}
-
-
- {showDescriptiveLabel && {descriptiveLabel}} - {showDescriptiveLabel && pool.description && ( - - )} - {!showDescriptiveLabel && ( - - Default - - )} +
{pool.name}
+
+ ( + + {children} + + )}> + {defaultLabel} + + {pool.description && }
}> @@ -194,9 +197,7 @@ const ResourcePoolCard: React.FC = ({
)} -
- -
+
diff --git a/webui/react/src/pages/Clusters/ClustersOverview.tsx b/webui/react/src/pages/Clusters/ClustersOverview.tsx index c57c7bf998a..1a7b1c76f00 100644 --- a/webui/react/src/pages/Clusters/ClustersOverview.tsx +++ b/webui/react/src/pages/Clusters/ClustersOverview.tsx @@ -39,12 +39,6 @@ const ClusterOverview: React.FC = () => { [canManageResourcePoolBindings, rpBindingFlagOn], ); - const renderDefaultLabel = useCallback((pool: ResourcePool) => { - if (pool.defaultAuxPool && pool.defaultComputePool) return 'Default'; - if (pool.defaultComputePool) return 'Default Aux'; - if (pool.defaultAuxPool) return 'Default Compute'; - }, []); - return ( <> @@ -55,7 +49,8 @@ const ClusterOverview: React.FC = () => { resourcePools.data.map((rp) => ( diff --git a/webui/react/src/pages/WorkspaceDetails/ResourcePoolsBound.tsx b/webui/react/src/pages/WorkspaceDetails/ResourcePoolsBound.tsx index cb797211cb3..6ec6931fc89 100644 --- a/webui/react/src/pages/WorkspaceDetails/ResourcePoolsBound.tsx +++ b/webui/react/src/pages/WorkspaceDetails/ResourcePoolsBound.tsx @@ -38,16 +38,6 @@ const ResourcePoolsBound: React.FC = ({ workspace }) => { ); }, [resourcePools, boundResourcePoolNames, unboundResourcePools]); - const renderDefaultLabel = useCallback( - (pool: ResourcePool) => { - if (pool.name === workspace.defaultAuxPool && pool.name === workspace.defaultComputePool) - return 'Default'; - if (pool.name === workspace.defaultAuxPool) return 'Default Aux'; - if (pool.name === workspace.defaultComputePool) return 'Default Compute'; - }, - [workspace.defaultComputePool, workspace.defaultAuxPool], - ); - const actionMenu = useCallback( (pool: ResourcePool) => canManageResourcePoolBindings @@ -98,7 +88,8 @@ const ResourcePoolsBound: React.FC = ({ workspace }) => { {boundResourcePools.map((rp) => (