Skip to content

Commit 8eedecd

Browse files
committed
Merge remote-tracking branch 'origin/main' into dependabot/npm_and_yarn/types/lodash-4.17.17
2 parents 128db10 + a5b4aa4 commit 8eedecd

File tree

7 files changed

+98
-43
lines changed

7 files changed

+98
-43
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: PR Auto Updater
2+
on:
3+
push:
4+
branches:
5+
- 'main'
6+
- 'release/*'
7+
tags-ignore:
8+
- '*'
9+
10+
jobs:
11+
pr-autoupdate:
12+
runs-on: ubuntu-22.04
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
token: ${{ secrets.BOT_TOKEN }}
19+
20+
- name: Install GitHub CLI
21+
run: |
22+
sudo apt update
23+
sudo apt install gh -y
24+
25+
- name: Configure Git
26+
run: |
27+
git config --global user.email ${{ vars.BOT_EMAIL }}
28+
git config --global user.name ${{ vars.BOT_USERNAME }}
29+
30+
- name: Update PR branches
31+
env:
32+
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
33+
GH_PROMPT_DISABLED: 1
34+
run: |
35+
prs=$(gh pr list --state open --base main --json number,headRefName -q '.[] | [.number, .headRefName] | @tsv')
36+
37+
while IFS=$'\t' read -r number branch; do
38+
echo "Updating PR #$number (branch: $branch)"
39+
40+
git fetch origin "$branch"
41+
git checkout "$branch"
42+
43+
if git merge origin/main --no-edit; then
44+
git push origin HEAD:$branch
45+
echo "✅ Updated $branch"
46+
else
47+
echo "❌ Merge conflict on $branch — skipped."
48+
git merge --abort
49+
fi
50+
done <<< "$prs"

