ToolJet/frontend/src/ManageOrgVars/VariableForm.jsx
Kiran Ashok e5d75bd4cf
Feat :: Editor UI revamp (#7275)
* temp commit ::  editor redesign

* fix :: components panel ui

* style updates

* fix :: arrangement widget list

* fix :: light mode widget list

* style fixes query manager

* updates

* updates heaer styles

* global settings fix

* left sidebar states and icon change

* cleanup

* minor fixes :: review

* fix opacity mode toggle

* detailing in hover states , bugfixes

* fix :: coloring whole app , debugger ui

* cleanup

* fix :: revert some changes , fix statistics widget

* feat :: navbar with new layout

* fix :: lint warnings

* cleanup

* cleanup

* minor fixes

* fix :: reusing serchbox

* removed unwanted prop

* Revert "cleanup"

This reverts commit b18abe19fb.

* fix :: icons sidebar

* fix :: padding searchbar

* style fix

* radix :: dark theme for portals

* fix :: icon styles

* fix :: all codehinter styles

* update :: base bg color app

* fix :: viewer color

* minor fixes :: icon left sidebar

* typo

* fix :: styling save message header

* icon :: fix for layout and inspector queries

* fix :: canvas and editor bg

* fix :: release btn style

* fix :: navbar border

* undo redo tooltip

* fix :: page input

* remove released btn icon

* fix :: for icon not loading proper in inspector

* fix :: dark mode toggle icon size

* fix :: share  app ui

* fix :: style fixes , inspector runpy icon

* fix :: ui runpy codehinter

* fix :: inputs in gds connection

* cleanup

* fix :: copilot codehinter ui

* fix :: share modal button

* fix :: canvas bg text

* style fix debugger

* fix :: whole dahsboard layout and border for all codehinters

* fix :: icon fills

* fix :: icon fill color sidebar

* darkmode fill color

* minor style fix

* Widget inspector redesign (#7355)

* Setup Storybook

* Update storybook config

* Add tab and toggle group component

* Created list component

* Properties tab

* update codehinter dropdown components

* Refactor styling

* Inspector header changes

* Fix es lint issue

* Fix

* feat :: styling color picker styles panel

* Fix color picker alignment

* feat :: remove alpha

* Fix UI bugs

* fix :: color picker

* Ui fix

* Backward compatible pagination changes

* fix

* Feedback changes

* UI feedback

* Check fix

* Fix

* fix :: canvas bg popover

* Styles fix

* Fix conflct issues

* minor style fix style tab

* Fix

* review comments fix :: hovering in color picker

* Code review and design feedback

* UI feedback

* Fix UI styles

* Fix pagination issue

* fix :: dark mode issues in select , number input

* fix :: remove extra boreder

* fix :: table column popover ui and component popover inspector

* fix :: datepickre input table column

* fix :: colopicker in table column inspector

* fix :: link column type ui in table

* fix :: column delete ui and delete not triggering

* Fix list item not dragging

* fix :: closing of popover on link column select

* style fix table popover

* Pass dark mode to Event manager button

* fix :: ux event manager

* cleanup

* cleanup

* fix :: delete page modal ui

---------

Co-authored-by: stepinfwd <stepinfwd@gmail.com>

* style fixes

---------

Co-authored-by: Nakul Nagargade <133095394+nakulnagargade@users.noreply.github.com>
2023-09-04 13:30:39 +05:30

143 lines
6.1 KiB
JavaScript

import React from 'react';
import Select from '@/_ui/Select';
import { withTranslation } from 'react-i18next';
import { ButtonSolid } from '@/_ui/AppButton/AppButton';
class VariableForm extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div className="variable-form-wrap">
<div className="card-header">
<h3 className="card-title" data-cy="workspace-variable-form-title">
{!this.props.selectedVariableId
? this.props.t(
'header.organization.menus.manageSSO.environmentVar.variableForm.addNewVariable',
'Add new variable'
)
: this.props.t(
'header.organization.menus.manageSSO.environmentVar.variableForm.updatevariable',
'Update variable'
)}
</h3>
</div>
<div className="card-body">
<form onSubmit={this.props.createOrUpdate} noValidate>
<div className="form-group mb-3 ">
<div>
<div className="col tj-app-input">
<label className="form-label" data-cy="workspace-variable-name-label">
{this.props.t('header.organization.menus.manageSSO.environmentVar.variableForm.name', 'Name')}
</label>
<input
type="text"
className="form-control"
placeholder={this.props.t(
'header.organization.menus.manageSSO.environmentVar.variableForm.enterVariableName',
'Enter Variable Name'
)}
name="variable_name"
onChange={this.props.changeNewVariableOption.bind(this, 'variable_name')}
value={this.props.fields['variable_name']}
data
autoFocus
data-cy="workspace-variable-name-input"
/>
<span className="text-danger" data-cy="name-error-text">
{this.props.errors['variable_name']}
</span>
</div>
<div className="col tj-app-input">
<label className="form-label" data-cy="workspace-variable-value-label">
{this.props.t('header.organization.menus.manageSSO.environmentVar.variableForm.value', 'Value')}
</label>
<input
type="text"
className="form-control"
placeholder={this.props.t(
'header.organization.menus.manageSSO.environmentVar.variableForm.enterValue',
'Enter Value'
)}
name="value"
onChange={this.props.changeNewVariableOption.bind(this, 'value')}
value={this.props.fields['value']}
data-cy="workspace-variable-value-input"
/>
<span className="text-danger" data-cy="value-error-text">
{this.props.errors['value']}
</span>
</div>
</div>
</div>
<div className="form-group mb-3 ">
<div className="row">
<div className="col">
<label className="form-label" data-cy="workspace-variable-type-label">
{this.props.t('header.organization.menus.manageSSO.environmentVar.variableForm.type', 'Type')}
</label>
{this.props.selectedVariableId ? (
<span>{this.props.fields['variable_type']}</span>
) : (
<Select
options={[
{ name: 'Client', value: 'client' },
{ name: 'Server', value: 'server' },
]}
hasSearch={false}
value={this.props.fields['variable_type'] ?? 'client'}
onChange={(value) => this.props.handleVariableTypeSelect(value)}
useMenuPortal={false}
/>
)}
</div>
<div className="col">
<label className="form-label" data-cy="enable-toggle-label">
{this.props.t(
'header.organization.menus.manageSSO.environmentVar.variableForm.enableEncryption',
' Enable encryption'
)}
</label>
<div className="form-check form-switch encryption-input">
<input
className="form-check-input"
type="checkbox"
disabled={
this.props.selectedVariableId || this.props.fields['variable_type'] === 'server' ? true : false
}
data-cy="enable-toggle"
onChange={(e) => this.props.handleEncryptionToggle(e)}
checked={this.props.fields['variable_type'] === 'server' ? true : this.props.fields['encryption']}
/>
</div>
</div>
</div>
</div>
</form>
</div>
<div className="form-footer gap-2 variable-form-footer">
<ButtonSolid onClick={() => this.props.onCancelBtnClicked()} data-cy="cancel-button" variant="tertiary">
{this.props.t('globals.cancel', 'Cancel')}
</ButtonSolid>
<ButtonSolid
type="submit"
onClick={this.props.createOrUpdate}
isLoading={this.props.addingVar}
disabled={this.props.addingVar}
data-cy="add-varable-button"
>
{' '}
{!this.props.selectedVariableId
? this.props.t(
'header.organization.menus.manageSSO.environmentVar.variableForm.addVariable',
'Add variable'
)
: this.props.t('globals.save', 'Save')}
</ButtonSolid>
</div>
</div>
);
}
}
export default withTranslation()(VariableForm);