-
Notifications
You must be signed in to change notification settings - Fork 3
feat: service page using form components #525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
6a2e01e
feat: basic fields for service
ElderMatt 751cc49
feat: first run
ElderMatt 25e855f
feat: some fields are now loading data
ElderMatt e5e78a0
feat: all fields working
ElderMatt 0a2641e
feat: number field with custom end andorment
dennisvankekem 85b02ab
fix: validation message now visible
ElderMatt 6edc8a7
feat: fix custom errors
ElderMatt 25b8d35
fix: knative error
ElderMatt 3c98580
fix: remove demo data
ElderMatt a4cebdd
fix: find services and secrets
ElderMatt a80ed6d
fix: find service
ElderMatt d356a19
fix: find secrets
ElderMatt efdb878
fix: subdomain
ElderMatt 124d1cd
fix: remove cname and headers if empty
ElderMatt baf6d5e
fix: styling subdomain and paths
ElderMatt 9a38294
fix: remove demo values
ElderMatt 0d7753e
fix: styling and refresh page empty values
ElderMatt eac9924
fix: removed logs
ElderMatt 08fca90
Merge branch 'main' into APL-537
dennisvankekem fbfee66
fix: urls empty and namespace required
ElderMatt 4806690
feat: added linkednumber validation and url helper
ElderMatt e3fc1e3
fix: doc change console log removed and comment fixed
ElderMatt c478ace
Merge branch 'main' into APL-537
ElderMatt 118824f
feat: ports is select and filter services
ElderMatt df5a135
Merge branch 'main' into APL-537
ElderMatt bbeca4f
fix: serviceid to servicename
ElderMatt 72e6ae3
fix: put back smtp in team component
ElderMatt 9dde7c2
Update Team.tsx
ElderMatt cf18d7d
feat: added keys and changed texts
ElderMatt 7a58715
fix: url being empty
ElderMatt 9465d15
fix: set url
ElderMatt 61032d6
fix: fetching check
ElderMatt 684a2a3
fix: set service and filtered services
ElderMatt a5c9fdd
feat: platform ingress classnames now fetched
ElderMatt 372a8cf
feat: use advancedsettings component from APL-540
dennisvankekem 1cf514c
fix: rerender issues
ElderMatt 87f3029
Merge branch 'main' into APL-537
ElderMatt 6736a82
Merge branch 'main' into APL-537
ElderMatt 43a6eb5
feat: use api v2
ElderMatt e09338c
feat: merge branch main into apl-537 and fix checkboxes
ElderMatt 5d7de7f
Merge branch 'main' into APL-537
ElderMatt ae3e4d7
fix: empty fields and double slash in overview
ElderMatt 956d1fc
fix: teams being undefined
ElderMatt 77fe0e5
fix: empty teams
ElderMatt d4e06d4
fix: undefined paths
ElderMatt 3a79170
fix: trafficmanagement and dropdowns
ElderMatt 4b0d29c
fix: default value in linkednumber component
ElderMatt 38c8799
fix: add default ingressclassname platform
ElderMatt 7cf9973
feat: added adjustable width to autocomplete
ElderMatt f2f1021
feat: cname domainsuffix validation
ElderMatt 681fc30
fix: light mode cname text
ElderMatt d959b33
Merge branch 'main' into APL-537
dennisvankekem 9568088
fix: clamped values
dennisvankekem 02d8c8b
fix: comment from ux findings
ElderMatt 3b8957e
fix: pathing and forward slash
ElderMatt afb3419
fix: uxfindings
ElderMatt 63c0313
fix: save changes instead of edit service
ElderMatt 33e3054
fix: cname styling
ElderMatt 965a5c7
fix: add buttons in keyvalue
ElderMatt 4543723
fix: removed tsnocheck
ElderMatt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| import React, { useState } from 'react' | ||
| import { Box } from '@mui/material' | ||
| import { TextField } from 'components/forms/TextField' | ||
| import { makeStyles } from '@mui/styles' | ||
| import { Typography } from 'components/Typography' | ||
| import { InputLabel } from 'components/InputLabel' | ||
| import { useFieldArray, useFormContext } from 'react-hook-form' | ||
| import FormRow from './FormRow' | ||
|
|
||
| const useStyles = makeStyles({ | ||
| container: { | ||
| padding: '16px', | ||
| backgroundColor: '#424242', | ||
| borderRadius: '8px', | ||
| }, | ||
| itemRow: { | ||
| marginBottom: '20px', | ||
| display: 'flex', | ||
| alignItems: 'center', | ||
| }, | ||
| addItemButton: { | ||
| marginLeft: '-10px', | ||
| display: 'flex', | ||
| alignItems: 'center', | ||
| textTransform: 'none', | ||
| }, | ||
| }) | ||
|
|
||
| interface registers { | ||
| registerA: any | ||
| registerB: any | ||
| } | ||
|
|
||
| interface KeyValueProps { | ||
| title: string | ||
| subTitle?: string | ||
| keyLabel: string | ||
| keyValue?: string | ||
| keyDisabled?: boolean | ||
| showLabel?: boolean | ||
| valueLabel: string | ||
| valueDisabled?: boolean | ||
| name: string | ||
| registers?: registers | ||
| } | ||
|
|
||
| export default function KeyValue(props: KeyValueProps) { | ||
| const classes = useStyles() | ||
| const { control, register } = useFormContext() | ||
|
|
||
| const { | ||
| title, | ||
| subTitle, | ||
| keyLabel, | ||
| valueLabel, | ||
| name, | ||
| keyValue, | ||
| keyDisabled = false, | ||
| showLabel = true, | ||
| valueDisabled = false, | ||
| registers, | ||
| } = props | ||
|
|
||
| const [items, setItems] = useState([{ [keyLabel.toLowerCase()]: '', [valueLabel.toLowerCase()]: '' }]) | ||
|
|
||
| const { fields, append, remove } = useFieldArray({ | ||
| control, | ||
| name, | ||
| }) | ||
|
|
||
| return ( | ||
| <Box> | ||
| <InputLabel sx={{ fontWeight: 'bold', fontSize: '14px' }}>{title}</InputLabel> | ||
| {subTitle && <Typography sx={{ color: '#ABABAB' }}>{subTitle}</Typography>} | ||
|
|
||
| <FormRow spacing={10}> | ||
| <TextField | ||
| sx={{ color: '#B5B5BC' }} | ||
| disabled={keyDisabled} | ||
| value={keyValue} | ||
| label={showLabel ? keyLabel : ''} | ||
| {...registers.registerA} | ||
| /> | ||
| <TextField disabled={valueDisabled} label={showLabel ? valueLabel : ''} {...registers.registerB} /> | ||
| </FormRow> | ||
| </Box> | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| import { Box, FormHelperText } from '@mui/material' | ||
| import { TextField } from './TextField' | ||
| import FormRow from './FormRow' | ||
|
|
||
| interface Registers { | ||
| registerA: any | ||
| registerB: any | ||
| setValue: (name: string, value: any) => void | ||
| watch: (name: string) => any | ||
| } | ||
|
|
||
| interface LinkedNumberFieldProps { | ||
| labelA: string | ||
| labelB: string | ||
| valueMax: number | ||
| disabled: boolean | ||
| registers: Registers | ||
| helperText?: string | ||
| error?: boolean | ||
| } | ||
|
|
||
| export default function LinkedNumberField({ | ||
| labelA, | ||
| labelB, | ||
| valueMax, | ||
| disabled, | ||
| registers, | ||
| error, | ||
| helperText, | ||
| }: LinkedNumberFieldProps) { | ||
| const { setValue, watch } = registers | ||
| const defaultValue = valueMax / 2 | ||
| const rawA = watch(registers.registerA.name) | ||
| const rawB = watch(registers.registerB.name) | ||
|
|
||
| const valueA: number = Math.min(Math.max(rawA ?? defaultValue, 0), valueMax) | ||
| const valueB: number = Math.min(Math.max(rawB ?? defaultValue, 0), valueMax) | ||
|
|
||
| function calculateValues(updatedValue: number, isValueA: boolean) { | ||
| const clamped = Math.min(Math.max(updatedValue, 0), valueMax) | ||
| const complementary = valueMax - clamped | ||
|
|
||
| if (isValueA) { | ||
| setValue(registers.registerA.name, clamped) | ||
| setValue(registers.registerB.name, complementary) | ||
| } else { | ||
| setValue(registers.registerA.name, complementary) | ||
| setValue(registers.registerB.name, clamped) | ||
| } | ||
| } | ||
|
|
||
| // Increment/Decrement helpers | ||
| const incrementA = () => calculateValues(valueA + 1, true) | ||
| const decrementA = () => calculateValues(valueA - 1, true) | ||
| const incrementB = () => calculateValues(valueB + 1, false) | ||
| const decrementB = () => calculateValues(valueB - 1, false) | ||
|
|
||
| return ( | ||
| <Box> | ||
| <FormRow spacing={10}> | ||
| <TextField | ||
| {...registers.registerA} | ||
| width='small' | ||
| label={labelA} | ||
| value={valueA} | ||
| type='number' | ||
| inputProps={{ min: 0, max: valueMax }} | ||
| onChange={(e) => calculateValues(Number(e.target.value), true)} | ||
| onIncrement={incrementA} | ||
| onDecrement={decrementA} | ||
| suffixSymbol='%' | ||
| disabled={disabled} | ||
| error={error} | ||
| /> | ||
| <TextField | ||
| {...registers.registerB} | ||
| width='small' | ||
| label={labelB} | ||
| value={valueB} | ||
| type='number' | ||
| inputProps={{ min: 0, max: valueMax }} | ||
| onChange={(e) => calculateValues(Number(e.target.value), false)} | ||
| onIncrement={incrementB} | ||
| onDecrement={decrementB} | ||
| suffixSymbol='%' | ||
| disabled={disabled} | ||
| error={error} | ||
| /> | ||
| </FormRow> | ||
| {helperText && <FormHelperText data-qa-textfield-helper-text>{helperText}</FormHelperText>} | ||
| </Box> | ||
| ) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.