This commit is contained in:
Charles
2021-10-26 12:10:55 -04:00
parent 83a4493a61
commit 6fb6e92382
13 changed files with 92 additions and 97 deletions

7
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "ucentral-client",
"version": "2.2.15",
"version": "2.3.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "ucentral-client",
"version": "2.2.15",
"version": "2.3.0",
"dependencies": {
"@coreui/coreui": "^3.4.0",
"@coreui/icons": "^2.0.1",
@@ -32,7 +32,8 @@
"react-tooltip": "^4.2.21",
"react-widgets": "^5.1.1",
"sass": "^1.35.1",
"ucentral-libs": "^0.9.84"
"ucentral-libs": "^0.9.84",
"uuid": "^8.3.2"
},
"devDependencies": {
"@babel/core": "^7.14.6",

View File

@@ -1,6 +1,6 @@
{
"name": "ucentral-client",
"version": "2.2.15",
"version": "2.3.0",
"dependencies": {
"@coreui/coreui": "^3.4.0",
"@coreui/icons": "^2.0.1",
@@ -26,7 +26,8 @@
"react-tooltip": "^4.2.21",
"react-widgets": "^5.1.1",
"sass": "^1.35.1",
"ucentral-libs": "^0.9.84"
"ucentral-libs": "^0.9.84",
"uuid": "^8.3.2"
},
"main": "index.js",
"scripts": {

View File

@@ -44,6 +44,7 @@
"certificates": "Zertifikate",
"clear": "Löschen",
"close": "Schließen",
"code": "Code",
"command": "Befehl",
"commands": "Befehle",
"commands_executed": "Ausgeführte Befehle",
@@ -208,7 +209,7 @@
"error_update": "Fehler: {{error}}",
"explanation": "Erläuterung",
"key_pem_explanation": "Bitte .pem-Datei auswählen",
"last_configuration_change": "Konfigurationsänderung",
"last_configuration_change": "Letzte Konfigurationsänderung",
"last_configuration_download": "Letzter Konfigurations-Download",
"location": "Ort",
"need_device_type": "Jede Konfiguration muss mindestens einen Gerätetyp unterstützen",
@@ -310,8 +311,10 @@
"error_fetch_entity": "Fehler beim Abrufen von Entitätsinformationen",
"error_fetching": "Fehler beim Abrufen von Entitäten",
"error_saving": "Fehler beim Speichern der Entität",
"higher_priority": "Stellen Sie eine höhere Priorität ein",
"ip_detection": "IP-Erkennung",
"ip_formats": "Sie können IPv4- oder IPv6-Adressen in den folgenden Formaten hinzufügen:",
"lower_priority": "Niedrigere Priorität setzen",
"need_select_entity": "sSie müssen eine Entität aus der folgenden Tabelle auswählen",
"no_ips": "Keine IPs ausgewählt",
"not_assigned": "Nicht zugeordnet",
@@ -598,6 +601,7 @@
"avatar": "Dein Avatar",
"avatar_file": "Dein Avatar (max. 2 MB)",
"check_phone": "Bitte überprüfen Sie Ihr Telefon auf Ihren Validierungscode",
"confirm_new_password": "Bestätige neues Passwort",
"create": "Benutzer erstellen",
"create_failure": "Fehler beim Erstellen des Benutzers. Bitte stellen Sie sicher, dass diese E-Mail-Adresse nicht bereits mit einem Konto verknüpft ist.",
"create_success": "Benutzer erfolgreich erstellt",
@@ -618,6 +622,7 @@
"id": "Benutzeridentifikation.",
"last_login": "Letzte Anmeldung",
"login_id": "Anmelde-ID.",
"make_sure_same_password": "Stellen Sie sicher, dass beide Passwörter gleich und gültig sind",
"my_profile": "Mein Profil",
"name": "Name",
"new_code_sent": "Neuer Code gesendet!",

View File

@@ -44,6 +44,7 @@
"certificates": "Certificates",
"clear": "Clear",
"close": "Close",
"code": "Code",
"command": "Command",
"commands": "Commands",
"commands_executed": "Commands Executed",
@@ -208,7 +209,7 @@
"error_update": "Error: {{error}}",
"explanation": "Explanation",
"key_pem_explanation": "Please select .pem file",
"last_configuration_change": "Config Change",
"last_configuration_change": "Last Configuration Change",
"last_configuration_download": "Last Configuration Download",
"location": "Location",
"need_device_type": "Every configuration needs to support at least one device type",
@@ -310,8 +311,10 @@
"error_fetch_entity": "Error while fetching entity information",
"error_fetching": "Error while fetching entities",
"error_saving": "Error while saving entity",
"higher_priority": "Make Higher Priority",
"ip_detection": "IP Detection",
"ip_formats": "You can add IPv4 or IPv6 addresses in the following formats:",
"lower_priority": "Make Lower Priority",
"need_select_entity": "You need to select an entity from the table below",
"no_ips": "No IPs selected",
"not_assigned": "Not Assigned",
@@ -598,6 +601,7 @@
"avatar": "Your Avatar",
"avatar_file": "Your Avatar (max. of 2 MB)",
"check_phone": "Please check your phone for your validation code",
"confirm_new_password": "Confirm New Password",
"create": "Create User",
"create_failure": "Error while creating user. Please make sure this email address is not already linked to an account.",
"create_success": "User Created Successfully",
@@ -618,6 +622,7 @@
"id": "User Id.",
"last_login": "Last Login",
"login_id": "Login Id.",
"make_sure_same_password": "Make sure both passwords are the same and are valid",
"my_profile": "My Profile",
"name": "Name",
"new_code_sent": "New Code Sent!",

View File

@@ -44,6 +44,7 @@
"certificates": "Certificados",
"clear": "Claro",
"close": "Cerrar",
"code": "Código",
"command": "Mando",
"commands": "comandos",
"commands_executed": "Comandos ejecutados",
@@ -208,7 +209,7 @@
"error_update": "Error: {{error}}",
"explanation": "Explicación",
"key_pem_explanation": "Seleccione el archivo .pem",
"last_configuration_change": "CAMBIO DE CONFIGURACIÓN",
"last_configuration_change": "Último cambio de configuración",
"last_configuration_download": "Descarga de la última configuración",
"location": "Ubicación",
"need_device_type": "Cada configuración debe admitir al menos un tipo de dispositivo",
@@ -310,8 +311,10 @@
"error_fetch_entity": "Error al obtener la información de la entidad",
"error_fetching": "Error al recuperar entidades",
"error_saving": "Error al guardar la entidad",
"higher_priority": "Dar mayor prioridad",
"ip_detection": "Detección de IP",
"ip_formats": "Puede agregar direcciones IPv4 o IPv6 en los siguientes formatos:",
"lower_priority": "Hacer una prioridad más baja",
"need_select_entity": "Debe seleccionar una entidad de la siguiente tabla",
"no_ips": "No se seleccionaron direcciones IP",
"not_assigned": "No asignado",
@@ -598,6 +601,7 @@
"avatar": "Tu avatar",
"avatar_file": "Tu avatar (máx. De 2 MB)",
"check_phone": "Por favor revise su teléfono para su código de validación",
"confirm_new_password": "confirmar nueva contraseña",
"create": "Crear usuario",
"create_failure": "Error al crear usuario. Asegúrese de que esta dirección de correo electrónico no esté vinculada a una cuenta.",
"create_success": "Usuario creado con éxito",
@@ -618,6 +622,7 @@
"id": "Id. De usuario",
"last_login": "Último acceso",
"login_id": "Ingresar identificación.",
"make_sure_same_password": "Asegúrese de que ambas contraseñas sean iguales y válidas",
"my_profile": "Mi perfil",
"name": "Nombre",
"new_code_sent": "¡Nuevo código enviado!",

View File

@@ -44,6 +44,7 @@
"certificates": "Certificats",
"clear": "Clair",
"close": "Fermer",
"code": "Code",
"command": "Commander",
"commands": "Les commandes",
"commands_executed": "commandes exécutées",
@@ -208,7 +209,7 @@
"error_update": "Erreur: {{error}}",
"explanation": "Explication",
"key_pem_explanation": "Veuillez sélectionner le fichier .pem",
"last_configuration_change": "Changement de configuration",
"last_configuration_change": "Dernière modification de configuration",
"last_configuration_download": "Téléchargement de la dernière configuration",
"location": "Emplacement",
"need_device_type": "Chaque configuration doit prendre en charge au moins un type d'appareil",
@@ -310,8 +311,10 @@
"error_fetch_entity": "Erreur lors de la récupération des informations sur l'entité",
"error_fetching": "Erreur lors de la récupération des entités",
"error_saving": "Erreur lors de l'enregistrement de l'entité",
"higher_priority": "Faire une priorité plus élevée",
"ip_detection": "Détection IP",
"ip_formats": "Vous pouvez ajouter des adresses IPv4 ou IPv6 aux formats suivants :",
"lower_priority": "Faire une priorité inférieure",
"need_select_entity": "Vous devez sélectionner une entité dans le tableau ci-dessous",
"no_ips": "Aucune adresse IP sélectionnée",
"not_assigned": "Non attribué",
@@ -598,6 +601,7 @@
"avatar": "Votre avatar",
"avatar_file": "Votre Avatar (max. de 2 Mo)",
"check_phone": "Veuillez vérifier votre téléphone pour votre code de validation",
"confirm_new_password": "Confirmer le nouveau mot de passe",
"create": "Créer un utilisateur",
"create_failure": "Erreur lors de la création de l'utilisateur. Veuillez vous assurer que cette adresse e-mail n'est pas déjà liée à un compte.",
"create_success": "L'utilisateur a été créé avec succès",
@@ -618,6 +622,7 @@
"id": "Identifiant d'utilisateur.",
"last_login": "Dernière connexion",
"login_id": "Identifiant de connexion.",
"make_sure_same_password": "Assurez-vous que les deux mots de passe sont identiques et valides",
"my_profile": "Mon profil",
"name": "Prénom",
"new_code_sent": "Nouveau code envoyé !",

View File

@@ -44,6 +44,7 @@
"certificates": "Certificados",
"clear": "Claro",
"close": "Perto",
"code": "Código",
"command": "Comando",
"commands": "comandos",
"commands_executed": "Comandos Executados",
@@ -208,7 +209,7 @@
"error_update": "Erro: {{error}}",
"explanation": "Explicação",
"key_pem_explanation": "Selecione o arquivo .pem",
"last_configuration_change": "Mudança de configuração",
"last_configuration_change": "Última Mudança de Configuração",
"last_configuration_download": "Último download da configuração",
"location": "Localização",
"need_device_type": "Cada configuração deve suportar pelo menos um tipo de dispositivo",
@@ -310,8 +311,10 @@
"error_fetch_entity": "Erro ao buscar informações da entidade",
"error_fetching": "Erro ao buscar entidades",
"error_saving": "Erro ao salvar entidade",
"higher_priority": "Dê maior prioridade",
"ip_detection": "Detecção de IP",
"ip_formats": "Você pode adicionar endereços IPv4 ou IPv6 nos seguintes formatos:",
"lower_priority": "Faça menor prioridade",
"need_select_entity": "Você precisa selecionar uma entidade da tabela abaixo",
"no_ips": "Nenhum IP selecionado",
"not_assigned": "Não atribuído",
@@ -598,6 +601,7 @@
"avatar": "Seu avatar",
"avatar_file": "Seu avatar (máx. De 2 MB)",
"check_phone": "Por favor, verifique o seu telefone para o seu código de validação",
"confirm_new_password": "confirme a nova senha",
"create": "Criar usuário",
"create_failure": "Erro ao criar usuário. Certifique-se de que este endereço de e-mail ainda não esteja vinculado a uma conta.",
"create_success": "Usuário criado com sucesso",
@@ -618,6 +622,7 @@
"id": "ID do usuário.",
"last_login": "Último login",
"login_id": "Identificação de usuário.",
"make_sure_same_password": "Certifique-se de que ambas as senhas são iguais e válidas",
"my_profile": "Meu perfil",
"name": "Nome",
"new_code_sent": "Novo código enviado!",

View File

@@ -188,9 +188,11 @@ const DeviceCommands = () => {
};
const columns = [
{ key: 'command', label: t('common.command'), _style: { width: '15%' } },
{ key: 'completed', label: t('common.completed'), filter: false, _style: { width: '20%' } },
{ key: 'submitted', label: t('common.submitted'), filter: false, _style: { width: '20%' } },
{ key: 'command', label: t('common.command'), _style: { width: '15%' } },
{ key: 'executed', label: t('common.executed'), filter: false, _style: { width: '20%' } },
{ key: 'completed', label: t('common.completed'), filter: false, _style: { width: '20%' } },
{ key: 'errorCode', label: t('common.code'), filter: false, _style: { width: '5%' } },
{
key: 'show_buttons',
label: '',
@@ -271,21 +273,29 @@ const DeviceCommands = () => {
sorterValue={{ column: 'created', desc: 'true' }}
scopedSlots={{
completed: (item) => (
<td>
<td className="align-middle">
{item.completed && item.completed !== 0
? prettyDate(item.completed)
: 'Pending'}
</td>
),
executed: (item) => (
<td className="align-middle">
{item.executed && item.executed !== 0
? prettyDate(item.executed)
: 'Pending'}
</td>
),
submitted: (item) => (
<td>
<td className="align-middle">
{item.submitted && item.submitted !== ''
? prettyDate(item.submitted)
: 'Pending'}
</td>
),
errorCode: (item) => <td className="align-middle">{item.errorCode}</td>,
show_buttons: (item, index) => (
<td>
<td className="align-middle">
<CButtonToolbar
role="group"
className="justify-content-flex-end"

View File

@@ -2,11 +2,9 @@
import React, { useState, useEffect } from 'react';
import {
CWidgetDropdown,
CCollapse,
CButton,
CDataTable,
CCard,
CCardBody,
CRow,
CCol,
CProgress,
@@ -26,7 +24,6 @@ const DeviceHealth = () => {
const { t } = useTranslation();
const { currentToken, endpoints } = useAuth();
const { deviceSerialNumber } = useDevice();
const [details, setDetails] = useState([]);
const [loading, setLoading] = useState(false);
const [healthChecks, setHealthChecks] = useState([]);
const [start, setStart] = useState('');
@@ -95,35 +92,11 @@ const DeviceHealth = () => {
});
};
const toggleDetails = (index) => {
const position = details.indexOf(index);
let newDetails = details.slice();
if (position !== -1) {
newDetails.splice(position, 1);
} else {
newDetails = [...details, index];
}
setDetails(newDetails);
};
const getDetails = (index, healthCheckDetails) => {
if (details.includes(index))
return <pre className="ignore">{JSON.stringify(healthCheckDetails, null, 4)}</pre>;
return <pre className="ignore" />;
};
const columns = [
{ key: 'UUID', label: t('common.config_id') },
{ key: 'recorded', label: t('common.recorded') },
{ key: 'sanity', label: t('health.sanity') },
{
key: 'show_details',
label: '',
_style: { width: '1%' },
sorter: false,
filter: false,
},
{ key: 'recorded', label: t('common.recorded'), _style: { width: '15%' } },
{ key: 'UUID', label: t('common.config_id'), _style: { width: '10%' } },
{ key: 'sanity', label: t('health.sanity'), _style: { width: '5%' } },
{ key: 'checkDetails', label: t('common.details'), _style: { width: '65%' } },
];
useEffect(() => {
@@ -218,29 +191,11 @@ const DeviceHealth = () => {
UUID: (item) => <td className="align-middle">{item.UUID}</td>,
recorded: (item) => <td className="align-middle">{prettyDate(item.recorded)}</td>,
sanity: (item) => <td className="align-middle">{`${item.sanity}%`}</td>,
show_details: (item, index) => (
<td className="align-middle">
<CButton
color="primary"
variant={details.includes(index) ? '' : 'outline'}
shape="square"
size="sm"
onClick={() => {
toggleDetails(index);
}}
>
<CIcon name="cilList" size="lg" />
</CButton>
checkDetails: (item) => (
<td>
<pre className="my-0">{JSON.stringify(item.values)}</pre>
</td>
),
details: (item, index) => (
<CCollapse show={details.includes(index)}>
<CCardBody>
<h5>{t('common.details')}</h5>
<div>{getDetails(index, item.values)}</div>
</CCardBody>
</CCollapse>
),
}}
/>
{showLoadingMore && (

View File

@@ -111,9 +111,10 @@ const DeviceLogs = () => {
};
const columns = [
{ key: 'recorded', label: t('common.recorded'), _style: { width: '15%' } },
{ key: 'UUID', label: t('common.config_id'), _style: { width: '10%' } },
{ key: 'severity', label: t('device_logs.severity'), _style: { width: '5%' } },
{ key: 'log', label: t('device_logs.log') },
{ key: 'severity', label: t('device_logs.severity') },
{ key: 'recorded', label: t('common.recorded') },
{
key: 'show_details',
label: '',
@@ -186,6 +187,7 @@ const DeviceLogs = () => {
<CCard>
<div className="overflow-auto" style={{ height: '250px' }}>
<CDataTable
border
items={logs ?? []}
fields={columns}
loading={loading}

View File

@@ -125,6 +125,13 @@ const EditUserModal = ({ show, toggle, userId, getUsers }) => {
}
}
const newNotes = [];
for (let i = 0; i < user.notes.value.length; i += 1) {
if (user.notes.value[i].new) newNotes.push({ note: user.notes.value[i].note });
}
parameters.notes = newNotes;
if (newData) {
const options = {
headers: {
@@ -171,29 +178,14 @@ const EditUserModal = ({ show, toggle, userId, getUsers }) => {
};
const addNote = (currentNote) => {
setLoading(true);
const parameters = {
id: userId,
notes: [{ note: currentNote }],
};
const options = {
headers: {
Accept: 'application/json',
Authorization: `Bearer ${currentToken}`,
},
};
axiosInstance
.put(`${endpoints.owsec}/api/v1/user/${userId}`, parameters, options)
.then(() => {
getUser();
})
.catch(() => {})
.finally(() => {
setLoading(false);
});
const newNotes = [...user.notes.value];
newNotes.unshift({
note: currentNote,
new: true,
created: new Date().getTime() / 1000,
createdBy: '',
});
updateWithKey('notes', { value: newNotes });
};
useEffect(() => {

View File

@@ -128,7 +128,7 @@ const DevicePage = () => {
active={index === 1}
onClick={() => setIndex(1)}
>
{t('configuration.title')}
{t('common.details')}
</CNavLink>
<CNavLink
className="font-weight-bold"

View File

@@ -13,10 +13,17 @@ const initialState = {
error: false,
editable: false,
},
currentPassword: {
newPassword: {
value: '',
error: false,
editable: true,
ignore: true,
},
confirmNewPassword: {
value: '',
error: false,
editable: true,
ignore: true,
},
email: {
value: '',
@@ -163,10 +170,11 @@ const ProfilePage = () => {
}
if (
userForm.currentPassword.value !== '' &&
!testRegex(userForm.currentPassword.value, policies.passwordPattern)
userForm.newPassword.value !== '' &&
(!testRegex(userForm.newPassword.value, policies.passwordPattern) ||
userForm.newPassword.value !== userForm.confirmNewPassword.value)
) {
updateWithKey('currentPassword', {
updateWithKey('newPassword', {
error: true,
});
setLoading(false);
@@ -188,6 +196,7 @@ const ProfilePage = () => {
userRole: userForm.userRole.value,
notes: newNotes,
userTypeProprietaryInfo: propInfo,
currentPassword: userForm.newPassword.value !== '' ? userForm.newPassword.value : undefined,
};
const options = {