The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/client/views/admin/settings/groups/AssetsGroupPage.js

48 lines
1.4 KiB

import { Button } from '@rocket.chat/fuselage';
import React, { memo } from 'react';
import { useEditableSettingsGroupSections } from '../../../../contexts/EditableSettingsContext';
import { useMethod } from '../../../../contexts/ServerContext';
import { useToastMessageDispatch } from '../../../../contexts/ToastMessagesContext';
import { useTranslation } from '../../../../contexts/TranslationContext';
import GroupPage from '../GroupPage';
import Section from '../Section';
function AssetsGroupPage({ _id, ...group }) {
const sections = useEditableSettingsGroupSections(_id);
const solo = sections.length === 1;
const t = useTranslation();
const refreshClients = useMethod('refreshClients');
const dispatchToastMessage = useToastMessageDispatch();
const handleApplyAndRefreshAllClientsButtonClick = async () => {
try {
await refreshClients();
dispatchToastMessage({
type: 'success',
message: t('Clients_will_refresh_in_a_few_seconds'),
});
} catch (error) {
dispatchToastMessage({ type: 'error', message: error });
}
};
return (
<GroupPage
_id={_id}
{...group}
headerButtons={
<>
<Button onClick={handleApplyAndRefreshAllClientsButtonClick}>{t('Apply_and_refresh_all_clients')}</Button>
</>
}
>
{sections.map((sectionName) => (
<Section key={sectionName} groupId={_id} hasReset={false} sectionName={sectionName} solo={solo} />
))}
</GroupPage>
);
}
export default memo(AssetsGroupPage);