From ce1e196b78600f505c0966f234dee5ce62d7aea4 Mon Sep 17 00:00:00 2001 From: Balazs Gobel Date: Fri, 8 Feb 2019 13:18:15 +0100 Subject: [PATCH] Follow the same principle as the old application - Restyle table cells only when metric semaphore is enabled --- src/data-table/data-cell.jsx | 4 ++-- src/initialize-transformed.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/data-table/data-cell.jsx b/src/data-table/data-cell.jsx index 0dd2138..babee8b 100644 --- a/src/data-table/data-cell.jsx +++ b/src/data-table/data-cell.jsx @@ -76,9 +76,9 @@ const DataCell = ({ data, general, measurement, styleBuilder, styling }) => { textAlign: 'right' }; - const { semaphoreColors } = styling; + const { semaphoreColors, semaphoreColors: { fieldsToApplyTo } } = styling; const isValidSemaphoreValue = !styleBuilder.hasComments() && !isNaN(measurement.value); - const shouldHaveSemaphoreColors = semaphoreColors.fieldsToApplyTo.applyToAll || semaphoreColors.fieldsToApplyTo.specificFields.indexOf(measurement.name) !== -1; + const shouldHaveSemaphoreColors = fieldsToApplyTo.applyToMetric && (fieldsToApplyTo.applyToAll || fieldsToApplyTo.specificFields.indexOf(measurement.name) !== -1); if (isValidSemaphoreValue && shouldHaveSemaphoreColors) { const { backgroundColor, color } = getSemaphoreColors(measurement, semaphoreColors); cellStyle = { diff --git a/src/initialize-transformed.js b/src/initialize-transformed.js index 1ed7a02..b8aaff4 100644 --- a/src/initialize-transformed.js +++ b/src/initialize-transformed.js @@ -259,6 +259,7 @@ async function initializeTransformed ({ $element, layout, component }) { semaphoreColors: { fieldsToApplyTo: { applyToAll: layout.allsemaphores, + applyToMetric: layout.allmetrics, specificFields: [ layout.conceptsemaphore1, layout.conceptsemaphore2,