Limited widget displayed fields to 4
This commit is contained in:
parent
3fb9ad8695
commit
0fcfaea47e
@ -296,6 +296,13 @@ export function cleanServiceGroups(groups) {
|
||||
} = cleanedService.widget;
|
||||
|
||||
let fieldsList = fields;
|
||||
|
||||
const MAX_ALLOWED_FIELDS = 4;
|
||||
// Limits max number of displayed fields
|
||||
if (fieldsList != null && fieldsList.length > MAX_ALLOWED_FIELDS) {
|
||||
fieldsList = fieldsList.slice(0, MAX_ALLOWED_FIELDS);
|
||||
}
|
||||
|
||||
if (typeof fields === 'string') {
|
||||
try { JSON.parse(fields) }
|
||||
catch (e) {
|
||||
|
||||
@ -13,6 +13,11 @@ export default function Component({ service }) {
|
||||
return <Container service={service} error={serverError} />;
|
||||
}
|
||||
|
||||
// Default fields
|
||||
if (widget.fields == null || widget.fields.length === 0) {
|
||||
widget.fields = ["map", "currentPlayers", "ping"];
|
||||
}
|
||||
|
||||
if (!serverData) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user