trafficcontrol icon indicating copy to clipboard operation
trafficcontrol copied to clipboard

TP browser support disclaimer

Open mitchell852 opened this issue 4 years ago • 7 comments

This Improvement request (usability, performance, tech debt, etc.) affects these Traffic Control components:

  • Traffic Portal

Current behavior:

There is no disclaimer in TP that only one browser is guaranteed to fully work: chrome and another is known to fully work: firefox.

New behavior:

Some sort of disclaimer about this in TP would be nice so people don't use Safari, for example.

mitchell852 avatar Oct 21 '21 18:10 mitchell852

@mitchell852 - Should we do this using the navigator.userAgent property?

hritvikpatel4 avatar Jun 11 '22 06:06 hritvikpatel4

@mitchell852 - Should we do this using the navigator.userAgent property?

sure. you mean check the value of navigator.userAgent and if not chrome/firefox display a message or something? sound good to me. the message could be set using:

messageModel.setMessages([{level: 'warning', text: 'Unsupported browser. Use chrome or firefox.'}], false);

mitchell852 avatar Jun 14 '22 17:06 mitchell852

globalThis.navigator.userAgentData is a great interface for doing that without parsing the insane jumble of text that UA strings have become - but it's not available in Firefox (or Safari or stably in most versions of Samsung Internet). So it's possible we could find a shim on npm or something.

ocket8888 avatar Jun 14 '22 19:06 ocket8888

globalThis.navigator.userAgentData is a great interface for doing that without parsing the insane jumble of text that UA strings have become - but it's not available in Firefox (or Safari or stably in most versions of Samsung Internet). So it's possible we could find a shim on npm or something.

There are three popular npm packages:

  1. https://www.npmjs.com/package/ua-parser-js
  2. https://www.npmjs.com/package/bowser
  3. https://www.npmjs.com/package/useragent

The third one claims it's the fastest parser. I would rank them as 1 > 2 > 3 based on their popularity on npmjs.com

@ocket8888 @mitchell852 - What are your thoughts on this?

hritvikpatel4 avatar Jun 15 '22 04:06 hritvikpatel4

It's unlikely to be a performance bottleneck, especially since if done correctly it should only be calculated once. Speed is a non-issue. Whatever library is easiest to use and/or smaller and/or more accurate (I would hope they're all equally accurate) is the best choice. Or if you think it's easiest to just parse it yourself since we only support two browsers, that's fine too.

ocket8888 avatar Jun 15 '22 07:06 ocket8888

It's unlikely to be a performance bottleneck, especially since if done correctly it should only be calculated once. Speed is a non-issue. Whatever library is easiest to use and/or smaller and/or more accurate (I would hope they're all equally accurate) is the best choice. Or if you think it's easiest to just parse it yourself since we only support two browsers, that's fine too.

Got it.

@ocket8888 - Could you tell me if there is any documentation on how to integrate new features into traffic portal?

I see there are two modules folders traffic_portal/app/src/modules and traffic_portal/app/src/common/modules.

hritvikpatel4 avatar Jun 15 '22 11:06 hritvikpatel4

@ocket8888 - Could you tell me if there is any documentation on how to integrate new features into traffic portal?

I see there are two modules folders traffic_portal/app/src/modules and traffic_portal/app/src/common/modules.

sorry, no documentation on how to do it but traffic_portal/app/src/modules is really for view/pages. module was a bad name for that directory i guess. so probably go with "common modules".

Actually, you might just want to inject your code into ApplicationService.js as i believe that runs on TP startup.

mitchell852 avatar Jun 17 '22 17:06 mitchell852