From f738c305de485510f5aa05221cecf62b5dfefd32 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 22 Feb 2019 15:18:04 -0500 Subject: [PATCH] Resource Quota Charts: removed 'compact' css, quota scope changes --- .../public/components/_cluster-overview.scss | 5 --- frontend/public/components/_quota.scss | 44 ++++--------------- .../public/components/graphs/_graphs.scss | 6 --- .../overview/namespace-overview.tsx | 10 ++--- frontend/public/components/resource-quota.jsx | 31 ++++++++----- 5 files changed, 32 insertions(+), 64 deletions(-) diff --git a/frontend/public/components/_cluster-overview.scss b/frontend/public/components/_cluster-overview.scss index 8014050e1221..012ad9fb58bd 100644 --- a/frontend/public/components/_cluster-overview.scss +++ b/frontend/public/components/_cluster-overview.scss @@ -16,11 +16,6 @@ } } -.group__title--no-side-borders { - border-left: none; - border-right: none; -} - .group__body { border: 1px solid $color-grey-background-border; border-top: none; diff --git a/frontend/public/components/_quota.scss b/frontend/public/components/_quota.scss index ec707968eefd..a9d6b20da5f9 100644 --- a/frontend/public/components/_quota.scss +++ b/frontend/public/components/_quota.scss @@ -1,12 +1,9 @@ .co-resource-quota-chart-row { display: flex; flex-wrap: wrap; - justify-content: center; - margin-bottom: 20px; -} - -.co-resource-quota-chart-row--compact { - margin-bottom: 2px; + justify-content: space-evenly; + margin-left: 40px; + margin-right: 40px; } .co-resource-quota-empty { @@ -21,41 +18,16 @@ padding-left: 34px; } -.co-resource-quota-scope__description { - font-size: $font-size-small; +.quota-dashboard-scopes { + font-size: $font-size-h5; font-weight: 300; } -.co-resource-quota-scope__description--compact { - display: inline; - padding-left: 6px; +.co-resource-quota-scope__description { + font-size: $font-size-small; + font-weight: 300; } .co-resource-quota-scope__label { font-weight: 500; } - -.co-resource-quota-scope__label--compact { - display: inline; - font-size: $font-size-small; -} - - -.quota-dashboard-column { - display: flex; - flex-direction: column; -} - -.quota-dashboard-row { - display: flex; -} - -.quota-dashboard-scopes { - padding-left: 24px; - padding-right: 24px; -} - -.quota-dashboard-scopes--compact { - line-height: ($line-height-base - .2); - margin-bottom: 2px; -} diff --git a/frontend/public/components/graphs/_graphs.scss b/frontend/public/components/graphs/_graphs.scss index 0a96af3204ce..3bf1a3b93324 100644 --- a/frontend/public/components/graphs/_graphs.scss +++ b/frontend/public/components/graphs/_graphs.scss @@ -5,12 +5,6 @@ overflow: hidden; } -.graph-wrapper--compact { - margin-top: 2px; - margin-bottom: 0px; - padding-top: 10px; -} - .graph-title { margin: 0; text-align: center; diff --git a/frontend/public/components/overview/namespace-overview.tsx b/frontend/public/components/overview/namespace-overview.tsx index 6b945951a5b1..a5620cb74bcf 100644 --- a/frontend/public/components/overview/namespace-overview.tsx +++ b/frontend/public/components/overview/namespace-overview.tsx @@ -9,7 +9,7 @@ import { deleteModal, NamespaceLineCharts, NamespaceSummary, TopPodsBarChart } f import { Firehose, LoadingInline, ResourceLink, resourceListPathFromModel, StatusBox } from '../utils'; import { RoleBindingModel } from '../../models'; import { K8sResourceKind } from '../../module/k8s'; -import { getQuotaResourceTypes, hasComputeResources, QuotaGaugeCharts, QuotaScopes } from '../resource-quota'; +import { getQuotaResourceTypes, hasComputeResources, QuotaGaugeCharts, QuotaScopesInline } from '../resource-quota'; const editRoleBindings = (kind, obj) => ({ label: 'Edit Role Bindings', @@ -52,14 +52,12 @@ const ResourceQuotaCharts = ({quota, resourceTypes}) => {

+ namespace={quota.metadata.namespace} inline="true" title={quota.metadata.name} /> + {scopes && }

- - {scopes &&
- -
} +
; }; diff --git a/frontend/public/components/resource-quota.jsx b/frontend/public/components/resource-quota.jsx index 47b26eff367d..ea6ab35f26d6 100644 --- a/frontend/public/components/resource-quota.jsx +++ b/frontend/public/components/resource-quota.jsx @@ -83,39 +83,48 @@ const ResourceUsageRow = ({quota, resourceType}) => { ; }; -export const QuotaGaugeCharts = ({quota, resourceTypes, compact}) => { +export const QuotaGaugeCharts = ({quota, resourceTypes}) => { const resourceTypesSet = new Set(resourceTypes); - return
+ return
{(resourceTypesSet.has('requests.cpu') || resourceTypesSet.has('cpu')) &&
-
} {resourceTypesSet.has('limits.cpu') &&
-
} {(resourceTypesSet.has('requests.memory') || resourceTypesSet.has('memory')) &&
-
} {resourceTypesSet.has('limits.memory') &&
-
}
; }; -export const QuotaScopes = ({scopes, compact}) => { +export const QuotaScopesInline = ({scopes, className}) => { + return ( + {scopes.map(scope => { + const scopeObj = _.get(quotaScopes, scope); + return scopeObj ? scopeObj.label : scope; + }).join(',')}) + ; +}; + +export const QuotaScopesList = ({scopes}) => { return scopes.map(scope => { const scopeObj = _.get(quotaScopes, scope); return scopeObj ? -
-
{scopeObj.label}
-
{scopeObj.description}
+
+
{scopeObj.label}
+
{scopeObj.description}
:
{scope}
; }); @@ -141,7 +150,7 @@ const Details = ({obj: rq}) => { {scopes &&
Scopes
- +
}