|
@@ -19,11 +19,8 @@
|
|
|
package org.apache.hadoop.yarn.webapp.view;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
-import com.google.inject.Inject;
|
|
|
|
|
|
import java.util.List;
|
|
|
-import java.util.Locale;
|
|
|
-import javax.servlet.http.Cookie;
|
|
|
|
|
|
import static org.apache.commons.lang.StringEscapeUtils.*;
|
|
|
import static org.apache.hadoop.yarn.util.StringHelper.*;
|
|
@@ -54,10 +51,7 @@ public class JQueryUI extends HtmlBlock {
|
|
|
public static final String DIALOG_SELECTOR = DIALOG +".selector";
|
|
|
public static final String PROGRESSBAR = "ui.progressbar";
|
|
|
public static final String PROGRESSBAR_ID = PROGRESSBAR +".id";
|
|
|
- public static final String THEMESWITCHER = "ui.themeswitcher";
|
|
|
- public static final String THEMESWITCHER_ID = THEMESWITCHER +".id";
|
|
|
- public static final String THEME_KEY = "theme";
|
|
|
- public static final String COOKIE_THEME = "jquery-ui-theme";
|
|
|
+
|
|
|
// common CSS classes
|
|
|
public static final String _PROGRESSBAR =
|
|
|
".ui-progressbar.ui-widget.ui-widget-content.ui-corner-all";
|
|
@@ -79,14 +73,12 @@ public class JQueryUI extends HtmlBlock {
|
|
|
@Override
|
|
|
protected void render(Block html) {
|
|
|
html.
|
|
|
- link(join("https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/",
|
|
|
- getTheme(), "/jquery-ui.css")).
|
|
|
+ link(join("https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css")).
|
|
|
link(root_url("static/dt-1.7.5/css/jui-dt.css")).
|
|
|
script("https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js").
|
|
|
script("https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js").
|
|
|
script(root_url("static/dt-1.7.5/js/jquery.dataTables.min.js")).
|
|
|
script(root_url("static/yarn.dt.plugins.js")).
|
|
|
- script(root_url("static/themeswitcher.js")).
|
|
|
style("#jsnotice { padding: 0.2em; text-align: center; }",
|
|
|
".ui-progressbar { height: 1em; min-width: 5em }"); // required
|
|
|
|
|
@@ -95,7 +87,6 @@ public class JQueryUI extends HtmlBlock {
|
|
|
initDataTables(list);
|
|
|
initDialogs(list);
|
|
|
initProgressBars(list);
|
|
|
- initThemeSwitcher(list);
|
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
html.
|
|
@@ -189,28 +180,6 @@ public class JQueryUI extends HtmlBlock {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- protected void initThemeSwitcher(List<String> list) {
|
|
|
- for (String id : split($(THEMESWITCHER_ID))) {
|
|
|
- if (Html.isValidId(id)) {
|
|
|
- list.add(join(" $('#", id,
|
|
|
- "').themeswitcher({expires:888, path:'/'});"));
|
|
|
- break; // one is enough
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- protected String getTheme() {
|
|
|
- String theme = $(THEME_KEY);
|
|
|
- if (!theme.isEmpty()) {
|
|
|
- return theme;
|
|
|
- }
|
|
|
- Cookie c = cookies().get(COOKIE_THEME);
|
|
|
- if (c != null) {
|
|
|
- return c.getValue().toLowerCase(Locale.US).replace("%20", "-");
|
|
|
- }
|
|
|
- return "base";
|
|
|
- }
|
|
|
-
|
|
|
public static String initID(String name, String id) {
|
|
|
return djoin(name, id, "init");
|
|
|
}
|