Skip to content

Commit

Permalink
Support update (#67)
Browse files Browse the repository at this point in the history
* minor correction to event log text (it was logging the card long ID twice in some cases)

* cleaning up unused code & commenting methods and where they're used ready for refactoring

* added trello long id to trello query support page to make it easier to check the duplicates list

* removed some commented code, left mains because they're tests with context I dont want to loose
  • Loading branch information
matallen authored May 16, 2020
1 parent 2609dd0 commit 664f61f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 83 deletions.
6 changes: 5 additions & 1 deletion src/main/java/com/redhat/sso/ninja/Heartbeat2.java
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,11 @@ public void allocatePoints(Database2 db, InputStream is, Map<String,Object> scri
}
}

if (s.contains("/")){ // ignore the line if it doesn't contain a slash
if (s.startsWith("#")){ // Informational lines only, some may need to be added to event logging as reasons points were not awarded



}else if (s.contains("/")){ // ignore the line if it doesn't contain a slash
String[] split=s.split("/");

// take the last section of the script name as the pool id. so "trello" stays as "trello", but "trello.thoughtleadership" becomes "thoughtleadership" where the "trello" part is the source type/context
Expand Down
68 changes: 0 additions & 68 deletions src/main/java/com/redhat/sso/ninja/ManagementController.java
Original file line number Diff line number Diff line change
Expand Up @@ -292,74 +292,6 @@ public Response pushGraphDataOnly(@Context HttpServletRequest request, @Context
return newResponse(200).entity("RUNNING").build();
}

// // manually (via rest) to register new users via a rest/json payload
// // this is how you current add users to the system
// // not used
// @POST
// @Path("/users/register")
// public Response register(
// @Context HttpServletRequest request
// ,@Context HttpServletResponse response
// ,@Context ServletContext servletContext
// ,String raw
// ){
// try{
// log.debug("/register called");
//// String raw=IOUtils.toString(request.getInputStream());
// mjson.Json x=mjson.Json.read(raw);
//
// Database2 db=Database2.get();
// for (mjson.Json user:x.asJsonList()){
// String username=user.at("username").asString();
//
// if (db.getUsers().containsKey(username))
// db.getUsers().remove(username); // remove so we can overwrite the user details
//
// Map<String, String> userInfo=new HashMap<String, String>();
// for(Entry<String, Object> e:user.asMap().entrySet())
// userInfo.put(e.getKey(), (String)e.getValue());
//
// userInfo.put("level", LevelsUtil.get().getBaseLevel().getRight());
// userInfo.put("levelChanged", new SimpleDateFormat("yyyy-MM-dd").format(new Date()));// nextLevel.getRight());
//
// db.getUsers().put(username, userInfo);
// log.debug("New User Registered (via API): "+Json.newObjectMapper(true).writeValueAsString(userInfo));
// db.getScoreCards().put(username, new HashMap<String, Integer>());
//
// db.addEvent("New User Registered (via API)", username, "");
// }
//
// db.save();
// return Response.status(200).entity("{\"status\":\"DONE\"}").build();
// }catch(IOException e){
// e.printStackTrace();
// return Response.status(500).entity("{\"status\":\"ERROR\",\"message\":\""+e.getMessage()+"\"}").build();
// }
// }

// // manually (via rest) to increment the points for a specific user and pool id
// // intended for external scripts to update points, however there would be no event logging so lets deprecate for now
// // not used
// @GET
// @Path("/points/{user}/{pool}/{increment}")
// public Response incrementPool(
// @Context HttpServletRequest request
// ,@Context HttpServletResponse response
// ,@Context ServletContext servletContext
// ,@PathParam("user") String user
// ,@PathParam("pool") String pool
// ,@PathParam("increment") String increment
// ){
// try{
// Database2 db=Database2.get();
// db.increment(pool, user, Integer.valueOf(increment), null).save();
// db.save();
// return Response.status(200).entity("{\"status\":\"DONE\"}").build();
// }catch(Exception e){
// return Response.status(500).entity("{\"status\":\"ERROR\",\"message\":\""+e.getMessage()+"\"}").build();
// }
// }

// returns the database content - used in admin UI & backup purposes
@GET
@Path("/database/get")
Expand Down
30 changes: 16 additions & 14 deletions src/main/java/com/redhat/sso/ninja/chart/DataSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import java.util.List;

public class DataSet {
// private String fillColor; //ie "rgba(220,220,220,0.2)"
// private String strokeColor; //ie "rgba(220,220,220,1)"
private String fillColor; //ie "rgba(220,220,220,0.2)"
private String strokeColor; //ie "rgba(220,220,220,1)"

private List<Integer> data;
private Integer borderWidth;
Expand All @@ -19,18 +19,20 @@ public String getLabel() {
public void setLabel(String label) {
this.label = label;
}
// public String getFillColor() {
// return fillColor;
// }
// public void setFillColor(String fillColor) {
// this.fillColor=fillColor;
// }
// public String getStrokeColor() {
// return strokeColor;
// }
// public void setStrokeColor(String strokeColor) {
// this.strokeColor=strokeColor;
// }

public String getFillColor() {
return fillColor;
}
public void setFillColor(String fillColor) {
this.fillColor=fillColor;
}
public String getStrokeColor() {
return strokeColor;
}
public void setStrokeColor(String strokeColor) {
this.strokeColor=strokeColor;
}

public List<Integer> getData() {
if (data==null) data=new ArrayList<Integer>();
return data;
Expand Down
5 changes: 5 additions & 0 deletions src/main/webapp/support-trello-card.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ $(document).ready(function() {
}
document.getElementById("trelloCard").innerHTML=`<a href="https://trello.com/b/`+boardShortId+`?menu=filter&filter=member:`+trelloUsername+`">`+boardName+`</a>/`+data[key]['listName']+`/<a href="https://trello.com/c/`+cardShortId+`">`+data[key]['name']+`</a>`;
document.getElementById("trelloCardLongId").innerHTML=data[key]['id'];
document.getElementById("trelloCardShortId").innerHTML=cardShortId;
document.getElementById("trelloCardPointsExpected").innerHTML=pointsFromCardTitle;
document.getElementById("trelloCardMembers").innerHTML=members;
document.getElementById("trelloCardDateMovedToDone").innerHTML=(undefined!=dateMovedToDone?dateMovedToDone:"Never");
Expand Down Expand Up @@ -339,6 +342,8 @@ $(document).ready(function() {
<h3>Trello Card Information</h3>
<table border=1 style="width: 100%">
<tr><td class="title" style="width: 20%">Trello Card (Board/List/Card Title)</td><td><span id="trelloCard"></span></td></tr>
<tr><td class="title">Trello Long ID</td><td><span id="trelloCardLongId"></span></td></tr>
<tr><td class="title">Trello Short ID</td><td><span id="trelloCardShortId"></span></td></tr>
<tr><td class="title">Point Expected</td><td><span id="trelloCardPointsExpected"></span></td></tr>
<tr><td class="title">Members</td><td><span id="trelloCardMembers"></span></td></tr>
<tr><td class="title"><span title="Using Trello Activity logs, this is the date this card moved to (or passed) Done. It doesnt mean it's in the Done column now, it means it has been in the past">Date moved to Done</span></td><td><span id="trelloCardDateMovedToDone"></span></td></tr>
Expand Down

0 comments on commit 664f61f

Please sign in to comment.