From ff3044c365f2196332277c60bf3a2b2cd95ed863 Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Wed, 23 Jan 2019 11:14:30 +0100 Subject: [PATCH] lang file anpassen + refactoring --- .../src/repos/changesets/ChangesetDiff.js | 2 +- scm-ui/public/locales/en/repos.json | 160 +++++----- scm-ui/public/locales/en/users.json | 78 +++-- scm-ui/src/repos/components/DeleteRepo.js | 12 +- scm-ui/src/repos/components/EditNavLink.js | 2 +- .../src/repos/components/EditNavLink.test.js | 2 +- .../repos/components/PermissionsNavLink.js | 2 +- .../repos/components/form/RepositoryForm.js | 47 ++- scm-ui/src/repos/containers/ChangesetView.js | 4 +- scm-ui/src/repos/containers/ChangesetsRoot.js | 2 +- scm-ui/src/repos/containers/Overview.js | 2 +- scm-ui/src/repos/containers/RepositoryRoot.js | 24 +- .../src/repos/sources/containers/Sources.js | 2 +- scm-ui/src/users/components/DeleteUser.js | 12 +- .../src/users/components/SetUserPassword.js | 4 +- scm-ui/src/users/components/UserForm.js | 4 +- .../components/buttons/CreateUserButton.js | 20 -- .../components/navLinks/GeneralUserNavLink.js | 2 +- .../components/navLinks/SetPasswordNavLink.js | 2 +- scm-ui/src/users/containers/AddUser.js | 4 +- scm-ui/src/users/containers/SingleUser.js | 10 +- scm-ui/src/users/containers/Users.js | 286 +++++++++--------- 22 files changed, 326 insertions(+), 357 deletions(-) delete mode 100644 scm-ui/src/users/components/buttons/CreateUserButton.js diff --git a/scm-ui-components/packages/ui-components/src/repos/changesets/ChangesetDiff.js b/scm-ui-components/packages/ui-components/src/repos/changesets/ChangesetDiff.js index 857ff8c827..232b0e3577 100644 --- a/scm-ui-components/packages/ui-components/src/repos/changesets/ChangesetDiff.js +++ b/scm-ui-components/packages/ui-components/src/repos/changesets/ChangesetDiff.js @@ -25,7 +25,7 @@ class ChangesetDiff extends React.Component { render() { const { changeset, t } = this.props; if (!this.isDiffSupported(changeset)) { - return {t("changesets.diff.not-supported")}; + return {t("changesets.changeset.diffNotSupported")}; } else { const url = this.createUrl(changeset); return ; diff --git a/scm-ui/public/locales/en/repos.json b/scm-ui/public/locales/en/repos.json index 4693dedfd6..a7a7d8449f 100644 --- a/scm-ui/public/locales/en/repos.json +++ b/scm-ui/public/locales/en/repos.json @@ -11,12 +11,15 @@ "name-invalid": "The repository name is invalid", "contact-invalid": "Contact must be a valid mail address" }, - "overview": { - "title": "Repositories", - "subtitle": "Overview of available repositories", - "create-button": "Create" + "help": { + "nameHelpText": "The name of the repository. This name will be part of the repository url.", + "typeHelpText": "The type of the repository (e.g. Mercurial, Git or Subversion).", + "contactHelpText": "Email address of the person who is responsible for this repository.", + "descriptionHelpText": "A short description of the repository." }, - "repository-root": { + "repositoryRoot": { + "errorTitle": "Error", + "errorSubtitle": "Unknown repository error", "menu": { "navigationLabel": "Repository Navigation", "informationNavLink": "Information", @@ -25,29 +28,37 @@ "settingsNavLink": "Settings", "editNavLink": "General", "permissionsNavLink": "Permissions" - }, - "errorTitle": "Error", - "errorSubtitle": "Unknown repository error" + } + }, + "overview": { + "title": "Repositories", + "subtitle": "Overview of available repositories", + "createButton": "Create" }, "create": { "title": "Create Repository", "subtitle": "Create a new repository" }, - "repository-form": { - "submit": "Save" - }, - "edit-nav-link": { - "label": "Edit" - }, - "delete-nav-action": { - "label": "Delete", - "confirm-alert": { - "title": "Delete repository", - "message": "Do you really want to delete the repository?", - "submit": "Yes", - "cancel": "No" + "changesets": { + "errorTitle": "Error", + "errorSubtitle": "Could not fetch changesets", + "branchSelectorLabel": "Branches", + "changeset": { + "description": "Description", + "summary": "Changeset {{id}} was committed {{time}}", + "diffNotSupported": "Diff of changesets is not supported by the type of repository", + "id": "ID", + "contact": "Contact", + "date": "Date" + }, + "author": { + "name": "Author", + "mail": "Mail" } }, + "repositoryForm": { + "submit": "Save" + }, "sources": { "file-tree": { "name": "Name", @@ -67,71 +78,54 @@ "size": "Size" } }, - "changesets": { - "diff": { - "not-supported": "Diff of changesets is not supported by the type of repository" - }, + "permission": { + "user": "User", + "group": "Group", "error-title": "Error", - "error-subtitle": "Could not fetch changesets", - "changeset": { - "id": "ID", - "description": "Description", - "contact": "Contact", - "date": "Date", - "summary": "Changeset {{id}} was committed {{time}}" + "error-subtitle": "Unknown permissions error", + "name": "User or Group", + "type": "Type", + "group-permission": "Group Permission", + "user-permission": "User Permission", + "edit-permission": { + "delete-button": "Delete", + "save-button": "Save Changes" }, - "author": { - "name": "Author", - "mail": "Mail" + "delete-permission-button": { + "label": "Delete", + "confirm-alert": { + "title": "Delete permission", + "message": "Do you really want to delete the permission?", + "submit": "Yes", + "cancel": "No" + } + }, + "add-permission": { + "add-permission-heading": "Add new Permission", + "submit-button": "Submit", + "name-input-invalid": "Permission is not allowed to be empty! If it is not empty, your input name is invalid or it already exists!" + }, + "help": { + "groupPermissionHelpText": "States if a permission is a group permission.", + "nameHelpText": "Manage permissions for a specific user or group", + "typeHelpText": "READ = read; WRITE = read and write; OWNER = read, write and also the ability to manage the properties and permissions" + }, + "autocomplete": { + "no-group-options": "No group suggestion available", + "group-placeholder": "Enter group", + "no-user-options": "No user suggestion available", + "user-placeholder": "Enter user", + "loading": "Loading..." } }, - "branch-selector": { - "label": "Branches" - }, - "permission": { - "user": "User", - "group": "Group", - "error-title": "Error", - "error-subtitle": "Unknown permissions error", - "name": "User or Group", - "type": "Type", - "group-permission": "Group Permission", - "user-permission": "User Permission", - "edit-permission": { - "delete-button": "Delete", - "save-button": "Save Changes" - }, - "delete-permission-button": { - "label": "Delete", - "confirm-alert": { - "title": "Delete permission", - "message": "Do you really want to delete the permission?", - "submit": "Yes", - "cancel": "No" - } - }, - "add-permission": { - "add-permission-heading": "Add new Permission", - "submit-button": "Submit", - "name-input-invalid": "Permission is not allowed to be empty! If it is not empty, your input name is invalid or it already exists!" - }, - "help": { - "groupPermissionHelpText": "States if a permission is a group permission.", - "nameHelpText": "Manage permissions for a specific user or group", - "typeHelpText": "READ = read; WRITE = read and write; OWNER = read, write and also the ability to manage the properties and permissions" - }, - "autocomplete": { - "no-group-options": "No group suggestion available", - "group-placeholder": "Enter group", - "no-user-options": "No user suggestion available", - "user-placeholder": "Enter user", - "loading": "Loading..." - } - }, - "help": { - "nameHelpText": "The name of the repository. This name will be part of the repository url.", - "typeHelpText": "The type of the repository (e.g. Mercurial, Git or Subversion).", - "contactHelpText": "Email address of the person who is responsible for this repository.", - "descriptionHelpText": "A short description of the repository." + "delete": { + "subtitle": "Delete Repository", + "button": "Delete", + "confirmAlert": { + "title": "Delete repository", + "message": "Do you really want to delete the repository?", + "submit": "Yes", + "cancel": "No" + } } } diff --git a/scm-ui/public/locales/en/users.json b/scm-ui/public/locales/en/users.json index 0ec61c9870..394d23dbb0 100644 --- a/scm-ui/public/locales/en/users.json +++ b/scm-ui/public/locales/en/users.json @@ -10,46 +10,6 @@ "creationDate": "Creation Date", "lastModified": "Last Modified" }, - "users": { - "title": "Users", - "subtitle": "Create, read, update and delete users" - }, - "create-user-button": { - "label": "Create" - }, - "add-user": { - "title": "Create User", - "subtitle": "Create a new user" - }, - "single-user": { - "menu": { - "navigationLabel": "User Navigation", - "informationNavLink": "Information", - "settingsNavLink": "Settings", - "editNavLink": "General", - "setPasswordNavLink": "Password" - }, - "edit": { - "subtitle": "Edit User", - "button": "Submit" - }, - "delete": { - "subtitle": "Delete User", - "button": "Delete", - "confirm-alert": { - "title": "Delete user", - "message": "Do you really want to delete the user?", - "submit": "Yes", - "cancel": "No" - } - }, - "password": { - "button": "Set password", - "set-password-successful": "Password successfully set" - }, - "errorTitle": "Error", - "errorSubtitle": "Unknown user error" - }, "validation": { "mail-invalid": "This email is invalid", "name-invalid": "This name is invalid", @@ -61,5 +21,43 @@ "mailHelpText": "Email address of the user.", "adminHelpText": "An administrator is able to create, modify and delete repositories, groups and users.", "activeHelpText": "Activate or deactive the user." + }, + "users": { + "title": "Users", + "subtitle": "Create, read, update and delete users", + "createButton": "Create" + }, + "singleUser": { + "errorTitle": "Error", + "errorSubtitle": "Unknown user error", + "menu": { + "navigationLabel": "User Navigation", + "informationNavLink": "Information", + "settingsNavLink": "Settings", + "editNavLink": "General", + "setPasswordNavLink": "Password" + } + }, + "addUser": { + "title": "Create User", + "subtitle": "Create a new user" + }, + "delete": { + "subtitle": "Delete User", + "button": "Delete", + "confirm-alert": { + "title": "Delete user", + "message": "Do you really want to delete the user?", + "submit": "Yes", + "cancel": "No" + } + }, + "singleUserPassword": { + "button": "Set password", + "setPasswordSuccessful": "Password successfully set" + }, + "userForm": { + "subtitle": "Edit User", + "button": "Submit" } } diff --git a/scm-ui/src/repos/components/DeleteRepo.js b/scm-ui/src/repos/components/DeleteRepo.js index 512ec9a2f2..d1908f9daf 100644 --- a/scm-ui/src/repos/components/DeleteRepo.js +++ b/scm-ui/src/repos/components/DeleteRepo.js @@ -24,15 +24,15 @@ class DeleteRepo extends React.Component { confirmDelete = () => { const { t } = this.props; confirmAlert({ - title: t("repository.delete.confirm-alert.title"), - message: t("repository.delete.confirm-alert.message"), + title: t("delete.confirmAlert.title"), + message: t("delete.confirmAlert.message"), buttons: [ { - label: t("repository.delete.confirm-alert.submit"), + label: t("delete.confirmAlert.submit"), onClick: () => this.delete() }, { - label: t("repository.delete.confirm-alert.cancel"), + label: t("delete.confirmAlert.cancel"), onClick: () => null } ] @@ -53,11 +53,11 @@ class DeleteRepo extends React.Component { return ( <> - +
diff --git a/scm-ui/src/repos/components/EditNavLink.js b/scm-ui/src/repos/components/EditNavLink.js index 2163624e4d..b06cd8d96e 100644 --- a/scm-ui/src/repos/components/EditNavLink.js +++ b/scm-ui/src/repos/components/EditNavLink.js @@ -15,7 +15,7 @@ class EditNavLink extends React.Component { return null; } const { editUrl, t } = this.props; - return ; + return ; } } diff --git a/scm-ui/src/repos/components/EditNavLink.test.js b/scm-ui/src/repos/components/EditNavLink.test.js index 935b7cf928..080440cc88 100644 --- a/scm-ui/src/repos/components/EditNavLink.test.js +++ b/scm-ui/src/repos/components/EditNavLink.test.js @@ -33,6 +33,6 @@ describe("EditNavLink", () => { , options.get() ); - expect(navLink.text()).toBe("edit-nav-link.label"); + expect(navLink.text()).toBe("repositoryRoot.menu.editNavLink"); }); }); diff --git a/scm-ui/src/repos/components/PermissionsNavLink.js b/scm-ui/src/repos/components/PermissionsNavLink.js index 364c274f6b..773ad94246 100644 --- a/scm-ui/src/repos/components/PermissionsNavLink.js +++ b/scm-ui/src/repos/components/PermissionsNavLink.js @@ -20,7 +20,7 @@ class PermissionsNavLink extends React.Component { } const { permissionUrl, t } = this.props; return ( - + ); } } diff --git a/scm-ui/src/repos/components/form/RepositoryForm.js b/scm-ui/src/repos/components/form/RepositoryForm.js index cc0b409175..a97c76af8b 100644 --- a/scm-ui/src/repos/components/form/RepositoryForm.js +++ b/scm-ui/src/repos/components/form/RepositoryForm.js @@ -83,32 +83,29 @@ class RepositoryForm extends React.Component { const repository = this.state.repository; return ( - <> - -
- {this.renderCreateOnlyFields()} - + + {this.renderCreateOnlyFields()} + -