From b6f23a99c12e83214cefb90b77645d6dfc8d4d88 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Mon, 23 Apr 2018 14:15:15 +0200 Subject: [PATCH] feat(GPU): add gpu to debug screen Needed to add some default values, because GPU is not yet pr, because GPU is not yet provided Closes DCOS-21935 --- .../src/js/components/DeclinedOffersTable.js | 15 ++++++++++++++- .../src/js/components/RecentOffersSummary.js | 17 ++++++++++++++--- .../src/js/constants/DeclinedOffersReasons.js | 1 + 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/plugins/services/src/js/components/DeclinedOffersTable.js b/plugins/services/src/js/components/DeclinedOffersTable.js index 277376a5b8..ac0263d070 100644 --- a/plugins/services/src/js/components/DeclinedOffersTable.js +++ b/plugins/services/src/js/components/DeclinedOffersTable.js @@ -87,7 +87,7 @@ class DeclinedOffersTable extends React.Component { "text-danger": isResourceUnmatched }); - let requestedResource = summary[prop].requested; + let requestedResource = (summary[prop] || { requested: 0 }).requested; let receivedResource = row.offered[prop]; let requestedResourceSuffix = ""; @@ -290,6 +290,19 @@ class DeclinedOffersTable extends React.Component { ) ) }, + { + heading: this.getColumnHeadingFn("GPU"), + prop: "gpus", + className: this.getColumnClassNameFn("text-align-center"), + render: this.getMatchedOfferRenderFn( + DeclinedOffersReasons.INSUFFICIENT_GPU + ), + sortable: true, + sortFunction: TableUtil.getSortFunction( + "timestamp", + this.getMatchedResourcesSortFn(DeclinedOffersReasons.INSUFFICIENT_GPU) + ) + }, { heading: this.getColumnHeadingFn("Port", "PRT"), prop: "ports", diff --git a/plugins/services/src/js/components/RecentOffersSummary.js b/plugins/services/src/js/components/RecentOffersSummary.js index 059aae75c5..535dfaa681 100644 --- a/plugins/services/src/js/components/RecentOffersSummary.js +++ b/plugins/services/src/js/components/RecentOffersSummary.js @@ -20,7 +20,7 @@ const displayedResourceValues = { const MAX_BAR_HEIGHT = 200; function getGraphBar(resource, data, index) { - const resourceOfferSummary = data[resource]; + const resourceOfferSummary = data[resource] || { offers: 0, matched: 0 }; const matchedOffers = resourceOfferSummary.matched; const offeredCount = resourceOfferSummary.offers; let percentageMatched = null; @@ -99,7 +99,10 @@ function getGraphSpacer({ key, showIcon = true }) { } function getResourceTooltipContent(resource, data) { - let { matched, offers, requested: requestedValue } = data[resource]; + let { matched, offers, requested: requestedValue } = data[resource] || { + offers: 0, + matched: 0 + }; let docsURI = null; let explanatoryText = null; @@ -158,7 +161,15 @@ function getResourceTooltipContent(resource, data) { } function RecentOffersSummary({ data }) { - const funnelItems = ["roles", "constraints", "cpus", "mem", "disk", "ports"]; + const funnelItems = [ + "roles", + "constraints", + "cpus", + "mem", + "disk", + "gpus", + "ports" + ]; const funnelGraphItems = funnelItems.reduce((accumulator, item, index) => { accumulator.push(getGraphBar(item, data, index)); diff --git a/plugins/services/src/js/constants/DeclinedOffersReasons.js b/plugins/services/src/js/constants/DeclinedOffersReasons.js index 0affc32e43..f03a42a5dd 100644 --- a/plugins/services/src/js/constants/DeclinedOffersReasons.js +++ b/plugins/services/src/js/constants/DeclinedOffersReasons.js @@ -2,6 +2,7 @@ module.exports = { INSUFFICIENT_MEM: "InsufficientMemory", INSUFFICIENT_CPU: "InsufficientCpus", INSUFFICIENT_DISK: "InsufficientDisk", + INSUFFICIENT_GPU: "InsufficientGpus", INSUFFICIENT_PORTS: "InsufficientPorts", UNFULFILLED_CONSTRAINT: "UnfulfilledConstraint", UNFULFILLED_ROLE: "UnfulfilledRole"