1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *     http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 
19 package org.apache.hadoop.yarn.server.resourcemanager.webapp;
20 
21 import org.apache.hadoop.yarn.api.records.YarnApplicationState;
22 import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
23 import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV;
24 import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.LI;
25 import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.UL;
26 import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
27 
28 public class NavBlock extends HtmlBlock {
29 
render(Block html)30   @Override public void render(Block html) {
31     UL<DIV<Hamlet>> mainList = html.
32       div("#nav").
33         h3("Cluster").
34         ul().
35           li().a(url("cluster"), "About")._().
36           li().a(url("nodes"), "Nodes")._().
37           li().a(url("nodelabels"), "Node Labels")._();
38     UL<LI<UL<DIV<Hamlet>>>> subAppsList = mainList.
39           li().a(url("apps"), "Applications").
40             ul();
41     subAppsList.li()._();
42     for (YarnApplicationState state : YarnApplicationState.values()) {
43       subAppsList.
44               li().a(url("apps", state.toString()), state.toString())._();
45     }
46     subAppsList._()._();
47     mainList.
48           li().a(url("scheduler"), "Scheduler")._()._().
49         h3("Tools").
50         ul().
51           li().a("/conf", "Configuration")._().
52           li().a("/logs", "Local logs")._().
53           li().a("/stacks", "Server stacks")._().
54           li().a("/jmx?qry=Hadoop:*", "Server metrics")._()._()._();
55   }
56 }
57