Skip to content

Commit

Permalink
Merge pull request #2036 from MAIF/testsForUX
Browse files Browse the repository at this point in the history
Routes Wizard enhancement
  • Loading branch information
Zwiterrion authored Dec 6, 2024
2 parents 8a8d2e1 + 9832d59 commit e2c2ee8
Show file tree
Hide file tree
Showing 12 changed files with 368 additions and 251 deletions.
1 change: 0 additions & 1 deletion otoroshi/javascript/src/components/inputs/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,6 @@ export class Table extends Component {
: []
}
onFetchData={(state, instance) => {
// console.log('onFetchData')
this.update(state);
}}
onFilteredChange={(column, value) => {
Expand Down
3 changes: 2 additions & 1 deletion otoroshi/javascript/src/components/nginputs/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ export class NgFormRenderer extends Component {
onClick={() => {
if (clickable) this.setBreadcrumb();
}}
>
className={showChildren ? '' : 'component_collapsable' }
>
<div
style={{
display: 'flex',
Expand Down
41 changes: 6 additions & 35 deletions otoroshi/javascript/src/pages/FeaturesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,53 +389,24 @@ const Feature = ({ title, description, img, link, icon }) => {
return (
<AutoLink
to={link}
className="d-flex"
style={{
backgroundColor: 'var(--bg-color_level2)',
margin: '5px 0px',
height: '100%',
borderRadius: '12px',
maxWidth: 300,
minWidth: 300,
maxHeight: 300,
minHeight: 300,
padding: 0,
display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
}}
className="cards"
>
<div
className="cards-header"
style={{
flex: 1,
background: `url(${img})`,
backgroundSize: 'contain',
backgroundPosition: 'center',
backgroundRepeat: 'no-repeat',
minHeight: 150,
margin: 12,
background: `url(${img})`
}}
></div>
<div
className="d-flex flex-column"
style={{ flex: 1, backgroundColor: 'var(--bg-color_level3)', padding: '12px' }}
className="cards-body"
>
<div
style={{
fontWeight: 'bold',
marginLeft: '5px',
marginTop: '7px',
marginBottom: '10px',
fontSize: 20,
color: 'var(--color_level3)',
textTransform: 'capitalize',
}}
className="cards-title"
>
{zeIcon} {title}
</div>
<div
className="me-1"
style={{ marginLeft: '5px', marginBottom: '10px', color: 'var(--color_level3)' }}
className="cards-description"
>
<p>{description}</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion otoroshi/javascript/src/pages/JwtVerifiersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class JwtVerifiersPage extends Component {
<PageTitle title={title} {...this.props}>
{isEditPage && (
<Dropdown>
<YAMLExportButton value={verifier} entityKind="JwtVerifier" />
<YAMLExportButton value={verifier} entityKind="security.otoroshi.io/JwtVerifier" />
<JsonExportButton value={verifier} entityKind="security.otoroshi.io/JwtVerifier" />
<SquareButton
level="danger"
Expand Down
6 changes: 3 additions & 3 deletions otoroshi/javascript/src/pages/RouteDesigner/Designer.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ const Modal = ({ question, onOk, onCancel }) => (
Cancel
</button>
<button type="button" className="btn btn-sm btn-success" onClick={onOk}>
<i className="fas fa-check me-1" />
Delete
<i className=" me-1" />
Remove
</button>
</div>
</div>
Expand Down Expand Up @@ -927,7 +927,7 @@ class Designer extends React.Component {
this.setState({
alertModal: {
show: true,
question: `Delete this plugin ?`,
question: `Remove this plugin ?`,
onCancel: (e) => {
e.stopPropagation();
this.setState({
Expand Down
43 changes: 35 additions & 8 deletions otoroshi/javascript/src/pages/RouteDesigner/Informations.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,19 @@ export const Informations = forwardRef(
);
}, [value]);

if (!value) return null;
function saveRoute(customValue) {

const finalValue = customValue || value;

function saveRoute() {
if (isCreation || location.state?.routeFromService) {
return nextClient
.forEntityNext(nextClient.ENTITIES[fetchName])
.create(value)
.then(() => history.push(`/${link}/${value.id}?tab=flow`));
.create(finalValue)
.then(() => history.push(`/${link}/${finalValue.id}?tab=flow`));
} else {
return nextClient
.forEntityNext(nextClient.ENTITIES[fetchName])
.update(value)
.update(finalValue)
.then((res) => {
if (!res.error) setValue(res);
});
Expand All @@ -69,9 +70,35 @@ export const Informations = forwardRef(
// constraints: [constraints.required()],
},
enabled: {
type: 'bool',
label: 'Enabled',
props: {},
renderer: props => {
return <>
<div className='d-flex align-items-baseline'>
<p className='ms-2'>Exposition of the route</p>
<div className='d-flex flex-column gap-3 ms-3'>
<span className={`badge bg-${props.value ? 'success' : 'danger'}`} style={{ width: 'fit-content' }}>
{props.value ? 'Exposed' : 'Disabled'}
</span>
{props.value ?
<Button type="danger" className="btn-sm mb-3" text="Disable this route"
onClick={() => {
window
.newConfirm('Are you sure you disable this route ? Traffic will be stop immediately.')
.then((ok) => {
if (ok) {
saveRoute({ ...value, enabled: false })
.then(() => window.location.reload())
}
})
}} /> :
<Button type="success" className="btn-sm mb-3" text="Publish this route"
onClick={() => {
saveRoute({ ...value, enabled: true })
.then(() => window.location.reload())
}} />}
</div>
</div>
</>
}
},
capture: {
type: 'bool',
Expand Down
Loading

0 comments on commit e2c2ee8

Please sign in to comment.