map icon color state

asicara year ago

Can anyone help me change the map icon in Traccar to show if a vehicle is on or off instead of online or offline? I have already tried modifying the formatter.js file and have used the getStatusColor function shown below

export const getStatusColor = (positionIgnition) => {
  switch (positionIgnition) {
    case 'true':
      return 'positive';
    case 'false':
      return 'negative';
    case 'unknown':
    default:
      return 'neutral';
  }
};

Although I have made these changes, I have not been successful and I am seeking guidance or suggestions on how to do it correctly. If anyone has experience making these changes in Traccar, I would appreciate any help they can provide.

asicara year ago

also

export const getStatusColor = (positionIgnition) => {
  if (positionIgnition = true) {
    return 'positive';
  }
};
Joysticka year ago

Hi asicar,
I think you should be able to achieve it with the "color" computed attribute.

ignition?"positive":"negative"
gLeWa year ago