From 63d010182e88ba266305bec49c08f35ed08aa82d Mon Sep 17 00:00:00 2001 From: KEGustafsson Date: Sat, 3 Feb 2024 21:06:23 +0200 Subject: [PATCH 01/13] fix: separate and sort Connections and Plugins lists on UI --- .../src/views/Dashboard/Dashboard.js | 246 +++++++++++++----- 1 file changed, 174 insertions(+), 72 deletions(-) diff --git a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js index 345a4cd76..f1d6adb8d 100644 --- a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js +++ b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js @@ -73,9 +73,9 @@ const Dashboard = (props) => { -
Connection activity
+
Connections activity
+

+
Plugins activity
+
    + {Object.keys(providerStatistics || {}).sort().map((providerId) => { + const providerStats = providerStatistics[providerId] + let linkType = 'provider' + try { + linkType = providerStatus.find( + (item) => item.id === providerId + ).statusType + } catch (error) {} + const inputPulseIconClass = + 'icon-login' + + (providerStats.deltaRate > 50 + ? ' text-primary fa-pulse-fast' + : providerStats.deltaRate > 0 + ? ' text-primary fa-pulse' + : '') + const outputPulseIconClass = + 'icon-logout' + + (providerStats.writeRate > 50 + ? ' text-primary fa-pulse-fast' + : providerStats.writeRate > 0 + ? ' text-primary fa-pulse' + : '') + if (linkType === 'plugin') { + return ( +
  • + props.history.push( + `/serverConfiguration/providers/${providerId}` + ) + } + > + - -
  • - ) + + + {pluginNameLink(providerId)} + + {providerStats.writeRate > 0 && ( + + {' '} + {providerStats.writeRate}{' '} + + {'msg/s'} + {' '} + + )} + {providerStats.deltaRate > 0 && + providerStats.writeRate > 0 && ( + + {','} +   + + )} + {providerStats.deltaRate > 0 && ( + + {' '} + {providerStats.deltaRate}{' '} + + ( + {( + (providerStats.deltaRate / deltaRate) * + 100 + ).toFixed(0)} + %) + {' '} + + {'deltas/s'} + {' '} + + )} +
    + +
    + + ) + } })}
From 542696f24a6e90ac9aec8ccc39568898b0ac8c94 Mon Sep 17 00:00:00 2001 From: KEGustafsson Date: Sat, 3 Feb 2024 22:39:47 +0200 Subject: [PATCH 02/13] fix: format --- .../src/views/Dashboard/Dashboard.js | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js index f1d6adb8d..26bbd0f65 100644 --- a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js +++ b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js @@ -82,21 +82,21 @@ const Dashboard = (props) => { linkType = providerStatus.find( (item) => item.id === providerId ).statusType - } catch (error) {} + } catch (error) { } const inputPulseIconClass = 'icon-login' + (providerStats.deltaRate > 50 ? ' text-primary fa-pulse-fast' : providerStats.deltaRate > 0 - ? ' text-primary fa-pulse' - : '') + ? ' text-primary fa-pulse' + : '') const outputPulseIconClass = 'icon-logout' + (providerStats.writeRate > 50 ? ' text-primary fa-pulse-fast' : providerStats.writeRate > 0 - ? ' text-primary fa-pulse' - : '') + ? ' text-primary fa-pulse' + : '') if (linkType === 'provider') { return (
  • { } })} -

    +

    Plugins activity
      {Object.keys(providerStatistics || {}).sort().map((providerId) => { @@ -184,21 +184,21 @@ const Dashboard = (props) => { linkType = providerStatus.find( (item) => item.id === providerId ).statusType - } catch (error) {} + } catch (error) { } const inputPulseIconClass = 'icon-login' + (providerStats.deltaRate > 50 ? ' text-primary fa-pulse-fast' : providerStats.deltaRate > 0 - ? ' text-primary fa-pulse' - : '') + ? ' text-primary fa-pulse' + : '') const outputPulseIconClass = 'icon-logout' + (providerStats.writeRate > 50 ? ' text-primary fa-pulse-fast' : providerStats.writeRate > 0 - ? ' text-primary fa-pulse' - : '') + ? ' text-primary fa-pulse' + : '') if (linkType === 'plugin') { return (
    • { const lastError = status.lastError && status.lastError != status.message ? status.lastErrorTimeStamp + - ': ' + - status.lastError + ': ' + + status.lastError : '' return ( { onClick={() => { props.history.push( '/serverConfiguration/' + - (status.statusType === 'plugin' - ? 'plugins/' - : 'connections/') + - status.id + (status.statusType === 'plugin' + ? 'plugins/' + : 'connections/') + + status.id ) }} > From d1d32b5cd458ac4104b49d81a07832b64fc1f333 Mon Sep 17 00:00:00 2001 From: KEGustafsson Date: Sun, 4 Feb 2024 13:16:58 +0200 Subject: [PATCH 03/13] fix: activities heading font size increased --- packages/server-admin-ui/src/views/Dashboard/Dashboard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js index 26bbd0f65..297779139 100644 --- a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js +++ b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js @@ -73,7 +73,7 @@ const Dashboard = (props) => { -
      Connections activity
      +
      Connections activity
        {Object.keys(providerStatistics || {}).sort().map((providerId) => { const providerStats = providerStatistics[providerId] @@ -175,7 +175,7 @@ const Dashboard = (props) => { })}


      -
      Plugins activity
      +
      Plugins activity
        {Object.keys(providerStatistics || {}).sort().map((providerId) => { const providerStats = providerStatistics[providerId] From 03f04a96a52c296cb26e3e985dadf348612feb8d Mon Sep 17 00:00:00 2001 From: KEGustafsson Date: Sun, 4 Feb 2024 13:18:39 +0200 Subject: [PATCH 04/13] fix: prettier --- .../src/views/Dashboard/Dashboard.js | 388 +++++++++--------- 1 file changed, 200 insertions(+), 188 deletions(-) diff --git a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js index 297779139..7d712118c 100644 --- a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js +++ b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js @@ -73,208 +73,220 @@ const Dashboard = (props) => { -
        Connections activity
        +
        + Connections activity +
          - {Object.keys(providerStatistics || {}).sort().map((providerId) => { - const providerStats = providerStatistics[providerId] - let linkType = 'provider' - try { - linkType = providerStatus.find( - (item) => item.id === providerId - ).statusType - } catch (error) { } - const inputPulseIconClass = - 'icon-login' + - (providerStats.deltaRate > 50 - ? ' text-primary fa-pulse-fast' - : providerStats.deltaRate > 0 + {Object.keys(providerStatistics || {}) + .sort() + .map((providerId) => { + const providerStats = providerStatistics[providerId] + let linkType = 'provider' + try { + linkType = providerStatus.find( + (item) => item.id === providerId + ).statusType + } catch (error) {} + const inputPulseIconClass = + 'icon-login' + + (providerStats.deltaRate > 50 + ? ' text-primary fa-pulse-fast' + : providerStats.deltaRate > 0 ? ' text-primary fa-pulse' : '') - const outputPulseIconClass = - 'icon-logout' + - (providerStats.writeRate > 50 - ? ' text-primary fa-pulse-fast' - : providerStats.writeRate > 0 + const outputPulseIconClass = + 'icon-logout' + + (providerStats.writeRate > 50 + ? ' text-primary fa-pulse-fast' + : providerStats.writeRate > 0 ? ' text-primary fa-pulse' : '') - if (linkType === 'provider') { - return ( -
        • - props.history.push( - `/serverConfiguration/providers/${providerId}` - ) - } - > - - - - {providerIdLink(providerId)} - - {providerStats.writeRate > 0 && ( - - {' '} - {providerStats.writeRate}{' '} - - {'msg/s'} - {' '} + if (linkType === 'provider') { + return ( +
        • + props.history.push( + `/serverConfiguration/providers/${providerId}` + ) + } + > + + + + {providerIdLink(providerId)} - )} - {providerStats.deltaRate > 0 && - providerStats.writeRate > 0 && ( + {providerStats.writeRate > 0 && ( - {','} -   + {' '} + {providerStats.writeRate}{' '} + + {'msg/s'} + {' '} )} - {providerStats.deltaRate > 0 && ( - - {' '} - {providerStats.deltaRate}{' '} - - ( - {( - (providerStats.deltaRate / deltaRate) * - 100 - ).toFixed(0)} - %) - {' '} - - {'deltas/s'} - {' '} - - )} -
          - -
          -
        • - ) - } - })} + {providerStats.deltaRate > 0 && + providerStats.writeRate > 0 && ( + + + {','} + +   + + )} + {providerStats.deltaRate > 0 && ( + + {' '} + {providerStats.deltaRate}{' '} + + ( + {( + (providerStats.deltaRate / deltaRate) * + 100 + ).toFixed(0)} + %) + {' '} + + {'deltas/s'} + {' '} + + )} +
          + +
          + + ) + } + })}


        -
        Plugins activity
        +
        + Plugins activity +
          - {Object.keys(providerStatistics || {}).sort().map((providerId) => { - const providerStats = providerStatistics[providerId] - let linkType = 'provider' - try { - linkType = providerStatus.find( - (item) => item.id === providerId - ).statusType - } catch (error) { } - const inputPulseIconClass = - 'icon-login' + - (providerStats.deltaRate > 50 - ? ' text-primary fa-pulse-fast' - : providerStats.deltaRate > 0 + {Object.keys(providerStatistics || {}) + .sort() + .map((providerId) => { + const providerStats = providerStatistics[providerId] + let linkType = 'provider' + try { + linkType = providerStatus.find( + (item) => item.id === providerId + ).statusType + } catch (error) {} + const inputPulseIconClass = + 'icon-login' + + (providerStats.deltaRate > 50 + ? ' text-primary fa-pulse-fast' + : providerStats.deltaRate > 0 ? ' text-primary fa-pulse' : '') - const outputPulseIconClass = - 'icon-logout' + - (providerStats.writeRate > 50 - ? ' text-primary fa-pulse-fast' - : providerStats.writeRate > 0 + const outputPulseIconClass = + 'icon-logout' + + (providerStats.writeRate > 50 + ? ' text-primary fa-pulse-fast' + : providerStats.writeRate > 0 ? ' text-primary fa-pulse' : '') - if (linkType === 'plugin') { - return ( -
        • - props.history.push( - `/serverConfiguration/providers/${providerId}` - ) - } - > - - - - {pluginNameLink(providerId)} - - {providerStats.writeRate > 0 && ( - - {' '} - {providerStats.writeRate}{' '} - - {'msg/s'} - {' '} + if (linkType === 'plugin') { + return ( +
        • + props.history.push( + `/serverConfiguration/providers/${providerId}` + ) + } + > + + + + {pluginNameLink(providerId)} - )} - {providerStats.deltaRate > 0 && - providerStats.writeRate > 0 && ( + {providerStats.writeRate > 0 && ( - {','} -   + {' '} + {providerStats.writeRate}{' '} + + {'msg/s'} + {' '} )} - {providerStats.deltaRate > 0 && ( - - {' '} - {providerStats.deltaRate}{' '} - - ( - {( - (providerStats.deltaRate / deltaRate) * - 100 - ).toFixed(0)} - %) - {' '} - - {'deltas/s'} - {' '} - - )} -
          - -
          -
        • - ) - } - })} + {providerStats.deltaRate > 0 && + providerStats.writeRate > 0 && ( + + + {','} + +   + + )} + {providerStats.deltaRate > 0 && ( + + {' '} + {providerStats.deltaRate}{' '} + + ( + {( + (providerStats.deltaRate / deltaRate) * + 100 + ).toFixed(0)} + %) + {' '} + + {'deltas/s'} + {' '} + + )} +
          + +
          + + ) + } + })}
        @@ -309,8 +321,8 @@ const Dashboard = (props) => { const lastError = status.lastError && status.lastError != status.message ? status.lastErrorTimeStamp + - ': ' + - status.lastError + ': ' + + status.lastError : '' return ( { onClick={() => { props.history.push( '/serverConfiguration/' + - (status.statusType === 'plugin' - ? 'plugins/' - : 'connections/') + - status.id + (status.statusType === 'plugin' + ? 'plugins/' + : 'connections/') + + status.id ) }} > From bc6176dc4a1d0768f70cd8530fc411f7f70a33bf Mon Sep 17 00:00:00 2001 From: KEGustafsson Date: Sun, 4 Feb 2024 17:02:40 +0200 Subject: [PATCH 05/13] fix: hide plugins view if none --- .../src/views/Dashboard/Dashboard.js | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js index 7d712118c..5efc776da 100644 --- a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js +++ b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js @@ -30,6 +30,7 @@ const Dashboard = (props) => { const uptimeD = Math.floor(uptime / (60 * 60 * 24)) const uptimeH = Math.floor((uptime % (60 * 60 * 24)) / (60 * 60)) const uptimeM = Math.floor((uptime % (60 * 60)) / 60) + let isPlugins = false let errors = '' if (errorCount > 0) { errors = `(${errorCount} errors)` @@ -181,9 +182,24 @@ const Dashboard = (props) => { })}


      -
      - Plugins activity -
      + {Object.keys(providerStatistics || {}) + .sort() + .map((providerId) => { + let linkType = 'provider' + try { + linkType = providerStatus.find( + (item) => item.id === providerId + ).statusType + } catch (error) {} + if (linkType === 'plugin') { + isPlugins = true + } + })} + {isPlugins ? ( +
      + Plugin activity +
      + ) : null}
        {Object.keys(providerStatistics || {}) .sort() From dccf72b41fd19fbde3bfdab55c49e96ce9d2f9df Mon Sep 17 00:00:00 2001 From: KEGustafsson Date: Sun, 4 Feb 2024 17:29:36 +0200 Subject: [PATCH 06/13] fix: links to point correct directions --- packages/server-admin-ui/src/views/Dashboard/Dashboard.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js index 5efc776da..189c94bae 100644 --- a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js +++ b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js @@ -393,7 +393,13 @@ function pluginNameLink(id) { } function providerIdLink(id) { - return {id} + if (id === 'defaults') { + return {id} + } else if (id.startsWith('ws.')) { + return {id} + } else { + return {id} + } } export default connect( From b04411b161dbf09fe9b02604bbdbc8ad2701dce9 Mon Sep 17 00:00:00 2001 From: KEGustafsson Date: Sun, 4 Feb 2024 18:06:25 +0200 Subject: [PATCH 07/13] fix: history link pointing to dashboard --- packages/server-admin-ui/src/views/Dashboard/Dashboard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js index 189c94bae..d0de9a51d 100644 --- a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js +++ b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js @@ -108,7 +108,7 @@ const Dashboard = (props) => { key={providerId} onClick={() => props.history.push( - `/serverConfiguration/providers/${providerId}` + `/dashboard` ) } > @@ -231,7 +231,7 @@ const Dashboard = (props) => { key={providerId} onClick={() => props.history.push( - `/serverConfiguration/providers/${providerId}` + `/dashboard` ) } > From a39e5f906d65ec2378288d10cfebc14a5e324b72 Mon Sep 17 00:00:00 2001 From: KEGustafsson Date: Sun, 4 Feb 2024 21:37:52 +0200 Subject: [PATCH 08/13] fix: format --- .../server-admin-ui/src/views/Dashboard/Dashboard.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js index d0de9a51d..1c1d171a0 100644 --- a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js +++ b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js @@ -106,11 +106,7 @@ const Dashboard = (props) => { return (
      • - props.history.push( - `/dashboard` - ) - } + onClick={() => props.history.push(`/dashboard`)} > { return (
      • - props.history.push( - `/dashboard` - ) - } + onClick={() => props.history.push(`/dashboard`)} > Date: Wed, 7 Feb 2024 23:32:32 +0200 Subject: [PATCH 09/13] fix: use functions to render list --- .../src/views/Dashboard/Dashboard.js | 283 ++++++------------ 1 file changed, 92 insertions(+), 191 deletions(-) diff --git a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js index 1c1d171a0..68ffec89e 100644 --- a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js +++ b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js @@ -35,6 +35,93 @@ const Dashboard = (props) => { if (errorCount > 0) { errors = `(${errorCount} errors)` } + + const getLinkType = (providerId) => { + try { + return providerStatus.find((item) => item.id === providerId).statusType + } catch (err) { + return 'provider' + } + } + + const inputPulseIconClass = (providerStats) => { + return ( + 'icon-login' + + (providerStats.deltaRate > 50 + ? ' text-primary fa-pulse-fast' + : providerStats.deltaRate > 0 + ? ' text-primary fa-pulse' + : '') + ) + } + + const outputPulseIconClass = (providerStats) => { + return ( + 'icon-logout' + + (providerStats.writeRate > 50 + ? ' text-primary fa-pulse-fast' + : providerStats.writeRate > 0 + ? ' text-primary fa-pulse' + : '') + ) + } + + const renderer = (providerId, providerStats, linkType) => { + return ( +
      • props.history.push(`/dashboard`)}> + + + + {linkType === 'plugin' + ? pluginNameLink(providerId) + : providerIdLink(providerId)} + + {providerStats.writeRate > 0 && ( + + {' '} + {providerStats.writeRate}{' '} + {'msg/s'}{' '} + + )} + {providerStats.deltaRate > 0 && providerStats.writeRate > 0 && ( + + {','} +   + + )} + {providerStats.deltaRate > 0 && ( + + {' '} + {providerStats.deltaRate}{' '} + + ({((providerStats.deltaRate / deltaRate) * 100).toFixed(0)} + %) + {' '} + {'deltas/s'}{' '} + + )} +
        + +
        +
      • + ) + } + return (
        {props.websocketStatus === 'open' && ( @@ -82,98 +169,8 @@ const Dashboard = (props) => { .sort() .map((providerId) => { const providerStats = providerStatistics[providerId] - let linkType = 'provider' - try { - linkType = providerStatus.find( - (item) => item.id === providerId - ).statusType - } catch (error) {} - const inputPulseIconClass = - 'icon-login' + - (providerStats.deltaRate > 50 - ? ' text-primary fa-pulse-fast' - : providerStats.deltaRate > 0 - ? ' text-primary fa-pulse' - : '') - const outputPulseIconClass = - 'icon-logout' + - (providerStats.writeRate > 50 - ? ' text-primary fa-pulse-fast' - : providerStats.writeRate > 0 - ? ' text-primary fa-pulse' - : '') - if (linkType === 'provider') { - return ( -
      • props.history.push(`/dashboard`)} - > - - - - {providerIdLink(providerId)} - - {providerStats.writeRate > 0 && ( - - {' '} - {providerStats.writeRate}{' '} - - {'msg/s'} - {' '} - - )} - {providerStats.deltaRate > 0 && - providerStats.writeRate > 0 && ( - - - {','} - -   - - )} - {providerStats.deltaRate > 0 && ( - - {' '} - {providerStats.deltaRate}{' '} - - ( - {( - (providerStats.deltaRate / deltaRate) * - 100 - ).toFixed(0)} - %) - {' '} - - {'deltas/s'} - {' '} - - )} -
        - -
        -
      • - ) + if (getLinkType(providerId) === 'provider') { + return renderer(providerId, providerStats, 'provider') } })}
      @@ -181,13 +178,7 @@ const Dashboard = (props) => { {Object.keys(providerStatistics || {}) .sort() .map((providerId) => { - let linkType = 'provider' - try { - linkType = providerStatus.find( - (item) => item.id === providerId - ).statusType - } catch (error) {} - if (linkType === 'plugin') { + if (getLinkType(providerId) === 'plugin') { isPlugins = true } })} @@ -201,98 +192,8 @@ const Dashboard = (props) => { .sort() .map((providerId) => { const providerStats = providerStatistics[providerId] - let linkType = 'provider' - try { - linkType = providerStatus.find( - (item) => item.id === providerId - ).statusType - } catch (error) {} - const inputPulseIconClass = - 'icon-login' + - (providerStats.deltaRate > 50 - ? ' text-primary fa-pulse-fast' - : providerStats.deltaRate > 0 - ? ' text-primary fa-pulse' - : '') - const outputPulseIconClass = - 'icon-logout' + - (providerStats.writeRate > 50 - ? ' text-primary fa-pulse-fast' - : providerStats.writeRate > 0 - ? ' text-primary fa-pulse' - : '') - if (linkType === 'plugin') { - return ( -
    • props.history.push(`/dashboard`)} - > - - - - {pluginNameLink(providerId)} - - {providerStats.writeRate > 0 && ( - - {' '} - {providerStats.writeRate}{' '} - - {'msg/s'} - {' '} - - )} - {providerStats.deltaRate > 0 && - providerStats.writeRate > 0 && ( - - - {','} - -   - - )} - {providerStats.deltaRate > 0 && ( - - {' '} - {providerStats.deltaRate}{' '} - - ( - {( - (providerStats.deltaRate / deltaRate) * - 100 - ).toFixed(0)} - %) - {' '} - - {'deltas/s'} - {' '} - - )} -
      - -
      -
    • - ) + if (getLinkType(providerId) === 'plugin') { + return renderer(providerId, providerStats, 'plugin') } })}
    From 614752570eaa8e5dc8ed93d3f1aa7fb44b2af405 Mon Sep 17 00:00:00 2001 From: KEGustafsson Date: Thu, 8 Feb 2024 22:26:15 +0200 Subject: [PATCH 10/13] fix: optimize functions --- .../src/views/Dashboard/Dashboard.js | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js index 68ffec89e..65b9f6f7d 100644 --- a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js +++ b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js @@ -30,7 +30,6 @@ const Dashboard = (props) => { const uptimeD = Math.floor(uptime / (60 * 60 * 24)) const uptimeH = Math.floor((uptime % (60 * 60 * 24)) / (60 * 60)) const uptimeM = Math.floor((uptime % (60 * 60)) / 60) - let isPlugins = false let errors = '' if (errorCount > 0) { errors = `(${errorCount} errors)` @@ -168,32 +167,33 @@ const Dashboard = (props) => { {Object.keys(providerStatistics || {}) .sort() .map((providerId) => { - const providerStats = providerStatistics[providerId] if (getLinkType(providerId) === 'provider') { - return renderer(providerId, providerStats, 'provider') + return renderer( + providerId, + providerStatistics[providerId], + 'provider' + ) } })}

    - {Object.keys(providerStatistics || {}) - .sort() - .map((providerId) => { - if (getLinkType(providerId) === 'plugin') { - isPlugins = true - } - })} - {isPlugins ? ( -
    - Plugin activity -
    - ) : null} +
    + {Object.keys(providerStatistics || {}).some( + (providerId) => getLinkType(providerId) === 'plugin' + ) + ? 'Plugin activity' + : null} +
      {Object.keys(providerStatistics || {}) .sort() .map((providerId) => { - const providerStats = providerStatistics[providerId] if (getLinkType(providerId) === 'plugin') { - return renderer(providerId, providerStats, 'plugin') + return renderer( + providerId, + providerStatistics[providerId], + 'plugin' + ) } })}
    From 768993123cbd9a9def8b616b0595395d181e34a9 Mon Sep 17 00:00:00 2001 From: KEGustafsson Date: Sat, 10 Feb 2024 00:21:26 +0200 Subject: [PATCH 11/13] fix: font size modification --- packages/server-admin-ui/src/views/Dashboard/Dashboard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js index 65b9f6f7d..cf6a04930 100644 --- a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js +++ b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js @@ -160,7 +160,7 @@ const Dashboard = (props) => { -
    +
    Connections activity
      @@ -177,7 +177,7 @@ const Dashboard = (props) => { })}


    -
    +
    {Object.keys(providerStatistics || {}).some( (providerId) => getLinkType(providerId) === 'plugin' ) From 27c17fc37bcacd5d896d979f28a4eefffba6490d Mon Sep 17 00:00:00 2001 From: KEGustafsson Date: Sat, 10 Feb 2024 01:19:53 +0200 Subject: [PATCH 12/13] fix: updates to status view functions --- .../src/views/Dashboard/Dashboard.js | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js index cf6a04930..fedca6bf5 100644 --- a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js +++ b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js @@ -65,7 +65,7 @@ const Dashboard = (props) => { ) } - const renderer = (providerId, providerStats, linkType) => { + const activityRenderer = (providerId, providerStats, linkType) => { return (
  • props.history.push(`/dashboard`)}> { ) } + const statusRenderer = (status, statusClass, lastError) => { + return ( + { + props.history.push( + '/serverConfiguration/' + + (status.statusType === 'plugin' ? 'plugins/' : 'connections/') + + status.id + ) + }} + > + + {status.statusType === 'plugin' + ? pluginNameLink(status.id) + : providerIdLink(status.id)} + + +

    {lastError}

    + + +

    + {(status.message || '').substring(0, 80)} + {status.message.length > 80 ? '...' : ''} +

    + + + ) + } + return (
    {props.websocketStatus === 'open' && ( @@ -168,7 +198,7 @@ const Dashboard = (props) => { .sort() .map((providerId) => { if (getLinkType(providerId) === 'provider') { - return renderer( + return activityRenderer( providerId, providerStatistics[providerId], 'provider' @@ -189,7 +219,7 @@ const Dashboard = (props) => { .sort() .map((providerId) => { if (getLinkType(providerId) === 'plugin') { - return renderer( + return activityRenderer( providerId, providerStatistics[providerId], 'plugin' @@ -219,49 +249,19 @@ const Dashboard = (props) => { {providerStatus.map((status) => { - let statusClass - if (status.type === 'status') { - statusClass = 'text-success' - } else if (status.type === 'warning') { - statusClass = 'text-warning' - } else { - statusClass = 'text-danger' + const statusClasses = { + status: 'text-success', + warning: 'text-warning', + error: 'text-danger', } + const statusClass = statusClasses[status.type] const lastError = status.lastError && status.lastError != status.message ? status.lastErrorTimeStamp + ': ' + status.lastError : '' - return ( - { - props.history.push( - '/serverConfiguration/' + - (status.statusType === 'plugin' - ? 'plugins/' - : 'connections/') + - status.id - ) - }} - > - - {status.statusType === 'plugin' - ? pluginNameLink(status.id) - : providerIdLink(status.id)} - - -

    {lastError}

    - - -

    - {(status.message || '').substring(0, 80)} - {status.message.length > 80 ? '...' : ''} -

    - - - ) + return statusRenderer(status, statusClass, lastError) })} From a37d38a8d5b674ebc8e8e1258f40fdde415c9555 Mon Sep 17 00:00:00 2001 From: Karl-Erik Gustafsson Date: Sat, 10 Feb 2024 15:05:55 +0200 Subject: [PATCH 13/13] fix: rename render-functions and typo correction --- .../server-admin-ui/src/views/Dashboard/Dashboard.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js index fedca6bf5..37339db06 100644 --- a/packages/server-admin-ui/src/views/Dashboard/Dashboard.js +++ b/packages/server-admin-ui/src/views/Dashboard/Dashboard.js @@ -65,7 +65,7 @@ const Dashboard = (props) => { ) } - const activityRenderer = (providerId, providerStats, linkType) => { + const renderActivity = (providerId, providerStats, linkType) => { return (
  • props.history.push(`/dashboard`)}> { ) } - const statusRenderer = (status, statusClass, lastError) => { + const renderStatus = (status, statusClass, lastError) => { return ( { .sort() .map((providerId) => { if (getLinkType(providerId) === 'provider') { - return activityRenderer( + return renderActivity( providerId, providerStatistics[providerId], 'provider' @@ -211,7 +211,7 @@ const Dashboard = (props) => { {Object.keys(providerStatistics || {}).some( (providerId) => getLinkType(providerId) === 'plugin' ) - ? 'Plugin activity' + ? 'Plugins activity' : null}
      @@ -219,7 +219,7 @@ const Dashboard = (props) => { .sort() .map((providerId) => { if (getLinkType(providerId) === 'plugin') { - return activityRenderer( + return renderActivity( providerId, providerStatistics[providerId], 'plugin' @@ -261,7 +261,7 @@ const Dashboard = (props) => { ': ' + status.lastError : '' - return statusRenderer(status, statusClass, lastError) + return renderStatus(status, statusClass, lastError) })}