Skip to content
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

fix: UI tweaks #1704

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/src/components/kubernetes/rbac/Rbac.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const directory = [
{ path: ROLE_BINDINGS_REL_PATH, label: 'Role bindings' },
{ path: CLUSTER_ROLES_REL_PATH, label: 'Cluster roles' },
{ path: CLUSTER_ROLE_BINDINGS_REL_PATH, label: 'Cluster role bindings' },
{ path: SERVICE_ACCOUNTS_REL_PATH, label: 'Service Accounts' },
{ path: SERVICE_ACCOUNTS_REL_PATH, label: 'Service accounts' },
] as const

export default function Rbac() {
Expand Down
47 changes: 29 additions & 18 deletions assets/src/components/pr/automations/CreatePrModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { Body1BoldP, Body1P } from 'components/utils/typography/Text'

import { PrConfigurationFields } from './PrConfigurationFields'
import { validateAndFilterConfig } from './prConfigurationUtils'
import { isEmpty } from 'lodash'

function CreateSuccess({ pr }: { pr: PullRequestFragment }) {
const theme = useTheme()
Expand Down Expand Up @@ -60,7 +61,10 @@ function CreatePrModalBase({
onClose: Nullable<() => void>
}) {
const configuration = prAutomation.configuration || []
const [currentStep, setCurrentStep] = useState<StepKey>('config')
const hasConfiguration = !isEmpty(configuration)
const [currentStep, setCurrentStep] = useState<StepKey>(
hasConfiguration ? 'config' : 'review'
)
const stepIndex = steps.findIndex((s) => s.key === currentStep)
const [configVals, setConfigVals] = useState(
Object.fromEntries(
Expand Down Expand Up @@ -128,6 +132,7 @@ function CreatePrModalBase({
})
}
}}
size="large"
open={open}
onClose={onClose || undefined}
header={
Expand Down Expand Up @@ -184,12 +189,14 @@ function CreatePrModalBase({
>
Create
</Button>
<Button
secondary
onClick={() => setCurrentStep('config')}
>
Back
</Button>
{hasConfiguration && (
<Button
secondary
onClick={() => setCurrentStep('config')}
>
Back
</Button>
)}
<Button
secondary
onClick={() => onClose?.()}
Expand Down Expand Up @@ -225,7 +232,7 @@ function CreatePrModalBase({
gap: theme.spacing.large,
}}
>
{currentStep !== 'success' && (
{currentStep !== 'success' && hasConfiguration && (
<div css={{ display: 'flex' }}>
<Stepper
compact
Expand Down Expand Up @@ -274,21 +281,24 @@ function CreatePrModalBase({
</Card>
)}

<FormField
label="Configuration review"
name="configuration"
>
<Code
language="json"
showHeader={false}
{hasConfiguration && (
<FormField
label="Configuration review"
name="configuration"
>
{configJson || ''}
</Code>
</FormField>
<Code
language="json"
showHeader={false}
>
{configJson || ''}
</Code>
</FormField>
)}
<FormField
label="Repository"
required
name="repository"
hint={'Repository slug, i.e. username/infra-repo.'}
>
<Input2
value={identifier}
Expand All @@ -299,6 +309,7 @@ function CreatePrModalBase({
label="Branch"
required
name="branch"
hint="Pull request source branch name. Avoid using existing branches."
>
<Input2
value={branch}
Expand Down
2 changes: 1 addition & 1 deletion assets/src/components/utils/KickButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function KickButton({
} & ButtonProps) {
const [mutation, { loading, error }] = kickMutationHook({ variables })
const [lastSync, setLastSync] = useState<Date | undefined>(undefined)
const { disabled, secondsRemaining } = useSyncCooldown(lastSync, 5 * 1000)
const { disabled, secondsRemaining } = useSyncCooldown(lastSync, 15 * 1000)
const onClick = useCallback(() => {
setLastSync(new Date())
mutation()
Expand Down
Loading