Skip to content
Snippets Groups Projects
Commit 15a2e937 authored by xiaohua guan's avatar xiaohua guan Committed by Yas Naoi
Browse files

Issue #3194659 by Xiaohua Guan, yas: Fix some errors in a front page by...

Issue #3194659 by Xiaohua Guan, yas: Fix some errors in a front page by K8sNodeAllocatedResourcesBlock and K8sNodeHeatmapBlock
parent b9694dea
No related branches found
Tags 8.x-2.0-alpha7
No related merge requests found
......@@ -36,7 +36,7 @@ class K8sNodeAllocatedResourcesBlock extends K8sBaseBlock {
$form['display_view_k8s_node_list_only'] = [
'#type' => 'checkbox',
'#title' => $this->t('Display this block in K8s Node detail/list page and K8s Project Content page only'),
'#default_value' => $this->configuration['display_view_k8s_node_list_only'],
'#default_value' => $this->configuration['display_view_k8s_node_list_only'] ?? 1,
];
$form['use_event_listener'] = [
'#type' => 'checkbox',
......@@ -44,7 +44,7 @@ class K8sNodeAllocatedResourcesBlock extends K8sBaseBlock {
'#description' => $this->t('Check to use a common JS resource url to update this block on dashboard.
Useful if this block is placed on a page along with K8s Node Heatmap block. Reduces duplicate AJAX calls to
K8s Resource Url.'),
'#default_value' => $this->configuration['use_event_listener'],
'#default_value' => $this->configuration['use_event_listener'] ?? 1,
];
return $form;
}
......@@ -155,7 +155,7 @@ class K8sNodeAllocatedResourcesBlock extends K8sBaseBlock {
];
// Add refresh js that uses Event Trigger method of updating the block.
if ($this->configuration['use_event_listener']) {
if ($this->configuration['use_event_listener'] ?? TRUE) {
$build['k8s_node_allocated_resources']['#attached']['library'][] = 'k8s/k8s_refresh_resource_trigger';
$build['k8s_node_allocated_resources']['#attached']['drupalSettings']['k8s']['use_event_listener'] = TRUE;
}
......
......@@ -35,7 +35,7 @@ class K8sNodeHeatmapBlock extends K8sBaseBlock {
$form['display_view_k8s_node_list_only'] = [
'#type' => 'checkbox',
'#title' => $this->t('Display this block in K8s Node detail/list page and K8s Project Content page only'),
'#default_value' => $this->configuration['display_view_k8s_node_list_only'],
'#default_value' => $this->configuration['display_view_k8s_node_list_only'] ?? 1,
];
$form['use_event_listener'] = [
'#type' => 'checkbox',
......@@ -43,7 +43,7 @@ class K8sNodeHeatmapBlock extends K8sBaseBlock {
'#description' => $this->t('Check to use a common JS resource url to update this block on dashboard.
Useful if this block is placed on a page along with K8s Node Allocated Resources block. Reduces duplicate AJAX calls to
K8s Resource Url.'),
'#default_value' => $this->configuration['use_event_listener'],
'#default_value' => $this->configuration['use_event_listener'] ?? 1,
];
return $form;
}
......@@ -136,7 +136,7 @@ class K8sNodeHeatmapBlock extends K8sBaseBlock {
];
// Add refresh js that uses Event Trigger method of updating the block.
if ($this->configuration['use_event_listener'] && empty($k8s_node)) {
if ($this->configuration['use_event_listener'] ?? TRUE && empty($k8s_node)) {
$build['k8s_node_allocated_resources']['#attached']['library'][] = 'k8s/k8s_refresh_resource_trigger';
$build['k8s_node_allocated_resources']['#attached']['drupalSettings']['k8s']['use_event_listener'] = TRUE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment