From 93a0d18cda03cb07bfb634a1448a11b667d8fad8 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Mon, 8 Apr 2019 17:06:41 +0200 Subject: [PATCH] WIP - move status to react memo --- .../js/columns/ServicesTableStatusColumn.tsx | 18 +++++++++++++++++- .../src/js/utils/DeclinedOffersUtil.d.ts | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 plugins/services/src/js/utils/DeclinedOffersUtil.d.ts diff --git a/plugins/services/src/js/columns/ServicesTableStatusColumn.tsx b/plugins/services/src/js/columns/ServicesTableStatusColumn.tsx index 39537844af..c8d130b4f2 100644 --- a/plugins/services/src/js/columns/ServicesTableStatusColumn.tsx +++ b/plugins/services/src/js/columns/ServicesTableStatusColumn.tsx @@ -3,6 +3,8 @@ import { Trans } from "@lingui/macro"; import { TextCell } from "@dcos/ui-kit"; import StringUtil from "#SRC/js/utils/StringUtil"; +import DateUtil from "#SRC/js/utils/DateUtil"; +import DeclinedOffersUtil from "../utils/DeclinedOffersUtil"; import ServiceStatusIcon from "../components/ServiceStatusIcon"; import * as ServiceStatus from "../constants/ServiceStatus"; import ServiceStatusProgressBar from "../components/ServiceStatusProgressBar"; @@ -16,13 +18,19 @@ const StatusMapping: any = { Running: "running-state" }; +interface ServiceQueue { + since: unknown; +} + export function statusRenderer( service: Service | Pod | ServiceTree ): React.ReactNode { const serviceStatusText: string = service.getStatus(); - const serviceStatusClassSet: string = StatusMapping[serviceStatusText] || ""; const instancesCount = service.getInstancesCount() as number; const runningInstances = service.getRunningInstancesCount() as number; + const queue = (service.getQueue() as unknown) as ServiceQueue; + + const serviceStatusClassSet: string = StatusMapping[serviceStatusText] || ""; // L10NTODO: Pluralize const tooltipContent = ( @@ -38,6 +46,14 @@ export function statusRenderer(