This is an automated email from the ASF dual-hosted git repository. dsmiley pushed a commit to branch branch_10x in repository https://gitbox.apache.org/repos/asf/solr.git
commit d6f203202972d082905d9d3caccddc0ff83da523 Author: Prithvi S <[email protected]> AuthorDate: Sat Nov 7 03:20:25 2026 +0530 SOLR-12613: node picker for cross-node screens (#5110) (cherry picked from commit 0d40291db05b7c8aa3042b0f5286f7f7d072da72) --- .../unreleased/SOLR-12613-admin-ui-node-picker.yml | 13 ++ .../deployment-guide/pages/cloud-screens.adoc | 8 +- .../deployment-guide/pages/thread-dump.adoc | 2 +- .../getting-started/pages/solr-admin-ui.adoc | 6 +- .../webapp/AdminUiCoreAdminStandaloneTest.java | 3 + .../apache/solr/webapp/AdminUiNodePickerTest.java | 136 +++++++++++++++ .../solr/webapp/AdminUiSecurityAuthTest.java | 5 +- .../org/apache/solr/webapp/AdminUiTestBase.java | 50 +++++- solr/webapp/web/css/angular/cloud.css | 8 + solr/webapp/web/css/angular/common.css | 52 ++++++ solr/webapp/web/css/angular/logging.css | 8 + solr/webapp/web/css/angular/menu.css | 142 +++++++++++++-- solr/webapp/web/index.html | 190 ++++++++++++--------- solr/webapp/web/js/angular/app.js | 177 +++++++++++++++++-- solr/webapp/web/js/angular/controllers/cloud.js | 34 +++- .../js/angular/controllers/collection-overview.js | 6 +- solr/webapp/web/js/angular/controllers/cores.js | 45 ++++- solr/webapp/web/js/angular/controllers/index.js | 15 +- .../web/js/angular/controllers/java-properties.js | 15 +- solr/webapp/web/js/angular/controllers/logging.js | 61 +++---- solr/webapp/web/js/angular/controllers/threads.js | 13 +- solr/webapp/web/js/angular/services.js | 152 +++++++++++++++++ solr/webapp/web/partials/cloud.html | 6 +- solr/webapp/web/partials/cores.html | 16 +- solr/webapp/web/partials/index.html | 5 + solr/webapp/web/partials/logging-levels.html | 7 +- 26 files changed, 991 insertions(+), 184 deletions(-) diff --git a/changelog/unreleased/SOLR-12613-admin-ui-node-picker.yml b/changelog/unreleased/SOLR-12613-admin-ui-node-picker.yml new file mode 100644 index 00000000000..372beac103b --- /dev/null +++ b/changelog/unreleased/SOLR-12613-admin-ui-node-picker.yml @@ -0,0 +1,13 @@ +# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc +title: Admin UI adds a node picker so Thread Dump, Java Properties, Logging, Cores, and Dashboard can target any live SolrCloud node, with the sidebar split into Cluster and Node sections. +type: added +authors: + - name: Prithvi S. + nick: iprithv +links: + - name: PR#5110 + url: https://github.com/apache/solr/pull/5110 + - name: SOLR-12613 + url: https://issues.apache.org/jira/browse/SOLR-12613 + - name: SOLR-18537 + url: https://issues.apache.org/jira/browse/SOLR-18537 diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/cloud-screens.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/cloud-screens.adoc index a17c7ee8b3a..8cd86207889 100644 --- a/solr/solr-ref-guide/modules/deployment-guide/pages/cloud-screens.adoc +++ b/solr/solr-ref-guide/modules/deployment-guide/pages/cloud-screens.adoc @@ -21,12 +21,12 @@ This screen provides status information about each collection & node in your clu .Only Visible When using SolrCloud [NOTE] ==== -The "Cloud" menu option is only available when Solr is running xref:getting-started:cluster-types.adoc#solrcloud-clusters[SolrCloud]. -User-managed clusters or standalone installations will not display this option. +The Cluster section in the left-hand navigation is only available when Solr is running xref:getting-started:cluster-types.adoc#solrcloud-clusters[SolrCloud]. +User-managed clusters or standalone installations will not display this section. ==== -Click on the "Cloud" option in the left-hand navigation, and a small sub-menu appears with options called "Nodes", "Tree", "ZK Status" and "Graph". -The sub-view selected by default is "Nodes". +Click *Cluster* in the left-hand navigation to open *Nodes*, *Tree*, *ZK Status*, and *Graph*. +The view selected by default is *Nodes*. == Nodes View The "Nodes" view shows a list of the hosts and nodes in the cluster along with key information for each: "CPU", "Heap", "Disk usage", "Requests", "Collections" and "Replicas". diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/thread-dump.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/thread-dump.adoc index 78c08dff978..80c5b976932 100644 --- a/solr/solr-ref-guide/modules/deployment-guide/pages/thread-dump.adoc +++ b/solr/solr-ref-guide/modules/deployment-guide/pages/thread-dump.adoc @@ -16,7 +16,7 @@ // specific language governing permissions and limitations // under the License. -The Thread Dump screen lets you inspect the currently active threads on your server. +The Thread Dump screen lets you inspect the currently active threads on the selected Solr node. Each thread is listed and access to the stacktraces is available where applicable. Icons to the left indicate the state of the thread: for example, threads with a green check-mark in a green circle are in a "RUNNABLE" state. diff --git a/solr/solr-ref-guide/modules/getting-started/pages/solr-admin-ui.adoc b/solr/solr-ref-guide/modules/getting-started/pages/solr-admin-ui.adoc index 715047bec86..0ff1885be0e 100644 --- a/solr/solr-ref-guide/modules/getting-started/pages/solr-admin-ui.adoc +++ b/solr/solr-ref-guide/modules/getting-started/pages/solr-admin-ui.adoc @@ -23,14 +23,16 @@ Solr features a Web interface that provides online access to many Solr configura === Dashboard -Accessing the URL `\http://hostname:8983/solr/` will show the main dashboard, which is divided into two parts. +Accessing the URL `\http://hostname:8983/solr/` opens the Cluster Nodes page in SolrCloud, or the Dashboard in standalone. The Dashboard is divided into two parts. .Solr Dashboard image::solr-admin-ui/dashboard.png[image,height=400] The left-side of the screen is a menu under the Solr logo that provides the navigation through the screens of the UI. -The first set of links are for system-level information and configuration and provide access to xref:deployment-guide:configuring-logging.adoc#logging-screen[Logging Screen], xref:deployment-guide:collections-core-admin.adoc[], and xref:deployment-guide:jvm-settings.adoc#java-properties-screen[Java Properties Screen], among other things. +The first set of links is split into Cluster (SolrCloud) and Node sections. +On SolrCloud, the Node Selector starts empty like the Collection Selector; pick a live node to show Dashboard, Logging, Java Properties, Thread Dump, and Cores for that node. +Logging → Level stays cluster-wide. At the end of this information is at least one pulldown listing Solr cores configured for this instance. On xref:cluster-types.adoc#solrcloud-clusters[SolrCloud] nodes, an additional pulldown list shows all collections in this cluster. diff --git a/solr/webapp/src/test/org/apache/solr/webapp/AdminUiCoreAdminStandaloneTest.java b/solr/webapp/src/test/org/apache/solr/webapp/AdminUiCoreAdminStandaloneTest.java index fb5d8f05b66..ac59fea2b16 100644 --- a/solr/webapp/src/test/org/apache/solr/webapp/AdminUiCoreAdminStandaloneTest.java +++ b/solr/webapp/src/test/org/apache/solr/webapp/AdminUiCoreAdminStandaloneTest.java @@ -58,6 +58,9 @@ public class AdminUiCoreAdminStandaloneTest extends AdminUiStandaloneTestBase { // cloud-only menu entries are absent in standalone mode assertTrue(driver.findElements(By.cssSelector("#menu .cloud")).isEmpty()); assertTrue(driver.findElements(By.cssSelector("#menu .collections")).isEmpty()); + assertTrue( + "node picker is SolrCloud-only", + driver.findElements(By.id("node-selector-item")).isEmpty()); // the per-core menu (shown when a core page is open) offers the core-level // screens directly - query and replication are standalone-only entries openPage("swapa/core-overview", By.id("dashboard")); diff --git a/solr/webapp/src/test/org/apache/solr/webapp/AdminUiNodePickerTest.java b/solr/webapp/src/test/org/apache/solr/webapp/AdminUiNodePickerTest.java new file mode 100644 index 00000000000..e2c675435d1 --- /dev/null +++ b/solr/webapp/src/test/org/apache/solr/webapp/AdminUiNodePickerTest.java @@ -0,0 +1,136 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.webapp; + +import org.junit.Before; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; + +/** + * Browser coverage for the Admin UI live-node picker: selecting another node, verifying node-scoped + * screens follow that target, restoring the selection from sessionStorage across reload, and + * confirming the picker stays hidden in standalone mode (covered separately). + */ +public class AdminUiNodePickerTest extends AdminUiTestBase { + + private static final By DASHBOARD_NODE = By.cssSelector("#content #index .node dd"); + + @Before + public void clearPersistedNodeSelection() { + ensureCloudCluster(); + driver.get(baseUrl + "/index.html#/"); + waitFor(By.id("node-selector-item")); + ((JavascriptExecutor) driver) + .executeScript("sessionStorage.removeItem('adminui.selectedNode');"); + } + + private void selectNode(String nodeName) { + chosenSelect("node_selector_select", nodeName); + } + + @Test + public void testCloudLandingShowsNodesAndEmptyNodeSelector() { + driver.get(baseUrl + "/index.html#/"); + waitFor(By.id("node-selector-item")); + ((JavascriptExecutor) driver) + .executeScript("sessionStorage.removeItem('adminui.selectedNode');"); + driver.navigate().refresh(); + waitFor(By.id("nodes-table")); + waitFor(By.id("node-selector-item")); + String pickerText = waitFor(By.id("node_selector_select_chosen")).getText(); + assertTrue( + "empty picker should show Node Selector placeholder, got: " + pickerText, + pickerText.contains("Node Selector")); + assertFalse( + "node prompt stays off the cluster Nodes page", + driver.findElement(By.id("select-node-prompt")).isDisplayed()); + + click(By.cssSelector("#menu #index a")); + waitFor(By.id("select-node-prompt")); + assertTrue(driver.findElement(By.id("select-node-prompt")).isDisplayed()); + + String remoteNode = cluster.getJettySolrRunner(1).getNodeName(); + selectNode(remoteNode); + waitForTextContains(DASHBOARD_NODE, remoteNode); + assertFalse(driver.findElement(By.id("select-node-prompt")).isDisplayed()); + assertNoSevereConsoleErrors(); + } + + @Test + public void testSelectRemoteNodeUpdatesDashboardAndPersistsAcrossReload() throws Exception { + String localNode = cluster.getJettySolrRunner(0).getNodeName(); + String remoteNode = cluster.getJettySolrRunner(1).getNodeName(); + + openPage("", By.id("index")); + waitFor(By.id("node-selector-item")); + waitForTextContains(DASHBOARD_NODE, localNode); + waitFor(By.id("selected-node-badge")); + + selectNode(remoteNode); + + waitForTextContains(DASHBOARD_NODE, remoteNode); + waitForTextContains(By.cssSelector("#selected-node-badge .badge-value"), remoteNode); + assertTrue( + "badge should mark remote targeting", + waitFor(By.id("selected-node-badge")).getAttribute("class").contains("remote")); + + driver.navigate().refresh(); + waitFor(By.cssSelector("#content #index")); + waitForTextContains(DASHBOARD_NODE, remoteNode); + waitForTextContains(By.cssSelector("#selected-node-badge .badge-value"), remoteNode); + assertTrue(waitFor(By.id("selected-node-badge")).getAttribute("class").contains("remote")); + + assertNoSevereConsoleErrors(); + } + + @Test + public void testNodeSelectionSurvivesInAppNavigation() { + String remoteNode = cluster.getJettySolrRunner(1).getNodeName(); + + openPage("", By.id("index")); + waitFor(By.id("node-selector-item")); + selectNode(remoteNode); + waitForTextContains(DASHBOARD_NODE, remoteNode); + + click(By.cssSelector("#menu #java-properties a")); + waitFor(By.id("java-properties")); + waitFor(By.cssSelector("#java-properties li")); + waitForTextContains(By.cssSelector("#selected-node-badge .badge-value"), remoteNode); + assertTrue(waitFor(By.id("selected-node-badge")).getAttribute("class").contains("remote")); + assertNoSevereConsoleErrors(); + } + + @Test + public void testLoggingLevelsHidesNodeBadge() { + String remoteNode = cluster.getJettySolrRunner(1).getNodeName(); + + openPage("", By.id("index")); + waitFor(By.id("node-selector-item")); + selectNode(remoteNode); + + click(By.cssSelector("#menu #logging a")); + waitFor(By.id("logging")); + click(By.cssSelector("#menu #logging .level a")); + waitFor(By.id("loggingtree")); + + assertFalse( + "Node badge should stay hidden on logging levels", + driver.findElement(By.id("selected-node-badge")).isDisplayed()); + assertNoSevereConsoleErrors(); + } +} diff --git a/solr/webapp/src/test/org/apache/solr/webapp/AdminUiSecurityAuthTest.java b/solr/webapp/src/test/org/apache/solr/webapp/AdminUiSecurityAuthTest.java index a3269ccfc3f..66392e8ae69 100644 --- a/solr/webapp/src/test/org/apache/solr/webapp/AdminUiSecurityAuthTest.java +++ b/solr/webapp/src/test/org/apache/solr/webapp/AdminUiSecurityAuthTest.java @@ -63,9 +63,8 @@ public class AdminUiSecurityAuthTest extends AdminUiTestBase { setText(By.id("password"), PASS); click(By.xpath("//div[@id='login']//button[@type='submit']")); - // after login the dashboard loads and shows the authenticated security info - waitFor(By.id("index")); - waitForPageContains("BasicAuthPlugin"); + waitFor(By.id("nodes-table")); + waitFor(By.id("menu-section-cluster")); // the security screen shows the configured plugins and users openPage("~security", By.id("securityPanel")); diff --git a/solr/webapp/src/test/org/apache/solr/webapp/AdminUiTestBase.java b/solr/webapp/src/test/org/apache/solr/webapp/AdminUiTestBase.java index 77674cadc4d..f9e5d542d35 100644 --- a/solr/webapp/src/test/org/apache/solr/webapp/AdminUiTestBase.java +++ b/solr/webapp/src/test/org/apache/solr/webapp/AdminUiTestBase.java @@ -322,12 +322,58 @@ public abstract class AdminUiTestBase extends SolrCloudTestCase { if (samePage) { driver.navigate().refresh(); } - // ng-view (#content) is empty until the app has booted and rendered its first route - waitFor(By.cssSelector("#content > *")); + if (standaloneMode) { + waitFor(By.cssSelector("#content > *")); + } else { + waitUntilDisplayed(By.id("login"), By.id("node-selector-item")); + } + boolean onLogin = isDisplayed(By.id("login")); + if (!standaloneMode && !onLogin) { + selectLocalNodeIfPickerShown(); + } + if (route.isEmpty()) { + if (!standaloneMode && !onLogin) { + click(By.cssSelector("#menu #index a")); + } + return waitFor(anchor); + } driver.get(baseUrl + "/index.html#/" + route); return waitFor(anchor); } + protected static void selectLocalNodeIfPickerShown() { + if (!isDisplayed(By.id("node-selector-item"))) { + return; + } + waitFor(By.id("node_selector_select_chosen")); + String nodeName = cluster.getJettySolrRunner(0).getNodeName(); + chosenSelect("node_selector_select", nodeName); + waitForTextContains(By.id("node_selector_select_chosen"), nodeName); + } + + private static void waitUntilDisplayed(By... locators) { + long deadlineNanos = System.nanoTime() + WAIT_TIMEOUT.toNanos(); + while (System.nanoTime() < deadlineNanos) { + for (By locator : locators) { + if (isDisplayed(locator)) { + return; + } + } + try { + Thread.sleep(200); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + break; + } + } + throw new AssertionError("Timed out waiting for any of " + Arrays.toString(locators)); + } + + private static boolean isDisplayed(By locator) { + List<WebElement> found = driver.findElements(locator); + return !found.isEmpty() && found.get(0).isDisplayed(); + } + /** Waits for the given element to be visible, up to {@link #WAIT_TIMEOUT}. */ protected static WebElement waitFor(By locator) { return poll(locator, el -> el.isDisplayed() ? el : null, "visible element"); diff --git a/solr/webapp/web/css/angular/cloud.css b/solr/webapp/web/css/angular/cloud.css index 16e6db9a3cc..b519508e2b9 100644 --- a/solr/webapp/web/css/angular/cloud.css +++ b/solr/webapp/web/css/angular/cloud.css @@ -506,6 +506,14 @@ limitations under the License. { font-style: italic; } + +#content #cloud #nodes-content .node-spec a.node-admin-link +{ + display: inline-block; + margin-top: 4px; + font-style: normal; + font-weight: bold; +} #content #cloud #nodes-content .node-uptime { font-weight: bolder; diff --git a/solr/webapp/web/css/angular/common.css b/solr/webapp/web/css/angular/common.css index 0d06795694f..a97ccb57267 100644 --- a/solr/webapp/web/css/angular/common.css +++ b/solr/webapp/web/css/angular/common.css @@ -201,6 +201,9 @@ ul padding-bottom: 10px; position: fixed; z-index: 42; + left: 0; + right: 0; + pointer-events: none; } .scroll #header @@ -211,10 +214,14 @@ ul #header #solr { background-image: url( ../../img/solr.svg ); + background-repeat: no-repeat; + background-position: left center; background-size: 128px; display: block; height: 78px; width: 150px; + margin: 0 0 0 30px; + pointer-events: auto; } #header #solr span @@ -222,6 +229,51 @@ ul display: none; } +#header #selected-node-badge +{ + position: absolute; + top: 18px; + right: 24px; + box-sizing: border-box; + width: 280px; + max-width: calc(100vw - 220px); + padding: 8px 14px; + border: 1px solid #c0c0c0; + border-radius: 4px; + background: #f7f7f7; + color: #333; + font-size: 12px; + line-height: 1.3; + text-align: left; + pointer-events: auto; + overflow: hidden; +} + +#header #selected-node-badge.remote +{ + border-color: #e0a800; + background: #fff8e6; +} + +#header #selected-node-badge .badge-label +{ + display: block; + color: #888; + font-size: 10px; + font-weight: bold; + letter-spacing: 0.04em; + text-transform: uppercase; +} + +#header #selected-node-badge .badge-value +{ + display: block; + font-weight: bold; + overflow-x: auto; + overflow-y: hidden; + white-space: nowrap; +} + #main { min-width: 750px; diff --git a/solr/webapp/web/css/angular/logging.css b/solr/webapp/web/css/angular/logging.css index 3ec9e20d805..066ea8256df 100644 --- a/solr/webapp/web/css/angular/logging.css +++ b/solr/webapp/web/css/angular/logging.css @@ -36,6 +36,14 @@ limitations under the License. margin-left: 10px; } +#content #logging .block h2 .cluster-level-note +{ + color: #c47a00; + font-size: 12px; + font-weight: normal; + margin-left: 10px; +} + #content #logging #viewer { position: relative; diff --git a/solr/webapp/web/css/angular/menu.css b/solr/webapp/web/css/angular/menu.css index c97c2ae6e14..0e00222f08f 100644 --- a/solr/webapp/web/css/angular/menu.css +++ b/solr/webapp/web/css/angular/menu.css @@ -21,16 +21,24 @@ limitations under the License. { position: fixed; top: 120px; + bottom: 8px; + left: 30px; width: 150px; + overflow-x: hidden; + overflow-y: auto; + -webkit-overflow-scrolling: touch; } .scroll #menu-wrapper { - position: absolute; - top: 90px; + position: fixed; + top: 120px; + bottom: 8px; + left: 30px; } -.has-environment #menu-wrapper +.has-environment #menu-wrapper, +.has-environment.scroll #menu-wrapper { top: 160px; } @@ -43,16 +51,125 @@ limitations under the License. text-overflow: ellipsis; } +#menu .menu-section +{ + margin-top: 14px; + padding: 8px 4px 4px 8px; + border-bottom: 1px solid #d8d8d8; + color: #888; + font-size: 10px; + font-weight: bold; + letter-spacing: 0.06em; + text-transform: uppercase; +} + +#menu .menu-section:first-of-type, +#menu #login + div > .menu-section:first-child +{ + margin-top: 6px; +} + +#menu .menu-control +{ + border-bottom: 0; + padding-top: 6px; + padding-bottom: 8px; +} + #core-selector,#collection-selector { - margin-top: 20px; + margin-top: 8px; + padding-right: 10px; + box-sizing: border-box; +} + +#node-selector +{ + margin: 0; padding-right: 10px; + box-sizing: border-box; } #core-selector .chosen-container, -#collection-selector .chosen-container +#collection-selector .chosen-container, +#node-selector .chosen-container +{ + width: 100% !important; + max-width: 100%; +} + +/* Keep Chosen drops inside the 150px sidebar (base Chosen uses width:auto). */ +#menu-wrapper .chosen-container-single .chosen-drop { width: 100% !important; + max-width: 100%; + box-sizing: border-box; +} + +#menu-wrapper .chosen-container-single .chosen-single +{ + height: 25px; + line-height: 24px; + padding: 0 0 0 8px; + box-sizing: border-box; +} + +#menu-wrapper .chosen-container-single .chosen-single span +{ + display: block; + margin-right: 26px; + line-height: 24px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +#menu-wrapper #node-selector .chosen-results +{ + display: grid; + grid-template-columns: minmax(100%, max-content); + max-height: 220px; + overflow-x: auto; + overflow-y: auto; + margin: 0; + padding: 0; + scrollbar-width: thin; +} + +#menu-wrapper #node-selector .chosen-results li.active-result +{ + display: block; + white-space: nowrap; + min-width: 100%; + box-sizing: border-box; + word-wrap: normal; +} + +#menu-wrapper #node-selector .chosen-results li.highlighted +{ + background-image: none; + background-color: #3875d7; +} + +#menu-wrapper .chosen-container-single .chosen-single div +{ + height: 100%; +} + +#menu-wrapper .chosen-container-single .chosen-single div b +{ + background: url("../../img/chosen-sprite.png") no-repeat 0 2px; +} + +#menu-wrapper .chosen-container-active.chosen-with-drop .chosen-single div b +{ + background-position: -18px 2px; +} + +#menu-wrapper .chosen-container .chosen-results +{ + max-height: 220px; + overflow-y: auto; } #core-selector a, @@ -63,7 +180,8 @@ limitations under the License. } #core-selector select, -#collection-selector select +#collection-selector select, +#node-selector select { width: 100%; } @@ -267,14 +385,14 @@ limitations under the License. #menu #collections.global p a { background-image: url( ../../img/ico/documents-stack.png ); } #menu #cores.global p a { background-image: url( ../../img/ico/databases.png ); } -#menu #cloud.global p a { background-image: url( ../../img/ico/network-cloud.png ); } -#menu #cloud.global .tree a { background-image: url( ../../img/ico/folder-tree.png ); } -#menu #cloud.global .nodes a { background-image: url( ../../img/solr-ico.png ); } -#menu #cloud.global .zkstatus a { background-image: url( ../../img/ico/node-leader.png ); } -#menu #cloud.global .graph a { background-image: url( ../../img/ico/molecule.png ); } +#menu #cloud-nodes.global p a { background-image: url( ../../img/solr-ico.png ); } +#menu #cloud-tree.global p a { background-image: url( ../../img/ico/folder-tree.png ); } +#menu #cloud-zkstatus.global p a { background-image: url( ../../img/ico/node-leader.png ); } +#menu #cloud-graph.global p a { background-image: url( ../../img/ico/molecule.png ); } #menu #schema-designer.global p a { background-image: url( ../../img/ico/book-open-text.png ); } -#menu #security.global p a { background-image: url( ../../img/ico/users.png ); } +#menu #security.global p a, +#menu #security-standalone.global p a { background-image: url( ../../img/ico/users.png ); } .sub-menu .ping.error a { diff --git a/solr/webapp/web/index.html b/solr/webapp/web/index.html index bfb5c60ddc7..c4bf32a659c 100644 --- a/solr/webapp/web/index.html +++ b/solr/webapp/web/index.html @@ -111,7 +111,15 @@ limitations under the License. <div id="header"> - <a href="#/" id="solr"><span>Apache SOLR</span></a> + <a ng-href="{{ isCloudEnabled ? '#/~cloud?view=nodes' : '#/' }}" id="solr"><span>Apache SOLR</span></a> + + <div id="selected-node-badge" + ng-show="!http401 && isCloudEnabled && liveNodes.length > 1 && selectedNode && isNodeScopedPage" + ng-class="{remote: viewingRemoteNode}" + title="{{ selectedNode }}"> + <span class="badge-label">Node</span> + <span class="badge-value">{{ selectedNode }}</span> + </div> </div> @@ -154,7 +162,12 @@ limitations under the License. </div> <div id="content-wrapper"> - <div ng-view id="content"> + <div id="select-node-prompt" class="header-message" + ng-show="!http401 && needsNodeSelection && isNodeScopedPage" ng-cloak> + <h2>Select a node</h2> + <p>Choose a live node from the Node Selector.</p> + </div> + <div ng-view id="content" ng-hide="needsNodeSelection && isNodeScopedPage"> </div> </div> @@ -167,98 +180,119 @@ limitations under the License. <li id="login" class="global" ng-class="{active:page=='login'}" ng-show="http401 || currentUser"><p><a href="#/login">{{http401 ? "Login" : "Logout " + currentUser}}</a></p></li> - <li id="index" class="global" ng-class="{active:page=='index'}"><p><a href="#/">Dashboard</a></p></li> - <div ng-show="!http401"> - <li id="logging" class="global" ng-class="{active:page=='logging'}"><p><a href="#/~logging">Logging</a></p> - <ul ng-show="showingLogging"> - <li class="level" ng-class="{active:page=='logging-levels'}"><a href="#/~logging/level">Level</a></li> + + <li class="menu-section" id="menu-section-cluster" ng-show="isCloudEnabled">Cluster</li> + + <li ng-show="isCloudEnabled" id="cloud-nodes" class="global" ng-class="{active:page=='cloud-nodes'}"><p><a href="#/~cloud?view=nodes">Nodes</a></p></li> + <li ng-show="isCloudEnabled" id="cloud-tree" class="global" ng-class="{active:page=='cloud-tree'}"><p><a href="#/~cloud?view=tree">Tree</a></p></li> + <li ng-show="isCloudEnabled" id="cloud-zkstatus" class="global" ng-class="{active:page=='cloud-zkstatus'}"><p><a href="#/~cloud?view=zkstatus">ZK Status</a></p></li> + <li ng-show="isCloudEnabled" id="cloud-graph" class="global" ng-class="{active:page=='cloud-graph'}"><p><a href="#/~cloud?view=graph">Graph</a></p></li> + + <li ng-show="isCloudEnabled" id="security" class="global" ng-class="{active:page=='security'}"><p><a href="#/~security">Security</a></p></li> + + <li ng-show="isCloudEnabled && isSchemaDesignerEnabled" id="schema-designer" class="global" ng-class="{active:page=='schema-designer'}"><p><a href="#/~schema-designer">Schema Designer</a></p></li> + + <li ng-show="isCloudEnabled" id="collections" class="global" ng-class="{active:page=='collections'}"><p><a href="#/~collections">Collections</a></p></li> + + <div id="collection-selector" class="menu-control" ng-show="isCloudEnabled"> + <div id="has-collections" ng-show="collections.length!=0"> + <select placeholder-text-single="'Collection Selector'" + ng-model="currentCollection" + chosen + search-contains="true" + ng-change="showCollection(currentCollection)" + ng-options="collection.name for collection in aliases_and_collections"></select> + </div> + <p id="has-no-collections" ng-show="collections.length==0"><a href="#/~collections"> + No collections available + <span>Go and create one</span> + </a></p> + </div> + <div id="collection-menu" class="sub-menu" ng-show="currentCollection"> + <ul> + <li class="overview" ng-show="currentCollection.type === 'collection'" ng-class="{active:page=='collection-overview'}"><a href="#/{{currentCollection.name}}/collection-overview"><span>Overview</span></a></li> + <li class="overview" ng-show="currentCollection.type === 'alias'" ng-class="{active:page=='alias-overview'}"><a href="#/{{currentCollection.name}}/alias-overview"><span>Overview</span></a></li> + <li class="analysis" ng-show="!isMultiDestAlias(currentCollection)" ng-class="{active:page=='analysis'}"><a href="#/{{currentCollection.name}}/analysis"><span>Analysis</span></a></li> + <li class="documents" ng-show="!isMultiDestAlias(currentCollection)" ng-class="{active:page=='documents'}"><a href="#/{{currentCollection.name}}/documents"><span>Documents</span></a></li> + <li class="paramsets" ng-show="!isMultiDestAlias(currentCollection)" ng-class="{active:page=='paramsets'}"><a href="#/{{currentCollection.name}}/paramsets"><span>Paramsets</span></a></li> + <li class="files" ng-show="!isMultiDestAlias(currentCollection)" ng-class="{active:page=='files'}"><a href="#/{{currentCollection.name}}/files"><span>Files</span></a></li> + <li class="query" ng-class="{active:page=='query'}"><a href="#/{{currentCollection.name}}/query"><span>Query</span></a></li> + <li class="stream" ng-class="{active:page=='stream'}"><a href="#/{{currentCollection.name}}/stream"><span>Stream</span></a></li> + <li class="sqlquery" ng-class="{active:page=='sqlquery'}"><a href="#/{{currentCollection.name}}/sqlquery"><span>SQL</span></a></li> + <li class="schema" ng-show="!isMultiDestAlias(currentCollection)" ng-class="{active:page=='schema'}"><a href="#/{{currentCollection.name}}/schema"><span>Schema</span></a></li> </ul> + </div> + + <li class="menu-section" id="menu-section-node">Node</li> + + <li id="node-selector-item" class="menu-control" ng-if="isCloudEnabled && liveNodes.length > 1"> + <div id="node-selector"> + <div id="has-nodes"> + <select id="node_selector_select" + aria-label="Node" + placeholder-text-single="'Node Selector'" + ng-model="$parent.selectedNode" + chosen + search-contains="true" + ng-change="onSelectedNodeChange()" + ng-options="node for node in liveNodes"> + <option value=""></option> + </select> + </div> + </div> </li> - <li id="security" class="global" ng-class="{active:page=='security'}"><p><a href="#/~security">Security</a></p></li> + <li id="index" class="global" ng-class="{active:page=='index'}"><p><a href="#/">Dashboard</a></p></li> - <li id="cloud" class="global optional" ng-show="isCloudEnabled" ng-class="{active:showingCloud}"><p><a href="#/~cloud">Cloud</a></p> - <ul ng-show="showingCloud"> - <li class="nodes" ng-class="{active:page=='cloud-nodes'}"><a href="#/~cloud?view=nodes">Nodes</a></li> - <li class="tree" ng-class="{active:page=='cloud-tree'}"><a href="#/~cloud?view=tree">Tree</a></li> - <li class="zkstatus" ng-class="{active:page=='cloud-zkstatus'}"><a href="#/~cloud?view=zkstatus">ZK Status</a></li> - <li class="graph" ng-class="{active:page=='cloud-graph'}"><a href="#/~cloud?view=graph">Graph</a></li> + <li id="logging" class="global" ng-class="{active:page=='logging'}"><p><a href="#/~logging">Logging</a></p> + <ul ng-show="showingLogging"> + <li class="level" ng-class="{active:page=='logging-levels'}"><a href="#/~logging/level">Level</a></li> </ul> </li> - <li ng-show="isCloudEnabled && isSchemaDesignerEnabled" id="schema-designer" class="global" ng-class="{active:page=='schema-designer'}"><p><a href="#/~schema-designer">Schema Designer</a></p></li> + <li id="java-properties" class="global" ng-class="{active:page=='java-props'}"><p><a href="#/~java-properties">Java Properties</a></p></li> - <li ng-show="isCloudEnabled" id="collections" class="global" ng-class="{active:page=='collections'}"><p><a href="#/~collections">Collections</a></p></li> - <li ng-hide="isCloudEnabled" id="cores" class="global" ng-class="{active:page=='cores'}"><p><a href="#/~cores">Core Admin</a></p></li> + <li id="threads" class="global" ng-class="{active:page=='threads'}"><p><a href="#/~threads">Thread Dump</a></p></li> - <li id="java-properties" class="global" ng-class="{active:page=='java-props'}"><p><a href="#/~java-properties">Java Properties</a></li> + <li ng-hide="isCloudEnabled" id="cores" class="global" ng-class="{active:page=='cores'}"><p><a href="#/~cores">Core Admin</a></p></li> - <li id="threads" class="global" ng-class="{active:page=='threads'}"><p><a href="#/~threads">Thread Dump</a></p></li> + <li ng-hide="isCloudEnabled" id="security-standalone" class="global" ng-class="{active:page=='security'}"><p><a href="#/~security">Security</a></p></li> + + <div id="core-selector" class="menu-control"> + <div id="has-cores" ng-show="cores.length!=0"> + <select placeholder-text-single="'Core Selector'" + ng-model="currentCore" + chosen + search-contains="true" + ng-change="showCore(currentCore)" + ng-options="core.name for core in cores"></select> + </div> + <p id="has-no-cores" ng-show="cores.length==0"><a href="#/~cores"> + No cores available + <span>Go and create one</span> + </a></p> + </div> + <div id="core-menu" class="sub-menu" ng-show="currentCore && !viewingRemoteNode"> + <ul> + <li class="overview" ng-class="{active:page=='overview'}"><a href="#/{{currentCore.name}}/core-overview"><span>Overview</span></a></li> + <li ng-hide="isCloudEnabled" class="analysis" ng-class="{active:page=='analysis'}"><a href="#/{{currentCore.name}}/analysis"><span>Analysis</span></a></li> + <li ng-hide="isCloudEnabled" class="documents" ng-class="{active:page=='documents'}"><a href="#/{{currentCore.name}}/documents"><span>Documents</span></a></li> + <li ng-hide="isCloudEnabled" class="paramsets" ng-class="{active:page=='paramsets'}"><a href="#/{{currentCore.name}}/paramsets"><span>Paramsets</span></a></li> + <li ng-hide="isCloudEnabled" class="files" ng-class="{active:page=='files'}"><a href="#/{{currentCore.name}}/files"><span>Files</span></a></li> + <li class="ping" ng-class="{active:page=='ping'}"><a ng-click="ping()"><span>Ping</span><small class="qtime" ng-show="showPing"> (<span>{{pingMS}}ms</span>)</small></a></li> + <li class="plugins" ng-class="{active:page=='plugins'}"><a href="#/{{currentCore.name}}/plugins"><span>Plugins / Stats</span></a></li> + <li ng-hide="isCloudEnabled" class="query" ng-class="{active:page=='query'}"><a href="#/{{currentCore.name}}/query"><span>Query</span></a></li> + <li ng-hide="isCloudEnabled" class="replication" ng-class="{active:page=='replication'}"><a href="#/{{currentCore.name}}/replication"><span>Replication</span></a></li> + <li ng-hide="isCloudEnabled" class="schema" ng-class="{active:page=='schema'}"><a href="#/{{currentCore.name}}/schema"><span>Schema</span></a></li> + <li class="segments" ng-class="{active:page=='segments'}"><a href="#/{{currentCore.name}}/segments"><span>Segments info</span></a></li> + </ul> + </div> <li id="new-ui" class="global"><p><a href="/solr/ui">Open New UI</a></p></li> </div> </ul> - <div ng-show="!http401"> - <div id="collection-selector" ng-show="isCloudEnabled"> - <div id="has-collections" ng-show="collections.length!=0"> - <select placeholder-text-single="'Collection Selector'" - ng-model="currentCollection" - chosen - search-contains="true" - ng-change="showCollection(currentCollection)" - ng-options="collection.name for collection in aliases_and_collections"></select> - </div> - <p id="has-no-collections" ng-show="collections.length==0"><a href="#/~collections"> - No collections available - <span>Go and create one</span> - </a></p> - </div> - <div id="collection-menu" class="sub-menu" ng-show="currentCollection"> - <ul> - <li class="overview" ng-show="currentCollection.type === 'collection'" ng-class="{active:page=='collection-overview'}"><a href="#/{{currentCollection.name}}/collection-overview"><span>Overview</span></a></li> - <li class="overview" ng-show="currentCollection.type === 'alias'" ng-class="{active:page=='alias-overview'}"><a href="#/{{currentCollection.name}}/alias-overview"><span>Overview</span></a></li> - <li class="analysis" ng-show="!isMultiDestAlias(currentCollection)" ng-class="{active:page=='analysis'}"><a href="#/{{currentCollection.name}}/analysis"><span>Analysis</span></a></li> - <li class="documents" ng-show="!isMultiDestAlias(currentCollection)" ng-class="{active:page=='documents'}"><a href="#/{{currentCollection.name}}/documents"><span>Documents</span></a></li> - <li class="paramsets" ng-show="!isMultiDestAlias(currentCollection)" ng-class="{active:page=='paramsets'}"><a href="#/{{currentCollection.name}}/paramsets"><span>Paramsets</span></a></li> - <li class="files" ng-show="!isMultiDestAlias(currentCollection)" ng-class="{active:page=='files'}"><a href="#/{{currentCollection.name}}/files"><span>Files</span></a></li> - <li class="query" ng-class="{active:page=='query'}"><a href="#/{{currentCollection.name}}/query"><span>Query</span></a></li> - <li class="stream" ng-class="{active:page=='stream'}"><a href="#/{{currentCollection.name}}/stream"><span>Stream</span></a></li> - <li class="sqlquery" ng-class="{active:page=='sqlquery'}"><a href="#/{{currentCollection.name}}/sqlquery"><span>SQL</span></a></li> - <li class="schema" ng-show="!isMultiDestAlias(currentCollection)" ng-class="{active:page=='schema'}"><a href="#/{{currentCollection.name}}/schema"><span>Schema</span></a></li> - </ul> - </div> - <div id="core-selector"> - <div id="has-cores" ng-show="cores.length!=0"> - <select placeholder-text-single="'Core Selector'" - ng-model="currentCore" - chosen - search-contains="true" - ng-change="showCore(currentCore)" - ng-options="core.name for core in cores"></select> - </div> - <p id="has-no-cores" ng-show="cores.length==0"><a href="#/~cores"> - No cores available - <span>Go and create one</span> - </a></p> - </div> - <div id="core-menu" class="sub-menu" ng-show="currentCore"> - <ul> - <li class="overview" ng-class="{active:page=='overview'}"><a href="#/{{currentCore.name}}/core-overview"><span>Overview</span></a></li> - <li ng-hide="isCloudEnabled" class="analysis" ng-class="{active:page=='analysis'}"><a href="#/{{currentCore.name}}/analysis"><span>Analysis</span></a></li> - <li ng-hide="isCloudEnabled" class="documents" ng-class="{active:page=='documents'}"><a href="#/{{currentCore.name}}/documents"><span>Documents</span></a></li> - <li ng-hide="isCloudEnabled" class="paramsets" ng-class="{active:page=='paramsets'}"><a href="#/{{currentCore.name}}/paramsets"><span>Paramsets</span></a></li> - <li ng-hide="isCloudEnabled" class="files" ng-class="{active:page=='files'}"><a href="#/{{currentCore.name}}/files"><span>Files</span></a></li> - <li class="ping" ng-class="{active:page=='ping'}"><a ng-click="ping()"><span>Ping</span><small class="qtime" ng-show="showPing"> (<span>{{pingMS}}ms</span>)</small></a></li> - <li class="plugins" ng-class="{active:page=='plugins'}"><a href="#/{{currentCore.name}}/plugins"><span>Plugins / Stats</span></a></li> - <li ng-hide="isCloudEnabled" class="query" ng-class="{active:page=='query'}"><a href="#/{{currentCore.name}}/query"><span>Query</span></a></li> - <li ng-hide="isCloudEnabled" class="replication" ng-class="{active:page=='replication'}"><a href="#/{{currentCore.name}}/replication"><span>Replication</span></a></li> - <li ng-hide="isCloudEnabled" class="schema" ng-class="{active:page=='schema'}"><a href="#/{{currentCore.name}}/schema"><span>Schema</span></a></li> - <li class="segments" ng-class="{active:page=='segments'}"><a href="#/{{currentCore.name}}/segments"><span>Segments info</span></a></li> - </ul> - </div> - </div> </div> </div> diff --git a/solr/webapp/web/js/angular/app.js b/solr/webapp/web/js/angular/app.js index 20bd0078fc7..aabe50a0c8e 100644 --- a/solr/webapp/web/js/angular/app.js +++ b/solr/webapp/web/js/angular/app.js @@ -513,9 +513,10 @@ solrAdminApp.config([ }; }); -solrAdminApp.controller('MainController', function($scope, $route, $rootScope, $location, $timeout, CoresV2, CollectionsV2, AliasesV2, SystemV2, Ping, Constants, SchemaDesigner, ApiErrorHandler) { +solrAdminApp.controller('MainController', function($scope, $route, $rootScope, $location, $timeout, CoresV2, CollectionsV2, AliasesV2, SystemV2, ClusterV2, Ping, Constants, SchemaDesigner, ApiErrorHandler, NodeTarget) { $rootScope.exceptions={}; + var cloudLandingDone = false; $rootScope.toggleException = function() { $scope.showException=!$scope.showException; @@ -525,6 +526,7 @@ solrAdminApp.controller('MainController', function($scope, $route, $rootScope, $ $scope.cores = []; $scope.collections = []; $scope.aliases = []; + $scope.liveNodes = []; } $scope.permissions = permissions; @@ -532,42 +534,77 @@ solrAdminApp.controller('MainController', function($scope, $route, $rootScope, $ return hasAllRequiredPermissions(permissions, $scope.usersPermissions); } - $scope.refresh(); - $scope.resetMenu = function(page, pageType) { - CoresV2.getAllCoreStatus({indexInfo: false}, function(error, data, response) { + var loadCoresForSelectedNode = function(pageType) { + if (NodeTarget.needsSelection()) { + $scope.cores = []; + delete $scope.currentCore; + $scope.viewingRemoteNode = false; + return; + } + CoresV2.getAllCoreStatus(NodeTarget.withNodes({indexInfo: false}), function(error, data, response) { $timeout(function() { if (error) { ApiErrorHandler.handle(response); return; } + var payload = NodeTarget.unwrap(data, response) || {}; + var status = payload.status || {}; + var initFailures = payload.initFailures || {}; $scope.cores = []; var currentCoreName = $route.current.params.core; delete $scope.currentCore; - for (var key in data.status) { - var core = data.status[key]; + for (var key in status) { + var core = status[key]; if (core.name.startsWith("._designer_")) { continue; } $scope.cores.push(core); - if ((!$scope.isSolrCloud || pageType == Constants.IS_CORE_PAGE) && core.name == currentCoreName) { + if ((!$scope.isCloudEnabled || pageType == Constants.IS_CORE_PAGE) && core.name == currentCoreName) { $scope.currentCore = core; } } - $scope.showInitFailures = Object.keys(data.initFailures).length>0; - $scope.initFailures = data.initFailures; + $scope.showInitFailures = Object.keys(initFailures).length>0; + $scope.initFailures = initFailures; + $scope.viewingRemoteNode = NodeTarget.isRemote(); }); }); + }; + + $scope.refresh(); + $scope.resetMenu = function(page, pageType) { + // Standalone never hits listClusterNodes; fetch cores here (also before mode is known). + if (!$scope.isCloudEnabled) { + loadCoresForSelectedNode(pageType); + } SystemV2.getNodeSystemInfo({}, function(error, data, response) { $timeout(function() { if (error) { ApiErrorHandler.handle(response); - // The mode could not be determined. Treat the node as standalone so that - // pages waiting for isCloudEnabled to settle (e.g. the logging page) fall - // back to local-only behavior instead of waiting forever. + // Settle mode so pages waiting on isCloudEnabled do not hang. $scope.isCloudEnabled = false; + NodeTarget.clear(); return; } - $scope.isCloudEnabled = data.mode.match( /solrcloud/i ); + $scope.isCloudEnabled = !!(data.mode && data.mode.match(/solrcloud/i)); + if ($scope.isCloudEnabled) { + if (!cloudLandingDone && $location.path() === '/' && !NodeTarget.state.selectedNode) { + cloudLandingDone = true; + $location.url('/~cloud?view=nodes'); + } else { + cloudLandingDone = true; + } + } $scope.usersPermissions = data.security.permissions; $scope.isSecurityEnabled = data.security.authenticationPlugin != null; + if (!$scope.isCloudEnabled) { + NodeTarget.clear(); + $scope.liveNodes = []; + $scope.selectedNode = null; + $scope.viewingRemoteNode = false; + $scope.needsNodeSelection = false; + } else if (data.node) { + NodeTarget.setLocalNode(data.node); + $scope.localNode = data.node; + $scope.selectedNode = NodeTarget.state.selectedNode; + } $scope.isSchemaDesignerEnabled = $scope.isPermitted([ permissions.CONFIG_EDIT_PERM, @@ -579,6 +616,25 @@ solrAdminApp.controller('MainController', function($scope, $route, $rootScope, $ var currentCollectionName = $route.current.params.core; delete $scope.currentCollection; if ($scope.isCloudEnabled) { + ClusterV2.listClusterNodes(function(error, nodesData, response) { + $timeout(function() { + if (error) { + ApiErrorHandler.handle(response); + NodeTarget.setLiveNodes([]); + } else { + NodeTarget.setLiveNodes(nodesData.nodes || []); + } + $scope.liveNodes = NodeTarget.state.liveNodes; + $scope.selectedNode = NodeTarget.state.selectedNode; + $scope.viewingRemoteNode = NodeTarget.isRemote(); + $scope.needsNodeSelection = NodeTarget.needsSelection(); + if (pageType === Constants.IS_CORE_PAGE && NodeTarget.isRemote()) { + $location.url('/'); + return; + } + loadCoresForSelectedNode(pageType); + }); + }); CollectionsV2.listCollections({}, function (error, cdata, response) { $timeout(function() { if (error) { ApiErrorHandler.handle(response); return; } @@ -638,10 +694,97 @@ solrAdminApp.controller('MainController', function($scope, $route, $rootScope, $ $scope.showingLogging = page.lastIndexOf("logging", 0) === 0; $scope.showingCloud = page.lastIndexOf("cloud", 0) === 0; $scope.page = page; + $scope.pageType = pageType; + // logging-levels is cluster-wide (nodes=all), so omit it from the Node badge pages. + $scope.isNodeScopedPage = + (pageType === Constants.IS_CORE_PAGE && !NodeTarget.isRemote()) || + /^(index|logging|java-props|threads|cores)$/.test(page); $scope.currentUser = sessionStorage.getItem("auth.username"); $scope.http401 = sessionStorage.getItem("http401"); }; + // Keep long node names scrollable in the open Chosen list; #menu-wrapper steals wheel otherwise. + var stretchNodeResultRows = function(ul) { + if (!ul) { + return; + } + var lis = ul.querySelectorAll('li.active-result'); + var max = ul.clientWidth; + var i; + for (i = 0; i < lis.length; i++) { + lis[i].style.minWidth = ''; + if (lis[i].scrollWidth > max) { + max = lis[i].scrollWidth; + } + } + for (i = 0; i < lis.length; i++) { + lis[i].style.minWidth = max + 'px'; + } + if (ul.scrollWidth > max) { + max = ul.scrollWidth; + for (i = 0; i < lis.length; i++) { + lis[i].style.minWidth = max + 'px'; + } + } + }; + var bindNodeResultsWheel = function(el) { + if (!el || el.getAttribute('data-node-wheel') === '1') { + return; + } + el.setAttribute('data-node-wheel', '1'); + el.addEventListener('wheel', function(e) { + var canX = el.scrollWidth > el.clientWidth; + var canY = el.scrollHeight > el.clientHeight; + var absX = Math.abs(e.deltaX); + var absY = Math.abs(e.deltaY); + if (canX && (e.shiftKey || absX > absY || !canY)) { + el.scrollLeft += (e.shiftKey && !e.deltaX) ? e.deltaY : (e.deltaX || e.deltaY); + e.preventDefault(); + e.stopPropagation(); + } else if (canY) { + e.stopPropagation(); + } + }, {passive: false}); + }; + var syncNodeSelectorTitle = function() { + var chosen = document.querySelector('#node_selector_select_chosen > a.chosen-single'); + if (chosen) { + chosen.title = $scope.selectedNode || ''; + } + }; + $scope.$watch('selectedNode', function() { + $timeout(syncNodeSelectorTitle); + }); + $scope.$watchCollection('liveNodes', function() { + $timeout(syncNodeSelectorTitle); + }); + angular.element(document).on('chosen:showing_dropdown', '#node_selector_select', function() { + $timeout(function() { + var results = document.querySelector('#node_selector_select_chosen .chosen-results'); + stretchNodeResultRows(results); + bindNodeResultsWheel(results); + }); + }); + $scope.$on('$destroy', function() { + angular.element(document).off('chosen:showing_dropdown', '#node_selector_select'); + }); + + $scope.onSelectedNodeChange = function() { + if (!$scope.selectedNode) { + return; + } + if (!NodeTarget.selectNode($scope.selectedNode)) { + return; + } + $scope.viewingRemoteNode = NodeTarget.isRemote(); + $scope.needsNodeSelection = NodeTarget.needsSelection(); + if ($scope.isNodeScopedPage && !($scope.pageType === Constants.IS_CORE_PAGE && NodeTarget.isRemote())) { + $route.reload(); + return; + } + $location.url('/'); + }; + $scope.showHideMenu = function() { $scope.http401 = sessionStorage.getItem("http401"); }; @@ -663,12 +806,18 @@ solrAdminApp.controller('MainController', function($scope, $route, $rootScope, $ } $scope.showCore = function(core) { - if (core) { + if (core && !NodeTarget.isRemote()) { $location.url("/" + core.name + "/core-overview"); } } $scope.showCollection = function(collection) { + if (!collection || !collection.type) { + return; + } + if ($route.current && $route.current.params && $route.current.params.core === collection.name) { + return; + } if (collection.type === 'collection') { $location.url("/" + collection.name + "/collection-overview") } else if (collection.type === 'alias') { diff --git a/solr/webapp/web/js/angular/controllers/cloud.js b/solr/webapp/web/js/angular/controllers/cloud.js index 87ae9eecf31..3c5a70f3267 100644 --- a/solr/webapp/web/js/angular/controllers/cloud.js +++ b/solr/webapp/web/js/angular/controllers/cloud.js @@ -16,7 +16,7 @@ */ solrAdminApp.controller('CloudController', - function($scope, $location, $timeout, $q, Zookeeper, ZookeeperReadV2, Constants, ClusterV2, CollectionsV2, SystemV2, Metrics, MetricsExtractor, ZookeeperStatus, ApiErrorHandler) { + function($scope, $location, $timeout, $q, Zookeeper, ZookeeperReadV2, Constants, ClusterV2, CollectionsV2, SystemV2, Metrics, MetricsExtractor, ZookeeperStatus, ApiErrorHandler, NodeTarget) { $scope.showDebug = false; @@ -37,7 +37,7 @@ solrAdminApp.controller('CloudController', graphSubController($scope, $timeout, Zookeeper, ClusterV2, ApiErrorHandler); } else if (view === "nodes") { $scope.resetMenu("cloud-nodes", Constants.IS_ROOT_PAGE); - nodesSubController($scope, $timeout, ClusterV2, CollectionsV2, SystemV2, Metrics, MetricsExtractor, ApiErrorHandler); + nodesSubController($scope, $location, $timeout, ClusterV2, CollectionsV2, SystemV2, Metrics, MetricsExtractor, ApiErrorHandler, NodeTarget); } else if (view === "zkstatus") { $scope.resetMenu("cloud-zkstatus", Constants.IS_ROOT_PAGE); zkStatusSubController($scope, ZookeeperStatus, false); @@ -79,6 +79,14 @@ function ensureNodeInHosts(node_name, hosts) { ensureInList(node_name, hostNodes); } +function nodeNameToAdminUrl(nodeName) { + var match = /^(.*):(\d+)_(.+)$/.exec(nodeName); + if (!match) { + return null; + } + return window.location.protocol + '//' + match[1] + ':' + match[2] + '/' + match[3]; +} + // from http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/ function bytesToSize(bytes) { var sizes = ['b', 'Kb', 'Mb', 'Gb', 'Tb']; @@ -107,7 +115,7 @@ function isNumeric(n) { return !isNaN(parseFloat(n)) && isFinite(n); } -var nodesSubController = function($scope, $timeout, ClusterV2, CollectionsV2, SystemV2, Metrics, MetricsExtractor, ApiErrorHandler) { +var nodesSubController = function($scope, $location, $timeout, ClusterV2, CollectionsV2, SystemV2, Metrics, MetricsExtractor, ApiErrorHandler, NodeTarget) { $scope.pageSize = 10; $scope.showNodes = true; $scope.showTree = false; @@ -119,6 +127,23 @@ var nodesSubController = function($scope, $timeout, ClusterV2, CollectionsV2, Sy $scope.to = $scope.pageSize - 1; $scope.filterType = "node"; // Pre-initialize dropdown + $scope.openNodeDashboard = function(nodeName) { + if (!nodeName) { + return; + } + NodeTarget.selectNode(nodeName); + var parent = $scope.$parent; + while (parent) { + if (angular.isDefined(parent.liveNodes)) { + parent.selectedNode = nodeName; + parent.viewingRemoteNode = NodeTarget.isRemote(); + break; + } + parent = parent.$parent; + } + $location.url('/'); + }; + $scope.toggleAllDetails = function() { $scope.showAllDetails = !$scope.showAllDetails; for (var node in $scope.nodes) { @@ -231,6 +256,9 @@ var nodesSubController = function($scope, $timeout, ClusterV2, CollectionsV2, Sy nodes[node] = {}; nodes[node]['host'] = hostName; } + if (!nodes[node]['base_url']) { + nodes[node]['base_url'] = nodeNameToAdminUrl(node); + } ensureNodeInHosts(node, hosts); } diff --git a/solr/webapp/web/js/angular/controllers/collection-overview.js b/solr/webapp/web/js/angular/controllers/collection-overview.js index 9292da4f7c6..569c7375cd6 100644 --- a/solr/webapp/web/js/angular/controllers/collection-overview.js +++ b/solr/webapp/web/js/angular/controllers/collection-overview.js @@ -23,7 +23,11 @@ function($scope, $routeParams, $timeout, CollectionsV2, Constants, ApiErrorHandl CollectionsV2.listCollections({detailed: true, collection: $routeParams.core}, function(error, data, response) { $timeout(function() { if (error) { ApiErrorHandler.handle(response); return; } - $scope.selectedCollection = data.collectionsDetail[$routeParams.core]; + var collection = data.collectionsDetail && data.collectionsDetail[$routeParams.core]; + if (!collection) { + return; + } + $scope.selectedCollection = collection; $scope.selectedCollection.name = $routeParams.core; $scope.rootUrl = Constants.ROOT_URL; }); diff --git a/solr/webapp/web/js/angular/controllers/cores.js b/solr/webapp/web/js/angular/controllers/cores.js index c6c6b311488..5a13e9ba244 100644 --- a/solr/webapp/web/js/angular/controllers/cores.js +++ b/solr/webapp/web/js/angular/controllers/cores.js @@ -16,19 +16,25 @@ */ solrAdminApp.controller('CoreAdminController', - function($scope, $routeParams, $location, $timeout, $route, CoresV2, Update, Constants, ApiErrorHandler){ + function($scope, $routeParams, $location, $timeout, $route, CoresV2, Update, Constants, ApiErrorHandler, NodeTarget){ $scope.resetMenu("cores", Constants.IS_ROOT_PAGE); $scope.selectedCore = $routeParams.corename; // use 'corename' not 'core' to distinguish from /solr/:core/ $scope.refresh = function() { - CoresV2.getAllCoreStatus({}, function(error, data, response) { + if (NodeTarget.needsSelection()) { + return; + } + CoresV2.getAllCoreStatus(NodeTarget.withNodes({}), function(error, data, response) { $timeout(function() { if (error) { ApiErrorHandler.handle(response); return; } + var payload = NodeTarget.unwrap(data, response) || {}; var coreCount = 0; - var cores = data.status; + var cores = payload.status || {}; for (var _obj in cores) coreCount++; $scope.hasCores = coreCount >0; if (!$scope.selectedCore && coreCount==0) { - $scope.showAddCore(); + if (!NodeTarget.isRemote()) { + $scope.showAddCore(); + } return; } else if (!$scope.selectedCore) { var firstCore; @@ -52,6 +58,9 @@ solrAdminApp.controller('CoreAdminController', }); }; $scope.showAddCore = function() { + if (NodeTarget.isRemote()) { + return; + } $scope.hideAll(); $scope.showAdd = true; $scope.newCore = { @@ -66,6 +75,10 @@ solrAdminApp.controller('CoreAdminController', }; $scope.addCore = function() { + if (NodeTarget.isRemote()) { + $scope.addMessage = "Core mutations run on this node only. Select the local node first."; + return; + } if (!$scope.newCore.name) { $scope.addMessage = "Please provide a core name"; } else if (false) { //@todo detect whether core exists @@ -78,7 +91,7 @@ solrAdminApp.controller('CoreAdminController', schema: $scope.newCore.schema, dataDir: $scope.newCore.dataDir }; - if ($scope.isCloud) { + if ($scope.isCloudEnabled) { createCoreParams.collection = $scope.newCore.collection; createCoreParams.shard = $scope.newCore.shard; } @@ -102,6 +115,9 @@ solrAdminApp.controller('CoreAdminController', }; $scope.unloadCore = function() { + if (NodeTarget.isRemote()) { + return; + } var answer = confirm( 'Do you really want to unload Core "' + $scope.selectedCore + '"?' ); if( !answer ) return; CoresV2.unloadCore($scope.selectedCore, {}, function(error, data, response) { @@ -113,11 +129,18 @@ solrAdminApp.controller('CoreAdminController', }; $scope.showRenameCore = function() { + if (NodeTarget.isRemote()) { + return; + } $scope.hideAll(); $scope.showRename = true; }; $scope.renameCore = function() { + if (NodeTarget.isRemote()) { + $scope.renameMessage = "Core mutations run on this node only. Select the local node first."; + return; + } if (!$scope.other) { $scope.renameMessage = "Please provide a new name for the " + $scope.selectedCore + " core"; } else if ($scope.other == $scope.selectedCore) { @@ -144,11 +167,18 @@ solrAdminApp.controller('CoreAdminController', }; $scope.showSwapCores = function() { + if (NodeTarget.isRemote()) { + return; + } $scope.hideAll(); $scope.showSwap = true; }; $scope.swapCores = function() { + if (NodeTarget.isRemote()) { + $scope.swapMessage = "Core mutations run on this node only. Select the local node first."; + return; + } if (!$scope.swapOther) { $scope.swapMessage = "Please select a core to swap with"; } else if ($scope.swapOther == $scope.selectedCore) { @@ -175,6 +205,9 @@ solrAdminApp.controller('CoreAdminController', } $scope.reloadCore = function() { + if (NodeTarget.isRemote()) { + return; + } if ($scope.initFailures[$scope.selectedCore]) { delete $scope.initFailures[$scope.selectedCore]; $scope.showInitFailures = Object.keys($scope.initFailures).length>0; @@ -205,6 +238,6 @@ solrAdminApp.controller('CoreAdminController', $scope.showSwap = false; }; - $scope.refresh(); + NodeTarget.whenReady($scope.refresh, $scope); } ); diff --git a/solr/webapp/web/js/angular/controllers/index.js b/solr/webapp/web/js/angular/controllers/index.js index 553724f1f4a..c0decb69b6c 100644 --- a/solr/webapp/web/js/angular/controllers/index.js +++ b/solr/webapp/web/js/angular/controllers/index.js @@ -15,17 +15,24 @@ See the License for the specific language governing permissions and limitations under the License. */ -solrAdminApp.controller('IndexController', function($scope, $timeout, SystemV2, Constants, ApiErrorHandler) { +solrAdminApp.controller('IndexController', function($scope, $timeout, SystemV2, Constants, ApiErrorHandler, NodeTarget) { $scope.resetMenu("index", Constants.IS_ROOT_PAGE); $scope.reload = function() { - SystemV2.getNodeSystemInfo({}, function(error, data, response) { + if (NodeTarget.needsSelection()) { + return; + } + SystemV2.getNodeSystemInfo(NodeTarget.withNodes({}), function(error, data, response) { $timeout(function() { if (error) { ApiErrorHandler.handle(response); return; } + data = NodeTarget.unwrap(data, response); + if (!data || !data.jvm || !data.system) { + return; + } $scope.system = data; const releaseDate = parse_release_date($scope.system.lucene['solr-impl-version']) $scope.releaseDaysOld = (new Date() - releaseDate)/1000/60/60/24; - if (data.security.authenticationPlugin) { + if (data.security && data.security.authenticationPlugin) { $scope.isSecurityEnabled = true } @@ -136,7 +143,7 @@ solrAdminApp.controller('IndexController', function($scope, $timeout, SystemV2, $scope.commandLineArgs = $scope.commandLineArgsUnsorted; } } -$scope.reload(); + NodeTarget.whenReady($scope.reload, $scope); }); var parse_memory_value = function( value ) { diff --git a/solr/webapp/web/js/angular/controllers/java-properties.js b/solr/webapp/web/js/angular/controllers/java-properties.js index 92c04b13f56..52307826afc 100644 --- a/solr/webapp/web/js/angular/controllers/java-properties.js +++ b/solr/webapp/web/js/angular/controllers/java-properties.js @@ -16,14 +16,23 @@ */ solrAdminApp.controller('JavaPropertiesController', - function($scope, $timeout, NodeV2, Constants, ApiErrorHandler){ + function($scope, $timeout, NodeV2, Constants, ApiErrorHandler, NodeTarget){ $scope.resetMenu("java-props", Constants.IS_ROOT_PAGE); $scope.refresh = function() { + if (NodeTarget.needsSelection()) { + return; + } + NodeTarget.withNodes(); NodeV2.getNodeProperties(function(error, data, response) { $timeout(function() { if (error) { ApiErrorHandler.handle(response); return; } - var sysprops = data["system.properties"]; + var payload = NodeTarget.unwrap(data, response) || {}; + var sysprops = payload["system.properties"] || payload.systemProperties; + if (!sysprops) { + $scope.props = []; + return; + } var sep = sysprops["path.separator"] var props = []; for (var key in sysprops) { @@ -45,5 +54,5 @@ solrAdminApp.controller('JavaPropertiesController', }); }; - $scope.refresh(); + NodeTarget.whenReady($scope.refresh, $scope); }); diff --git a/solr/webapp/web/js/angular/controllers/logging.js b/solr/webapp/web/js/angular/controllers/logging.js index c2f6d46eb6d..ce13bde316d 100644 --- a/solr/webapp/web/js/angular/controllers/logging.js +++ b/solr/webapp/web/js/angular/controllers/logging.js @@ -24,16 +24,21 @@ var format_time_content = function( time, timeZone ) { } solrAdminApp.controller('LoggingController', - function($scope, $timeout, $cookies, LoggingV2, Constants, ApiErrorHandler){ + function($scope, $timeout, $cookies, LoggingV2, Constants, ApiErrorHandler, NodeTarget){ $scope.resetMenu("logging", Constants.IS_ROOT_PAGE); $scope.timezone = $cookies.logging_timezone || "Local"; $scope.refresh = function() { - LoggingV2.fetchLocalLogMessages({since: 0}, function(error, data, response) { + if (NodeTarget.needsSelection()) { + $timeout.cancel($scope.timeout); + return; + } + LoggingV2.fetchLocalLogMessages(NodeTarget.withNodes({since: 0}), function(error, data, response) { $timeout(function() { if (error) { ApiErrorHandler.handle(response); return; } + var payload = NodeTarget.unwrap(data, response) || {}; $scope.since = new Date(); $scope.sinceDisplay = format_time_content($scope.since, "Local"); - var events = data.history; + var events = payload.history || []; for (var i=0; i<events.length; i++) { var event = events[i]; var time = new Date(event.time); @@ -52,35 +57,16 @@ solrAdminApp.controller('LoggingController', event.showTrace = false; } $scope.events = events; - $scope.watcher = data.watcher; - /* @todo sticky_mode - // state element is in viewport - sticky_mode = ( state.position().top <= $( window ).scrollTop() + $( window ).height() - ( $( 'body' ).height() - state.position().top ) ); - // initial request - if( 0 === since ) { - sticky_mode = true; - } - $scope.loggingEvents = events; - - if( sticky_mode ) - { - $( 'body' ) - .animate - ( - { scrollTop: state.position().top }, - 1000 - ); - } - */ + $scope.watcher = payload.watcher; }); }); + $timeout.cancel($scope.timeout); $scope.timeout = $timeout($scope.refresh, 10000); - var onRouteChangeOff = $scope.$on('$routeChangeStart', function() { - $timeout.cancel($scope.timeout); - onRouteChangeOff(); - }); }; - $scope.refresh(); + $scope.$on('$destroy', function() { + $timeout.cancel($scope.timeout); + }); + NodeTarget.whenReady($scope.refresh, $scope); $scope.toggleRefresh = function() { if(!$scope.stopped) { $scope.stopped = true; @@ -101,7 +87,7 @@ solrAdminApp.controller('LoggingController', ) .controller('LoggingLevelController', - function($scope, $timeout, LoggingV2, ApiErrorHandler) { + function($scope, $timeout, LoggingV2, ApiErrorHandler, NodeTarget) { $scope.resetMenu("logging-levels"); var packageOf = function(logger) { @@ -129,11 +115,12 @@ solrAdminApp.controller('LoggingController', LoggingV2.listAllLoggersAndLevels(function(error, data, response) { $timeout(function() { if (error) { ApiErrorHandler.handle(response); return; } - $scope.logging = makeTree(data.loggers, ""); - $scope.watcher = data.watcher; + var payload = data || {}; + $scope.logging = makeTree(payload.loggers || [], ""); + $scope.watcher = payload.watcher; $scope.levels = []; - for (var level in data.levels) { - $scope.levels.push({name:data.levels[level], pos:level}); + for (var level in payload.levels) { + $scope.levels.push({name:payload.levels[level], pos:level}); } }); }); @@ -162,9 +149,7 @@ solrAdminApp.controller('LoggingController', logger.showOptions = false; var doSetLevel = function() { var opts = {logLevelChange: [{logger: logger.name, level: newLevel}]}; - // "nodes=all" only makes sense in SolrCloud mode, where it broadcasts the level - // change to every live node; in standalone (user-managed) mode the request is - // handled locally, so the param is omitted entirely. + // Broadcast in SolrCloud; omit in standalone (handled locally). if ($scope.isCloudEnabled) { opts.nodes = "all"; } @@ -173,8 +158,6 @@ solrAdminApp.controller('LoggingController', $scope.refresh(); }); }; - // isCloudEnabled populates asynchronously via resetMenu(), so wait for it to settle - // before deciding whether to broadcast (same pattern as in paramsets.js). if ($scope.isCloudEnabled === undefined) { var unwatchCloudEnabled = $scope.$watch('isCloudEnabled', function(value) { if (value === undefined) return; @@ -186,5 +169,5 @@ solrAdminApp.controller('LoggingController', } }; - $scope.refresh(); + NodeTarget.whenReady($scope.refresh, $scope); }); diff --git a/solr/webapp/web/js/angular/controllers/threads.js b/solr/webapp/web/js/angular/controllers/threads.js index 123a42d6382..331fe710028 100644 --- a/solr/webapp/web/js/angular/controllers/threads.js +++ b/solr/webapp/web/js/angular/controllers/threads.js @@ -16,17 +16,22 @@ */ solrAdminApp.controller('ThreadsController', - function($scope, $timeout, SystemV2, Constants, ApiErrorHandler){ + function($scope, $timeout, SystemV2, Constants, ApiErrorHandler, NodeTarget){ $scope.resetMenu("threads", Constants.IS_ROOT_PAGE); $scope.refresh = function() { + if (NodeTarget.needsSelection()) { + return; + } + NodeTarget.withNodes(); SystemV2.getThreadDump(function(error, data, response) { $timeout(function() { if (error) { ApiErrorHandler.handle(response); return; } - if (!data || !data.system) { + var payload = NodeTarget.unwrap(data, response); + if (!payload || !payload.system) { $scope.threads = []; return; } - var threadDump = data.system.threadDump; + var threadDump = payload.system.threadDump; var threads = []; for (var i=0; i<threadDump.length; i++) { var thread = threadDump[i].thread; @@ -53,5 +58,5 @@ solrAdminApp.controller('ThreadsController', $scope.threads[i].showStackTrace = $scope.showAllStacktraces; } }; - $scope.refresh(); + NodeTarget.whenReady($scope.refresh, $scope); }); diff --git a/solr/webapp/web/js/angular/services.js b/solr/webapp/web/js/angular/services.js index 2cac309ec3b..3fde3fd1dba 100644 --- a/solr/webapp/web/js/angular/services.js +++ b/solr/webapp/web/js/angular/services.js @@ -92,6 +92,158 @@ solrAdminServices.factory('Metrics', } return {handle: handle}; }]) +.factory('NodeTarget', + ['$rootScope', function($rootScope) { + var STORAGE_KEY = 'adminui.selectedNode'; + var state = { + localNode: null, + selectedNode: sessionStorage.getItem(STORAGE_KEY) || null, + liveNodes: [], + ready: false + }; + + function isRemote() { + return !!(state.selectedNode && state.localNode && state.selectedNode !== state.localNode); + } + + function persistSelected() { + if (state.selectedNode) { + sessionStorage.setItem(STORAGE_KEY, state.selectedNode); + } else { + sessionStorage.removeItem(STORAGE_KEY); + } + } + + function isNodeScopedUrl(url) { + url = url || ''; + return /\/api\/node\/(system|threads|properties|logging\/messages)(?:\?|$)/.test(url) + || /\/api\/cores(?:\?|$)/.test(url); + } + + var pendingTarget = null; + + function withNodes(opts) { + opts = opts || {}; + if (isRemote()) { + pendingTarget = state.selectedNode; + } + return opts; + } + + function unwrap(data, response) { + if (!isRemote()) { + return data; + } + var body = (response && response.body) || data || {}; + if (state.selectedNode && body[state.selectedNode]) { + return body[state.selectedNode]; + } + return data; + } + + function needsSelection() { + return state.liveNodes.length > 1 && !state.selectedNode; + } + + function publish() { + $rootScope.localNode = state.localNode; + $rootScope.selectedNode = state.selectedNode; + $rootScope.liveNodes = state.liveNodes; + $rootScope.viewingRemoteNode = isRemote(); + $rootScope.needsNodeSelection = needsSelection(); + } + + function markReady() { + if (!state.ready) { + state.ready = true; + publish(); + } + } + + function whenReady(fn, scope) { + if (state.ready) { + fn(); + return angular.noop; + } + var unwatch = $rootScope.$watch(function() { return state.ready; }, function(ready) { + if (!ready) { + return; + } + unwatch(); + fn(); + }); + if (scope) { + scope.$on('$destroy', unwatch); + } + return unwatch; + } + + function setLocalNode(nodeName) { + state.localNode = nodeName; + publish(); + } + + function setLiveNodes(nodes) { + state.liveNodes = (nodes || []).slice().sort(); + if (state.liveNodes.length <= 1) { + state.selectedNode = state.localNode || state.liveNodes[0] || null; + persistSelected(); + } else if (state.selectedNode && state.liveNodes.indexOf(state.selectedNode) === -1) { + state.selectedNode = null; + persistSelected(); + } + publish(); + markReady(); + } + + function selectNode(nodeName) { + if (!nodeName || nodeName === state.selectedNode) { + return false; + } + state.selectedNode = nodeName; + persistSelected(); + publish(); + return true; + } + + function clear() { + state.localNode = null; + state.selectedNode = null; + state.liveNodes = []; + persistSelected(); + publish(); + markReady(); + } + + var plugins = solrApi.ApiClient.instance.plugins || []; + plugins.push(function(request) { + var target = pendingTarget; + pendingTarget = null; + if (!target) { + return request; + } + var method = (request.method || 'GET').toUpperCase(); + if (method === 'GET' && isNodeScopedUrl(request.url)) { + request.set('X-Solr-targetNode', target); + } + return request; + }); + solrApi.ApiClient.instance.plugins = plugins; + + return { + state: state, + isRemote: isRemote, + needsSelection: needsSelection, + withNodes: withNodes, + unwrap: unwrap, + setLocalNode: setLocalNode, + setLiveNodes: setLiveNodes, + selectNode: selectNode, + clear: clear, + markReady: markReady, + whenReady: whenReady + }; + }]) .factory('CollectionsV2', function() { solrApi.ApiClient.instance.basePath = '/api'; diff --git a/solr/webapp/web/partials/cloud.html b/solr/webapp/web/partials/cloud.html index 480f72c1428..8b4ca96b54e 100644 --- a/solr/webapp/web/partials/cloud.html +++ b/solr/webapp/web/partials/cloud.html @@ -172,13 +172,17 @@ limitations under the License. <a ng-show="!showDetails[h.host]">show details...</a> </div> </td> - <td ng-class="{'dead-node': n.dead}"><div class="node-name"><a href="{{n.base_url}}">{{key.replace(n.host+':', '')}}</a></div> + <td ng-class="{'dead-node': n.dead}"><div class="node-name"> + <a ng-show="!n.dead" href="" ng-click="openNodeDashboard(key); $event.preventDefault()">{{key.replace(n.host+':', '')}}</a> + <span ng-show="n.dead">{{key.replace(n.host+':', '')}}</span> + </div> <div ng-show="n.dead" class="node-down">(DEAD)</div> <div ng-show="!n.dead"> Uptime: {{n.jvmUptime}}<br/> <div class="node-spec" ng-show="showDetails[key]"> Java <span title="{{n.system.jvm.jre.vendor}}">{{n.system.jvm.jre.version}}</span><br/> Solr {{n.system.lucene['solr-impl-version'].split(" ")[0]}}<br> + <a class="node-admin-link" ng-href="{{n.base_url}}" target="_blank" rel="noopener">Open node Admin UI</a> </div> <div class="node-spec" ng-click="toggleDetails(key)"> <a ng-show="showDetails[key]">hide details...</a> diff --git a/solr/webapp/web/partials/cores.html b/solr/webapp/web/partials/cores.html index 1615769564f..f36fe486064 100644 --- a/solr/webapp/web/partials/cores.html +++ b/solr/webapp/web/partials/cores.html @@ -22,12 +22,16 @@ limitations under the License. <div id="actions" class="actions clearfix"> - <button id="add" class="action" ng-click="showAddCore()"><span>Add Core</span></button> + <p id="remote-core-admin-note" class="clearfix note" ng-show="viewingRemoteNode"> + <span>Showing cores from the selected remote node. Add, unload, rename, swap, and reload stay on this node — switch the Node picker back to the local node to mutate cores.</span> + </p> + + <button id="add" class="action" ng-click="showAddCore()" ng-disabled="viewingRemoteNode"><span>Add Core</span></button> <span ng-show="hasCores"> - <button id="unload" class="warn requires-core" ng-click="unloadCore()"><span>Unload</span></button> - <button id="rename" class="action requires-core" ng-click="showRenameCore()"><span>Rename</span></button> - <button id="swap" class="action requires-core" ng-click="showSwapCores()"><span>Swap</span></button> - <button id="reload" class="requires-core" ng-click="reloadCore()" + <button id="unload" class="warn requires-core" ng-click="unloadCore()" ng-disabled="viewingRemoteNode"><span>Unload</span></button> + <button id="rename" class="action requires-core" ng-click="showRenameCore()" ng-disabled="viewingRemoteNode"><span>Rename</span></button> + <button id="swap" class="action requires-core" ng-click="showSwapCores()" ng-disabled="viewingRemoteNode"><span>Swap</span></button> + <button id="reload" class="requires-core" ng-click="reloadCore()" ng-disabled="viewingRemoteNode" ng-class="{success: reloadSuccess, warn: reloadFailure}"><span>Reload</span></button> </span> <div class="action add" data-rel="add" ng-show="showAdd" style="display:block;left:0px;"> @@ -49,7 +53,7 @@ limitations under the License. <p class="clearfix"><label for="add_schema">schema:</label> <input type="text" name="schema" id="add_schema" ng-model="newCore.schema"></p> - <div class="cloud" ng-show="isCloud"> + <div class="cloud" ng-show="isCloudEnabled"> <p class="clearfix"><label for="add_collection">collection:</label> <input type="text" name="collection" id="add_collection" ng-model="newCore.collection"></p> diff --git a/solr/webapp/web/partials/index.html b/solr/webapp/web/partials/index.html index a417d7d5fc8..148abca137d 100644 --- a/solr/webapp/web/partials/index.html +++ b/solr/webapp/web/partials/index.html @@ -28,6 +28,11 @@ limitations under the License. <ul class="data" ngShow="system"> + <li class="node" ng-show="system.node"><dl class="clearfix"> + <dt><span>Node</span></dt> + <dd>{{system.node}}</dd> + </dl></li> + <li class="start_time"><dl class="clearfix"> <dt><span>Start</span></dt> <dd class="timeago">{{system.jvm.jmx.startTime | timeago}}</dd> diff --git a/solr/webapp/web/partials/logging-levels.html b/solr/webapp/web/partials/logging-levels.html index 14c6c085ddb..f137108771a 100644 --- a/solr/webapp/web/partials/logging-levels.html +++ b/solr/webapp/web/partials/logging-levels.html @@ -17,7 +17,12 @@ limitations under the License. <div id="logging" class="clearfix"> <div id="frame"> <div class="block"> - <h2><span>{{watcher}}</span></h2> + <h2> + <span>{{watcher}}</span> + <span class="cluster-level-note" ng-show="liveNodes.length > 1"> + (Temporarily changes the logging output level across the entire cluster. Changes will be lost after a restart.) + </span> + </h2> <div id="loggingtree"> <ul class="tree jstree jstree-container-ul jstree-children tree ng-isolate-scope jstree-1 jstree-default"> <li class="jstree-node jstree-leaf jstree-open level-{{logger.level.toLowerCase()}}" ng-class="{'jstree-last':$last}" ng-repeat="logger in logging" ng-include="'logger.html'"></li>
