refactor(app-config): rename allowCustomConnection as customConnectionAllowed

This commit is contained in:
Ali BARIN
2024-10-09 12:03:57 +00:00
committed by Faruk AYDIN
parent 0bbe362660
commit 73edb45ff7
9 changed files with 17 additions and 12 deletions

View File

@@ -8,11 +8,15 @@ export class AdminApplicationSettingsPage extends AuthenticatedPage {
constructor(page) { constructor(page) {
super(page); super(page);
this.allowCustomConnectionsSwitch = this.page.locator('[name="allowCustomConnection"]'); this.allowCustomConnectionsSwitch = this.page.locator(
'[name="customConnectionAllowed"]'
);
this.allowSharedConnectionsSwitch = this.page.locator('[name="shared"]'); this.allowSharedConnectionsSwitch = this.page.locator('[name="shared"]');
this.disableConnectionsSwitch = this.page.locator('[name="disabled"]'); this.disableConnectionsSwitch = this.page.locator('[name="disabled"]');
this.saveButton = this.page.getByTestId('submit-button'); this.saveButton = this.page.getByTestId('submit-button');
this.successSnackbar = this.page.getByTestId('snackbar-save-admin-apps-settings-success'); this.successSnackbar = this.page.getByTestId(
'snackbar-save-admin-apps-settings-success'
);
} }
async allowCustomConnections() { async allowCustomConnections() {

View File

@@ -20,7 +20,7 @@ function AdminApplicationCreateAuthClient(props) {
const { const {
mutateAsync: createAppConfig, mutateAsync: createAppConfig,
isPending: isCreateAppConfigPending, isPending: isCreateAppConfigPending,
error: createAppConfigError error: createAppConfigError,
} = useAdminCreateAppConfig(props.appKey); } = useAdminCreateAppConfig(props.appKey);
const { const {
@@ -34,7 +34,7 @@ function AdminApplicationCreateAuthClient(props) {
if (!appConfigId) { if (!appConfigId) {
const { data: appConfigData } = await createAppConfig({ const { data: appConfigData } = await createAppConfig({
allowCustomConnection: true, customConnectionAllowed: true,
shared: false, shared: false,
disabled: false, disabled: false,
}); });

View File

@@ -46,7 +46,8 @@ function AdminApplicationSettings(props) {
const defaultValues = useMemo( const defaultValues = useMemo(
() => ({ () => ({
allowCustomConnection: appConfig?.data?.allowCustomConnection || false, customConnectionAllowed:
appConfig?.data?.customConnectionAllowed || false,
shared: appConfig?.data?.shared || false, shared: appConfig?.data?.shared || false,
disabled: appConfig?.data?.disabled || false, disabled: appConfig?.data?.disabled || false,
}), }),
@@ -61,8 +62,8 @@ function AdminApplicationSettings(props) {
<Paper sx={{ p: 2, mt: 4 }}> <Paper sx={{ p: 2, mt: 4 }}>
<Stack spacing={2} direction="column"> <Stack spacing={2} direction="column">
<Switch <Switch
name="allowCustomConnection" name="customConnectionAllowed"
label={formatMessage('adminAppsSettings.allowCustomConnection')} label={formatMessage('adminAppsSettings.customConnectionAllowed')}
FormControlLabelProps={{ FormControlLabelProps={{
labelPlacement: 'start', labelPlacement: 'start',
}} }}

View File

@@ -95,7 +95,7 @@ function ChooseConnectionSubstep(props) {
if ( if (
!appConfig?.data || !appConfig?.data ||
(!appConfig.data?.disabled && appConfig.data?.allowCustomConnection) (!appConfig.data?.disabled && appConfig.data?.customConnectionAllowed)
) { ) {
options.push({ options.push({
label: formatMessage('chooseConnectionSubstep.addNewConnection'), label: formatMessage('chooseConnectionSubstep.addNewConnection'),

View File

@@ -292,7 +292,7 @@
"adminApps.connections": "Connections", "adminApps.connections": "Connections",
"adminApps.authClients": "Auth clients", "adminApps.authClients": "Auth clients",
"adminApps.settings": "Settings", "adminApps.settings": "Settings",
"adminAppsSettings.allowCustomConnection": "Allow custom connection", "adminAppsSettings.customConnectionAllowed": "Allow custom connection",
"adminAppsSettings.shared": "Shared", "adminAppsSettings.shared": "Shared",
"adminAppsSettings.disabled": "Disabled", "adminAppsSettings.disabled": "Disabled",
"adminAppsSettings.save": "Save", "adminAppsSettings.save": "Save",

View File

@@ -78,7 +78,7 @@ export default function Application() {
const connectionOptions = React.useMemo(() => { const connectionOptions = React.useMemo(() => {
const shouldHaveCustomConnection = const shouldHaveCustomConnection =
appConfig?.data?.connectionAllowed && appConfig?.data?.connectionAllowed &&
appConfig?.data?.allowCustomConnection; appConfig?.data?.customConnectionAllowed;
const options = [ const options = [
{ {
@@ -158,7 +158,7 @@ export default function Application() {
(appConfig?.data && (appConfig?.data &&
!appConfig?.data?.disabled && !appConfig?.data?.disabled &&
!appConfig?.data?.connectionAllowed && !appConfig?.data?.connectionAllowed &&
!appConfig?.data?.allowCustomConnection) || !appConfig?.data?.customConnectionAllowed) ||
connectionOptions.every(({ disabled }) => disabled) connectionOptions.every(({ disabled }) => disabled)
} }
options={connectionOptions} options={connectionOptions}

View File

@@ -459,7 +459,7 @@ export const SamlAuthProviderRolePropType = PropTypes.shape({
export const AppConfigPropType = PropTypes.shape({ export const AppConfigPropType = PropTypes.shape({
id: PropTypes.string, id: PropTypes.string,
key: PropTypes.string, key: PropTypes.string,
allowCustomConnection: PropTypes.bool, customConnectionAllowed: PropTypes.bool,
connectionAllowed: PropTypes.bool, connectionAllowed: PropTypes.bool,
shared: PropTypes.bool, shared: PropTypes.bool,
disabled: PropTypes.bool, disabled: PropTypes.bool,