Show streamed servers even for users that are not signed in! #5482 (#5519)
* Show streamed servers even for users that are not signed in! #5482 * Better placement of sign-in prompt #5482
George Moschovitis committed
Feb 28, 2019 at 14:12 UTC
4fd9c251c4d30bf21c1f85a779ef00106bfc810b
1 file changed
+26
-16
web/gui/main.js
+26
-16
@@ -550,10 +550,6 @@ function renderStreamedHosts(options) {
550
}
551
552
function renderMachines(machinesArray) {
553
- // let html = isSignedIn()
554
- // ? `<div class="info-item">My nodes</div>`
555
- // : `<div class="info-item">My nodes</div>`;
556
-
553
let html = `<div class="info-item">My nodes</div>`;
554
555
if (machinesArray === null) {
@@ -710,13 +706,6 @@ function renderMyNetdataMenu(machinesArray) {
706
const el = document.getElementById('my-netdata-dropdown-content');
707
el.classList.add(`theme-${netdataTheme}`);
708
713
- if (!isSignedIn()) {
714
- if (!NETDATA.registry.isRegistryEnabled()) {
715
- restrictMyNetdataMenu();
716
- return;
717
- }
718
- }
719
-
709
if (machinesArray == registryAgents) {
710
console.log("Rendering my-netdata menu from registry");
711
} else {
@@ -725,6 +714,18 @@ function renderMyNetdataMenu(machinesArray) {
714
715
let html = '';
716
717
+ if (!isSignedIn()) {
718
+ if (!NETDATA.registry.isRegistryEnabled()) {
719
+ html += (
720
+ `<div class="info-item" style="white-space: nowrap">
721
+ <span>Please <a href="#" onclick="signInDidClick(event); return false">sign in to netdata.cloud</a> to view your nodes!</span>
722
+ <div></div>
723
+ </div>
724
+ <hr />`
725
+ );
726
+ }
727
+ }
728
+
729
if (isSignedIn()) {
730
html += (
731
`<div class="filter-control">
@@ -743,16 +744,26 @@ function renderMyNetdataMenu(machinesArray) {
744
);
745
}
746
747
+ // options.hosts = [
748
+ // {
749
+ // hostname: "streamed1",
750
+ // },
751
+ // {
752
+ // hostname: "streamed2",
753
+ // },
754
+ // ]
755
+
756
if (options.hosts.length > 1) {
757
html += `<div id="my-netdata-menu-streamed">${renderStreamedHosts(options)}</div><hr />`;
758
}
759
750
- html += `<div id="my-netdata-menu-machines">${renderMachines(machinesArray)}</div>`;
760
+ if (isSignedIn() || NETDATA.registry.isRegistryEnabled()) {
761
+ html += `<div id="my-netdata-menu-machines">${renderMachines(machinesArray)}</div><hr />`;
762
+ }
763
764
if (!isSignedIn()) {
765
html += (
754
- `<hr />
755
- <div class="agent-item">
766
+ `<div class="agent-item">
767
<i class="fas fa-cog""></i>
768
<a href="#" onclick="switchRegistryModalHandler(); return false;">Switch Identity</a>
769
<div></div>
@@ -765,8 +776,7 @@ function renderMyNetdataMenu(machinesArray) {
776
)
777
} else {
778
html += (
768
- `<hr />
769
- <div class="agent-item">
779
+ `<div class="agent-item">
780
<i class="fas fa-sync"></i>
781
<a href="#" onclick="showSyncModal(); return false">Synchronize with netdata.cloud</a>
782
<div></div>