Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
executionware_ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PaaSage
executionware_ui
Commits
6852e8ef
Commit
6852e8ef
authored
Sep 25, 2015
by
Ahmed Zarioh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
centralize parseResult
parent
0dfde9f7
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
70 additions
and
42 deletions
+70
-42
app/RestService.php
app/RestService.php
+30
-24
app/Service/Colosseum/ApplicationService.php
app/Service/Colosseum/ApplicationService.php
+7
-8
app/Service/Colosseum/VirtualMachineService.php
app/Service/Colosseum/VirtualMachineService.php
+6
-6
app/Service/KairosService.php
app/Service/KairosService.php
+8
-2
config/metrics.json
config/metrics.json
+6
-0
executionware-ui-apis.json
executionware-ui-apis.json
+1
-1
public/js/controller/Charts/ChartsController.js
public/js/controller/Charts/ChartsController.js
+11
-0
public/partials/rawMonitor-detail.html
public/partials/rawMonitor-detail.html
+1
-1
No files found.
app/RestService.php
View file @
6852e8ef
...
...
@@ -69,9 +69,12 @@ class RestService
{
$apiObjects
[
$value2
]
=
[];
$temp
=
static
::
getSimpleAll
(
$value2
);
foreach
(
$temp
as
$k
=>
$val
)
if
(
isset
(
$temp
))
{
$apiObjects
[
$value2
][
$val
->
id
]
=
$val
;
foreach
(
$temp
as
$k
=>
$val
)
{
$apiObjects
[
$value2
][
$val
->
id
]
=
$val
;
}
}
}
}
...
...
@@ -131,39 +134,42 @@ class RestService
public
static
function
getAll
(
$apiname
)
{
$result
=
static
::
getSimpleAll
(
$apiname
);
$apiObjects
=
static
::
getCurrentObjectOptions
();
$fkList
=
static
::
getFKList
(
$GLOBALS
[
'currentobject'
][
"form"
]);
foreach
(
$result
as
$key1
=>
$value1
)
{
foreach
(
$
fkList
as
$key2
=>
$value2
)
if
(
count
(
$result
))
{
$apiObjects
=
static
::
getCurrentObjectOptions
();
$fkList
=
static
::
getFKList
(
$GLOBALS
[
'currentobject'
][
"form"
]);
foreach
(
$
result
as
$key1
=>
$value1
)
{
if
(
isset
(
$value1
->
$key2
)
&&
!
(
isset
(
$GLOBALS
[
'config'
][
'apisObjects'
][
$apiname
][
"form"
][
$key2
][
"isArray"
])
&&
$GLOBALS
[
'config'
][
'apisObjects'
][
$apiname
][
"form"
][
$key2
][
"isArray"
]
==
true
))
foreach
(
$fkList
as
$key2
=>
$value2
)
{
if
(
is_array
(
$value2
))
if
(
isset
(
$value1
->
$key2
)
&&
!
(
isset
(
$GLOBALS
[
'config'
][
'apisObjects'
][
$apiname
][
"form"
][
$key2
][
"isArray"
])
&&
$GLOBALS
[
'config'
][
'apisObjects'
][
$apiname
][
"form"
][
$key2
][
"isArray"
]
==
true
))
{
$cont
=
true
;
if
(
is_array
(
$value2
))
{
$cont
=
true
;
foreach
(
$value2
as
$key3
=>
$value3
)
{
if
(
$cont
&&
isset
(
$apiObjects
[
$value3
][
$value1
->
$key2
]))
foreach
(
$value2
as
$key3
=>
$value3
)
{
$current
=
$apiObjects
[
$value3
][
$value1
->
$key2
];
$result
[
$key1
]
->
$key2
=
Tools
::
convertToField
(
$current
,
$value3
);
$cont
=
false
;
if
(
$cont
&&
isset
(
$apiObjects
[
$value3
][
$value1
->
$key2
]))
{
$current
=
$apiObjects
[
$value3
][
$value1
->
$key2
];
$result
[
$key1
]
->
$key2
=
Tools
::
convertToField
(
$current
,
$value3
);
$cont
=
false
;
}
}
}
}
else
{
$current
=
$apiObjects
[
$value2
][
$value1
->
$key2
]
;
$result
[
$key1
]
->
$key2
=
Tools
::
convertToField
(
$current
,
$value2
);
else
{
$current
=
$apiObjects
[
$value2
][
$value1
->
$key2
];
$result
[
$key1
]
->
$key2
=
Tools
::
convertToField
(
$current
,
$value2
)
;
}
}
}
}
}
}
return
static
::
parseResults
(
$result
);
}
...
...
app/Service/Colosseum/ApplicationService.php
View file @
6852e8ef
...
...
@@ -75,27 +75,27 @@ class ApplicationService extends ColosseumService
{
$url
=
"/
$apiname
/
$val
"
;
//GET APPLICATION BY ID
$result
=
static
::
parseResult
(
static
::
getResponse
(
$url
,
'GET'
,
''
)
);
$result
=
parent
::
getSimpleOne
(
$apiname
,
$val
);
//GET ApplicationComponent BY application id
$applicationComponents
=
static
::
parseResults
(
static
::
getResponse
(
"/ac"
,
'GET'
,
''
)
);
$applicationComponents
=
parent
::
getSimpleAll
(
"applicationComponent"
);
$result
->
applicationComponents
=
[];
$result
->
applicationComponentsById
=
[];
foreach
(
$applicationComponents
as
$key
=>
$value
)
{
if
(
$result
->
id
==
$value
->
application
)
{
$component
=
static
::
parseResult
(
static
::
getResponse
(
"/lifecycleComponent/"
.
$value
->
component
,
'GET'
,
''
)
);
$component
=
parent
::
getSimpleOne
(
"component"
,
$value
->
component
);
$value
->
components
=
[
$component
];
$result
->
applicationComponentsById
[
$value
->
id
]
=
$value
;
$result
->
applicationComponents
[]
=
$value
;
}
}
//GET portReq BY application id
$portReqs
=
static
::
parseResults
(
static
::
getResponse
(
"/portReq"
,
'GET'
,
''
)
);
$portReqs
=
parent
::
getSimpleAll
(
"requiredPort"
);
$result
->
portReqs
=
[];
foreach
(
$portReqs
as
$key
=>
$value
)
{
if
(
array_key_exists
(
$value
->
applicationComponent
,
$result
->
applicationComponentsById
))
...
...
@@ -106,7 +106,7 @@ class ApplicationService extends ColosseumService
}
//GET portProv BY application id
$portProvs
=
static
::
parseResults
(
static
::
getResponse
(
"/portProv"
,
'GET'
,
''
)
);
$portProvs
=
parent
::
getSimpleAll
(
"providedPort"
);
$result
->
portProvs
=
[];
foreach
(
$portProvs
as
$key
=>
$value
)
{
...
...
@@ -118,7 +118,7 @@ class ApplicationService extends ColosseumService
}
//GET COMMUCICATION by ...
$communications
=
static
::
parseResults
(
static
::
getResponse
(
"/communication"
,
'GET'
,
''
)
);
$communications
=
parent
::
getSimpleAll
(
"communication"
);
$result
->
communications
=
[];
foreach
(
$communications
as
$key
=>
$value
)
{
...
...
@@ -131,5 +131,4 @@ class ApplicationService extends ColosseumService
}
return
static
::
parseResult
(
$result
);
}
}
\ No newline at end of file
app/Service/Colosseum/VirtualMachineService.php
View file @
6852e8ef
...
...
@@ -30,12 +30,12 @@ class VirtualMachineService extends ColosseumService
{
$url
=
"/
$apiname
/
$val
"
;
//GET VM BY ID
$result
=
static
::
parseResult
(
static
::
getResponse
(
$url
,
'GET'
,
''
,
$apiname
)
);
$result
=
parent
::
getOne
(
$apiname
,
$val
);
//GET monitorInstance
$result
->
monitorInstances
=
[];
//$result->monitorInstancesById = [];
$monitorInstances
=
static
::
parseResults
(
static
::
getResponse
(
"/monitorInstance"
,
'GET'
,
''
,
$apiname
)
);
$monitorInstances
=
parent
::
getSimpleAll
(
"monitorInstance"
);
foreach
(
$monitorInstances
as
$key
=>
$value
)
{
if
(
$result
->
id
==
$value
->
virtualMachine
)
...
...
@@ -51,10 +51,10 @@ class VirtualMachineService extends ColosseumService
{
//"rawMonitor","composedMonitor","constantMonitor"
$rawMonitors
=
static
::
parseResults
(
static
::
getResponse
(
"/rawMonitor"
,
'GET'
,
''
,
$apiname
)
);
$composedMonitors
=
static
::
parseResults
(
static
::
getResponse
(
"/composedMonitor"
,
'GET'
,
''
,
$apiname
)
);
$constantMonitors
=
static
::
parseResults
(
static
::
getResponse
(
"/constantMonitor"
,
'GET'
,
''
,
$apiname
)
);
$sensorDescriptions
=
static
::
parseResults
(
static
::
getResponse
(
"/sensorDescription"
,
'GET'
,
''
,
$apiname
)
);
$rawMonitors
=
parent
::
getSimpleAll
(
"rawMonitor"
);
$composedMonitors
=
parent
::
getSimpleAll
(
"composedMonitor"
);
$constantMonitors
=
parent
::
getSimpleAll
(
"constantMonitor"
);
$sensorDescriptions
=
parent
::
getSimpleAll
(
"sensorDescription"
);
$rawMonitorsById
=
Tools
::
getKeyValueArray
(
$rawMonitors
);
$composedMonitorsById
=
Tools
::
getKeyValueArray
(
$composedMonitors
);
...
...
app/Service/KairosService.php
View file @
6852e8ef
...
...
@@ -51,8 +51,14 @@ class KairosService extends RestService
)
);
$url
=
isset
(
$chartInfo
->
apiEndpoint
)
?
"http://"
.
$chartInfo
->
apiEndpoint
:
$GLOBALS
[
'config'
][
'apis'
][
'kairosapi'
][
'url'
];
$url
=
$url
.
":8080/api/v1/datapoints/query"
;
if
(
isset
(
$chartInfo
->
apiEndpoint
))
{
$url
=
"http://"
.
$chartInfo
->
apiEndpoint
.
":8080/api/v1/datapoints/query"
;
}
else
{
$url
=
$GLOBALS
[
'config'
][
'apis'
][
'kairosapi'
][
'url'
];
}
$option
=
array
(
'metrics'
=>
[
$metric
],
...
...
config/metrics.json
View file @
6852e8ef
...
...
@@ -6,6 +6,12 @@
"start_relative"
:{
"value"
:
"1"
,
"unit"
:
"hours"
}
},
"de.uniulm.omi.cloudiator.visor.sensors.MemoryUsageSensor"
:
{
"aggregator"
:
{
"name"
:
"avg"
},
"interval"
:
{
"value"
:
"1"
,
"unit"
:
"seconds"
},
"start_relative"
:{
"value"
:
"1"
,
"unit"
:
"hours"
}
},
"default"
:
{
"aggregator"
:
{
"name"
:
"avg"
},
"interval"
:
{
"value"
:
"1"
,
"unit"
:
"seconds"
},
...
...
executionware-ui-apis.json
View file @
6852e8ef
...
...
@@ -6,7 +6,7 @@
},
"kairosapi"
:
{
"name"
:
"kairosapi"
,
"url"
:
"http://52.21.93.224"
,
"url"
:
"http://52.21.93.224
:8080/api/v1/datapoints/query
"
,
"controller"
:
"KairosController"
,
"router"
:
"KairosRouter"
}
...
...
public/js/controller/Charts/ChartsController.js
View file @
6852e8ef
...
...
@@ -24,6 +24,17 @@
crudControllers
.
controller
(
'
ChartsCtrl
'
,
function
(
$scope
,
$interval
,
$http
,
ajaxFactory
)
{
$scope
.
url
=
"
kairosapi/charts
"
;
$scope
.
init2
=
function
(
id
,
metricName
=
null
,
apiEndpoint
=
null
)
{
monitorInstance
=
{};
monitorInstance
.
id
=
id
;
monitorInstance
.
metricName
=
metricName
;
monitorInstance
.
apiEndpoint
=
apiEndpoint
;
$scope
.
init
(
monitorInstance
);
}
$scope
.
init
=
function
(
monitorInstance
)
{
$scope
.
graphDetails
=
{};
...
...
public/partials/rawMonitor-detail.html
View file @
6852e8ef
...
...
@@ -9,7 +9,7 @@
<div>
<div
class=
"col-md-6 mgt10"
ng-repeat=
"(k,v) in item.monitorInstances"
ng-init=
"init
(v
)"
ng-init=
"init
2(v.id, v.metricName, v.apiEndpoint
)"
ng-include=
"chart.url"
ng-controller=
'ChartsCtrl'
id=
"graph-num-{{k}}"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment