diff --git a/navbar-auth-state-old.js b/navbar-auth-state-old.js
index f2a2a7d37..b8d691047 100644
--- a/navbar-auth-state-old.js
+++ b/navbar-auth-state-old.js
@@ -11,12 +11,16 @@ $(document).ready(function() {
$('#auth-dropdown').after(
'
');
$('ul .dropdown-menu').append(`Profile`);
- if (typeof window.showPerms !== 'undefined') {
- $('ul .dropdown-menu').append(`MQTT Permissions`);
- $('#show_perms').on('click', function() {
- window.showPerms();
- });
- }
+ $('ul .dropdown-menu').append(`MQTT Permissions`);
+ $('#show_perms').on('click', function() {
+ const frame = document.getElementsByTagName('iframe');
+ const win = (frame && frame.length > 0) ? frame[0].contentWindow : window;
+ if (typeof win.showPerms !== 'undefined') {
+ win.showPerms();
+ } else {
+ alert('No MQTT permissions');
+ }
+ });
$('ul .dropdown-menu').append(`Logout`);
} else {
$('#auth-dropdown').html('Login').on('click', function(e) {
@@ -46,9 +50,9 @@ $(document).ready(function() {
storePath = storePath.replace('/storemng/files', '/store');
const fullPath = `${window.location.protocol}//${window.location.host}${storePath}`;
navigator.clipboard.writeText(fullPath);
- Swal.fire( 'Copied!', fullPath, 'success' );
+ Swal.fire('Copied!', fullPath, 'success');
} else {
- Swal.fire( 'Invalid path', 'Please navigate to another File Store file or folder', 'warning' );
+ Swal.fire('Invalid path', 'Please navigate to another File Store file or folder', 'warning');
}
});
diff --git a/navbar-auth-state.js b/navbar-auth-state.js
index 3ab5aee78..16ca24d47 100644
--- a/navbar-auth-state.js
+++ b/navbar-auth-state.js
@@ -12,14 +12,18 @@ $(document).ready(function() {
authDrop.attr('aria-haspopup', 'true');
authDrop.attr('aria-expanded', 'false');
$('#auth-dropdown').after(
- '');
+ '');
$('ul .dropdown-menu').append(`Profile`);
- if (typeof window.showPerms !== 'undefined') {
- $('ul .dropdown-menu').append(`MQTT Permissions`);
- $('#show_perms').on('click', function() {
- window.showPerms();
- });
- }
+ $('ul .dropdown-menu').append(`MQTT Permissions`);
+ $('#show_perms').on('click', function() {
+ const frame = document.getElementsByTagName('iframe');
+ const win = (frame && frame.length > 0) ? frame[0].contentWindow : window;
+ if (typeof win.showPerms !== 'undefined') {
+ win.showPerms();
+ } else {
+ alert('No MQTT permissions');
+ }
+ });
$('ul .dropdown-menu').append(`Logout`);
} else {
$('#auth-dropdown').html('Login').on('click', function(e) {
@@ -39,7 +43,7 @@ $(document).ready(function() {
$('#btn-copy-store-path').hide();
}
return link == loc;
- }).parent().addClass('active');
+ }).addClass('active');
// copy the file store public path
$('#btn-copy-store-path').on('click', function(e) {
@@ -49,9 +53,9 @@ $(document).ready(function() {
storePath = storePath.replace('/storemng/files', '/store');
const fullPath = `${window.location.protocol}//${window.location.host}${storePath}`;
navigator.clipboard.writeText(fullPath);
- Swal.fire( 'Copied!', fullPath, 'success' );
+ Swal.fire('Copied!', fullPath, 'success');
} else {
- Swal.fire( 'Invalid path', 'Please navigate to another File Store file or folder', 'warning' );
+ Swal.fire('Invalid path', 'Please navigate to another File Store file or folder', 'warning');
}
});