From ba9143d78ebb50d6bdc3bb255fd155ef616e7575 Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Tue, 24 Nov 2020 13:05:36 +0100 Subject: [PATCH] Unify key views across all user settings --- scm-ui/ui-webapp/public/locales/de/users.json | 17 ++++++---- scm-ui/ui-webapp/public/locales/en/users.json | 17 ++++++---- .../users/components/apiKeys/AddApiKey.tsx | 4 ++- .../users/components/apiKeys/ApiKeyEntry.tsx | 6 ++-- .../users/components/apiKeys/SetApiKeys.tsx | 20 ++++------- .../components/publicKeys/AddPublicKey.tsx | 6 ++-- .../components/publicKeys/PublicKeyEntry.tsx | 33 ++++++++++++------- .../components/publicKeys/SetPublicKeys.tsx | 7 +++- 8 files changed, 67 insertions(+), 43 deletions(-) diff --git a/scm-ui/ui-webapp/public/locales/de/users.json b/scm-ui/ui-webapp/public/locales/de/users.json index 271caff650..187d04a19b 100644 --- a/scm-ui/ui-webapp/public/locales/de/users.json +++ b/scm-ui/ui-webapp/public/locales/de/users.json @@ -79,15 +79,22 @@ } }, "publicKey": { + "subtitle": "Öffentliche Schlüssel", + "description": "Zum Prüfen von Signaturen für z. B. Commits können hier die entsprechenden öffentlichen Schlüssel hinterlegt werden. Zudem können hier die vom SCM-Manager erstellten Signaturschlüssel heruntergeladen werden.", "noStoredKeys": "Es wurden keine Schlüssel gefunden.", "displayName": "Anzeigename", - "raw": "Schlüssel", "created": "Eingetragen an", - "addKey": "Schlüssel hinzufügen", + "raw": "Schlüssel", + "download": "Herunterladen", "delete": "Löschen", - "download": "Herunterladen" + "addSubtitle": "Neuen Schlüssel hinzufügen", + "addKey": "Schlüssel hinzufügen" }, "apiKey": { + "subtitle": "API Schlüssel", + "text1": "Erstelle und verwalte Personal Access Token um auf die REST API zuzugreifen oder diese als Passwort für SCM-Clients zu nutzen. Die Rechte der Token sind auf Repositories und die gewählte Rolle beschränkt.", + "manageRoles": "Sie können die Rollenberechtigungen in der Administration unter „Berechtigungsrollen“ einsehen und neue Rollen anlegen.", + "text2": "Um den Token in REST-Abfragen zu nutzen, übergeben Sie diesen als Cookie mit dem Namen „X-Bearer-Token“. Sie können den Token auch anstelle Ihres Passworts nutzen, um sich mit SCM-Clients anzumelden.", "noStoredKeys": "Es wurden keine Schlüssel gefunden.", "displayName": "Anzeigename", "permissionRole": { @@ -95,12 +102,10 @@ "help": "Mit der Rolle können Sie die Berechtigung für diesen Schlüssel einschränken" }, "created": "Eingetragen an", + "addSubtitle": "Neuen Schlüssel hinzufügen", "addKey": "Schlüssel hinzufügen", "delete": "Löschen", "download": "Herunterladen", - "text1": "Erstelle und verwalte Personal Access Token um auf die REST API zuzugreifen oder diese als Passwort für SCM-Clients zu nutzen. Die Rechte der Token sind auf Repositories und die gewählte Rolle beschränkt.", - "manageRoles": "Sie können die Rollenberechtigungen in der Administration unter „Berechtigungsrollen“ einsehen und neue Rollen anlegen.", - "text2": "Um den Token in REST-Abfragen zu nutzen, übergeben Sie diesen als Cookie mit dem Namen „X-Bearer-Token“. Sie können den Token auch anstelle Ihres Passworts nutzen, um sich mit SCM-Clients anzumelden.", "modal": { "title": "Schlüssel erzeugt", "text1": "Ihr neuer API-Schlüssel ist bereit. Sie können diesen als Token für Zugriffe auf die REST-Schnittstelle nutzen oder anstelle Ihres Passworts zum Login mit SCM-Clients nutzen.", diff --git a/scm-ui/ui-webapp/public/locales/en/users.json b/scm-ui/ui-webapp/public/locales/en/users.json index 877675bc85..a087716618 100644 --- a/scm-ui/ui-webapp/public/locales/en/users.json +++ b/scm-ui/ui-webapp/public/locales/en/users.json @@ -79,15 +79,22 @@ } }, "publicKey": { + "subtitle": "Public Keys", + "description": "To check signatures for example for commits, public keys can be stored here. Additionally the keys created by SCM-Manager can be accessed here, too.", "noStoredKeys": "No keys found.", "displayName": "Display Name", - "raw": "Key", "created": "Created on", - "addKey": "Add key", + "raw": "Key", + "download": "Download", "delete": "Delete", - "download": "Download" + "addSubtitle": "Add new key", + "addKey": "Add key" }, "apiKey": { + "subtitle": "API Keys", + "text1": "Create and manage personal access tokens to access the REST API or use as a password for SCM clients. The privileges of these tokens are limited to repositories and the selected role.", + "manageRoles": "You may view and create roles in the administration view “Permission Roles”.", + "text2": "To use the token in a REST request, pass it as a cookie named “X-Bearer-Token”. You may use the token as your password for SCM clients, too.", "noStoredKeys": "No keys found.", "displayName": "Display Name", "permissionRole": { @@ -95,12 +102,10 @@ "help": "The api key will be restricted to permissions of this role" }, "created": "Created on", + "addSubtitle": "Add new key", "addKey": "Add key", "delete": "Delete", "download": "Download", - "text1": "Create and manage personal access tokens to access the REST API or use as a password for SCM clients. The privileges of these tokens are limited to repositories and the selected role.", - "manageRoles": "You may view and create roles in the administration view “Permission Roles”.", - "text2": "To use the token in a REST request, pass it as a cookie named “X-Bearer-Token”. You may use the token as your password for SCM clients, too.", "modal": { "title": "Key created", "text1": "Your new API key is ready. You can use it as a bearer token for REST calls or as a password for SCM clients.", diff --git a/scm-ui/ui-webapp/src/users/components/apiKeys/AddApiKey.tsx b/scm-ui/ui-webapp/src/users/components/apiKeys/AddApiKey.tsx index 216f33d425..fdbda0903b 100644 --- a/scm-ui/ui-webapp/src/users/components/apiKeys/AddApiKey.tsx +++ b/scm-ui/ui-webapp/src/users/components/apiKeys/AddApiKey.tsx @@ -23,7 +23,7 @@ */ import React, { FC, useEffect, useState } from "react"; -import { apiClient, ErrorNotification, InputField, Level, Loading, SubmitButton } from "@scm-manager/ui-components"; +import { apiClient, ErrorNotification, InputField, Level, Loading, SubmitButton, Subtitle } from "@scm-manager/ui-components"; import { useTranslation } from "react-i18next"; import { CONTENT_TYPE_API_KEY } from "./SetApiKeys"; import { connect } from "react-redux"; @@ -105,6 +105,8 @@ const AddApiKey: FC = ({ return ( <> +
+ {newKeyModal} = ({ apiKey, onDelete }) => { if (apiKey?._links?.delete) { deleteButton = ( onDelete((apiKey._links.delete as Link).href)}> - - + + ); @@ -52,7 +52,7 @@ export const ApiKeyEntry: FC = ({ apiKey, onDelete }) => { {apiKey.displayName} {apiKey.permissionRole} - + {deleteButton} diff --git a/scm-ui/ui-webapp/src/users/components/apiKeys/SetApiKeys.tsx b/scm-ui/ui-webapp/src/users/components/apiKeys/SetApiKeys.tsx index 8d80add477..7b9af8a415 100644 --- a/scm-ui/ui-webapp/src/users/components/apiKeys/SetApiKeys.tsx +++ b/scm-ui/ui-webapp/src/users/components/apiKeys/SetApiKeys.tsx @@ -25,11 +25,10 @@ import { Collection, Links, User, Me } from "@scm-manager/ui-types"; import React, { FC, useEffect, useState } from "react"; import { Link } from "react-router-dom"; -import { apiClient, ErrorNotification, Loading } from "@scm-manager/ui-components"; +import { apiClient, ErrorNotification, Loading, Subtitle } from "@scm-manager/ui-components"; import ApiKeyTable from "./ApiKeyTable"; import AddApiKey from "./AddApiKey"; import { useTranslation } from "react-i18next"; -import styled from "styled-components"; export type ApiKeysCollection = Collection & { _embedded: { @@ -51,10 +50,6 @@ type Props = { user: User | Me; }; -const Subtitle = styled.div` - margin-bottom: 1rem; -`; - const SetApiKeys: FC = ({ user }) => { const [t] = useTranslation("users"); const [error, setError] = useState(); @@ -94,14 +89,13 @@ const SetApiKeys: FC = ({ user }) => { return ( <> -
-

{t("apiKey.text1")} {t("apiKey.manageRoles")}

-

{t("apiKey.text2")}

-
-
+ +

+ {t("apiKey.text1")} {t("apiKey.manageRoles")} +

+

{t("apiKey.text2")}

+
-
-

Create new key

{createLink && } ); diff --git a/scm-ui/ui-webapp/src/users/components/publicKeys/AddPublicKey.tsx b/scm-ui/ui-webapp/src/users/components/publicKeys/AddPublicKey.tsx index e0129e8245..c693d89130 100644 --- a/scm-ui/ui-webapp/src/users/components/publicKeys/AddPublicKey.tsx +++ b/scm-ui/ui-webapp/src/users/components/publicKeys/AddPublicKey.tsx @@ -23,7 +23,6 @@ */ import React, { FC, useState } from "react"; -import { User, Link, Links, Collection } from "@scm-manager/ui-types/src"; import { ErrorNotification, InputField, @@ -31,7 +30,8 @@ import { Textarea, SubmitButton, apiClient, - Loading + Loading, + Subtitle } from "@scm-manager/ui-components"; import { useTranslation } from "react-i18next"; import { CONTENT_TYPE_PUBLIC_KEY } from "./SetPublicKeys"; @@ -77,6 +77,8 @@ const AddPublicKey: FC = ({ createLink, refresh }) => { return ( <> +
+