Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Swagger Docs, Login UI Update #205

Merged
merged 12 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

@Controller
@RequestMapping("/api")
Expand All @@ -27,6 +28,7 @@ public MyRestService() {
* Example POST service
*
*/
@ApiIgnore
@RequestMapping(value = "/example", method = POST)
public @ResponseBody String example(
final HttpSession session) {
Expand Down
11 changes: 9 additions & 2 deletions cws-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
<artifactId>spring-test</artifactId>
</dependency>



<!-- AWS JAVA API -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
Expand Down Expand Up @@ -255,6 +253,15 @@
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
</dependency>

<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>
Expand Down
15 changes: 15 additions & 0 deletions cws-service/src/main/java/jpl/cws/controller/MvcCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,21 @@ protected ModelAndView buildModelerModel(String message) {
}
return model;
}

protected ModelAndView buildApiDocsModel(String message) {
log.trace("Building apidocs's model...");
ModelAndView model = new ModelAndView("api-docs");
try {
model.addObject("base", appRoot);
model.addObject("msg", message);

log.trace("MODEL for Modeler page: "+model.getModel());
}
catch (Throwable t) {
log.error("Unexpected exception", t);
}
return model;
}

}

48 changes: 31 additions & 17 deletions cws-service/src/main/java/jpl/cws/controller/MvcService.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import jpl.cws.process.initiation.InitiatorsService;
import jpl.cws.scheduler.Scheduler;
import jpl.cws.service.CwsConsoleService;
import springfox.documentation.annotations.ApiIgnore;

@Controller
public class MvcService extends MvcCore {
Expand All @@ -50,6 +51,7 @@ public MvcService() {}
/**
*
*/
@ApiIgnore
@RequestMapping(value = "/login", method = GET)
public ModelAndView login(final HttpSession session) {
return buildModel("login", "Please log in");
Expand All @@ -59,6 +61,7 @@ public ModelAndView login(final HttpSession session) {
/**
*
*/
@ApiIgnore
@RequestMapping(value = "/not_authorized", method = GET)
public ModelAndView notAuthorized(final HttpSession session) {
return buildModel("not_authorized", "Not authorized. Please navigate elsewhere");
Expand All @@ -68,6 +71,7 @@ public ModelAndView notAuthorized(final HttpSession session) {
/**
*
*/
@ApiIgnore
@RequestMapping(value = "/home", method = GET)
public ModelAndView index(final HttpSession session) {
return buildHomeModel("");
Expand All @@ -76,6 +80,7 @@ public ModelAndView index(final HttpSession session) {
/**
*
*/
@ApiIgnore
@RequestMapping(value = "/summary", method = GET)
public ModelAndView summary(final HttpSession session) {
return buildSummaryModel("");
Expand All @@ -87,6 +92,7 @@ public ModelAndView summary(final HttpSession session) {
* and results in displaying the home page with a welcome message
*
*/
@ApiIgnore
@RequestMapping(value = "/logintotarget", method = POST)
public ModelAndView logintotarget(
final HttpSession session,
Expand Down Expand Up @@ -140,26 +146,26 @@ public ModelAndView logintotarget(
return buildHomeModel("Welcome " + (user == null ? username : user.getFirstName()));
}
}


@ApiIgnore
@RequestMapping(value = "/deployments", method = GET)
public ModelAndView deployments() {
return buildDeploymentsModel("");
}


@ApiIgnore
@RequestMapping(value = "/logs", method = GET)
public ModelAndView logs() {
return buildLogsModel("");
}


@ApiIgnore
@RequestMapping(value = "/history", method = GET)
public ModelAndView history() {
return buildHistoryModel("");
}


@ApiIgnore
@RequestMapping(value = "/workers", method = GET)
public ModelAndView workers() {
return buildWorkersModel();
Expand All @@ -170,6 +176,7 @@ public ModelAndView workers() {
* Returns Initiators page model and view
*
*/
@ApiIgnore
@RequestMapping(value = "/initiators", method = GET)
public ModelAndView initiators() {
ModelAndView model = new ModelAndView("initiators");
Expand All @@ -187,44 +194,51 @@ public ModelAndView initiators() {
}
return model;
}


@ApiIgnore
@RequestMapping(value = "/snippets", method = GET)
public ModelAndView snippets() {
ModelAndView model = new ModelAndView("snippets");
model.addObject("base", appRoot);
model.addObject("msg", "");
return model;
}


@ApiIgnore
@RequestMapping(value = "/processes", method = GET)
public ModelAndView processes() {
return buildProcessesModel("");
}


@ApiIgnore
@RequestMapping(value = "/configuration", method = GET)
public ModelAndView configuration() {
return buildConfigurationModel("");
}


@ApiIgnore
@RequestMapping(value = "/documentation", method = GET)
public ModelAndView documentation() {
return buildDocumentationModel("");
}


@ApiIgnore
@RequestMapping(value = "/modeler", method = GET)
public ModelAndView modeler() {
return buildModelerModel("");
}

@ApiIgnore
@RequestMapping(value = "/api-docs", method = GET)
public ModelAndView apidocs() {
return buildApiDocsModel("");
}


/**
*
*/
@ApiIgnore
@RequestMapping(value = "/logout", method = GET)
public ModelAndView logout(
final HttpSession session,
Expand Down
Loading
Loading