mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Frontend: Foundations for multi tenant frontend * improve manifest parsing for multi-tenant frontend (#78876) * add test * add test * ?? * Updates * Added cache * test cleanup * lint * fix test * fix error templates * cleanup * remove copy * revert changes to list testdata * comment cleanup * prepare integration tests * Remove integrety --------- Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
/**
|
|
* Check to see if browser is not supported by Grafana
|
|
* This function is copied to index.html but is here so we can write tests
|
|
* */
|
|
export function checkBrowserCompatibility() {
|
|
const isIE = navigator.userAgent.indexOf('MSIE') > -1;
|
|
const isEdge = navigator.userAgent.indexOf('Edge/') > -1 || navigator.userAgent.indexOf('Edg/') > -1;
|
|
const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
|
const isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
|
|
|
|
/* Check for
|
|
<= IE11 (Trident 7)
|
|
Edge <= 16
|
|
Firefox <= 64
|
|
Chrome <= 54
|
|
*/
|
|
const isEdgeVersion = /Edge\/([0-9.]+)/.exec(navigator.userAgent);
|
|
|
|
if (isIE && parseFloat(/Trident\/([0-9.]+)/.exec(navigator.userAgent)![1]) <= 7) {
|
|
return false;
|
|
} else if (
|
|
isEdge &&
|
|
((isEdgeVersion && parseFloat(isEdgeVersion[1]) <= 16) ||
|
|
parseFloat(/Edg\/([0-9.]+)/.exec(navigator.userAgent)![1]) <= 16)
|
|
) {
|
|
return false;
|
|
} else if (isFirefox && parseFloat(/Firefox\/([0-9.]+)/.exec(navigator.userAgent)![1]) <= 64) {
|
|
return false;
|
|
} else if (isChrome && parseFloat(/Chrome\/([0-9.]+)/.exec(navigator.userAgent)![1]) <= 54) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
export function userAgentIsApple() {
|
|
const appleRe = /(iPhone|iPad|Mac)/;
|
|
return appleRe.test(navigator.platform);
|
|
}
|
|
|
|
export function getModKey() {
|
|
return userAgentIsApple() ? 'cmd' : 'ctrl';
|
|
}
|