Skip to content

Commit

Permalink
UI Updates for Port Drayage Web Service (#290)
Browse files Browse the repository at this point in the history
* UI Updates for Port Drayage Web Service

* Final UI updates

+ Clean up css files
+ Added comments
+ Renamed main to landing page
+ Inspection Tab only available at PORT area
  • Loading branch information
paulbourelly999 authored Dec 13, 2021
1 parent 0ab59fa commit 5a36e37
Show file tree
Hide file tree
Showing 23 changed files with 695 additions and 165 deletions.
1 change: 0 additions & 1 deletion tools/port-drayage-webservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
<library>spring-boot</library>
<apiPackage>com.baeldung.openapi.api</apiPackage>
<modelPackage>com.baeldung.openapi.model</modelPackage>
<skipValidateSpec>true</skipValidateSpec>
<supportingFilesToGenerate>
ApiUtil.java
</supportingFilesToGenerate>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.leidos.area;

public enum Area {
STAGING_AREA("STAGING_AREA"),
PORT_AREA("PORT_AREA");
private String name;

Area(String name){
this.name =name;
}

public String getName(){
return name;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.leidos.area;

import org.springframework.stereotype.Component;

@Component
public class AreaBean {

private Area area;

/**
* Empty Constructor.
*/
public AreaBean() {

}

public void stagingArea() {
area = Area.STAGING_AREA;
}

public void portArea() {
area = Area.PORT_AREA;
}

public Area getArea() {
return area;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.leidos.controller;

import com.baeldung.openapi.api.ResetApi;
import com.baeldung.openapi.api.UiactionApi;
import com.leidos.area.Area;
import com.leidos.area.AreaBean;
import com.leidos.inspection.InspectionActions;
import com.leidos.loading.LoadingActions;
import com.leidos.unloading.UnloadingActions;
Expand All @@ -14,9 +16,9 @@


@RestController
public class ResetController implements ResetApi {
public class UIActionController implements UiactionApi {

private static Logger logger = LoggerFactory.getLogger(ResetController.class);
private static Logger logger = LoggerFactory.getLogger(UIActionController.class);

/**
* Injected {@link LoadingActions} Spring Bean
Expand All @@ -35,16 +37,41 @@ public class ResetController implements ResetApi {
*/
@Autowired
private InspectionActions inspectionActions;

/**
*
*/
@Autowired
private AreaBean areaBean;

/**
* {@inheritDoc}
*/
@Override
public ResponseEntity<Void> resetPost() {
public ResponseEntity<Void> uiactionResetPost() {
inspectionActions.clear();
unloadingActions.clear();
loadingActions.clear();
logger.warn("Web Service Actions were cleared!");
return new ResponseEntity<Void>(HttpStatus.OK);
}

/**
* {@inheritDoc}
*/
@Override
public ResponseEntity<Void> uiactionAreaAreaPost(String area) {
if ( area.equals(Area.STAGING_AREA.getName())) {
areaBean.stagingArea();
return new ResponseEntity<>(HttpStatus.CREATED);
}
else if ( area.equals(Area.PORT_AREA.getName())) {
areaBean.portArea();
return new ResponseEntity<>(HttpStatus.CREATED);
}
else {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
package com.leidos.controller;


import com.leidos.area.Area;
import com.leidos.area.AreaBean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class UserInterfaceController {

@Autowired
public AreaBean areaBean;


@GetMapping("/")
public String main( Model model) {
return "index";
}
if ( areaBean.getArea() != null )
return "index";
else {
return "landing";
}
}

@GetMapping("/loading")
public String loading() {
Expand All @@ -29,4 +40,15 @@ public String inspection() {
return "_inspection";

}

/**
* Keeping access to landing page under this URL for testing purposes.
* @return
*/
@GetMapping("/debug/landing")
public String main() {
return "landing";

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,20 @@ public void clear() {
currentInspection = null;
}

/**
* Method to return the number of waiting actions for UI tab notification
*/
public int waitingActions() {
if ( pendingInspections.getInspections() != null && !pendingInspections.getInspections().isEmpty()) {
// plus one for current action
return pendingInspections.getInspections().size() + 1;
}
else if ( currentInspection != null ) {
return 1;
}
else {
return 0;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,20 @@ public void clear() {
currentAction = null;
}

/**
* Method to return the number of waiting actions for UI tab notification
*/
public int waitingActions() {
if ( pendingActions.getActions() != null && !pendingActions.getActions().isEmpty() ) {
// plus one for current action
return pendingActions.getActions().size() + 1;
}
else if ( currentAction != null ) {
return 1;
}
else {
return 0;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,20 @@ public void clear() {
completedActions.getActions().clear();
currentAction = null;
}

/**
* Method to return the number of waiting actions for UI tab notification
*/
public int waitingActions() {
if ( pendingActions.getActions() != null && !pendingActions.getActions().isEmpty() ) {
// plus one for current action
return pendingActions.getActions().size() + 1;
}
else if ( currentAction != null ) {
return 1;
}
else {
return 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,31 @@ servers:
- url: https://127.0.0.1:8443
description: Secured hosting for deployment
paths:
/reset:
/uiaction/reset:
post:
summary: Clear Web Service Actions
description:
Request will clear all actions in InspectionActions, LoadingActions, and UnloadingActions.
responses:
"201":
description: Created
/uiaction/area/{area}:
post:
parameters:
- in: path
name: area
schema:
type: string
required: true
description: Area Enumeration indicating where web service is deployed.
summary: Select Area Of Operations.
description: Indicates where the web service is deployed. Possible valid area of operations include PORT_AREA and STAGING_AREA
responses:
"201":
description: Created
"400":
description: Invalid Request

/loading:
post:
summary: Request a container is loaded on to freight vehicle.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/* Index Page Style Sheet */

/* Navigation bar holds tabs and CARMA-Streets logo*/
.navigation-bar{
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
}
/*Overwrite bootstrap nav-tabs class stop tabs from wrapping when screen is resized*/
.nav-tabs{
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}
.carma-streets-logo{
width: auto;
max-height: 90px;
}
/* Align icons to bottom of tab */
.icons{
max-height:40px;
max-width: 60px;
align-self: flex-end;
}
/* Style individual tabs */
.tabs{
display: flex;
clear: both;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-self: center;
width: 100%;
height: 100%;
/* overwrite some of the nav-link styling */
border: 2px black solid !important;
border-bottom: none !important;
color: lightgray !important;
}
/* Overwrite active tab styling for green backgrould */
.nav-link.active{
/* Override bootstrap styling */
background-color: hsla(120, 100%, 25%, 0.4) !important;
border: 2px black solid !important;
border-bottom: none !important;
color: black !important;
outline: none !important;
box-shadow: none !important;
}
/* Set tab label styling */
.tab-label{
align-self: flex-end;
margin-left: 7px;
margin-bottom: 0 !important;
}
/* Overwrite bootstrap badge style for notification badges for tabs */
.badge {
height: fit-content;
color: black;
}

/* Styling for Tab Content */

/* Add border to bootstrap tab content styling*/
.tab-content{
border: 2px black solid;
padding: 10px;
}
/* Overwrite bootstrap jumbotron styling for dialog popup */
.jumbotron{
display: flex;
flex-direction: row;
flex-wrap: nowrap;
padding: 1rem 1rem !important;
}
/* Left part of dialog popup*/
.action-dialog-left{
width: 60%;
height: 100%;
}
/* Right part of dialog popup*/
.action-dialog-right{
width: 40%;
color: darkblue;
border: 2px black dashed ;
border-radius: 5px;
display: flex;
justify-content: center;
align-items: center;
font-size: xxx-large;
}
/* Clear Actions button styling */
.clear-button{
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: center;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* Landing Page Style Sheet */
/* */
.main-splash{
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: center;
}
/* Style CARMA-Streets Description */
.main-splash-description{
width: 80%;
}

/* Style CARMA-Streets Logo */
.splash-logo{
width: 60%;
max-height: 45%;
margin-top: 20px;
}

/* Style container holding area selection buttons */
.area-select{
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: center;
}
/* Style buttons to be the same size */
.area-select-btn{
width: 190px;
}
Loading

0 comments on commit 5a36e37

Please sign in to comment.