package com.perforce.spark.navigation; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; import spark.Request; import com.perforce.spark.artifact.ArtifactType; import com.perforce.spark.connection.ConnectionSession; public class NavBar { private static SortedMap<String, NavBarInterface> map = new TreeMap<>(); static { add(new NavBarMenu("Browse", "browse", false)); add(new NavBarMenu("Search", "search", false)); NavBarMenu deploy = new NavBarMenu("Deploy", "deploy", true); for (ArtifactType type : ArtifactType.list()) { String path = "/deploy/" + type.getId(); ListItem item = new ListItem(type.getTitle(), path); deploy.add(item); } add(deploy); add(new NavBarConfig("Configuration", "config", false)); } public static void add(NavBarInterface item) { String id = item.getPage(); map.put(id, item); } public static Map<String, Object> attributes(String selected, Request request) { Map<String, Object> attributes = new HashMap<>(); attributes.put("navBar", navBar(selected)); attributes.put("title", title(selected)); attributes.put("login", ConnectionSession.isValid(request)); attributes.put("config", map.get("config").isActive()); attributes.put("error_show", "none"); attributes.put("error_message", ""); return attributes; } private static ArrayList<NavBarMenu> navBar(String selected) { ArrayList<NavBarMenu> items = new ArrayList<>(); for (String id : map.keySet()) { NavBarInterface item = map.get(id); if (id.equals(selected)) { item.setActive(true); } else { item.setActive(false); } if (item instanceof NavBarMenu) { items.add((NavBarMenu) item); } } return items; } private static String title(String id) { String title = ""; if (map.containsKey(id)) { title = map.get(id).getTitle(); } return title; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#9 | 15012 | Paul Allen | Proxy configuration. | ||
#8 | 14883 | Paul Allen | Submit via preview and redirect to asset | ||
#7 | 14864 | Paul Allen | Depot Configuration and Site type | ||
#6 | 14863 | Paul Allen | Change File/Dir browse to support extended options | ||
#5 | 14725 | Paul Allen | Generic deploy/upload | ||
#4 | 14723 | Paul Allen | Tidy up deploy/upload | ||
#3 | 14228 | Paul Allen |
Moved View over to the new model. Retactor connection to package. |
||
#2 | 14226 | Paul Allen | Tidy up Browse elements over to micro MVC model | ||
#1 | 14181 | Paul Allen | Lots of updates and refactoring. | ||
//guest/paul_allen/p4am/src/main/java/com/perforce/spark/NavBar.java | |||||
#5 | 13869 | Paul Allen |
- Fix logout when testing cookie. - Refactor ftl->html - Add local bootstrap |
||
#4 | 13798 | Paul Allen | Basic file upload and login/logout cookie tidyup | ||
#3 | 13728 | Paul Allen | Error support | ||
#2 | 13722 | Paul Allen | Login UX | ||
#1 | 13720 | Paul Allen | Perforce Asset Manager (PAM or P4AM) -- ideas |