Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
8c71321
reintroduced graph view after it was removed by merge
janniclas Jan 17, 2019
7e262ea
using routerLink instead of href link to permit the side from actuall…
janniclas Jan 18, 2019
9dabb82
manually included the update regarding renderRows
janniclas Jan 18, 2019
13f6639
temporary making graph view reachable over a navigation button
janniclas Jan 18, 2019
1f84546
check if add dialog status is add before actually adding the componen…
janniclas Jan 18, 2019
d9c3968
corrected comparison of dialog result
janniclas Jan 18, 2019
cf935ca
graph service is now able to update changed elements in addition to r…
janniclas Jan 18, 2019
3eae2a5
added default grid layout for the time being
janniclas Jan 18, 2019
2f03fda
storing status in nodes and edges to chose the correct visualization …
janniclas Jan 18, 2019
cdf557e
added handling of hypothetically different images corresponding to in…
janniclas Jan 18, 2019
6817450
added color scheme to edges to indecate their state
janniclas Jan 18, 2019
12b78d6
updated dependencies
janniclas Jan 20, 2019
640074f
Added table expand feature to display docker ID and labels.
Naveenkumar27 Jan 23, 2019
366782f
Changed the datatype.
Naveenkumar27 Jan 24, 2019
e3b0c03
added default line color to keep layout from breaking with unkown lin…
janniclas Jan 24, 2019
b493035
Fixed the button outline and overflowing of table.
Naveenkumar27 Jan 24, 2019
fe56195
added specific images for the instances depending on their state.
janniclas Jan 24, 2019
434a16f
Implementation of Authorization provider
Ayybeeshafi Jan 24, 2019
14316fd
fixed the pull request comments.
Naveenkumar27 Jan 24, 2019
fae6903
Merge pull request #104 from delphi-hub/feature/tableExpansion
janniclas Jan 27, 2019
4c21178
ishwaryamamidi Jan 28, 2019
5b2f566
ishwaryamamidi Jan 30, 2019
d6e3bc1
merged develop
janniclas Jan 30, 2019
77c71b3
fixed missed merge conflict
janniclas Jan 30, 2019
e6e4951
fixed test cases by adding the correct imports
janniclas Jan 30, 2019
ac980b4
removed unused import
janniclas Jan 30, 2019
60daff2
Implementation of Authorization for Delphi Management refs #105
Ayybeeshafi Jan 30, 2019
09cb1b8
ishwaryamamidi Jan 30, 2019
08cf57d
ishwaryamamidi Jan 31, 2019
d604acf
Merge branch 'feature/cytoscape' into feature/newUI
ishwaryamamidi Jan 31, 2019
c0a56e1
Implementation of authenticate on InstanceRegistryController refs #105
Ayybeeshafi Jan 31, 2019
b7969c9
Merge pull request #106 from delphi-hub/feature/cytoscape
janniclas Jan 31, 2019
8c5a80f
ishwaryamamidi Jan 31, 2019
6a4e75c
first basic hacky drag and drop functionality with hide nodes of inco…
janniclas Jan 31, 2019
4b7f532
Authentication of Delphi-Management refs #105
Ayybeeshafi Jan 31, 2019
5690662
Authentication of Delphi Management
Ayybeeshafi Feb 3, 2019
dc7afc1
Code commenting and formmating refs #105
Ayybeeshafi Feb 3, 2019
b3f8dc4
Merge branch 'develop' into feature/Authorization
janniclas Feb 4, 2019
37802bc
Merge branch 'develop' into release/0.8.0
janniclas Feb 4, 2019
92ef050
Merge pull request #110 from delphi-hub/release/0.8.0
bhermann Feb 4, 2019
4d9ecbe
Merge branch 'develop' into feature/Authorization
janniclas Feb 4, 2019
6250f0e
Fix of ambigious implicit values
Ayybeeshafi Feb 4, 2019
04d7fbf
Merge branch 'feature/Authorization' of https://github.com/delphi-hub…
Ayybeeshafi Feb 4, 2019
5f56a0b
added default img for unkown component states as described in https:/…
janniclas Feb 5, 2019
6dae3dc
restructured code for hiding invalid graph elements during drag and d…
janniclas Feb 5, 2019
09b7133
added code comments and some further cleanup
janniclas Feb 5, 2019
281496a
added an explicit class for the graph layout settings to unclutter th…
janniclas Feb 7, 2019
012fbb0
calculating the node to disconnect from when connecting to a differen…
janniclas Feb 7, 2019
33f2256
ishwaryamamidi Feb 7, 2019
db5753e
Basic Authentication of Components with IR is now working refs #105
Ayybeeshafi Feb 7, 2019
dcebdfe
ishwaryamamidi Feb 7, 2019
544113e
Adapting Delphi Management to new API. Adding Instance now works refs…
Ayybeeshafi Feb 7, 2019
d5de64e
Adating Delphi Management methods according to the new API refs #113
Ayybeeshafi Feb 8, 2019
d37dde2
Adatpting to new API. refs #113
Ayybeeshafi Feb 8, 2019
644fff1
ishwaryamamidi Feb 10, 2019
f161441
Merge branch 'develop' into feature/newUI
janniclas Feb 10, 2019
bf97647
updated api endpoint for getting the whole instance network
janniclas Feb 10, 2019
742faed
removed unneccessary user name passwort config
janniclas Feb 10, 2019
15003f6
corrected new api path for post instance
janniclas Feb 10, 2019
8919499
updated the handle action endpoint to new api
janniclas Feb 11, 2019
df87076
added api endpoint for reconnecting instances
janniclas Feb 11, 2019
46be8e8
Merge branch 'feature/Authorization' into feature/dragAndDropEdges
janniclas Feb 11, 2019
82940e3
supports drag and drop reconnect
janniclas Feb 11, 2019
40e8807
destroies cytoscape instance when component gets unmounted
janniclas Feb 11, 2019
7916f14
style fix
janniclas Feb 11, 2019
e3a9fef
included graph view in dashboard overview
janniclas Feb 11, 2019
8f4266a
ishwaryamamidi Feb 11, 2019
ba8506c
Merge remote-tracking branch 'origin/feature/newUI' into feature/newUI
ishwaryamamidi Feb 11, 2019
e90cba9
Merge remote-tracking branch 'origin/feature/newUI' into feature/newUI
ishwaryamamidi Feb 11, 2019
f668a3b
Now token expires after 30 minutes and Strings are loaded from Config…
Ayybeeshafi Feb 11, 2019
8c786ea
Scheduling of Generation of Tokens refs #105
Ayybeeshafi Feb 12, 2019
345bc68
ishwaryamamidi Feb 12, 2019
11633e4
Merge remote-tracking branch 'origin/feature/newUI' into feature/newUI
ishwaryamamidi Feb 12, 2019
a02df69
Generation of token at each method call
Ayybeeshafi Feb 12, 2019
84ae01f
auto refreshing expired token
janniclas Feb 13, 2019
88d758e
fixed style issue regarding return
janniclas Feb 14, 2019
7215ab3
scala style fixes
janniclas Feb 14, 2019
5599b67
updated info center default message.
janniclas Feb 14, 2019
2c5cc3d
merged new ui branch
janniclas Feb 14, 2019
36e0522
Merge remote-tracking branch 'origin/feature/Authorization' into feat…
janniclas Feb 14, 2019
8349a82
fixed old auth header bug
janniclas Feb 14, 2019
b1199ba
added safeguard to only register edgehandles once
janniclas Feb 14, 2019
be76175
fixed cytoscape edgehandles reregistration bug.
janniclas Feb 14, 2019
3524997
create initilization data for newly registred components to fix a bug…
janniclas Feb 14, 2019
10566d5
fixed import errors in test cases
janniclas Feb 14, 2019
70a0e93
Merge pull request #114 from delphi-hub/feature/newUI
janniclas Feb 14, 2019
2ed6a60
Merge branch 'develop' into feature/Authorization
janniclas Feb 14, 2019
63d88bf
Merge branch 'develop' into feature/dragAndDropEdges
janniclas Feb 14, 2019
628f83e
Merge pull request #109 from delphi-hub/feature/Authorization
bhermann Feb 15, 2019
51e94cc
Merge branch 'develop' into feature/dragAndDropEdges
janniclas Feb 15, 2019
5b3db88
Merge pull request #115 from delphi-hub/feature/dragAndDropEdges
janniclas Feb 18, 2019
e202133
bumped version to 0.9.0
janniclas Feb 18, 2019
4701813
Merge branch 'master' into release/0.9.0
janniclas Feb 18, 2019
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
46 changes: 46 additions & 0 deletions app/authorization/AuthProvider.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (C) 2018 The Delphi Team.
// See the LICENCE file distributed with this work for additional
// information regarding copyright ownership.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package authorization


