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: cluster-wizard UI & oidc-scopes #3209

Merged
merged 13 commits into from
Aug 27, 2024
2 changes: 1 addition & 1 deletion src/components/Clusters/components/AddClusterDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function AddClusterDialog() {
return (
<Dialog
open={showWizard}
className="wizard-dialog"
className="add-cluster-wizard-dialog"
headerText={t('clusters.add.title')}
onAfterClose={() => setShowWizard(false)}
>
Expand Down
25 changes: 13 additions & 12 deletions src/components/Clusters/components/AddClusterWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ export function AddClusterWizard({ kubeconfig, setKubeconfig, config }) {
const setIsFormOpen = useSetRecoilState(isFormOpenState);

useEffect(() => {
const contentContainer = document
.getElementsByTagName('ui5-wizard')[0]
?.shadowRoot?.querySelectorAll('.ui5-wiz-content-item-wrapper')[
selected - 1
];
const wizard = document.getElementsByTagName('ui5-wizard')[0];
const wizardContent = wizard?.shadowRoot?.querySelector('.ui5-wiz-content');

const contentContainer = wizardContent?.querySelectorAll(
'.ui5-wiz-content-item-wrapper',
)[selected - 1];

if (contentContainer) {
contentContainer.style['background-color'] = 'transparent';
contentContainer.style['padding'] = '0';
Expand Down Expand Up @@ -166,7 +168,7 @@ export function AddClusterWizard({ kubeconfig, setKubeconfig, config }) {
firstStep={true}
onCancel={() => setShowWizard(false)}
validation={!kubeconfig}
className="cluster-wizard__buttons"
className="cluster-wizard__buttons__sticky"
/>
</WizardStep>

Expand Down Expand Up @@ -197,7 +199,7 @@ export function AddClusterWizard({ kubeconfig, setKubeconfig, config }) {
setSelected={setSelected}
onCancel={() => setShowWizard(false)}
validation={!authValid}
className="cluster-wizard__buttons"
className="cluster-wizard__buttons__absolute"
/>
</WizardStep>
)}
Expand All @@ -217,14 +219,14 @@ export function AddClusterWizard({ kubeconfig, setKubeconfig, config }) {
data-step={!hasAuth || !hasOneContext ? '3' : '2'}
>
<div className="add-cluster__content-container">
<Title level="H5">
<Title level="H5" style={spacing.sapUiSmallMarginBottom}>
{t('clusters.storage.choose-storage.label')}
<>
<Button
id="storageDescriptionOpener"
icon="hint"
design="Transparent"
style={spacing.sapUiTinyMargin}
style={spacing.sapUiTinyMarginBegin}
onClick={() => setShowTitleDescription(true)}
/>
{createPortal(
Expand All @@ -248,7 +250,7 @@ export function AddClusterWizard({ kubeconfig, setKubeconfig, config }) {
setSelected={setSelected}
validation={!storage}
onCancel={() => setShowWizard(false)}
className="cluster-wizard__buttons"
className="cluster-wizard__buttons__absolute"
/>
</div>
</WizardStep>
Expand All @@ -269,7 +271,6 @@ export function AddClusterWizard({ kubeconfig, setKubeconfig, config }) {
<ClusterPreview
storage={storage}
kubeconfig={kubeconfig}
token={hasAuth ? hasKubeconfigAuth(kubeconfig) : null}
setSelected={setSelected}
hasAuth={hasAuth}
/>
Expand All @@ -284,7 +285,7 @@ export function AddClusterWizard({ kubeconfig, setKubeconfig, config }) {
setIsFormOpen({ formOpen: false });
}}
validation={!storage}
className="cluster-wizard__buttons"
className="cluster-wizard__buttons__sticky"
/>
</WizardStep>
</Wizard>
Expand Down
37 changes: 27 additions & 10 deletions src/components/Clusters/components/AddClusterWizard.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.add-cluster-wizard-dialog::part(content) {
height: 90vh;
}

.add-cluster {
&__content-container {
background-color: var(--sapGroup_TitleBackground);
Expand All @@ -11,20 +15,17 @@
}

ui5-wizard {
height: 90vh;
min-width: 80vw;
height: 100%;
width: 75vw;

.cluster-wizard {
&__buttons {
position: absolute;
@mixin cluster-wizard-buttons-style {
z-index: 100;
bottom: 1rem;
left: 0;
display: flex;
justify-content: flex-end;
box-sizing: border-box;
width: calc(100% - 20px);
margin: 0 10px;
padding: 7px;
padding: 0.5rem;
border: 1px solid var(--sapGroup_TitleBorderColor);
border-radius: var(--sapElement_BorderCornerRadius);
background-color: var(--sapGroup_TitleBackground);
Expand All @@ -34,6 +35,23 @@ ui5-wizard {
color-mix(in srgb, var(--sapContent_ShadowColor) 16%, transparent);
}

&__buttons {
&__sticky {
position: sticky;
width: calc(100% + 32px);
margin: 0 -16px;
@include cluster-wizard-buttons-style;
}

&__absolute {
position: absolute;
left: 0;
width: calc(100% - 32px);
margin: 0 16px;
@include cluster-wizard-buttons-style;
}
}

&__token-info,
&__storage-preference {
color: var(--sapContent_LabelColor);
Expand All @@ -44,7 +62,6 @@ ui5-wizard {
display: flex;
flex-flow: column;
overflow: auto;
height: calc(90vh - 8rem);

.cluster-wizard__auth-form {
height: unset;
Expand All @@ -53,7 +70,7 @@ ui5-wizard {
}

.resource-form {
padding: 1rem 0;
padding: 0;

.form-field {
justify-content: start;
Expand Down
19 changes: 10 additions & 9 deletions src/components/Clusters/components/AuthForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import * as Inputs from 'shared/ResourceForm/inputs';
import { getUser, getUserIndex } from '../shared';

import { spacing } from '@ui5/webcomponents-react-base';

export const AUTH_FORM_TOKEN = 'Token';
export const AUTH_FORM_OIDC = 'OIDC';
export const DEFAULT_SCOPE_VALUE = 'openid';
import { TextArrayInput } from 'shared/ResourceForm/fields';

const OIDCform = ({ resource, setResource, ...props }) => {
const { t } = useTranslation();
Expand Down Expand Up @@ -57,11 +54,11 @@ const OIDCform = ({ resource, setResource, ...props }) => {
input={Inputs.Text}
aria-label="client-secret"
/>
<ResourceForm.FormField
<TextArrayInput
required
propertyPath="$.scope"
label={t('clusters.wizard.auth.scopes')}
input={Inputs.Text}
defaultOpen
propertyPath="$.scopes"
title={t('clusters.wizard.auth.scopes')}
aria-label="scopes"
/>
</ResourceForm.Wrapper>
Expand Down Expand Up @@ -147,7 +144,11 @@ export function AuthForm({
<ResourceForm.FormField
label={t('clusters.wizard.auth.using-oidc')}
input={() => (
<Switch checked={useOidc} onChange={switchAuthVariant} />
<Switch
style={spacing.sapUiTinyMarginTop}
checked={useOidc}
onChange={switchAuthVariant}
/>
)}
className="oidc-switch"
/>
Expand Down
6 changes: 5 additions & 1 deletion src/components/Clusters/components/ChooseStorage.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { FlexBox, RadioButton } from '@ui5/webcomponents-react';
import { useTranslation } from 'react-i18next';
import { spacing } from '@ui5/webcomponents-react-base';
import './ChooseStorage.scss';

export function ChooseStorage({ storage, setStorage }) {
const { t } = useTranslation();

return (
<>
<p className="cluster-wizard__storage-preference">
<p
className="cluster-wizard__storage-preference"
style={spacing.sapUiTinyMarginBottom}
>
{`${t('clusters.storage.storage-preference')}:`}
</p>
<FlexBox direction="Column">
Expand Down
Loading
Loading