chore: Settings files sanitization (#33057)
parent
7e2facc979
commit
5d657eef55
@ -1,26 +0,0 @@ |
||||
import type { ComponentMeta, ComponentStory } from '@storybook/react'; |
||||
import React from 'react'; |
||||
|
||||
import GroupPage from './GroupPage'; |
||||
|
||||
export default { |
||||
title: 'Admin/Settings/GroupPage', |
||||
component: GroupPage, |
||||
subcomponents: { |
||||
'GroupPage.Skeleton': GroupPage.Skeleton, |
||||
}, |
||||
parameters: { |
||||
layout: 'fullscreen', |
||||
controls: { hideNoControlsWarning: true }, |
||||
}, |
||||
} as ComponentMeta<typeof GroupPage>; |
||||
|
||||
export const Default: ComponentStory<typeof GroupPage> = (args) => <GroupPage {...args} />; |
||||
|
||||
export const WithGroup: ComponentStory<typeof GroupPage> = (args) => <GroupPage {...args} />; |
||||
WithGroup.args = { |
||||
_id: 'General', |
||||
i18nLabel: 'General', |
||||
}; |
||||
|
||||
export const Skeleton: ComponentStory<typeof GroupPage.Skeleton> = () => <GroupPage.Skeleton />; |
||||
@ -1,16 +0,0 @@ |
||||
import type { ComponentMeta, ComponentStory } from '@storybook/react'; |
||||
import React from 'react'; |
||||
|
||||
import GroupSelector from './GroupSelector'; |
||||
|
||||
export default { |
||||
title: 'Admin/Settings/GroupSelector', |
||||
component: GroupSelector, |
||||
parameters: { |
||||
layout: 'fullscreen', |
||||
controls: { hideNoControlsWarning: true }, |
||||
}, |
||||
} as ComponentMeta<typeof GroupSelector>; |
||||
|
||||
export const Default: ComponentStory<typeof GroupSelector> = (args) => <GroupSelector {...args} />; |
||||
Default.storyName = 'GroupSelector'; |
||||
@ -1,43 +0,0 @@ |
||||
import type { GroupId } from '@rocket.chat/core-typings'; |
||||
import { useSettingStructure } from '@rocket.chat/ui-contexts'; |
||||
import React from 'react'; |
||||
|
||||
import GroupPage from './GroupPage'; |
||||
import AssetsGroupPage from './groups/AssetsGroupPage'; |
||||
import LDAPGroupPage from './groups/LDAPGroupPage'; |
||||
import OAuthGroupPage from './groups/OAuthGroupPage'; |
||||
import TabbedGroupPage from './groups/TabbedGroupPage'; |
||||
import VoipGroupPage from './groups/VoipGroupPage'; |
||||
|
||||
type GroupSelectorProps = { |
||||
groupId: GroupId; |
||||
onClickBack?: () => void; |
||||
}; |
||||
|
||||
const GroupSelector = ({ groupId, onClickBack }: GroupSelectorProps) => { |
||||
const group = useSettingStructure(groupId); |
||||
|
||||
if (!group) { |
||||
return <GroupPage.Skeleton />; |
||||
} |
||||
|
||||
if (groupId === 'Assets') { |
||||
return <AssetsGroupPage {...group} onClickBack={onClickBack} />; |
||||
} |
||||
|
||||
if (groupId === 'OAuth') { |
||||
return <OAuthGroupPage {...group} onClickBack={onClickBack} />; |
||||
} |
||||
|
||||
if (groupId === 'LDAP') { |
||||
return <LDAPGroupPage {...group} onClickBack={onClickBack} />; |
||||
} |
||||
|
||||
if (groupId === 'Call_Center') { |
||||
return <VoipGroupPage {...group} onClickBack={onClickBack} />; |
||||
} |
||||
|
||||
return <TabbedGroupPage {...group} onClickBack={onClickBack} />; |
||||
}; |
||||
|
||||
export default GroupSelector; |
||||
@ -1,23 +0,0 @@ |
||||
import type { ComponentMeta, ComponentStory } from '@storybook/react'; |
||||
import React from 'react'; |
||||
|
||||
import Section from './Section'; |
||||
|
||||
export default { |
||||
title: 'Admin/Settings/Section', |
||||
component: Section, |
||||
subcomponents: { |
||||
'Section.Skeleton': Section.Skeleton, |
||||
}, |
||||
parameters: { |
||||
layout: 'fullscreen', |
||||
controls: { hideNoControlsWarning: true }, |
||||
}, |
||||
} as ComponentMeta<typeof Section>; |
||||
|
||||
export const Default: ComponentStory<typeof Section> = (args) => <Section {...args} />; |
||||
Default.args = { |
||||
groupId: 'General', |
||||
}; |
||||
|
||||
export const Skeleton: ComponentStory<typeof Section.Skeleton> = () => <Section.Skeleton />; |
||||
@ -1,59 +0,0 @@ |
||||
import { FieldGroup } from '@rocket.chat/fuselage'; |
||||
import type { ComponentMeta, ComponentStory } from '@storybook/react'; |
||||
import React from 'react'; |
||||
|
||||
import Setting from './Setting'; |
||||
|
||||
export default { |
||||
title: 'Admin/Settings/Setting', |
||||
component: Setting, |
||||
subcomponents: { |
||||
'Setting.Memoized': Setting.Memoized, |
||||
}, |
||||
parameters: { |
||||
layout: 'centered', |
||||
actions: { |
||||
argTypesRegex: '^on.*', |
||||
}, |
||||
}, |
||||
decorators: [ |
||||
(fn) => ( |
||||
<div className='rc-old'> |
||||
<div className='page-settings'>{fn()}</div> |
||||
</div> |
||||
), |
||||
], |
||||
} as ComponentMeta<typeof Setting>; |
||||
|
||||
export const Default: ComponentStory<typeof Setting.Memoized> = (args) => <Setting.Memoized {...args} />; |
||||
Default.args = { |
||||
_id: 'setting-id', |
||||
label: 'Label', |
||||
hint: 'Hint', |
||||
}; |
||||
|
||||
export const WithCallout: ComponentStory<typeof Setting.Memoized> = (args) => <Setting.Memoized {...args} />; |
||||
WithCallout.args = { |
||||
_id: 'setting-id', |
||||
label: 'Label', |
||||
hint: 'Hint', |
||||
callout: 'Callout text', |
||||
}; |
||||
|
||||
export const types = () => ( |
||||
<FieldGroup> |
||||
<Setting.Memoized packageValue _id='setting-id-1' label='Label' type='action' actionText='Action text' /> |
||||
<Setting.Memoized packageValue='' _id='setting-id-2' label='Label' type='asset' /> |
||||
<Setting.Memoized packageValue _id='setting-id-3' label='Label' type='boolean' /> |
||||
<Setting.Memoized packageValue='' _id='setting-id-4' label='Label' type='code' /> |
||||
<Setting.Memoized packageValue='' _id='setting-id-5' label='Label' type='font' /> |
||||
<Setting.Memoized packageValue={1} _id='setting-id-6' label='Label' type='int' /> |
||||
<Setting.Memoized packageValue='' _id='setting-id-7' label='Label' type='language' /> |
||||
<Setting.Memoized packageValue='' _id='setting-id-8' label='Label' type='password' /> |
||||
<Setting.Memoized packageValue='' _id='setting-id-9' label='Label' type='relativeUrl' /> |
||||
<Setting.Memoized packageValue='' _id='setting-id-10' label='Label' type='select' /> |
||||
<Setting.Memoized packageValue='' _id='setting-id-11' label='Label' type='string' /> |
||||
</FieldGroup> |
||||
); |
||||
|
||||
export const skeleton = () => <Setting.Skeleton />; |
||||
@ -0,0 +1 @@ |
||||
export { default } from './ResetSettingButton'; |
||||
@ -0,0 +1,58 @@ |
||||
import { FieldGroup } from '@rocket.chat/fuselage'; |
||||
import type { ComponentMeta, ComponentStory } from '@storybook/react'; |
||||
import React from 'react'; |
||||
|
||||
import MemoizedSetting from './MemoizedSetting'; |
||||
import Setting from './Setting'; |
||||
import SettingSkeleton from './SettingSkeleton'; |
||||
|
||||
export default { |
||||
title: 'Admin/Settings/Setting', |
||||
component: Setting, |
||||
parameters: { |
||||
layout: 'centered', |
||||
actions: { |
||||
argTypesRegex: '^on.*', |
||||
}, |
||||
}, |
||||
decorators: [ |
||||
(fn) => ( |
||||
<div className='rc-old'> |
||||
<div className='page-settings'>{fn()}</div> |
||||
</div> |
||||
), |
||||
], |
||||
} as ComponentMeta<typeof Setting>; |
||||
|
||||
export const Default: ComponentStory<typeof MemoizedSetting> = (args) => <MemoizedSetting {...args} />; |
||||
Default.args = { |
||||
_id: 'setting-id', |
||||
label: 'Label', |
||||
hint: 'Hint', |
||||
}; |
||||
|
||||
export const WithCallout: ComponentStory<typeof MemoizedSetting> = (args) => <MemoizedSetting {...args} />; |
||||
WithCallout.args = { |
||||
_id: 'setting-id', |
||||
label: 'Label', |
||||
hint: 'Hint', |
||||
callout: 'Callout text', |
||||
}; |
||||
|
||||
export const types = () => ( |
||||
<FieldGroup> |
||||
<MemoizedSetting packageValue _id='setting-id-1' label='Label' type='action' actionText='Action text' /> |
||||
<MemoizedSetting packageValue='' _id='setting-id-2' label='Label' type='asset' /> |
||||
<MemoizedSetting packageValue _id='setting-id-3' label='Label' type='boolean' /> |
||||
<MemoizedSetting packageValue='' _id='setting-id-4' label='Label' type='code' /> |
||||
<MemoizedSetting packageValue='' _id='setting-id-5' label='Label' type='font' /> |
||||
<MemoizedSetting packageValue={1} _id='setting-id-6' label='Label' type='int' /> |
||||
<MemoizedSetting packageValue='' _id='setting-id-7' label='Label' type='language' /> |
||||
<MemoizedSetting packageValue='' _id='setting-id-8' label='Label' type='password' /> |
||||
<MemoizedSetting packageValue='' _id='setting-id-9' label='Label' type='relativeUrl' /> |
||||
<MemoizedSetting packageValue='' _id='setting-id-10' label='Label' type='select' /> |
||||
<MemoizedSetting packageValue='' _id='setting-id-11' label='Label' type='string' /> |
||||
</FieldGroup> |
||||
); |
||||
|
||||
export const Skeleton = () => <SettingSkeleton />; |
||||
@ -0,0 +1 @@ |
||||
export { default } from './Setting'; |
||||
@ -0,0 +1,24 @@ |
||||
import type { ComponentMeta, ComponentStory } from '@storybook/react'; |
||||
import React from 'react'; |
||||
|
||||
import SettingsGroupPage from './SettingsGroupPage'; |
||||
import SettingsGroupPageSkeleton from './SettingsGroupPageSkeleton'; |
||||
|
||||
export default { |
||||
title: 'Admin/Settings/SettingsGroupPage', |
||||
component: SettingsGroupPage, |
||||
parameters: { |
||||
layout: 'fullscreen', |
||||
controls: { hideNoControlsWarning: true }, |
||||
}, |
||||
} as ComponentMeta<typeof SettingsGroupPage>; |
||||
|
||||
export const Default: ComponentStory<typeof SettingsGroupPage> = (args) => <SettingsGroupPage {...args} />; |
||||
|
||||
export const WithGroup: ComponentStory<typeof SettingsGroupPage> = (args) => <SettingsGroupPage {...args} />; |
||||
WithGroup.args = { |
||||
_id: 'General', |
||||
i18nLabel: 'General', |
||||
}; |
||||
|
||||
export const Skeleton: ComponentStory<typeof SettingsGroupPageSkeleton> = () => <SettingsGroupPageSkeleton />; |
||||
@ -0,0 +1 @@ |
||||
export { default } from './SettingsGroupPage'; |
||||
@ -0,0 +1,16 @@ |
||||
import type { ComponentMeta, ComponentStory } from '@storybook/react'; |
||||
import React from 'react'; |
||||
|
||||
import SettingsGroupSelector from './SettingsGroupSelector'; |
||||
|
||||
export default { |
||||
title: 'Admin/Settings/SettingsGroupSelector', |
||||
component: SettingsGroupSelector, |
||||
parameters: { |
||||
layout: 'fullscreen', |
||||
controls: { hideNoControlsWarning: true }, |
||||
}, |
||||
} as ComponentMeta<typeof SettingsGroupSelector>; |
||||
|
||||
export const Default: ComponentStory<typeof SettingsGroupSelector> = (args) => <SettingsGroupSelector {...args} />; |
||||
Default.storyName = 'GroupSelector'; |
||||
@ -0,0 +1,42 @@ |
||||
import type { GroupId } from '@rocket.chat/core-typings'; |
||||
import { useSettingStructure } from '@rocket.chat/ui-contexts'; |
||||
import React from 'react'; |
||||
|
||||
import SettingsGroupPageSkeleton from '../SettingsGroupPage/SettingsGroupPageSkeleton'; |
||||
import BaseGroupPage from '../groups/BaseGroupPage'; |
||||
import LDAPGroupPage from '../groups/LDAPGroupPage'; |
||||
import OAuthGroupPage from '../groups/OAuthGroupPage'; |
||||
import VoipGroupPage from '../groups/VoipGroupPage'; |
||||
|
||||
type SettingsGroupSelectorProps = { |
||||
groupId: GroupId; |
||||
onClickBack?: () => void; |
||||
}; |
||||
|
||||
const SettingsGroupSelector = ({ groupId, onClickBack }: SettingsGroupSelectorProps) => { |
||||
const group = useSettingStructure(groupId); |
||||
|
||||
if (!group) { |
||||
return <SettingsGroupPageSkeleton />; |
||||
} |
||||
|
||||
if (groupId === 'OAuth') { |
||||
return <OAuthGroupPage {...group} onClickBack={onClickBack} />; |
||||
} |
||||
|
||||
if (groupId === 'LDAP') { |
||||
return <LDAPGroupPage {...group} onClickBack={onClickBack} />; |
||||
} |
||||
|
||||
if (groupId === 'Call_Center') { |
||||
return <VoipGroupPage {...group} onClickBack={onClickBack} />; |
||||
} |
||||
|
||||
if (groupId === 'Assets') { |
||||
return <BaseGroupPage {...group} onClickBack={onClickBack} hasReset={false} />; |
||||
} |
||||
|
||||
return <BaseGroupPage {...group} onClickBack={onClickBack} />; |
||||
}; |
||||
|
||||
export default SettingsGroupSelector; |
||||
@ -0,0 +1 @@ |
||||
export { default } from './SettingsGroupSelector'; |
||||
@ -0,0 +1,21 @@ |
||||
import type { ComponentMeta, ComponentStory } from '@storybook/react'; |
||||
import React from 'react'; |
||||
|
||||
import SettingsSection from './SettingsSection'; |
||||
import SettingsSectionSkeleton from './SettingsSectionSkeleton'; |
||||
|
||||
export default { |
||||
title: 'Admin/Settings/SettingsSection', |
||||
component: SettingsSection, |
||||
parameters: { |
||||
layout: 'fullscreen', |
||||
controls: { hideNoControlsWarning: true }, |
||||
}, |
||||
} as ComponentMeta<typeof SettingsSection>; |
||||
|
||||
export const Default: ComponentStory<typeof SettingsSection> = (args) => <SettingsSection {...args} />; |
||||
Default.args = { |
||||
groupId: 'General', |
||||
}; |
||||
|
||||
export const Skeleton: ComponentStory<typeof SettingsSectionSkeleton> = () => <SettingsSectionSkeleton />; |
||||
@ -0,0 +1 @@ |
||||
export { default } from './SettingsSection'; |
||||
@ -1,26 +0,0 @@ |
||||
import type { ISetting } from '@rocket.chat/core-typings'; |
||||
import type { ReactElement } from 'react'; |
||||
import React, { memo } from 'react'; |
||||
|
||||
import { useEditableSettingsGroupSections } from '../../EditableSettingsContext'; |
||||
import GroupPage from '../GroupPage'; |
||||
import Section from '../Section'; |
||||
|
||||
type AssetsGroupPageProps = ISetting & { |
||||
onClickBack?: () => void; |
||||
}; |
||||
|
||||
function AssetsGroupPage({ _id, onClickBack, ...group }: AssetsGroupPageProps): ReactElement { |
||||
const sections = useEditableSettingsGroupSections(_id); |
||||
const solo = sections.length === 1; |
||||
|
||||
return ( |
||||
<GroupPage _id={_id} onClickBack={onClickBack} {...group}> |
||||
{sections.map((sectionName) => ( |
||||
<Section key={sectionName} groupId={_id} hasReset={false} sectionName={sectionName} solo={solo} /> |
||||
))} |
||||
</GroupPage> |
||||
); |
||||
} |
||||
|
||||
export default memo(AssetsGroupPage); |
||||
@ -0,0 +1,28 @@ |
||||
import type { ReactElement } from 'react'; |
||||
import React from 'react'; |
||||
|
||||
import { useEditableSettingsGroupSections, useEditableSettingsGroupTabs } from '../../EditableSettingsContext'; |
||||
import GenericGroupPage from './GenericGroupPage'; |
||||
import TabbedGroupPage from './TabbedGroupPage'; |
||||
|
||||
type BaseGroupPageProps = { |
||||
_id: string; |
||||
i18nLabel: string; |
||||
headerButtons?: ReactElement; |
||||
hasReset?: boolean; |
||||
onClickBack?: () => void; |
||||
}; |
||||
const BaseGroupPage = ({ _id, i18nLabel, headerButtons, hasReset, onClickBack, ...props }: BaseGroupPageProps) => { |
||||
const tabs = useEditableSettingsGroupTabs(_id); |
||||
const sections = useEditableSettingsGroupSections(_id); |
||||
|
||||
if (tabs.length > 1) { |
||||
return ( |
||||
<TabbedGroupPage _id={_id} i18nLabel={i18nLabel} headerButtons={headerButtons} tabs={tabs} onClickBack={onClickBack} {...props} /> |
||||
); |
||||
} |
||||
|
||||
return <GenericGroupPage _id={_id} i18nLabel={i18nLabel} sections={sections} onClickBack={onClickBack} hasReset={hasReset} {...props} />; |
||||
}; |
||||
|
||||
export default BaseGroupPage; |
||||
@ -0,0 +1 @@ |
||||
export { default } from './OAuthGroupPage'; |
||||
@ -0,0 +1 @@ |
||||
export { default } from './VoipGroupPage'; |
||||
Loading…
Reference in new issue