From 395d5a89b232f60b68a71e7c7ac641284c1b2d12 Mon Sep 17 00:00:00 2001 From: ig Date: Wed, 5 Jul 2023 14:31:53 +0200 Subject: [PATCH 1/5] Change S3 keys format; add correct S3 key for SalimaxPrototype --- csharp/App/Backend/Controller.cs | 6 ++++-- csharp/App/Backend/DataTypes/Installation.cs | 6 ++---- .../Backend/DataTypes/Methods/Installation.cs | 2 +- csharp/App/Backend/db.sqlite | Bin 540672 -> 540672 bytes 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/csharp/App/Backend/Controller.cs b/csharp/App/Backend/Controller.cs index 2c54fd319..ca7deabb2 100644 --- a/csharp/App/Backend/Controller.cs +++ b/csharp/App/Backend/Controller.cs @@ -5,7 +5,7 @@ using InnovEnergy.App.Backend.Relations; using InnovEnergy.Lib.Utils; using Microsoft.AspNetCore.Mvc; -namespace InnovEnergy.App.Backend.Controllers; +namespace InnovEnergy.App.Backend; using Token = String; @@ -81,7 +81,9 @@ public class Controller : ControllerBase if (installation is null || !user.HasAccessTo(installation)) return Unauthorized(); - return installation.FillOrderNumbers().HideParentIfUserHasNoAccessToParent(user); + return installation + .FillOrderNumbers() + .HideParentIfUserHasNoAccessToParent(user); } [HttpGet(nameof(GetUsersWithDirectAccessToInstallation))] diff --git a/csharp/App/Backend/DataTypes/Installation.cs b/csharp/App/Backend/DataTypes/Installation.cs index 4a01de8dc..66fa98341 100644 --- a/csharp/App/Backend/DataTypes/Installation.cs +++ b/csharp/App/Backend/DataTypes/Installation.cs @@ -15,8 +15,6 @@ public class Installation : TreeNode public Double Lat { get; set; } public Double Long { get; set; } - public String S3Bucket { get; set; } = ""; - public String S3KeySecret { get; set; } = ""; - - + public String S3Url { get; set; } = ""; + public String S3KeySecret { get; set; } = ""; } \ No newline at end of file diff --git a/csharp/App/Backend/DataTypes/Methods/Installation.cs b/csharp/App/Backend/DataTypes/Methods/Installation.cs index f3c89995d..efbbf221a 100644 --- a/csharp/App/Backend/DataTypes/Methods/Installation.cs +++ b/csharp/App/Backend/DataTypes/Methods/Installation.cs @@ -142,7 +142,7 @@ public static class ExoCmd + " -O text") .ExecuteBufferedAsync(); - return preParse.StandardOutput.Split("\t")[2] + ";" + preParse.StandardOutput.Split("\t")[3]; + return $"{preParse.StandardOutput.Split("\t")[2]};{preParse.StandardOutput.Split("\t")[3]}"; } public static async void RevokeKey(this Installation installation) diff --git a/csharp/App/Backend/db.sqlite b/csharp/App/Backend/db.sqlite index b553a59036466d5f3c87ac9d2b548a3dbde7127c..48f4df21f777348630c05fc75e94b0c88f85bb4d 100644 GIT binary patch delta 191 zcmZo@P;6*WoFL5@Fj2;tHGo0Sd&0()rSln`Hghe==VUxHxoYJJ!Nx*H0eN0Qe|>g# zT?SnyhUCfSs|qDDN=gcft@QPa6LT{2a}#q@GmA3w(o^#$CteYDbB*vfF*8ZDOiME} zN=r#gG%+wwOf)w!vM@EZPBZc@aSr!0arJO3EGhFa%FZuIsq{1`Hx16pO7RE_aCCG@ lNp>;L%(iGYUEOZFnh}VZfS4JGS%8=oh}pKAu4X?y1prj!Km`B* delta 169 zcmZo@P;6*WoFL8UH&Mo!)sI0hUTR~?()o<4o4FR`b26@jHk+<)H(kvL#7scU48$xz P%nHP8+f7%qpPm8$JqkMZ From 25450aecee4e397d3d8352854716720e145d8b30 Mon Sep 17 00:00:00 2001 From: ig Date: Wed, 5 Jul 2023 15:09:28 +0200 Subject: [PATCH 2/5] Extract ExoCmd into own file --- .../App/Backend/DataTypes/Methods/ExoCmd.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 csharp/App/Backend/DataTypes/Methods/ExoCmd.cs diff --git a/csharp/App/Backend/DataTypes/Methods/ExoCmd.cs b/csharp/App/Backend/DataTypes/Methods/ExoCmd.cs new file mode 100644 index 000000000..50be5aafb --- /dev/null +++ b/csharp/App/Backend/DataTypes/Methods/ExoCmd.cs @@ -0,0 +1,48 @@ +using CliWrap; +using CliWrap.Buffered; +using InnovEnergy.Lib.Utils; + +namespace InnovEnergy.App.Backend.DataTypes.Methods; + +public static class ExoCmd +{ + private static readonly Command Exo = Cli.Wrap("exo"); + private const String ConfigFile = "./exoscale.toml"; + + public static async Task<(String key, String secret)> CreateKey(this Installation installation) + { + //if (installation.Id != 1) return "help"; //Todo remove me I am for debugging + + var preParse = await Exo + .WithArguments("iam access-key create " + installation.BucketName() + + " --operation get-sos-object" + + " --resource sos/bucket:" + installation.BucketName() + + " -C " + ConfigFile + + " -O text") + .ExecuteBufferedAsync(); + + var key = preParse.StandardOutput.Split("\t")[2]; + var secret = preParse.StandardOutput.Split("\t")[3]; + + return (key, secret); + + //return $"{key};{secret}"; + } + + public static async void RevokeKey(this Installation installation) + { + try + { + await Exo + .WithArguments("iam access-key revoke " + installation.S3Key + " -f " + " -C " + ConfigFile) + .ExecuteAsync(); + + } + catch + { + // TODO + ("Failed to revoke key for installation " + installation.Name).WriteLine(); + } + } + +} \ No newline at end of file From 3a10e4cb20284e11299d7a53a24d8f680a66ce87 Mon Sep 17 00:00:00 2001 From: ig Date: Wed, 5 Jul 2023 15:10:08 +0200 Subject: [PATCH 3/5] Split S3KeySecret into S3Key and S3Secret --- .../Backend/DataTypes/Methods/Installation.cs | 47 +++---------------- 1 file changed, 6 insertions(+), 41 deletions(-) diff --git a/csharp/App/Backend/DataTypes/Methods/Installation.cs b/csharp/App/Backend/DataTypes/Methods/Installation.cs index efbbf221a..92ca2a4c7 100644 --- a/csharp/App/Backend/DataTypes/Methods/Installation.cs +++ b/csharp/App/Backend/DataTypes/Methods/Installation.cs @@ -1,5 +1,3 @@ -using CliWrap; -using CliWrap.Buffered; using InnovEnergy.App.Backend.Database; using InnovEnergy.App.Backend.S3; using InnovEnergy.Lib.Utils; @@ -19,7 +17,11 @@ public static class InstallationMethods public static async Task RenewS3BucketUrl(this Installation installation) { installation.RevokeKey(); - installation.S3KeySecret = await installation.CreateKey(); + var (key, secret) = await installation.CreateKey(); + + installation.S3Key = key; + installation.S3Secret = secret; + return Db.Update(installation); } @@ -124,41 +126,4 @@ public static class InstallationMethods return installation; } -} - -public static class ExoCmd -{ - private static readonly Command Exo = Cli.Wrap("exo"); - private static String ConfigFile = "./exoscale.toml"; - - public static async Task CreateKey(this Installation installation) - { - if (installation.Id != 1) return "help"; //Todo remove me I am for debugging - var preParse = await Exo - .WithArguments("iam access-key create " + installation.BucketName() - + " --operation get-sos-object" - + " --resource sos/bucket:" + installation.BucketName() - + " -C " + ConfigFile - + " -O text") - .ExecuteBufferedAsync(); - - return $"{preParse.StandardOutput.Split("\t")[2]};{preParse.StandardOutput.Split("\t")[3]}"; - } - - public static async void RevokeKey(this Installation installation) - { - try - { - await Exo - .WithArguments("iam access-key revoke " + installation.S3KeySecret.Split(";", 2)[0] + " -f " + " -C " + ConfigFile) - .ExecuteAsync(); - - } - catch - { - // todo Fill me there is no key for this installation - } - } - -} - +} \ No newline at end of file From 9068f183d637c45d8aa07823c54c15c1ddb9afe1 Mon Sep 17 00:00:00 2001 From: ig Date: Wed, 5 Jul 2023 15:13:44 +0200 Subject: [PATCH 4/5] Use separate S3 data fields as in S3Config (cs & ts) --- csharp/App/Backend/DataTypes/Installation.cs | 7 +++++-- csharp/App/Backend/db.sqlite | Bin 540672 -> 540672 bytes .../Installations/Log/ScalarGraph.tsx | 5 ++--- .../Frontend/src/dataCache/S3/S3Access.ts | 8 +++----- typescript/Frontend/src/util/types.tsx | 8 ++++++-- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/csharp/App/Backend/DataTypes/Installation.cs b/csharp/App/Backend/DataTypes/Installation.cs index 66fa98341..428ce3dbe 100644 --- a/csharp/App/Backend/DataTypes/Installation.cs +++ b/csharp/App/Backend/DataTypes/Installation.cs @@ -15,6 +15,9 @@ public class Installation : TreeNode public Double Lat { get; set; } public Double Long { get; set; } - public String S3Url { get; set; } = ""; - public String S3KeySecret { get; set; } = ""; + public String S3Bucket { get; set; } = ""; + public String S3Region { get; set; } = ""; + public String S3Provider { get; set; } = ""; + public String S3Key { get; set; } = ""; + public String S3Secret { get; set; } = ""; } \ No newline at end of file diff --git a/csharp/App/Backend/db.sqlite b/csharp/App/Backend/db.sqlite index 48f4df21f777348630c05fc75e94b0c88f85bb4d..629857e5cc02d2317f4c301f6dc6fb53bf6bcf52 100644 GIT binary patch delta 387 zcmZo@P;6*WoFFY2#K6GN0>m(2IZ?-$F=%7L%K41eo4FR`b21*CT($C`Xk!JVkUX!T zzdk#=E`u(Uv#zePWb)*Wl|_?3t&%YG^AAx74R&==aP*7x^$&7I=NIP}>n3ODrey0H zrB>wYW#%_?uWsjF%?QLyK+FupEI`Z(#BAHSSF`_O;br~Az;}VKj?awuDeI?+Wm?;9 zHn4AF>H@nt3xBhlJiEBDF=Lx? mNn%n?>g11%!kf=CIxtRWy2dWm(2G*QQxF<@iD%K3~=o4FR`b26TpT($C`RAy0TUV3U? zVs+&8(i zSr%-Uy1;JEGI@c4KYvrXJiEBDF=MM}Nn%n?>g11%!kf=CIxtSx-OkQ2efL#%{_T?2 I*q>(t0H8ru Date: Thu, 6 Jul 2023 08:36:26 +0200 Subject: [PATCH 5/5] Added german and french --- typescript/Frontend/lang/de.json | 136 +++++++++++++++++++++++++++++++ typescript/Frontend/lang/fr.json | 136 +++++++++++++++++++++++++++++++ 2 files changed, 272 insertions(+) create mode 100644 typescript/Frontend/lang/de.json create mode 100644 typescript/Frontend/lang/fr.json diff --git a/typescript/Frontend/lang/de.json b/typescript/Frontend/lang/de.json new file mode 100644 index 000000000..903777cdf --- /dev/null +++ b/typescript/Frontend/lang/de.json @@ -0,0 +1,136 @@ +{ + "Information": { + "defaultMessage": "Information" + }, + "addNewChild": { + "defaultMessage": "Neues Kind hinzufügen" + }, + "addNewDialogButton": { + "defaultMessage": "Neue Dialogschaltfläche hinzufügen" + }, + "addUser": { + "defaultMessage": "Nutzer erstellen" + }, + "alarms": { + "defaultMessage": "Alarme" + }, + "applyChanges": { + "defaultMessage": "Änderungen speichern" + }, + "country": { + "defaultMessage": "Land" + }, + "createNewFolder": { + "defaultMessage": "Neuen Ordner erstellen" + }, + "createNewUser": { + "defaultMessage": "Neuen Nutzer erstellen" + }, + "customerName": { + "defaultMessage": "Kundenname" + }, + "email": { + "defaultMessage": "Email" + }, + "english": { + "defaultMessage": "Englisch" + }, + "error": { + }, + "folder": { + "defaultMessage": "Ordner" + }, + "german": { + "defaultMessage": "Deutsch" + }, + "groupTabs": { + "defaultMessage": "Gruppen" + }, + "groupTree": { + "defaultMessage": "Gruppenbaum" + }, + "information": { + "defaultMessage": "Information" + }, + "inheritedAccess": { + "defaultMessage": "Vererbter Zugriff von" + }, + "installation": { + "defaultMessage": "Installation" + }, + "installationTabs": { + "defaultMessage": "Installationen" + }, + "installations": { + "defaultMessage": "Installationen" + }, + "lastWeek": { + "defaultMessage": "Letzte Woche" + }, + "location": { + "defaultMessage": "Standort" + }, + "log": { + "defaultMessage": "Logbuch" + }, + "logout": { + "defaultMessage": "Abmelden" + }, + "makeASelection": { + "defaultMessage": "Bitte wählen Sie links eine Auswahl" + }, + "manageAccess": { + "defaultMessage": "Zugriff verwalten" + }, + "move": { + "defaultMessage": "Verschieben" + }, + "moveTo": { + "defaultMessage": "Verschieben zu" + }, + "moveTree": { + "defaultMessage": "Baum verschieben" + }, + "name": { + "defaultMessage": "Name" + }, + "navigationTabs": { + "defaultMessage": "Navigation" + }, + "orderNumbers": { + "defaultMessage": "Bestellnummer" + }, + "region": { + "defaultMessage": "Region" + }, + "requiredLocation": { + "defaultMessage": "Standort ist erforderlich" + }, + "requiredName": { + "defaultMessage": "Name ist erforderlich" + }, + "requiredRegion": { + "defaultMessage": "Region ist erforderlich" + }, + "search": { + "defaultMessage": "Suche" + }, + "submit": { + "defaultMessage": "Senden" + }, + "updateFolderErrorMessage": { + "defaultMessage": "Fehler, Ordner kann nicht aktualisiert werden" + }, + "updatedSuccessfully": { + "defaultMessage": "Erfolgreich aktualisiert" + }, + "user": { + "defaultMessage": "Nutzer" + }, + "userTabs": { + "defaultMessage": "Nutzer" + }, + "users": { + "defaultMessage": "Nutzer" + } +} diff --git a/typescript/Frontend/lang/fr.json b/typescript/Frontend/lang/fr.json new file mode 100644 index 000000000..a1178e87d --- /dev/null +++ b/typescript/Frontend/lang/fr.json @@ -0,0 +1,136 @@ +{ + "Information": { + "defaultMessage": "Informations" + }, + "addNewChild": { + "defaultMessage": "Ajouter un nouvel enfant" + }, + "addNewDialogButton": { + "defaultMessage": "Ajouter un nouveau bouton de dialogue" + }, + "addUser": { + "defaultMessage": "Créer un utilisateur" + }, + "alarms": { + "defaultMessage": "Alarmes" + }, + "applyChanges": { + "defaultMessage": "Appliquer les modifications" + }, + "country": { + "defaultMessage": "Pays" + }, + "createNewFolder": { + "defaultMessage": "Créer un nouveau dossier" + }, + "createNewUser": { + "defaultMessage": "Créer un nouvel utilisateur" + }, + "customerName": { + "defaultMessage": "Nom du client" + }, + "email": { + "defaultMessage": "E-mail" + }, + "english": { + "defaultMessage": "Anglais" + }, + "error": { + }, + "folder": { + "defaultMessage": "Dossier" + }, + "german": { + "defaultMessage": "Allemand" + }, + "groupTabs": { + "defaultMessage": "Onglets de groupe" + }, + "groupTree": { + "defaultMessage": "Arbre de groupe" + }, + "information": { + "defaultMessage": "Informations" + }, + "inheritedAccess": { + "defaultMessage": "Accès hérité de" + }, + "installation": { + "defaultMessage": "Installation" + }, + "installationTabs": { + "defaultMessage": "Onglets d'installation" + }, + "installations": { + "defaultMessage": "Installations" + }, + "lastWeek": { + "defaultMessage": "La semaine dernière" + }, + "location": { + "defaultMessage": "Localisation" + }, + "log": { + "defaultMessage": "Journal" + }, + "logout": { + "defaultMessage": "Déconnexion" + }, + "makeASelection": { + "defaultMessage": "Veuillez faire une sélection à gauche" + }, + "manageAccess": { + "defaultMessage": "Gérer l'accès" + }, + "move": { + "defaultMessage": "Déplacer" + }, + "moveTo": { + "defaultMessage": "Déplacer à" + }, + "moveTree": { + "defaultMessage": "Déplacer l'arbre" + }, + "name": { + "defaultMessage": "Nom" + }, + "navigationTabs": { + "defaultMessage": "Onglets de navigation" + }, + "orderNumbers": { + "defaultMessage": "Numéro de commande" + }, + "region": { + "defaultMessage": "Région" + }, + "requiredLocation": { + "defaultMessage": "L'emplacement est requis" + }, + "requiredName": { + "defaultMessage": "Le nom est obligatoire" + }, + "requiredRegion": { + "defaultMessage": "La région est obligatoire" + }, + "search": { + "defaultMessage": "Recherche" + }, + "submit": { + "defaultMessage": "Soumettre" + }, + "updateFolderErrorMessage": { + "defaultMessage": "Une erreur s'est produite, impossible de mettre à jour le dossier." + }, + "updatedSuccessfully": { + "defaultMessage": "Mise à jour réussie" + }, + "user": { + "defaultMessage": "Utilisateur" + }, + "userTabs": { + "defaultMessage": "Onglets utilisateurs" + }, + "users": { + "defaultMessage": "Utilisateurs" + } +}