Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fabio martelli
syncope
Commits
dc220b1a
Commit
dc220b1a
authored
Feb 03, 2017
by
Gianluca Filippone
Browse files
Action buttons on EE Resources tab now update when actions are performed
parent
8a1d2cff
Changes
4
Hide whitespace changes
Inline
Side-by-side
ext/choreography/client-console/src/main/java/org/apache/syncope/client/console/panels/ChoreographyEEResourcesPanel.java
View file @
dc220b1a
...
...
@@ -32,6 +32,7 @@ import org.apache.syncope.common.lib.to.AnyObjectTO;
import
org.apache.wicket.PageReference
;
import
org.apache.wicket.ajax.AjaxRequestTarget
;
import
org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink
;
import
org.apache.wicket.markup.html.WebMarkupContainer
;
import
org.apache.wicket.markup.html.basic.Label
;
import
org.apache.wicket.markup.html.panel.Panel
;
import
org.apache.wicket.markup.repeater.RepeatingView
;
...
...
@@ -39,13 +40,19 @@ import org.apache.wicket.model.Model;
public
class
ChoreographyEEResourcesPanel
extends
Panel
{
private
static
final
long
serialVersionUID
=
8745189061396851234L
;
private
final
ChoreographyRestClient
restClient
;
private
final
AnyObjectTO
enactmentEngine
;
private
final
BaseModal
<
Serializable
>
utilityModal
=
new
BaseModal
<>(
"resizeEEModal"
)
;
private
final
String
choreographyId
;
private
final
ChoreographyTO
choreography
;
private
final
PageReference
pageRef
;
private
final
WebMarkupContainer
content
;
private
final
BaseModal
<
Serializable
>
utilityModal
=
new
BaseModal
<>(
"resizeEEModal"
);
public
ChoreographyEEResourcesPanel
(
final
String
id
,
...
...
@@ -53,36 +60,32 @@ public class ChoreographyEEResourcesPanel extends Panel {
final
String
choreographyId
)
{
super
(
id
);
setOutputMarkupId
(
true
);
this
.
restClient
=
new
ChoreographyRestClient
();
this
.
choreography
=
restClient
.
getChoreography
(
choreographyId
)
;
this
.
enactmentEngine
=
restClient
.
getChoreographyEE
(
choreography
.
getId
())
;
this
.
choreography
Id
=
choreographyId
;
this
.
pageRef
=
pageRef
;
EnactmentEngineStatusTO
ee
=
restClient
.
getChoreography
EEStatus
(
enactmentEngine
.
getKey
(),
choreographyId
);
ChoreographyTO
choreography
=
restClient
.
getChoreography
(
choreographyId
);
double
ramPercentage
=
(
ee
.
getRamUsage
()
/
Float
.
valueOf
(
ee
.
getRamTotal
()))
*
100
;
double
storagePercentage
=
(
ee
.
getStorageUsage
()
/
Float
.
valueOf
(
ee
.
getStorageTotal
()))
*
100
;
this
.
enactmentEngine
=
restClient
.
getChoreographyEE
(
choreography
.
getId
());
this
.
content
=
new
WebMarkupContainer
(
"eeDetails"
);
content
.
add
(
buildResorucesOverviewPanel
());
content
.
add
(
new
ChoreographyVMDirectoryPanel
(
"virtualMachinesList"
,
pageRef
,
enactmentEngine
.
getKey
(),
choreographyId
));
content
.
add
(
buildActionsPanel
());
content
.
setOutputMarkupId
(
true
);
add
(
utilityModal
);
add
(
new
Label
(
"eeName"
,
enactmentEngine
.
getName
()));
add
(
content
);
add
(
utilityModal
);
setOutputMarkupId
(
true
);
}
RepeatingView
resourcesOverview
=
new
RepeatingView
(
"resourceWidget"
);
resourcesOverview
.
add
(
new
ResourceWidget
(
resourcesOverview
.
newChildId
(),
"bg-yellow"
,
ee
.
getVirtualMachinesCount
(),
"Virtual Machines"
,
"fa fa-cube"
));
resourcesOverview
.
add
(
new
ResourceWidget
(
resourcesOverview
.
newChildId
(),
"bg-red"
,
"CPU utilization"
,
ee
.
getCpuUsageRatio
(),
"fa fa-cogs"
));
resourcesOverview
.
add
(
new
ResourceWidget
(
resourcesOverview
.
newChildId
(),
"bg-green"
,
ee
.
getRamUsage
(),
ee
.
getRamTotal
(),
"RAM utilization"
,
ramPercentage
,
"MB"
,
""
));
resourcesOverview
.
add
(
new
ResourceWidget
(
resourcesOverview
.
newChildId
(),
"bg-aqua"
,
ee
.
getStorageUsage
(),
ee
.
getStorageTotal
(),
"Storage occupancy"
,
storagePercentage
,
"GB"
,
"fa fa-database"
));
add
(
resourcesOverview
);
private
ChoreographyActionsPanel
buildActionsPanel
()
{
ChoreographyTO
choreography
=
restClient
.
getChoreography
(
choreographyId
);
ChoreographyActionsPanel
actionsPanel
=
new
ChoreographyActionsPanel
(
"actionsPanel"
);
add
(
actionsPanel
);
actionsPanel
.
addAction
(
new
IndicatingAjaxLink
<
Void
>(
"link"
)
{
private
static
final
long
serialVersionUID
=
5283601360187316340L
;
...
...
@@ -113,6 +116,8 @@ public class ChoreographyEEResourcesPanel extends Panel {
?
e
.
getClass
().
getName
()
:
e
.
getMessage
());
}
((
BasePage
)
pageRef
.
getPage
()).
getNotificationPanel
().
refresh
(
target
);
content
.
addOrReplace
(
buildActionsPanel
());
target
.
add
(
content
);
}
},
ChoreographyActionsPanel
.
ChoreographyActionType
.
STOP
);
actionsPanel
.
addAction
(
new
IndicatingAjaxLink
<
Void
>(
"link"
)
{
...
...
@@ -130,6 +135,8 @@ public class ChoreographyEEResourcesPanel extends Panel {
?
e
.
getClass
().
getName
()
:
e
.
getMessage
());
}
((
BasePage
)
pageRef
.
getPage
()).
getNotificationPanel
().
refresh
(
target
);
content
.
addOrReplace
(
buildActionsPanel
());
target
.
add
(
content
);
}
},
ChoreographyActionsPanel
.
ChoreographyActionType
.
FREEZE
);
}
...
...
@@ -150,6 +157,8 @@ public class ChoreographyEEResourcesPanel extends Panel {
?
e
.
getClass
().
getName
()
:
e
.
getMessage
());
}
((
BasePage
)
pageRef
.
getPage
()).
getNotificationPanel
().
refresh
(
target
);
content
.
addOrReplace
(
buildActionsPanel
());
target
.
add
(
content
);
}
},
ChoreographyActionsPanel
.
ChoreographyActionType
.
START
);
}
...
...
@@ -170,12 +179,34 @@ public class ChoreographyEEResourcesPanel extends Panel {
?
e
.
getClass
().
getName
()
:
e
.
getMessage
());
}
((
BasePage
)
pageRef
.
getPage
()).
getNotificationPanel
().
refresh
(
target
);
content
.
addOrReplace
(
buildActionsPanel
());
target
.
add
(
content
);
}
},
ChoreographyActionsPanel
.
ChoreographyActionType
.
UNFREEZE
);
}
return
actionsPanel
;
}
private
RepeatingView
buildResorucesOverviewPanel
()
{
EnactmentEngineStatusTO
ee
=
restClient
.
getChoreographyEEStatus
(
enactmentEngine
.
getKey
(),
choreographyId
);
double
ramPercentage
=
(
ee
.
getRamUsage
()
/
Float
.
valueOf
(
ee
.
getRamTotal
()))
*
100
;
double
storagePercentage
=
(
ee
.
getStorageUsage
()
/
Float
.
valueOf
(
ee
.
getStorageTotal
()))
*
100
;
RepeatingView
resourcesOverview
=
new
RepeatingView
(
"resourceWidget"
);
resourcesOverview
.
add
(
new
ResourceWidget
(
resourcesOverview
.
newChildId
(),
"bg-yellow"
,
ee
.
getVirtualMachinesCount
(),
"Virtual Machines"
,
"fa fa-cube"
));
resourcesOverview
.
add
(
new
ResourceWidget
(
resourcesOverview
.
newChildId
(),
"bg-red"
,
"CPU utilization"
,
ee
.
getCpuUsageRatio
(),
"fa fa-cogs"
));
resourcesOverview
.
add
(
new
ResourceWidget
(
resourcesOverview
.
newChildId
(),
"bg-green"
,
ee
.
getRamUsage
(),
ee
.
getRamTotal
(),
"RAM utilization"
,
ramPercentage
,
"MB"
,
""
));
resourcesOverview
.
add
(
new
ResourceWidget
(
resourcesOverview
.
newChildId
(),
"bg-aqua"
,
ee
.
getStorageUsage
(),
ee
.
getStorageTotal
(),
"Storage occupancy"
,
storagePercentage
,
"GB"
,
"fa fa-database"
));
add
(
new
ChoreographyVMDirectoryPanel
(
"virtualMachinesList"
,
pageRef
,
enactmentEngine
.
getKey
(),
choreography
.
getId
()));
return
resourcesOverview
;
}
}
ext/choreography/client-console/src/main/java/org/apache/syncope/client/console/panels/ChoreographyVMDirectoryPanel.java
View file @
dc220b1a
...
...
@@ -112,8 +112,6 @@ public class ChoreographyVMDirectoryPanel extends DirectoryPanel<
}
});
//columns.add(new PropertyColumn<>(new ResourceModel(
// "choreography", "Deployed Choreography"), "Deployed Choreography", "choreography"));
columns
.
add
(
new
PropertyColumn
<>(
new
ResourceModel
(
"sysOp"
,
"OS"
),
"OS"
,
"sysOp"
));
columns
.
add
(
new
PropertyColumn
<>(
new
ResourceModel
(
"ip"
,
"IP Address"
),
"IP Address"
,
"ip"
));
columns
.
add
(
new
PropertyColumn
<>(
new
ResourceModel
(
"hostname"
,
"Hostname"
),
"Hostname"
,
"hostname"
));
...
...
ext/choreography/client-console/src/main/resources/org/apache/syncope/client/console/panels/ChoreographyEEResourcesPanel.html
View file @
dc220b1a
...
...
@@ -17,13 +17,15 @@ limitations under the License.
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:wicket=
"http://wicket.apache.org"
>
<wicket:panel>
<h3><wicket:message
key=
"enactmentEngine"
/>
<span
wicket:id=
"eeName"
/></h3>
<div
class=
"row"
>
<span
wicket:id=
"resourceWidget"
/>
<div
wicket:id=
"eeDetails"
>
<div
class=
"row"
>
<span
wicket:id=
"resourceWidget"
/>
</div>
<h3><wicket:message
key=
"actions"
/></h3>
<div
wicket:id=
"actionsPanel"
/>
<h3><wicket:message
key=
"virtualMachines"
/></h3>
<div
wicket:id=
"virtualMachinesList"
/>
</div>
<h3><wicket:message
key=
"actions"
/></h3>
<div
wicket:id=
"actionsPanel"
/>
<h3><wicket:message
key=
"virtualMachines"
/></h3>
<div
wicket:id=
"virtualMachinesList"
/>
<div
wicket:id=
"resizeEEModal"
/>
</wicket:panel>
</html>
ext/ee/client-console/src/main/java/org/apache/syncope/client/console/pages/EnactmentEnginePage.java
View file @
dc220b1a
...
...
@@ -74,7 +74,7 @@ public class EnactmentEnginePage extends BaseExtPage {
@Override
public
void
onClose
(
final
AjaxRequestTarget
target
)
{
target
.
add
(
getEEDirectoryPanel
(
));
target
.
add
(
new
EnactmentEngineDirectoryPanel
(
"enactmentengines"
,
getPageReference
()
));
target
.
add
(
content
);
utilityModal
.
show
(
false
);
}
...
...
@@ -84,9 +84,4 @@ public class EnactmentEnginePage extends BaseExtPage {
body
.
add
(
content
);
body
.
setOutputMarkupId
(
true
);
}
private
EnactmentEngineDirectoryPanel
getEEDirectoryPanel
()
{
return
new
EnactmentEngineDirectoryPanel
(
"enactmentengines"
,
getPageReference
());
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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