diff --git a/assets/js/common/ChartDisabledBox/ChartDisabledBox.jsx b/assets/js/common/ChartDisabledBox/ChartDisabledBox.jsx
new file mode 100644
index 0000000000..6081a4a8a7
--- /dev/null
+++ b/assets/js/common/ChartDisabledBox/ChartDisabledBox.jsx
@@ -0,0 +1,16 @@
+import React from 'react';
+
+function ChartDisabledBox() {
+ return (
+
+
+ Charts are disabled, please check documentation for further details
+
+
+ );
+}
+
+export default ChartDisabledBox;
diff --git a/assets/js/common/ChartDisabledBox/ChartDisabledBox.stories.jsx b/assets/js/common/ChartDisabledBox/ChartDisabledBox.stories.jsx
new file mode 100644
index 0000000000..9205f9ca6a
--- /dev/null
+++ b/assets/js/common/ChartDisabledBox/ChartDisabledBox.stories.jsx
@@ -0,0 +1,10 @@
+import ChartDisabledBox from '.';
+
+export default {
+ title: 'Components/ChartDisabledBox',
+ component: ChartDisabledBox,
+};
+
+export const Default = {
+ args: {},
+};
diff --git a/assets/js/common/ChartDisabledBox/index.js b/assets/js/common/ChartDisabledBox/index.js
new file mode 100644
index 0000000000..c5fc7d0aba
--- /dev/null
+++ b/assets/js/common/ChartDisabledBox/index.js
@@ -0,0 +1,3 @@
+import ChartDisabledBox from './ChartDisabledBox';
+
+export default ChartDisabledBox;
diff --git a/assets/js/common/ChartFeatureWrapper/ChartFeatureWrapper.jsx b/assets/js/common/ChartFeatureWrapper/ChartFeatureWrapper.jsx
new file mode 100644
index 0000000000..fe3f7a9269
--- /dev/null
+++ b/assets/js/common/ChartFeatureWrapper/ChartFeatureWrapper.jsx
@@ -0,0 +1,10 @@
+import React from 'react';
+import ChartDisabledBox from '@common/ChartDisabledBox';
+
+function ChartFeatureWrapper({ children }) {
+ // eslint-disable-next-line no-undef
+ if (!config.chartsEnabled) return ;
+ return children;
+}
+
+export default ChartFeatureWrapper;
diff --git a/assets/js/common/ChartFeatureWrapper/ChartFeatureWrapper.test.jsx b/assets/js/common/ChartFeatureWrapper/ChartFeatureWrapper.test.jsx
new file mode 100644
index 0000000000..ad8d814d0b
--- /dev/null
+++ b/assets/js/common/ChartFeatureWrapper/ChartFeatureWrapper.test.jsx
@@ -0,0 +1,31 @@
+import React from 'react';
+import { render, screen } from '@testing-library/react';
+import '@testing-library/jest-dom';
+import ChartFeatureWrapper from './ChartFeatureWrapper';
+
+describe('ChartFeatureWrapper', () => {
+ afterEach(() => {
+ global.config = { chartsEnabled: false };
+ });
+
+ it('should render ChartDisabledBox if the chart feature is disabled', () => {
+ global.config = { chartsEnabled: false };
+
+ render();
+ expect(screen.getByTestId('chart-disabled-box')).toHaveTextContent(
+ 'disabled'
+ );
+ });
+
+ it('should render children if the chart feature is enabled', () => {
+ global.config = { chartsEnabled: true };
+
+ render(
+
+ {' '}
+ child
{' '}
+
+ );
+ expect(screen.getByTestId('child')).toHaveTextContent('child');
+ });
+});
diff --git a/assets/js/common/ChartFeatureWrapper/index.js b/assets/js/common/ChartFeatureWrapper/index.js
new file mode 100644
index 0000000000..0210cb73bd
--- /dev/null
+++ b/assets/js/common/ChartFeatureWrapper/index.js
@@ -0,0 +1,3 @@
+import ChartFeatureWrapper from './ChartFeatureWrapper';
+
+export default ChartFeatureWrapper;
diff --git a/assets/js/pages/HostDetailsPage/HostDetails.jsx b/assets/js/pages/HostDetailsPage/HostDetails.jsx
index 4c5d48f6da..c4a53d31f9 100644
--- a/assets/js/pages/HostDetailsPage/HostDetails.jsx
+++ b/assets/js/pages/HostDetailsPage/HostDetails.jsx
@@ -12,6 +12,8 @@ import PageHeader from '@common/PageHeader';
import Table from '@common/Table';
import Tooltip from '@common/Tooltip';
import WarningBanner from '@common/Banners/WarningBanner';
+import ChartFeatureWrapper from '@common/ChartFeatureWrapper/ChartFeatureWrapper';
+
import { subHours } from 'date-fns';
import SuseLogo from '@static/suse_logo.svg';
@@ -209,24 +211,26 @@ function HostDetails({
/>
-
- `${value}%`}
- startInterval={subHours(timeNow, 3)}
- />
-
-
- formatBytes(value, 3)}
- />
-
+
+
+ `${value}%`}
+ startInterval={subHours(timeNow, 3)}
+ />
+
+
+ formatBytes(value, 3)}
+ />
+
+
Provider details
diff --git a/lib/trento_web/controllers/page_controller.ex b/lib/trento_web/controllers/page_controller.ex
index e0020274ba..535d5a93ee 100644
--- a/lib/trento_web/controllers/page_controller.ex
+++ b/lib/trento_web/controllers/page_controller.ex
@@ -3,11 +3,12 @@ defmodule TrentoWeb.PageController do
def index(conn, _params) do
check_service_base_url = Application.fetch_env!(:trento, :checks_service)[:base_url]
-
+ charts_enabled = Application.fetch_env!(:trento, Trento.Charts)[:enabled]
deregistration_debounce = Application.fetch_env!(:trento, :deregistration_debounce)
render(conn, "index.html",
check_service_base_url: check_service_base_url,
+ charts_enabled: charts_enabled,
deregistration_debounce: deregistration_debounce
)
end
diff --git a/lib/trento_web/templates/page/index.html.heex b/lib/trento_web/templates/page/index.html.heex
index b1f7755b62..173931cd3a 100644
--- a/lib/trento_web/templates/page/index.html.heex
+++ b/lib/trento_web/templates/page/index.html.heex
@@ -4,6 +4,7 @@
const config = {
checksServiceBaseUrl: '<%= @check_service_base_url %>',
deregistrationDebounce: <%= @deregistration_debounce %>,
+ chartsEnabled: <%= @charts_enabled %>,
};