Skip to content

Commit ccbc6df

Browse files
feat: service page using form components (#525)
* feat: basic fields for service * feat: first run * feat: some fields are now loading data * feat: all fields working * feat: number field with custom end andorment * fix: validation message now visible * feat: fix custom errors * fix: knative error * fix: remove demo data * fix: find services and secrets * fix: find service * fix: find secrets * fix: subdomain * fix: remove cname and headers if empty * fix: styling subdomain and paths * fix: remove demo values * fix: styling and refresh page empty values * fix: removed logs * fix: urls empty and namespace required * feat: added linkednumber validation and url helper * fix: doc change console log removed and comment fixed * feat: ports is select and filter services * fix: serviceid to servicename * fix: put back smtp in team component * Update Team.tsx * feat: added keys and changed texts * fix: url being empty * fix: set url * fix: fetching check * fix: set service and filtered services * feat: platform ingress classnames now fetched * feat: use advancedsettings component from APL-540 * fix: rerender issues * feat: use api v2 * fix: empty fields and double slash in overview * fix: teams being undefined * fix: empty teams * fix: undefined paths * fix: trafficmanagement and dropdowns * fix: default value in linkednumber component * fix: add default ingressclassname platform * feat: added adjustable width to autocomplete * feat: cname domainsuffix validation * fix: light mode cname text * fix: clamped values * fix: comment from ux findings * fix: pathing and forward slash * fix: uxfindings * fix: save changes instead of edit service * fix: cname styling * fix: add buttons in keyvalue * fix: removed tsnocheck --------- Co-authored-by: dvankeke <dvankeke@akamai.com> Co-authored-by: Dennis van Kekem <38350840+dennisvankekem@users.noreply.github.com>
1 parent 14f08b2 commit ccbc6df

File tree

18 files changed

+1039
-209
lines changed

18 files changed

+1039
-209
lines changed

package-lock.json

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"@types/js-yaml": "^4.0.9",
7979
"@types/json-schema": "^7.0.15",
8080
"@types/lodash": "^4.17.15",
81+
"@types/ramda": "^0.30.2",
8182
"@types/react": "18.3.18",
8283
"@types/react-dom": "18.3.5",
8384
"@types/react-helmet": "5.0.20",

public/assets/number_icon.svg

Lines changed: 4 additions & 0 deletions
Loading

src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import Catalog from 'pages/Catalog'
1818
import Error from 'pages/Error'
1919
import SealedSecret from 'pages/SealedSecret'
2020
import SealedSecrets from 'pages/SealedSecrets'
21-
import Service from 'pages/Service'
22-
import Services from 'pages/Services'
2321
import Setting from 'pages/Setting'
2422
import SettingsOverview from 'pages/SettingsOverview'
2523
import Team from 'pages/teams/create-edit'
@@ -51,6 +49,8 @@ import Policy from 'pages/Policy'
5149
import Maintenance from 'pages/Maintenance'
5250
import PrivateRoute from 'components/AuthzRoute'
5351
import Logout from 'pages/Logout'
52+
import Service from 'pages/services/create-edit'
53+
import Services from 'pages/services/overview'
5454
import CodeRepository from 'pages/code-repositories/create-edit'
5555
import CodeRepositories from 'pages/code-repositories/overview'
5656
import { HttpErrorBadRequest } from './utils/error'

src/components/AdvancedSettings.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,19 @@ interface Props {
4646
title?: string
4747
children?: React.ReactNode
4848
noPaddingTop?: boolean
49+
closed?: boolean
4950
}
5051

5152
export default function AdvancedSettings(props: Props) {
52-
const { title = 'Advanced Settings', description, children, noPaddingTop } = props
53+
const { title = 'Advanced Settings', description, children, noPaddingTop, closed = false } = props
5354
const [expanded, setExpanded] = useState(true)
5455

5556
const handleAccordionChange = () => {
5657
setExpanded((prev) => !prev)
5758
}
5859

5960
return (
60-
<StyledAccordion disableGutters expanded={expanded} onChange={handleAccordionChange}>
61+
<StyledAccordion defaultExpanded={!closed} disableGutters onChange={handleAccordionChange}>
6162
<StyledAccordionSummary
6263
expandIcon={<KeyboardArrowRight />}
6364
sx={{

src/components/Header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ export default function Header({ onOpenSidebar, isCollapse = false, verticalLayo
143143
<Select
144144
size='small'
145145
color='secondary'
146-
value={(teams.length && oboTeamId) || ''}
146+
value={(teams?.length && oboTeamId) || ''}
147147
onChange={handleChangeTeam}
148148
data-cy='select-oboteam'
149149
>
150-
{teams.map((teamName) => (
150+
{teams?.map((teamName) => (
151151
<MenuItem key={teamName} value={teamName} data-cy={`select-oboteam-${teamName}`}>
152152
{teamName}
153153
</MenuItem>

src/components/Service.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ export const addDomainEnumField = (
2525
formData: GetServiceApiResponse,
2626
): void => {
2727
const { cluster, dns } = settings
28-
if (['cluster', 'tlsPass'].includes(formData?.ingress?.type)) return
28+
// if (['cluster', 'tlsPass'].includes(formData?.ingress?.type)) return
2929
const ing = formData?.ingress as any
30-
const idx = idxMap[formData?.ingress?.type]
30+
// const idx = idxMap[formData?.ingress?.type]
3131
if (!formData || isEmpty(ing)) return
32-
const ingressSchemaPath = getIngressSchemaPath(idx)
32+
const ingressSchemaPath = getIngressSchemaPath(1)
3333
const ingressSchema = getStrict(schema, ingressSchemaPath)
3434
const zones = [cluster.domainSuffix, ...(dns?.zones || [])]
3535
if (!ingressSchema) return
@@ -85,7 +85,7 @@ export const getServiceSchema = (
8585
if (teamId !== 'admin') addServiceNameEnumField(schema, k8sServices, formData)
8686
addDomainEnumField(schema, settings, formData)
8787
const ing = formData?.ingress as Record<string, any>
88-
const idx = idxMap[formData?.ingress?.type]
88+
const idx = 1
8989
set(schema, 'properties.ingress.oneOf[1].allOf[0].properties.ingressClassName.enum', [
9090
'platform',
9191
...settings.ingressClassNames,

src/components/Services.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const renderHost = ({ ingress, teamId, name }): React.ReactElement | string => {
2626
if (!ingress) return ''
2727
if (ingress.type === 'cluster') return `${name}.team-${teamId}`
2828
const { subdomain, domain, paths } = ingress
29+
// TODO: Replace functionality in apl-core so that / is not needed on path or domain
2930
const url = `${subdomain ? `${subdomain}.` : ''}${domain}${paths?.[0] || ''}`
3031
return (
3132
<MuiLink href={`https://${url}`} target='_blank' rel='noopener'>

src/components/forms/Autocomplete.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export interface EnhancedAutocompleteProps<
2828
/** Label for the "select all" option. */
2929
selectAllLabel?: string
3030
textFieldProps?: Partial<TextFieldProps>
31+
width?: 'small' | 'medium' | 'large'
3132
}
3233

3334
/**
@@ -70,6 +71,7 @@ export function Autocomplete<
7071
textFieldProps,
7172
value,
7273
onChange,
74+
width = 'medium',
7375
...rest
7476
} = props
7577
const [inPlaceholder, setInPlaceholder] = useState('')
@@ -82,7 +84,7 @@ export function Autocomplete<
8284
((params) => (
8385
<TextField
8486
label={label}
85-
width='medium'
87+
width={width}
8688
loading={loading}
8789
placeholder={inPlaceholder || (placeholder ?? 'Select an option')}
8890
{...params}

src/components/forms/FormRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function FormRow(props: FormRowProps) {
1414
<Box
1515
display='flex'
1616
flexDirection='row'
17-
alignItems='flex-end'
17+
alignItems='baseline'
1818
sx={{
1919
'& > *:not(:last-child)': {
2020
marginRight: `${spacing}px`,

0 commit comments

Comments
 (0)