import pdi.jwt.{Jwt, JwtAlgorithm, JwtClaim}
import play.api.Configuration

object AuthProvider {

var Token = "" // scalastyle:ignore

/** This method generates JWT token for registering Delphi-Management at the Instance-Registry
*
* @param validFor
* @return
*/

def generateJwt(validFor: Long = 1)(implicit configuration: Configuration): String = {
val jwtSecretKey = configuration.get[String]("play.http.secret.JWTkey")
if (Token == "" || !Jwt.isValid(Token, jwtSecretKey, Seq(JwtAlgorithm.HS256))) {
val claim = JwtClaim()
.issuedNow
.expiresIn(validFor * 300)
.startsNow
. +("user_id", configuration.get[String]("play.http.instance"))
. +("user_type", "Admin")

Token = Jwt.encode(claim, jwtSecretKey, JwtAlgorithm.HS256)
}
Token
}
}
2 changes: 1 addition & 1 deletion app/controllers/ApiRouter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ class ApiRouter @Inject()(irController: InstanceRegistryController, sysControlle
case POST(p"/pauseInstance" ? q"instanceID=$instanceID") => irController.handleRequest(action="/pause", instanceID)
case POST(p"/resumeInstance" ? q"instanceID=$instanceID") => irController.handleRequest(action="/resume", instanceID)
case POST(p"/deleteInstance" ? q"instanceID=$instanceID") => irController.handleRequest(action="/delete", instanceID)

case POST(p"/reconnectInstance" ? q"from=$from"& q"to=$to") => irController.reconnect(from.toInt, to.toInt)
}
}
89 changes: 66 additions & 23 deletions app/controllers/InstanceRegistryController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ import akka.actor.{ActorRef, ActorSystem}
import javax.inject.Inject
import play.api.{Configuration, Logger}
import play.api.libs.concurrent.CustomExecutionContext
import play.api.libs.json._
import play.api.libs.ws.WSClient
import akka.stream.Materializer
import play.api.libs.streams.ActorFlow
import actors.{ClientSocketActor, PublishSocketMessageActor}
import play.api.mvc._

