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.server.webapp.WebPageUtils; 22 import org.apache.hadoop.yarn.webapp.SubView; 23 import org.apache.hadoop.yarn.webapp.view.TwoColumnLayout; 24 25 import static org.apache.hadoop.yarn.util.StringHelper.sjoin; 26 import static org.apache.hadoop.yarn.webapp.YarnWebParams.APP_STATE; 27 import static org.apache.hadoop.yarn.webapp.view.JQueryUI.*; 28 29 // Do NOT rename/refactor this to RMView as it will wreak havoc 30 // on Mac OS HFS 31 public class RmView extends TwoColumnLayout { 32 static final int MAX_DISPLAY_ROWS = 100; // direct table rendering 33 static final int MAX_FAST_ROWS = 1000; // inline js array 34 35 @Override preHead(Page.HTML<_> html)36 protected void preHead(Page.HTML<_> html) { 37 commonPreHead(html); 38 set(DATATABLES_ID, "apps"); 39 set(initID(DATATABLES, "apps"), initAppsTable()); 40 setTableStyles(html, "apps", ".queue {width:6em}", ".ui {width:8em}"); 41 42 // Set the correct title. 43 String reqState = $(APP_STATE); 44 reqState = (reqState == null || reqState.isEmpty() ? "All" : reqState); 45 setTitle(sjoin(reqState, "Applications")); 46 } 47 commonPreHead(Page.HTML<_> html)48 protected void commonPreHead(Page.HTML<_> html) { 49 set(ACCORDION_ID, "nav"); 50 set(initID(ACCORDION, "nav"), "{autoHeight:false, active:0}"); 51 } 52 53 @Override nav()54 protected Class<? extends SubView> nav() { 55 return NavBlock.class; 56 } 57 58 @Override content()59 protected Class<? extends SubView> content() { 60 return AppsBlockWithMetrics.class; 61 } 62 initAppsTable()63 protected String initAppsTable() { 64 return WebPageUtils.appsTableInit(); 65 } 66 } 67