Skip to content

Commit

Permalink
Fix dashboard options
Browse files Browse the repository at this point in the history
  • Loading branch information
cconard96 authored Dec 19, 2024
1 parent 9d57526 commit e5db895
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions js/modules/Dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,10 @@ class GLPIDashboard {
// prepare options
form_data.card_options.color = form_data.color || null;
form_data.card_options.widgettype = form_data.widgettype || null;
form_data.card_options.palette = form_data.palette || null;
form_data.card_options.use_gradient = form_data.use_gradient || 0;
form_data.card_options.point_labels = form_data.point_labels || 0;
form_data.card_options.legend = form_data.legend || 0;
form_data.card_options.limit = form_data.limit || 7;

// specific case for markdown
Expand Down
10 changes: 10 additions & 0 deletions tests/js/modules/Dashboard/Dashboard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,10 @@ describe('Dashboard', () => {
card_options: {
color: null,
widgettype: null,
palette: null,
use_gradient: 0,
point_labels: 0,
legend: 0,
limit: 7,
card_id: undefined,
gridstack_id: 'undefined_12345678-1234-1234-1234-123456789012',
Expand Down Expand Up @@ -193,8 +195,10 @@ describe('Dashboard', () => {
return [
{name: 'color', value: '#ff00ff'},
{name: 'widgettype', value: 'testWidget'},
{name: 'palette', value: 'testPalette'},
{name: 'use_gradient', value: 1},
{name: 'point_labels', value: 1},
{name: 'legend', value: 1},
{name: 'limit', value: 10},
{name: 'card_id', value: 'mycard'},
];
Expand All @@ -207,8 +211,10 @@ describe('Dashboard', () => {
card_id: 'mycard',
color: '#ff00ff',
widgettype: 'testWidget',
palette: 'testPalette',
use_gradient: 1,
point_labels: 1,
legend: 1,
limit: 10,
gridstack_id: 'mycard_12345678-1234-1234-1234-123456789012',
force: true,
Expand All @@ -217,8 +223,10 @@ describe('Dashboard', () => {
// TODO These duplicated values probably shouldn't be here
color: '#ff00ff',
widgettype: 'testWidget',
palette: 'testPalette',
use_gradient: 1,
point_labels: 1,
legend: 1,
limit: 10,
gridstack_id: 'mycard_12345678-1234-1234-1234-123456789012',
});
Expand Down Expand Up @@ -336,8 +344,10 @@ describe('Dashboard', () => {
args: {
color: null,
widgettype: null,
palette: null,
use_gradient: 0,
point_labels: 0,
legend: 0,
limit: 7,
card_id: undefined,
gridstack_id: 'undefined_12345678-1234-1234-1234-123456789012',
Expand Down

0 comments on commit e5db895

Please sign in to comment.