package com.perforce.spark.browse; import java.util.Map; import spark.ModelAndView; import spark.Request; import spark.Response; import com.perforce.p4java.exception.P4JavaException; import com.perforce.p4java.server.IOptionsServer; import com.perforce.spark.ErrorModel; import com.perforce.spark.connection.ConnectionSession; import com.perforce.spark.depot.DepotFactory; import com.perforce.spark.navigation.NavBar; public class BrowseControl extends ErrorModel { public static ModelAndView browse(Request request, Response response) { Map<String, Object> model; model = NavBar.attributes("browse", request); String base = request.pathInfo(); base = (base.endsWith("/")) ? base : base + "/"; BreadcrumbModel breadCrumb = new BreadcrumbModel(base); model.put("breadcrumb", breadCrumb.getList()); try { IOptionsServer p4 = ConnectionSession.get(request, response); BrowseModel browse = new BrowseModel(p4, base); model.put("directories", browse.getDirs()); model.put("files", browse.getFiles()); model.put("summary", browse.getSummary()); p4.disconnect(); } catch (P4JavaException e) { return error(e); } return new ModelAndView(model, "/browse/page-items.html"); } public static ModelAndView depots(Request request, Response response) { Map<String, Object> model; model = NavBar.attributes("browse", request); try { IOptionsServer p4 = ConnectionSession.get(request, response); model.put("depots", DepotFactory.listAll(p4)); } catch (P4JavaException e) { return error(e); } return new ModelAndView(model, "/browse/page-depots.html"); } public static ModelAndView list(Request request, Response response) { Map<String, Object> model; model = NavBar.attributes("browse", request); try { IOptionsServer p4 = ConnectionSession.get(request, response); model.put("depots", DepotFactory.listAll(p4)); } catch (P4JavaException e) { return error(e); } return new ModelAndView(model, "/browse/page-list.html"); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#8 | 15807 | Paul Allen | Browse (list/grid view) | ||
#7 | 15012 | Paul Allen | Proxy configuration. | ||
#6 | 14884 | Paul Allen | Moved create depot type into path and not a param. | ||
#5 | 14882 | Paul Allen | Refactor static html pages | ||
#4 | 14863 | Paul Allen | Change File/Dir browse to support extended options | ||
#3 | 14228 | Paul Allen |
Moved View over to the new model. Retactor connection to package. |
||
#2 | 14227 | Paul Allen | Moved over MAVEN Artifact summary. | ||
#1 | 14226 | Paul Allen | Tidy up Browse elements over to micro MVC model |