Explorar o código

Added enable toggle to charts

Henry Whitaker %!s(int64=6) %!d(string=hai) anos
pai
achega
31d6fd7b0e
Modificáronse 2 ficheiros con 71 adicións e 5 borrados
  1. 6 0
      api/config/default.php
  2. 65 5
      api/functions/homepage-functions.php

+ 6 - 0
api/config/default.php

@@ -343,4 +343,10 @@ return array(
 	'netdata6Chart' => '',
 	'netdata6Data' => '',
 	'netdata6Colour' => '',
+	'netdata1Enabled' => false,
+	'netdata2Enabled' => false,
+	'netdata3Enabled' => false,
+	'netdata4Enabled' => false,
+	'netdata5Enabled' => false,
+	'netdata6Enabled' => false,
 );

+ 65 - 5
api/functions/homepage-functions.php

@@ -3024,6 +3024,16 @@ function getHomepageList()
 					),
 				),
 				'Chart 1' => array(
+					array(
+						'type' => 'switch',
+						'name' => 'netdata1Enabled',
+						'label' => 'Enable',
+						'value' => $GLOBALS['netdata1Enabled']
+					),
+					array(
+						'type' => 'blank',
+						'label' => ''
+					),
 					array(
 						'type' => 'input',
 						'name' => 'netdata1Title',
@@ -3041,7 +3051,7 @@ function getHomepageList()
 					array(
 						'type' => 'select',
 						'name' => 'netdata1Chart',
-						'label' => 'Data',
+						'label' => 'Chart',
 						'value' => $GLOBALS['netdata1Chart'],
 						'options' => netdataChartOptions(),
 					),
@@ -3054,6 +3064,16 @@ function getHomepageList()
 					),
 				),
 				'Chart 2' => array(
+					array(
+						'type' => 'switch',
+						'name' => 'netdata2Enabled',
+						'label' => 'Enable',
+						'value' => $GLOBALS['netdata2Enabled']
+					),
+					array(
+						'type' => 'blank',
+						'label' => ''
+					),
 					array(
 						'type' => 'input',
 						'name' => 'netdata2Title',
@@ -3071,7 +3091,7 @@ function getHomepageList()
 					array(
 						'type' => 'select',
 						'name' => 'netdata2Chart',
-						'label' => 'Data',
+						'label' => 'Chart',
 						'value' => $GLOBALS['netdata2Chart'],
 						'options' => netdataChartOptions(),
 					),
@@ -3084,6 +3104,16 @@ function getHomepageList()
 					),
 				),
 				'Chart 3' => array(
+					array(
+						'type' => 'switch',
+						'name' => 'netdata3Enabled',
+						'label' => 'Enable',
+						'value' => $GLOBALS['netdata3Enabled']
+					),
+					array(
+						'type' => 'blank',
+						'label' => ''
+					),
 					array(
 						'type' => 'input',
 						'name' => 'netdata3Title',
@@ -3114,6 +3144,16 @@ function getHomepageList()
 					),
 				),
 				'Chart 4' => array(
+					array(
+						'type' => 'switch',
+						'name' => 'netdata4Enabled',
+						'label' => 'Enable',
+						'value' => $GLOBALS['netdata4Enabled']
+					),
+					array(
+						'type' => 'blank',
+						'label' => ''
+					),
 					array(
 						'type' => 'input',
 						'name' => 'netdata4Title',
@@ -3131,7 +3171,7 @@ function getHomepageList()
 					array(
 						'type' => 'select',
 						'name' => 'netdata4Chart',
-						'label' => 'Data',
+						'label' => 'Chart',
 						'value' => $GLOBALS['netdata4Chart'],
 						'options' => netdataChartOptions(),
 					),
@@ -3144,6 +3184,16 @@ function getHomepageList()
 					),
 				),
 				'Chart 5' => array(
+					array(
+						'type' => 'switch',
+						'name' => 'netdata5Enabled',
+						'label' => 'Enable',
+						'value' => $GLOBALS['netdata5Enabled']
+					),
+					array(
+						'type' => 'blank',
+						'label' => ''
+					),
 					array(
 						'type' => 'input',
 						'name' => 'netdata5Title',
@@ -3161,7 +3211,7 @@ function getHomepageList()
 					array(
 						'type' => 'select',
 						'name' => 'netdata5Chart',
-						'label' => 'Data',
+						'label' => 'Chart',
 						'value' => $GLOBALS['netdata5Chart'],
 						'options' => netdataChartOptions(),
 					),
@@ -3174,6 +3224,16 @@ function getHomepageList()
 					),
 				),
 				'Chart 6' => array(
+					array(
+						'type' => 'switch',
+						'name' => 'netdata6Enabled',
+						'label' => 'Enable',
+						'value' => $GLOBALS['netdata6Enabled']
+					),
+					array(
+						'type' => 'blank',
+						'label' => ''
+					),
 					array(
 						'type' => 'input',
 						'name' => 'netdata6Title',
@@ -3191,7 +3251,7 @@ function getHomepageList()
 					array(
 						'type' => 'select',
 						'name' => 'netdata6Chart',
-						'label' => 'Data',
+						'label' => 'Chart',
 						'value' => $GLOBALS['netdata6Chart'],
 						'options' => netdataChartOptions(),
 					),