import scala.concurrent.ExecutionContext
import authorization.AuthProvider
import play.api.libs.json.Json



trait MyExecutionContext extends ExecutionContext
Expand Down Expand Up @@ -63,9 +64,15 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma
val instanceRegistryUri = config.get[String]("app.instanceRegistryUri")
val instanceRegistryBasePath = config.get[String]("app.instanceRegistryBasePath")

/**This method maps list of instances with specific componentType.
*
* @param componentType
* @return
*/
def instances(componentType: String): Action[AnyContent] = Action.async {

ws.url(instanceRegistryUri + "/instances").addQueryStringParameters("ComponentType" -> componentType).get().map { response =>
ws.url(instanceRegistryUri).addQueryStringParameters("ComponentType" -> componentType)
.withHttpHeaders(("Authorization", s"Bearer ${AuthProvider.generateJwt()}"))
.get().map { response =>
// TODO: possible handling of parsing the data can be done here

Ok(response.body)
Expand All @@ -80,8 +87,15 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma
}
}

/**Called to fetch network graph of current registry. Contains a list of all instances and all links
* currently registered.
*
* @return
*/

def getNetwork(): Action[AnyContent] = Action.async {
ws.url(instanceRegistryUri + "/network").get().map { response =>
ws.url(instanceRegistryUri + "/instances/network").withHttpHeaders(("Authorization", s"Bearer ${AuthProvider.generateJwt()}"))
.get().map { response =>
// TODO: possible handling of parsing the data can be done here
Logger.debug(response.body)
if (response.status == 200) {
Expand All @@ -92,10 +106,20 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma
}(myExecutionContext)
}

def numberOfInstances(componentType: String) : Action[AnyContent] = Action.async {
/**
* Fetches the number of instances for the specified ComponentType. The ComponentType is an optional parameter which is passed as an query
* argument named 'ComponentType'
*
* @param componentType
* @return
*/

def numberOfInstances(componentType: String): Action[AnyContent] = Action.async {
// TODO: handle what should happen if the instance registry is not reachable.
// TODO: create constants for the urls
ws.url(instanceRegistryUri + "/numberOfInstances").addQueryStringParameters("ComponentType" -> componentType).get().map { response =>
ws.url(instanceRegistryUri + "/count").addQueryStringParameters("ComponentType" -> componentType)
.withHttpHeaders(("Authorization", s"Bearer ${AuthProvider.generateJwt()}"))
.get().map { response =>
// TODO: possible handling of parsing the data can be done here
if (response.status == 200) {
Ok(response.body)
Expand All @@ -106,31 +130,51 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma
}

/**
* This function is for handling all(start, stop, play, pause, resume) POST request.
* To control the instance State
* @param componentId
*/
* This function is for handling all(start, stop, play, pause, resume) POST request.
* To control the instance State (E.g. /instances/42/stop )
*
* @param componentId
*/


def handleRequest(action: String, instanceID: String): Action[AnyContent] = Action.async { request =>
ws.url(instanceRegistryUri + action)
.addQueryStringParameters("Id" -> instanceID)
ws.url(instanceRegistryUri + "/instances/" + instanceID + action)
.withHttpHeaders(("Authorization", s"Bearer ${AuthProvider.generateJwt()}"))
.post("")
.map { response =>
new Status(response.status)
}(myExecutionContext)
}

def reconnect(from: Int, to: Int): Action[AnyContent] = Action.async { request =>

ws.url(instanceRegistryUri + "/instances/" + from + "/assignInstance"
)
.withHttpHeaders(("Authorization", s"Bearer ${AuthProvider.generateJwt()}"))
.post(Json.obj("AssignedInstanceId" -> to))
.map { response =>
response.status match {
case 200 =>
Ok(response.body)
case x =>
new Status(x)
}
}(myExecutionContext)
}
/**
* This function is for handling an POST request for adding an instance to the Scala web server
*
* @param componentType
* @param name
*/
def postInstance(compType: String, name: String): Action[AnyContent] = Action.async { request =>
ws.url(instanceRegistryUri + "/deploy")
.addQueryStringParameters("ComponentType" -> compType, "InstanceName" -> name)
.post("")
* This function is for handling an POST request for adding an instance to the Scala web server
* (E.g. .../instances/deploy
*
* @param componentType
* @param name
*/

def postInstance(compType: String, name: String): Action[AnyContent] = Action.async
{
request =>
ws.url(instanceRegistryUri + "/instances/deploy")
.withHttpHeaders(("Authorization", s"Bearer ${AuthProvider.generateJwt()}"))
.post(Json.obj("ComponentType" -> compType, "InstanceName" -> name))
.map { response =>
response.status match {
// scalastyle:off magic.number
Expand All @@ -142,5 +186,4 @@ class InstanceRegistryController @Inject()(implicit system: ActorSystem, mat: Ma
}
}(myExecutionContext)
}

}
6 changes: 5 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ name := "delphi-management"

organization := "de.upb"

version := "0.8.0"

version := "0.9.0"


scalaVersion := "2.12.4"

Expand Down Expand Up @@ -58,3 +60,5 @@ libraryDependencies ++= Seq(
"com.google.guava" % "guava" % "25.1-jre",
"org.apache.commons" % "commons-compress" % "1.16"
)

libraryDependencies += "com.pauldijou" %% "jwt-core" % "1.0.0"
Loading