From 9898892a0154c2df73a67baa042b680fea8d601a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Zl=C3=A1mal?= Date: Wed, 2 Sep 2020 13:54:44 +0200 Subject: [PATCH] GUI: Show new group sync attribute with start time - When showing-up group sync details, show also timestamp of the last synchronization start (since it might not finish in one transaction to store end timestamp). --- .../webgui/json/groupsManager/GetAllRichGroups.java | 10 ++++++++-- .../webgui/json/groupsManager/GetAllRichSubGroups.java | 10 ++++++++-- .../cz/metacentrum/perun/webgui/model/RichGroup.java | 8 ++++++++ .../perun/webgui/tabs/groupstabs/GroupsTabItem.java | 1 + .../perun/webgui/tabs/groupstabs/SubgroupsTabItem.java | 1 + .../perun/webgui/tabs/vostabs/VoGroupsTabItem.java | 1 + 6 files changed, 27 insertions(+), 4 deletions(-) diff --git a/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/json/groupsManager/GetAllRichGroups.java b/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/json/groupsManager/GetAllRichGroups.java index c4f0e3ad6d..9cdd130305 100644 --- a/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/json/groupsManager/GetAllRichGroups.java +++ b/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/json/groupsManager/GetAllRichGroups.java @@ -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"; @@ -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 { @@ -292,7 +297,8 @@ public void onFinished(JavaScriptObject jso) { if (object.isSyncEnabled()) { html += "Last sync. state: "+SafeHtmlUtils.fromString(syncState).asString()+"
"; - html += "Last sync. timestamp: "+SafeHtmlUtils.fromString(syncTimestamp).asString()+"
"; + html += "Last sync. timestamp (start): "+SafeHtmlUtils.fromString(syncStartTimestamp).asString()+"
"; + html += "Last sync. timestamp (end): "+SafeHtmlUtils.fromString(syncTimestamp).asString()+"
"; html += "Last successful sync. timestamp (start): "+SafeHtmlUtils.fromString(syncSuccessStartTimestamp).asString()+"
"; html += "Last successful sync. timestamp (end): "+SafeHtmlUtils.fromString(syncSuccessTimestamp).asString()+"
"; } diff --git a/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/json/groupsManager/GetAllRichSubGroups.java b/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/json/groupsManager/GetAllRichSubGroups.java index 7a36a797c4..dc0d877fcc 100644 --- a/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/json/groupsManager/GetAllRichSubGroups.java +++ b/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/json/groupsManager/GetAllRichSubGroups.java @@ -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"; @@ -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 { @@ -255,7 +260,8 @@ public void onFinished(JavaScriptObject jso) { if (object.isSyncEnabled()) { html += "Last sync. state: "+SafeHtmlUtils.fromString(syncState).asString()+"
"; - html += "Last sync. timestamp: "+SafeHtmlUtils.fromString(syncTimestamp).asString()+"
"; + html += "Last sync. timestamp (start): "+SafeHtmlUtils.fromString(syncStartTimestamp).asString()+"
"; + html += "Last sync. timestamp (end): "+SafeHtmlUtils.fromString(syncTimestamp).asString()+"
"; html += "Last successful sync. timestamp (start): "+SafeHtmlUtils.fromString(syncSuccessStartTimestamp).asString()+"
"; html += "Last successful sync. timestamp (end): "+SafeHtmlUtils.fromString(syncSuccessTimestamp).asString()+"
"; } diff --git a/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/model/RichGroup.java b/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/model/RichGroup.java index 915b444de6..e7e2777f2f 100644 --- a/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/model/RichGroup.java +++ b/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/model/RichGroup.java @@ -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") { diff --git a/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/tabs/groupstabs/GroupsTabItem.java b/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/tabs/groupstabs/GroupsTabItem.java index fc61b22a5b..86fca99038 100644 --- a/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/tabs/groupstabs/GroupsTabItem.java +++ b/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/tabs/groupstabs/GroupsTabItem.java @@ -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); diff --git a/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/tabs/groupstabs/SubgroupsTabItem.java b/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/tabs/groupstabs/SubgroupsTabItem.java index 8a42ae25b4..990633b973 100644 --- a/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/tabs/groupstabs/SubgroupsTabItem.java +++ b/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/tabs/groupstabs/SubgroupsTabItem.java @@ -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); diff --git a/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/tabs/vostabs/VoGroupsTabItem.java b/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/tabs/vostabs/VoGroupsTabItem.java index a7e2801a66..ddc9e8f9a5 100644 --- a/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/tabs/vostabs/VoGroupsTabItem.java +++ b/perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/tabs/vostabs/VoGroupsTabItem.java @@ -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);