fix: fixed env var issues

This commit is contained in:
Anoop M D 2023-01-29 14:17:01 +05:30
parent 050ee2680f
commit cc261326fc
4 changed files with 27 additions and 13 deletions

View File

@ -4,6 +4,16 @@ const StyledWrapper = styled.div`
.variable-name { .variable-name {
color: ${(props) => props.theme.variables.name.color}; color: ${(props) => props.theme.variables.name.color};
} }
.variable-name{
width:100px;
}
.variable-value {
max-width: 500px;
inline-size: 500px;
overflow-wrap: break-word;
}
` `
export default StyledWrapper; export default StyledWrapper;

View File

@ -4,16 +4,16 @@ import StyledWrapper from './StyledWrapper';
const VariablesTable = ({ variables }) => { const VariablesTable = ({ variables }) => {
return ( return (
<StyledWrapper> <StyledWrapper>
<table className="w-full"> <div className="flex flex-col w-full">
<tbody> {(variables && variables.length) ? variables.map((variable) => {
{variables.map((variable) => ( return (
<tr key={variable.uid}> <div key={variable.uid} className="flex">
<td className='variable-name text-yellow-600'>{variable.name}</td> <div className='variable-name text-yellow-600 text-right pr-2'>{variable.name}</div>
<td className='pl-2'>{variable.value}</td> <div className='variable-value pl-2 whitespace-normal text-left flex-grow'>{variable.value}</div>
</tr> </div>
))} );
</tbody> }) : null}
</table> </div>
</StyledWrapper> </StyledWrapper>
); );
}; };

View File

@ -128,6 +128,9 @@ const registerNetworkIpc = (mainWindow, watcher, lastOpenedCollections) => {
data: result.data data: result.data
}; };
} catch (error) { } catch (error) {
// todo: better error handling
// need to convey the error to the UI
// and need not be always a network error
deleteCancelToken(cancelTokenUid); deleteCancelToken(cancelTokenUid);
if(error.response) { if(error.response) {

View File

@ -1,5 +1,5 @@
const Mustache = require('mustache'); const Mustache = require('mustache');
const { each, get } = require('lodash'); const { each, get, forOwn } = require('lodash');
// override the default escape function to prevent escaping // override the default escape function to prevent escaping
Mustache.escape = function (value) { Mustache.escape = function (value) {
@ -17,9 +17,10 @@ const interpolateVars = (request, envVars = {}) => {
request.url = interpolate(request.url); request.url = interpolate(request.url);
each(request.headers, (header) => { forOwn(request.headers, (value, key) => {
header.value = interpolate(header.value); request.headers[key] = interpolate(value);
}); });
each(request.params, (param) => { each(request.params, (param) => {
param.value = interpolate(param.value); param.value = interpolate(param.value);
}); });