map icon color state

asicar2 years 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.

asicar2 years ago

also

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

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

ignition?"positive":"negative"
gLeW2 years ago