Skip to content

Commit

Permalink
Merge pull request #2882 from zlamalp/startsync
Browse files Browse the repository at this point in the history
GUI: Show new group sync attribute with start time
  • Loading branch information
zlamalp authored Sep 2, 2020
2 parents 25d2b30 + 9898892 commit bb85379
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public void onFinished(JavaScriptObject jso) {

final RichGroup object = jso.cast();

String name, syncEnabled, syncInterval, syncTimestamp, syncSuccessTimestamp, syncState, authGroup, syncTimes, syncSuccessStartTimestamp;
String name, syncEnabled, syncInterval, syncStartTimestamp, syncTimestamp, syncSuccessTimestamp, syncState, authGroup, syncTimes, syncSuccessStartTimestamp;
name = object.getName();
if (object.isSyncEnabled()) {
syncEnabled = "enabled";
Expand Down Expand Up @@ -268,6 +268,11 @@ public void onFinished(JavaScriptObject jso) {
} else {
syncTimestamp = object.getLastSynchronizationTimestamp().split("\\.")[0];
}
if (object.getStartOfLastSynchronizationTimestamp() == null) {
syncStartTimestamp = "N/A";
} else {
syncStartTimestamp = object.getStartOfLastSynchronizationTimestamp().split("\\.")[0];
}
if (object.getLastSuccessSynchronizationTimestamp() == null) {
syncSuccessTimestamp = "N/A";
} else {
Expand All @@ -292,7 +297,8 @@ public void onFinished(JavaScriptObject jso) {

if (object.isSyncEnabled()) {
html += "Last sync. state: <b>"+SafeHtmlUtils.fromString(syncState).asString()+"</b><br>";
html += "Last sync. timestamp: <b>"+SafeHtmlUtils.fromString(syncTimestamp).asString()+"</b><br>";
html += "Last sync. timestamp (start): <b>"+SafeHtmlUtils.fromString(syncStartTimestamp).asString()+"</b><br>";
html += "Last sync. timestamp (end): <b>"+SafeHtmlUtils.fromString(syncTimestamp).asString()+"</b><br>";
html += "Last successful sync. timestamp (start): <b>"+SafeHtmlUtils.fromString(syncSuccessStartTimestamp).asString()+"</b><br>";
html += "Last successful sync. timestamp (end): <b>"+SafeHtmlUtils.fromString(syncSuccessTimestamp).asString()+"</b><br>";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public void onFinished(JavaScriptObject jso) {

final RichGroup object = jso.cast();

String name, syncEnabled, syncInterval, syncTimestamp, syncSuccessTimestamp, syncState, authGroup, syncTimes, syncSuccessStartTimestamp;
String name, syncEnabled, syncInterval, syncStartTimestamp, syncTimestamp, syncSuccessTimestamp, syncState, authGroup, syncTimes, syncSuccessStartTimestamp;
name = object.getName();
if (object.isSyncEnabled()) {
syncEnabled = "enabled";
Expand Down Expand Up @@ -231,6 +231,11 @@ public void onFinished(JavaScriptObject jso) {
} else {
syncTimestamp = object.getLastSynchronizationTimestamp().split("\\.")[0];
}
if (object.getStartOfLastSynchronizationTimestamp() == null) {
syncStartTimestamp = "N/A";
} else {
syncStartTimestamp = object.getStartOfLastSynchronizationTimestamp().split("\\.")[0];
}
if (object.getLastSuccessSynchronizationTimestamp() == null) {
syncSuccessTimestamp = "N/A";
} else {
Expand All @@ -255,7 +260,8 @@ public void onFinished(JavaScriptObject jso) {

if (object.isSyncEnabled()) {
html += "Last sync. state: <b>"+SafeHtmlUtils.fromString(syncState).asString()+"</b><br>";
html += "Last sync. timestamp: <b>"+SafeHtmlUtils.fromString(syncTimestamp).asString()+"</b><br>";
html += "Last sync. timestamp (start): <b>"+SafeHtmlUtils.fromString(syncStartTimestamp).asString()+"</b><br>";
html += "Last sync. timestamp (end): <b>"+SafeHtmlUtils.fromString(syncTimestamp).asString()+"</b><br>";
html += "Last successful sync. timestamp (start): <b>"+SafeHtmlUtils.fromString(syncSuccessStartTimestamp).asString()+"</b><br>";
html += "Last successful sync. timestamp (end): <b>"+SafeHtmlUtils.fromString(syncSuccessTimestamp).asString()+"</b><br>";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ public final native String getLastSynchronizationTimestamp() /*-{
}
return null;
}-*/;
public final native String getStartOfLastSynchronizationTimestamp() /*-{
for (var id in this.attributes) {
if (this.attributes[id].friendlyName === "startOfLastSynchronization") {
return this.attributes[id].value;
}
}
return null;
}-*/;
public final native String getLastSuccessSynchronizationTimestamp() /*-{
for (var id in this.attributes) {
if (this.attributes[id].friendlyName === "lastSuccessSynchronizationTimestamp") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public Widget draw() {
attrNames.add("urn:perun:group:attribute-def:def:authoritativeGroup");
attrNames.add("urn:perun:group:attribute-def:def:groupSynchronizationTimes");
attrNames.add("urn:perun:group:attribute-def:def:startOfLastSuccessfulSynchronization");
attrNames.add("urn:perun:group:attribute-def:def:startOfLastSynchronization");
final GetAllRichGroups groups = new GetAllRichGroups(voId, attrNames);
groups.setCheckable(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public Widget draw() {
attrNames.add("urn:perun:group:attribute-def:def:authoritativeGroup");
attrNames.add("urn:perun:group:attribute-def:def:groupSynchronizationTimes");
attrNames.add("urn:perun:group:attribute-def:def:startOfLastSuccessfulSynchronization");
attrNames.add("urn:perun:group:attribute-def:def:startOfLastSynchronization");

final GetAllRichSubGroups subgroups = new GetAllRichSubGroups(groupId, attrNames);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public Widget draw() {
attrNames.add("urn:perun:group:attribute-def:def:authoritativeGroup");
attrNames.add("urn:perun:group:attribute-def:def:groupSynchronizationTimes");
attrNames.add("urn:perun:group:attribute-def:def:startOfLastSuccessfulSynchronization");
attrNames.add("urn:perun:group:attribute-def:def:startOfLastSynchronization");
final GetAllRichGroups groups = new GetAllRichGroups(voId, attrNames);
final JsonCallbackEvents events = JsonCallbackEvents.refreshTableEvents(groups);
if (!session.isVoAdmin(voId)) groups.setCheckable(false);
Expand Down

0 comments on commit bb85379

Please sign in to comment.