Search in sources :

Example 1 with BreadCrumb

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);
}
Also used : BreadCrumb(models.BreadCrumb) CategoryDef(controllers.catalog.ServiceCatalog.CategoryDef) URI(java.net.URI)

Example 2 with BreadCrumb

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;
}
Also used : RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) BreadCrumb(models.BreadCrumb) Util(play.mvc.Util)

Example 3 with BreadCrumb

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));
}
Also used : BreadCrumb(models.BreadCrumb) Util(play.mvc.Util)

Aggregations

BreadCrumb (models.BreadCrumb)3 Util (play.mvc.Util)2 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 CategoryDef (controllers.catalog.ServiceCatalog.CategoryDef)1 URI (java.net.URI)1