Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions changelog/unreleased/SOLR-12613-admin-ui-node-picker.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ public void testStandaloneMenus() {
// 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"));
Expand Down
136 changes: 136 additions & 0 deletions solr/webapp/src/test/org/apache/solr/webapp/AdminUiNodePickerTest.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ public void testLoginAndSecurityScreen() throws Exception {
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"));
Expand Down
50 changes: 48 additions & 2 deletions solr/webapp/src/test/org/apache/solr/webapp/AdminUiTestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,58 @@ protected static WebElement openPage(String route, By anchor) {
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");
Expand Down
8 changes: 8 additions & 0 deletions solr/webapp/web/css/angular/cloud.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
52 changes: 52 additions & 0 deletions solr/webapp/web/css/angular/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ ul
padding-bottom: 10px;
position: fixed;
z-index: 42;
left: 0;
right: 0;
pointer-events: none;
}

.scroll #header
Expand All @@ -211,17 +214,66 @@ 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
{
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;
Expand Down
8 changes: 8 additions & 0 deletions solr/webapp/web/css/angular/logging.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading
Loading