Skip to content

Commit

Permalink
Enhancements (#838)
Browse files Browse the repository at this point in the history
* [Wrapper props] Add `defaults.tenants`

* [ConnectionList props] Support list of tenants

* Support listing by multiple tenants

* Fix qs should be appended instead of set

* Support for label input
  • Loading branch information
niwsa authored Jan 30, 2024
1 parent da48165 commit c04f8ed
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 8 deletions.
8 changes: 7 additions & 1 deletion src/sso/connections/ConnectionList/index.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ export default function ConnectionList(props: ConnectionListProps) {
const [urlPath, qs] = _url.split('?');
const urlParams = new URLSearchParams(qs);
if (props.tenant) {
urlParams.set('tenant', props.tenant);
if (Array.isArray(props.tenant)) {
for (const _tenant of props.tenant) {
urlParams.append('tenant', _tenant);
}
} else {
urlParams.set('tenant', props.tenant);
}
}
if (props.product) {
urlParams.set('product', props.product);
Expand Down
2 changes: 1 addition & 1 deletion src/sso/connections/ConnectionsWrapper/index.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default function ConnectionsWrapper(props: ConnectionsWrapperProp) {
urls={{ get: props.urls.get }}
handleActionClick={state.switchToEditView}
handleListFetchComplete={state.handleListFetchComplete}
tenant={props.defaults?.tenant}
tenant={props.defaults?.tenants || props.defaults?.tenant}
product={props.defaults?.product}></ConnectionList>
</div>
</Show>
Expand Down
14 changes: 14 additions & 0 deletions src/sso/connections/CreateConnection/oidc/index.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const DEFAULT_VALUES = {
const INITIAL_VALUES = {
oidcConnection: {
name: '',
label: '',
description: '',
tenant: '',
product: '',
Expand Down Expand Up @@ -142,6 +143,19 @@ export default function CreateOIDCConnection(props: CreateConnectionProps) {
/>
<Spacer y={6} />
</Show>
<Show when={!state.isExcluded('label')}>
<InputField
label='Connection label (Optional)'
id='label'
classNames={state.classes.inputField}
placeholder=''
required={false}
readOnly={state.isReadOnly('label')}
value={state.oidcConnection.label}
handleInputChange={state.handleChange}
/>
<Spacer y={6} />
</Show>
<Show when={!state.isExcluded('description')}>
<InputField
label='Description (Optional)'
Expand Down
14 changes: 14 additions & 0 deletions src/sso/connections/CreateConnection/saml/index.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const DEFAULT_VALUES = {
const INITIAL_VALUES = {
samlConnection: {
name: '',
label: '',
description: '',
tenant: '',
product: '',
Expand Down Expand Up @@ -126,6 +127,19 @@ export default function CreateSAMLConnection(props: CreateConnectionProps) {
/>
<Spacer y={6} />
</Show>
<Show when={!state.isExcluded('label')}>
<InputField
label='Connection label (Optional)'
id='label'
classNames={state.classes.inputField}
placeholder=''
required={false}
readOnly={state.isReadOnly('label')}
value={state.samlConnection.label}
handleInputChange={state.handleChange}
/>
<Spacer y={6} />
</Show>
<Show when={!state.isExcluded('description')}>
<InputField
label='Description (Optional)'
Expand Down
12 changes: 12 additions & 0 deletions src/sso/connections/EditConnection/oidc/index.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,18 @@ export default function EditOIDCConnection(props: EditOIDCConnectionProps) {
/>
<Spacer y={6} />
</Show>
<Show when={!state.isExcluded('label')}>
<InputField
label='Connection label (Optional)'
id='label'
classNames={state.classes.inputField}
placeholder=''
required={false}
value={state.oidcConnection.label!}
handleInputChange={state.handleChange}
/>
<Spacer y={6} />
</Show>
<Show when={!state.isExcluded('description')}>
<InputField
label='Description (Optional)'
Expand Down
19 changes: 15 additions & 4 deletions src/sso/connections/EditConnection/saml/index.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const DEFAULT_VALUES = {
const INITIAL_VALUES = {
samlConnection: {
name: '',
label: '',
tenant: '',
product: '',
clientID: '',
Expand Down Expand Up @@ -169,7 +170,7 @@ export default function EditSAMLConnection(props: EditSAMLConnectionProps) {
defaultRedirectUrl: _connection.defaultRedirectUrl,
rawMetadata: _connection.rawMetadata || '',
metadataUrl: _connection.metadataUrl || '',
forceAuthn: _connection.forceAuthn === true || _connection.forceAuthn === 'true',
forceAuthn: _connection.forceAuthn === true,
};
}
}
Expand Down Expand Up @@ -219,6 +220,18 @@ export default function EditSAMLConnection(props: EditSAMLConnectionProps) {
/>
<Spacer y={6} />
</Show>
<Show when={!state.isExcluded('label')}>
<InputField
label='Connection label (Optional)'
id='label'
classNames={state.classes.inputField}
placeholder=''
required={false}
value={state.samlConnection.label!}
handleInputChange={state.handleChange}
/>
<Spacer y={6} />
</Show>
<Show when={!state.isExcluded('description')}>
<InputField
label='Description (Optional)'
Expand Down Expand Up @@ -297,9 +310,7 @@ export default function EditSAMLConnection(props: EditSAMLConnectionProps) {
<Show when={state.formVariant === 'advanced'}>
<Show when={!state.isExcluded('forceAuthn')}>
<Checkbox
checked={
state.samlConnection.forceAuthn === 'true' || state.samlConnection.forceAuthn === true
}
checked={state.samlConnection.forceAuthn === true}
handleChange={state.handleChange}
label='Force Authentication'
name='forceAuthn'
Expand Down
5 changes: 3 additions & 2 deletions src/sso/connections/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface ConnectionListProps {
tableContainer?: string;
};
tableProps?: TableProps;
tenant?: string;
tenant?: string | string[];
product?: string;
}

Expand Down Expand Up @@ -111,6 +111,7 @@ interface SSOConnection {
tenant: string;
product: string;
name?: string;
label?: string;
description?: string;
}

Expand Down Expand Up @@ -294,7 +295,7 @@ export interface EditSAMLConnectionProps {

export interface ConnectionsWrapperProp {
title?: string;
defaults?: Partial<SSOConnection & Pick<SAMLSSOConnection, 'forceAuthn'>>;
defaults?: Partial<SSOConnection & Pick<SAMLSSOConnection, 'forceAuthn'> & { tenants: string[] }>;
classNames?: {
button?: { ctoa?: string; destructive?: string };
input?: string;
Expand Down

0 comments on commit c04f8ed

Please sign in to comment.