mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-21 23:43:15 +01:00
feat: updates
This commit is contained in:
parent
d8bf27f288
commit
f088cdb504
@ -59,7 +59,7 @@ const EnvironmentVariables = ({ environment, collection, setIsModified, original
|
||||
|
||||
const ErrorMessage = ({ name }) => {
|
||||
const meta = formik.getFieldMeta(name);
|
||||
if (!meta.error) {
|
||||
if (!meta.error || !meta.touched) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ const EnvironmentVariables = ({ environment, setIsModified, originalEnvironmentV
|
||||
|
||||
const ErrorMessage = ({ name }) => {
|
||||
const meta = formik.getFieldMeta(name);
|
||||
if (!meta.error) {
|
||||
if (!meta.error || !meta.touched) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
const _ = require('lodash');
|
||||
const Store = require('electron-store');
|
||||
const { encryptString, decryptString } = require('../utils/encryption');
|
||||
|
||||
class GlobalEnvironmentsStore {
|
||||
constructor() {
|
||||
@ -9,16 +10,52 @@ class GlobalEnvironmentsStore {
|
||||
});
|
||||
}
|
||||
|
||||
isValidValue(val) {
|
||||
return typeof val === 'string' && val.length >= 0;
|
||||
}
|
||||
|
||||
encryptGlobalEnvironmentVariables({ globalEnvironments }) {
|
||||
return globalEnvironments?.map(env => {
|
||||
const variables = env.variables?.map(v => ({
|
||||
...v,
|
||||
value: v?.secret ? (this.isValidValue(v.value) ? encryptString(v.value) : '') : v?.value
|
||||
})) || [];
|
||||
|
||||
return {
|
||||
...env,
|
||||
variables
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
decryptGlobalEnvironmentVariables({ globalEnvironments }) {
|
||||
return globalEnvironments?.map(env => {
|
||||
const variables = env.variables?.map(v => ({
|
||||
...v,
|
||||
value: v?.secret ? (this.isValidValue(v.value) ? decryptString(v.value) : '') : v?.value
|
||||
})) || [];
|
||||
|
||||
return {
|
||||
...env,
|
||||
variables
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
getGlobalEnvironments() {
|
||||
return this.store.get('environments', []);
|
||||
let globalEnvironments = this.store.get('environments', []);
|
||||
globalEnvironments = this.decryptGlobalEnvironmentVariables({ globalEnvironments });
|
||||
return globalEnvironments;
|
||||
}
|
||||
|
||||
getActiveGlobalEnvironmentUid() {
|
||||
return this.store.get('activeGlobalEnvironmentUid', null);
|
||||
}
|
||||
|
||||
setGlobalEnvironments(environments) {
|
||||
return this.store.set('environments', environments);
|
||||
setGlobalEnvironments(globalEnvironments) {
|
||||
globalEnvironments = this.encryptGlobalEnvironmentVariables({ globalEnvironments });
|
||||
return this.store.set('environments', globalEnvironments);
|
||||
}
|
||||
|
||||
setActiveGlobalEnvironmentUid(uid) {
|
||||
|
Loading…
Reference in New Issue
Block a user