From 9cae8f5118446919d72dcc3f399fbd219d000595 Mon Sep 17 00:00:00 2001 From: Alex Eng Date: Thu, 28 Jul 2016 09:42:38 +1000 Subject: [PATCH] refactor(admin: confirm): migrate js confirm to modal https://zanata.atlassian.net/browse/ZNTA-1283 https://zanata.atlassian.net/browse/ZNTA-1278 --- .../administration/TranslationMemoryPage.java | 4 +- .../action/RoleAssignmentRuleAction.java | 8 +- .../src/main/resources/messages.properties | 6 +- .../src/main/webapp/admin/rolemanager.xhtml | 36 +++-- .../src/main/webapp/admin/rolerules.xhtml | 135 ++++++++++-------- .../src/main/webapp/admin/usermanager.xhtml | 46 +++--- .../resources/zanata/confirm-modal.xhtml | 25 ++-- zanata-war/src/main/webapp/tm/home.xhtml | 20 ++- 8 files changed, 179 insertions(+), 101 deletions(-) diff --git a/functional-test/src/main/java/org/zanata/page/administration/TranslationMemoryPage.java b/functional-test/src/main/java/org/zanata/page/administration/TranslationMemoryPage.java index 4c0566a828..30c306543c 100644 --- a/functional-test/src/main/java/org/zanata/page/administration/TranslationMemoryPage.java +++ b/functional-test/src/main/java/org/zanata/page/administration/TranslationMemoryPage.java @@ -54,6 +54,7 @@ public class TranslationMemoryPage extends BasePage { private By listDeleteButton = By.linkText("Delete"); private By deleteConfirmation = By.id("deleteTMModal"); private By clearConfirmation = By.id("clearTMModal"); + private By uploadNotification = By.id("uploadTMNotification"); private By okConfirmation = By.id("confirm-ok-button"); private By cancelConfirmation = By.id("confirm-cancel-button"); @@ -91,7 +92,8 @@ public TranslationMemoryPage enterImportFileName(String importFileName) { public TranslationMemoryPage clickUploadButtonAndAcknowledge() { log.info("Click and accept Upload button"); clickElement(uploadButton); - switchToAlert().accept(); + clickElement( + readyElement(uploadNotification).findElement(okConfirmation)); return new TranslationMemoryPage(getDriver()); } diff --git a/zanata-war/src/main/java/org/zanata/action/RoleAssignmentRuleAction.java b/zanata-war/src/main/java/org/zanata/action/RoleAssignmentRuleAction.java index 1d08c42efa..53d1acb121 100644 --- a/zanata-war/src/main/java/org/zanata/action/RoleAssignmentRuleAction.java +++ b/zanata-war/src/main/java/org/zanata/action/RoleAssignmentRuleAction.java @@ -95,8 +95,12 @@ public List getAllRules() { return roleAssignmentRuleDAO.findAll(); } - public void remove(HRoleAssignmentRule rule) { - roleAssignmentRuleDAO.makeTransient(rule); + public void remove(String id) { + HRoleAssignmentRule rule = roleAssignmentRuleDAO.findById(new Long(id)); + if (rule != null) { + roleAssignmentRuleDAO.makeTransient(rule); + roleAssignmentRuleDAO.flush(); + } } public void setRoleToAssign(String roleName) { diff --git a/zanata-war/src/main/resources/messages.properties b/zanata-war/src/main/resources/messages.properties index 6616d15858..b237362fbe 100644 --- a/zanata-war/src/main/resources/messages.properties +++ b/zanata-war/src/main/resources/messages.properties @@ -1080,6 +1080,7 @@ jsf.config.userEmail.description=If enabled, user email will be visible jsf.CreateNewUser=Create new user jsf.MemberOf=Member of jsf.Enabled=Enabled +jsf.user.delete.title=Delete user jsf.AreYouSureYouWishToDeleteThisUserThisActionCannotBeUndone=Are you sure you wish to delete this user? This action cannot be undone. jsf.UserManager.delete.constraintViolation.error=This user cannot be removed from the system. You can deactivate the user instead. jsf.AccountEnabled=Account enabled @@ -1093,6 +1094,7 @@ jsf.account.notActivated=Account is not activated. #------ [home] > Administration > Manage Roles > Role Details ------ jsf.CreateRole=Create Role jsf.AreYouSureYouWishToDeleteThisRoleThisActionCannotBeUndone=Are you sure you wish to delete this role? This action cannot be undone. +jsf.role.delete.title=Delete role jsf.Role=Role jsf.RoleDetails=Role Details @@ -1185,6 +1187,7 @@ jsf.rolerules.CreateRule=New Rule jsf.rolerules.title=Rules jsf.rolerules.CreateRoleAssignmentRule=Create Role Assignment Rule jsf.rolerules.EditRoleAssignmentRule=Edit Role Assignment Rule +jsf.rolerules.delele.title=Delete rule jsf.rolerules.ConfirmDelete=Are you sure you want to remove this rule? jsf.rolerules.Description=Role Assignment Rules assist with the automatic assignment of user roles to certain users when they sign in. If the user's identity (e.g. user name) matches a certain pattern and they are authenticated in a certain way (e.g. via Open Id where available), Zanata will be able to automatically add the user to a specified user Role. jsf.rolerules.PolicyName=Policy Name @@ -1213,7 +1216,7 @@ jsf.processmanager.progress={0} of {1} complete #------ [home] > Translation Memory ------ jsf.transmemory.Id=Id jsf.transmemory.Title=Translation Memory -jsf.transmemory.Clear.Title=Clear the contents of a Translation Memory +jsf.transmemory.Clear.Title=Clear Translation Memory jsf.transmemory.Clearing.Message=Clearing jsf.transmemory.CreateNew = Create New jsf.transmemory.ConfirmClearTM=Are you sure you want to remove all content from this Translation Memory? @@ -1233,6 +1236,7 @@ jsf.transmemory.TransMemoryIdExample=Cannot include spaces and must be unique. E jsf.transmemory.title.New = New Translation Memory jsf.transmemory.TransMemoryNotFound = Translation Memory not found. jsf.transmemory.createdOn=Created on +jsf.transmemory.upload.notification=Upload status #------ [home] > Projects > [project-id] > [version-id] > [group-id] > Request To Join Group ------ diff --git a/zanata-war/src/main/webapp/admin/rolemanager.xhtml b/zanata-war/src/main/webapp/admin/rolemanager.xhtml index 93dec2d68d..3e54983840 100644 --- a/zanata-war/src/main/webapp/admin/rolemanager.xhtml +++ b/zanata-war/src/main/webapp/admin/rolemanager.xhtml @@ -4,8 +4,8 @@ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" - xmlns:a4j="http://richfaces.org/a4j" - > + xmlns:zanata="http://java.sun.com/jsf/composite/zanata" + xmlns:a4j="http://richfaces.org/a4j"> @@ -16,10 +16,27 @@ #{msgs['jsf.ManageRoles']} + + + + +
@@ -56,7 +73,7 @@