src/components/Setting.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export const getSettingUiSchema = (settings: GetSettingsInfoApiResponse, setting
6565
isMultitenant: { 'ui:widget': 'hidden' },
6666
isPreInstalled: { 'ui:widget': 'hidden' },
6767
adminPassword: { 'ui:widget': 'hidden' },
68+
useORCS: { 'ui:widget': 'hidden' },
6869
},
6970
kms: {
7071
sops: {

src/components/Users.tsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,18 @@ function UserTeamSelector({
8989
}
9090
return (
9191
<Box sx={{ display: 'flex', alignItems: 'center' }}>
92-
<Checkbox disabled={isDisabled} checked={row?.teams?.includes(teamId)} onChange={handleUserTeamToggle} />
92+
<Tooltip
93+
title={
94+
isDisabled
95+
? 'Team admins are permitted to add or remove users only within the teams they manage. However, they cannot remove themselves or other team admins from those teams.'
96+
: ''
97+
}
98+
placement='right'
99+
>
100+
<span>
101+
<Checkbox disabled={isDisabled} checked={row?.teams?.includes(teamId)} onChange={handleUserTeamToggle} />
102+
</span>
103+
</Tooltip>
93104
</Box>
94105
)
95106
}
@@ -105,9 +116,10 @@ const updateUsers = (onClick: () => void, disabled: boolean) => {
105116
interface Props {
106117
users: GetAllUsersApiResponse
107118
teamId?: string
119+
refetch: () => void
108120
}
109121

110-
export default function ({ users: inUsers, teamId }: Props): React.ReactElement {
122+
export default function ({ users: inUsers, teamId, refetch }: Props): React.ReactElement {
111123
const [users, setUsers] = useState<GetAllUsersApiResponse>(inUsers)
112124
const {
113125
user: sessionUser,
@@ -157,7 +169,13 @@ export default function ({ users: inUsers, teamId }: Props): React.ReactElement
157169
]
158170

159171
const handleUpdateUsers = () => {
160-
update({ teamId, body: users })
172+
const body = users.map((user) => ({
173+
id: user.id,
174+
teams: user.teams || [],
175+
}))
176+
update({ teamId, body }).then(() => {
177+
refetch()
178+
})
161179
}
162180

163181
if (hasExternalIDP) {

src/pages/Users.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ export default function ({
3030

3131
const { t } = useTranslation()
3232
// END HOOKS
33-
const comp = allUsers && <Users users={allUsers} teamId={teamId} />
33+
const comp = allUsers && <Users users={allUsers} refetch={refetchAllUsers} teamId={teamId} />
3434
return <PaperLayout loading={isLoadingAllUsers} comp={comp} title={t('TITLE_USERS', { scope: getRole(teamId) })} />
3535
}

src/pages/services/create-edit/index.tsx

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable dot-notation */
2-
import { Box, Button, Divider, Grid } from '@mui/material'
2+
import { Box, Divider, Grid } from '@mui/material'
33
import { LandingHeader } from 'components/LandingHeader'
44
import PaperLayout from 'layouts/Paper'
55
import React, { useEffect, useMemo, useState } from 'react'
@@ -27,11 +27,12 @@ import { MenuItem } from 'components/List'
2727
import { Typography } from 'components/Typography'
2828
import KeyValue from 'components/forms/KeyValue'
2929
import ControlledCheckbox from 'components/forms/ControlledCheckbox'
30-
import { isEmpty } from 'lodash'
30+
import { cloneDeep, isEmpty, isEqual } from 'lodash'
3131
import LinkedNumberField from 'components/forms/LinkedNumberField'
3232
import AdvancedSettings from 'components/AdvancedSettings'
3333
import font from 'theme/font'
3434
import { Autocomplete } from 'components/forms/Autocomplete'
35+
import { LoadingButton } from '@mui/lab'
3536
import { useStyles } from './create-edit.styles'
3637
import { serviceApiResponseSchema } from './create-edit.validator'
3738

@@ -143,6 +144,8 @@ export default function ({
143144
if (path.includes('/')) setValue(`spec.paths.${index}`, path.replace(/^\/+/, ''))
144145
})
145146
}
147+
148+
if (teamId !== 'admin' && !serviceName) setValue('spec.namespace', `team-${teamId}`)
146149
}, [data, setValue])
147150

148151
useEffect(() => {
@@ -181,17 +184,20 @@ export default function ({
181184
}
182185
}
183186
const onSubmit = (submitData: CreateAplServiceApiResponse) => {
184-
if (!isEmpty(submitData.spec?.paths)) {
185-
submitData.spec?.paths.forEach((path, index) => {
186-
submitData.spec.paths[index] = `/${path}`
187+
const body = cloneDeep(submitData)
188+
if (!isEmpty(body.spec?.paths)) {
189+
body.spec?.paths.forEach((path, index) => {
190+
body.spec.paths[index] = `/${path}`
187191
})
188192
}
189-
if (submitData.spec?.cname?.tlsSecretName === '') submitData.spec.cname.tlsSecretName = undefined
190-
if (submitData.spec?.ingressClassName === '') submitData.spec.ingressClassName = undefined
191-
if (isPreInstalled) submitData.spec.ingressClassName = 'platform'
192-
// eslint-disable-next-line object-shorthand
193-
if (serviceName) update({ teamId, serviceName: serviceName, body: submitData })
194-
else create({ teamId, body: submitData })
193+
if (body.spec?.cname?.tlsSecretName === '') {
194+
body.spec.cname.tlsSecretName = undefined
195+
body.spec.useCname = false
196+
} else if (body.spec?.cname?.tlsSecretName) body.spec.useCname = true
197+
198+
if (body.spec?.ingressClassName === '') body.spec.ingressClassName = undefined
199+
if (serviceName) update({ teamId, serviceName, body })
200+
else create({ teamId, body })
195201
}
196202
const mutating = isLoadingCreate || isLoadingUpdate || isLoadingDelete
197203
if (!mutating && (isSuccessCreate || isSuccessUpdate || isSuccessDelete))
@@ -202,7 +208,7 @@ export default function ({
202208
const error = isError || isErrorK8sServices || isErrorTeamSecrets || isErrorSettingsInfo
203209

204210
if (loading || fetching) return <PaperLayout loading title={t('TITLE_SERVICE')} />
205-
if (teamId !== 'admin') setValue('spec.namespace', `team-${teamId}`)
211+
206212
return (
207213
<Grid className={classes.root}>
208214
<PaperLayout loading={loading || error} title={t('TITLE_SERVICE')}>
@@ -454,17 +460,20 @@ export default function ({
454460
resourceType='service'
455461
data-cy='button-delete-service'
456462
sx={{ marginRight: '10px', textTransform: 'capitalize', ml: 2 }}
463+
loading={isLoadingDelete}
464+
disabled={isLoadingDelete || isLoadingCreate || isLoadingUpdate}
457465
/>
458466
)}
459-
<Button
460-
disabled={isEmpty(service)}
467+
<LoadingButton
461468
type='submit'
462469
variant='contained'
463470
color='primary'
464471
sx={{ textTransform: 'none' }}
472+
loading={isLoadingCreate || isLoadingUpdate}
473+
disabled={isLoadingCreate || isLoadingUpdate || isLoadingDelete || isEqual(watch(), data)}
465474
>
466475
{serviceName ? 'Save Changes' : 'Create Service'}
467-
</Button>
476+
</LoadingButton>
468477
</Box>
469478
</form>
470479
</FormProvider>

src/providers/Session.tsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export default function SessionProvider({ children }: Props): React.ReactElement
105105
}),
106106
[appsEnabled, oboTeamId, session, settings],
107107
)
108-
const { corrupt, editor, user } = ctx
108+
const { editor, user } = ctx
109109
const { isPlatformAdmin, teams } = user || {}
110110
const { t } = useTranslation()
111111
const [keys] = useState<Record<string, SnackbarKey | undefined>>({})
@@ -114,20 +114,6 @@ export default function SessionProvider({ children }: Props): React.ReactElement
114114
snack.close(keys[key])
115115
delete keys[key]
116116
}
117-
// special one for corrupt state
118-
useEffect(() => {
119-
if (corrupt) {
120-
keys.conflict = snack.error(
121-
`${t('Git conflict detected due to upstream changes. The database has been restored.')}`,
122-
{
123-
persist: true,
124-
onClick: () => {
125-
closeKey('conflict')
126-
},
127-
},
128-
)
129-
} else closeKey('conflict')
130-
}, [corrupt])
131117
// separate one for isDirty so we can be sure only that has changed
132118
useEffect(() => {
133119
if (isDirty === undefined) return

src/redux/otomiApi.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4477,23 +4477,14 @@ export type DeleteUserApiArg = {
44774477
}
44784478
export type EditTeamUsersApiResponse = /** status 200 Successfully edited a team user */ {
44794479
id?: string
4480-
email: string
4481-
firstName: string
4482-
lastName: string
4483-
isPlatformAdmin?: boolean
4484-
isTeamAdmin?: boolean
44854480
teams?: string[]
4486-
initialPassword?: string
44874481
}[]
44884482
export type EditTeamUsersApiArg = {
44894483
/** ID of team */
44904484
teamId: string
44914485
/** User object that contains updated values */
44924486
body: {
44934487
id?: string
4494-
email?: string
4495-
isPlatformAdmin?: boolean
4496-
isTeamAdmin?: boolean
44974488
teams?: string[]
44984489
}[]
44994490
}

0 commit comments

Comments
 (0)