use of models.BreadCrumb in project coprhd-controller by CoprHD.
the class Services method addBreadCrumbToRenderArgs.
private static void addBreadCrumbToRenderArgs(CatalogServiceRestRep service, String backUrlInput) {
List<BreadCrumb> breadcrumbs = ServiceCatalog.createBreadCrumbs(Models.currentAdminTenant(), service);
renderArgs.put("breadcrumbs", breadcrumbs);
String backUrl;
if (StringUtils.isEmpty(backUrlInput)) {
backUrl = request.params.get("return");
if (StringUtils.isBlank(backUrl)) {
String path = "";
URI categoryId = service.getCatalogCategory().getId();
if (categoryId != null) {
Map<String, CategoryDef> catalog = ServiceCatalog.getCatalog(Models.currentAdminTenant());
CategoryDef category = catalog.get(categoryId.toString());
path = (category != null) ? category.path : path;
}
backUrl = Common.reverseRoute(ServiceCatalog.class, "view") + "#" + path;
}
} else {
backUrl = backUrlInput;
}
renderArgs.put("backUrl", backUrl);
}
use of models.BreadCrumb in project coprhd-controller by CoprHD.
the class ServiceCatalog method createBreadCrumbs.
/**
* Creates the breadcrumbs for the catalog service.
*
* @param service
* the catalog service.
* @return the breadcrumb list.
*/
@Util
public static List<BreadCrumb> createBreadCrumbs(String tenantId, CatalogServiceRestRep service) {
RelatedResourceRep categoryId = service.getCatalogCategory();
String parentId = getParentId(categoryId);
List<BreadCrumb> breadcrumbs = createBreadCrumbs(parentId, getCatalog(tenantId));
String id = service.getId() != null ? service.getId().toString() : "";
addBreadCrumb(breadcrumbs, id, service.getName(), service.getTitle());
return breadcrumbs;
}
use of models.BreadCrumb in project coprhd-controller by CoprHD.
the class ServiceCatalog method addBreadCrumb.
/**
* Adds a breadcrumb to the end of the list, constructing its path based on the breadcrumb at the end of the list.
*
* @param breadcrumbs
* the list of breadcrumbs.
* @param id
* the breadcrumb ID.
* @param name
* the breadcrumb name, used to construct the path.
* @param title
* the breadcrumb title.
*/
@Util
public static void addBreadCrumb(List<BreadCrumb> breadcrumbs, String id, String name, String title) {
String path = getPath(getLastPath(breadcrumbs), name);
breadcrumbs.add(new BreadCrumb(id, name, title, path));
}
Aggregations