#{msgs['jsf.admin.managerole.header']}

- + diff --git a/zanata-war/src/main/webapp/admin/rolerules.xhtml b/zanata-war/src/main/webapp/admin/rolerules.xhtml index 334505aa0b..5f6b94dd07 100644 --- a/zanata-war/src/main/webapp/admin/rolerules.xhtml +++ b/zanata-war/src/main/webapp/admin/rolerules.xhtml @@ -5,7 +5,8 @@ xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.org/rich" - > + xmlns:zanata="http://java.sun.com/jsf/composite/zanata" + xmlns:a4j="http://richfaces.org/a4j"> @@ -16,9 +17,27 @@ name="page_title">#{msgs['jsf.RoleAssignmentRules']}
+ + + + + + @@ -56,66 +75,66 @@

#{msgs['jsf.rolerules.title']}

- -

#{msgs['jsf.rolerules.norules']}

-

- - - -

-
- + + +

#{msgs['jsf.rolerules.norules']}

+

+ + + +

+
- - - + + + + + +
diff --git a/zanata-war/src/main/webapp/admin/usermanager.xhtml b/zanata-war/src/main/webapp/admin/usermanager.xhtml index d03fad94a7..bce61121e3 100644 --- a/zanata-war/src/main/webapp/admin/usermanager.xhtml +++ b/zanata-war/src/main/webapp/admin/usermanager.xhtml @@ -18,8 +18,33 @@ #{msgs['jsf.ManageUsers']} - - + + + + + + + + +
@@ -51,19 +76,6 @@ - - - - - - -
    @@ -79,8 +91,8 @@
  • - + #{msgs['jsf.Delete']} diff --git a/zanata-war/src/main/webapp/resources/zanata/confirm-modal.xhtml b/zanata-war/src/main/webapp/resources/zanata/confirm-modal.xhtml index 5470398546..a1d0fd4d42 100644 --- a/zanata-war/src/main/webapp/resources/zanata/confirm-modal.xhtml +++ b/zanata-war/src/main/webapp/resources/zanata/confirm-modal.xhtml @@ -1,11 +1,16 @@ + + @@ -20,7 +25,7 @@