-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[BREAK] Move Multiple Department Creation to EE & [NEW] Department Archive #27753
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
Merged
Merged
Changes from 16 commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
985b025
Move save department functionality to EE
sampaiodiego 4e24aba
[FE] Move Departments to EE
MartinSchoeler ff865e3
Merge branch 'departments-to-ee' into move-save-department-ee
MartinSchoeler d61b219
Fix weird caching issue
MartinSchoeler 984da48
Fix TS & Better error message
MartinSchoeler 88c6dd5
Tests and small changes
MartinSchoeler 085c803
Better wording
MartinSchoeler c9a5070
Merge branch 'develop' into move-save-department-ee
MartinSchoeler 317bd12
Fix reviews & ee tests
MartinSchoeler 6ea0021
Merge branch 'move-save-department-ee' of https://github.com/RocketCh…
MartinSchoeler df4d8e7
fix review again
MartinSchoeler 050b0c2
Fix reviews
MartinSchoeler 1919d18
reviews
MartinSchoeler 49231b8
Merge branch 'develop' into move-save-department-ee
MartinSchoeler f89b05d
Fix wrong conditional
MartinSchoeler 31da816
Merge branch 'move-save-department-ee' of https://github.com/RocketCh…
MartinSchoeler cf29e81
Merge branch 'develop' into move-save-department-ee
tassoevan f8f1e65
Fix tests
MartinSchoeler fca41f8
Lint
MartinSchoeler a7a1c3d
Move department tests to ee
MartinSchoeler 6500401
Merge branch 'develop' into move-save-department-ee
MartinSchoeler 61ad52d
Update NewDepartment.tsx
MartinSchoeler e8502c8
I love typescript ™
MartinSchoeler aa408af
Update apps/meteor/tests/data/livechat/rooms.ts
MartinSchoeler 8a96b75
Merge branch 'develop' into move-save-department-ee
MartinSchoeler 1ef34e9
Fix TS
MartinSchoeler 0713f98
Merge branch 'develop' into move-save-department-ee
MartinSchoeler 9be3049
Merge branch 'develop' into move-save-department-ee
MartinSchoeler 40cc2d5
Merge branch 'develop' into move-save-department-ee
MartinSchoeler f5cab82
add jsdoc
MartinSchoeler 235b605
Merge branch 'move-save-department-ee' of https://github.com/RocketCh…
MartinSchoeler 8ad8a06
Remove extra skip
MartinSchoeler 6f9c1f2
remove wrong field
MartinSchoeler dbdfffd
TS fixes
MartinSchoeler 55457ec
Fix TS
MartinSchoeler 5f783b5
Move some tests to EE for now
MartinSchoeler d4edfdf
Merge branch 'develop' into move-save-department-ee
MartinSchoeler 8535bd7
Use correct image
MartinSchoeler 56be13d
Fix reviews on test
MartinSchoeler e1b7494
Merge branch 'develop' into move-save-department-ee
MartinSchoeler dfa6298
Reviews
MartinSchoeler 94a81ab
Review
MartinSchoeler 0c107c2
Merge branch 'develop' into move-save-department-ee
MartinSchoeler dd77129
update wording
MartinSchoeler fafaaeb
Merge branch 'move-save-department-ee' of https://github.com/RocketCh…
MartinSchoeler 2f5007c
Merge branch 'develop' into move-save-department-ee
MartinSchoeler 1b6b47b
Merge branch 'develop' into move-save-department-ee
MartinSchoeler 6ea6659
Update raw model
KevLehman 8422b8b
Merge branch 'move-save-department-ee' of github.com:RocketChat/Rocke…
KevLehman d39c13d
lint
MartinSchoeler 0d3df9a
Remove empty line
MartinSchoeler ce5dab8
Small wording & link changes to modal
MartinSchoeler 27f0d33
Merge branch 'develop' into move-save-department-ee
KevLehman fc420e0
Merge branch 'develop' into move-save-department-ee
MartinSchoeler c77addb
[NEW] Department Archivation (#27966)
MartinSchoeler ca8a7ca
Merge branch 'develop' into move-save-department-ee
MartinSchoeler 6d059b2
Fix typo
MartinSchoeler d17a769
Merge branch 'develop' into move-save-department-ee
MartinSchoeler fafc64c
Fix reviews & pagination
MartinSchoeler 680ad26
Merge branch 'move-save-department-ee' of https://github.com/RocketCh…
MartinSchoeler 38c5694
Chore: Add archived department tests (#27992)
MartinSchoeler b5a75a5
Improve coverage
MartinSchoeler 0ca3edc
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into move…
tassoevan 679c67f
Refactor minor pet peeves
tassoevan 0282109
Refactor minor pet peeves
tassoevan e199349
Refactor minor pet peeves
tassoevan d604602
Merge branch 'develop' into move-save-department-ee
murtaza98 d22906e
Fix error on edit forward
MartinSchoeler ebbfb21
Merge branch 'move-save-department-ee' of https://github.com/RocketCh…
MartinSchoeler cff00b7
Fix some reviews
MartinSchoeler b84d8ed
Merge branch 'develop' into move-save-department-ee
kodiakhq[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,16 @@ | ||
| import { Meteor } from 'meteor/meteor'; | ||
|
|
||
| import { hasPermission } from '../../../authorization'; | ||
| import { Livechat } from '../lib/Livechat'; | ||
| import { LivechatEnterprise } from '../../../../ee/app/livechat-enterprise/server/lib/LivechatEnterprise'; | ||
|
|
||
| Meteor.methods({ | ||
| 'livechat:saveDepartment'(_id, departmentData, departmentAgents) { | ||
| async 'livechat:saveDepartment'(_id, departmentData, departmentAgents) { | ||
| if (!Meteor.userId() || !hasPermission(Meteor.userId(), 'manage-livechat-departments')) { | ||
| throw new Meteor.Error('error-not-allowed', 'Not allowed', { | ||
| method: 'livechat:saveDepartment', | ||
| }); | ||
| } | ||
|
|
||
| return Livechat.saveDepartment(_id, departmentData, { upsert: departmentAgents }); | ||
| return LivechatEnterprise.saveDepartment(_id, departmentData, { upsert: departmentAgents }); | ||
| }, | ||
| }); |
73 changes: 73 additions & 0 deletions
73
apps/meteor/client/components/Omnichannel/modals/EnterpriseDepartmentsModal.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| import { Button, Modal, Box } from '@rocket.chat/fuselage'; | ||
| import { useOutsideClick } from '@rocket.chat/fuselage-hooks'; | ||
| import { useRoute, useTranslation } from '@rocket.chat/ui-contexts'; | ||
| import type { ReactElement } from 'react'; | ||
| import React, { useRef } from 'react'; | ||
|
|
||
| import { hasPermission } from '../../../../app/authorization/client'; | ||
| import { useUpgradeTabParams } from '../../../views/hooks/useUpgradeTabParams'; | ||
|
|
||
| const EnterpriseDepartmentsModal = ({ closeModal }: { closeModal: () => void }): ReactElement => { | ||
| const t = useTranslation(); | ||
| const upgradeRoute = useRoute('upgrade'); | ||
| const departmentsRoute = useRoute('omnichannel-departments'); | ||
| const { tabType, trialEndDate } = useUpgradeTabParams(); | ||
| const ref = useRef<HTMLDivElement>(null); | ||
| const upgradeNowClick = (): void => { | ||
| tabType && upgradeRoute.push({ type: tabType }, trialEndDate ? { trialEndDate } : undefined); | ||
| closeModal(); | ||
| }; | ||
|
|
||
| const onClose = (): void => { | ||
| departmentsRoute.push({}); | ||
| closeModal(); | ||
| }; | ||
|
|
||
| useOutsideClick([ref], onClose); | ||
|
|
||
| return ( | ||
| <> | ||
| <Modal data-qa-id='enterprise-departments-modal' ref={ref}> | ||
| <Modal.Header> | ||
| <Modal.HeaderText> | ||
| <Modal.Tagline>{t('Enterprise_capability')}</Modal.Tagline> | ||
| <Modal.Title>{t('Departments')}</Modal.Title> | ||
| </Modal.HeaderText> | ||
| <Modal.Close onClick={onClose} data-qa='modal-close' /> | ||
| </Modal.Header> | ||
| <Modal.Content fontScale='p2'> | ||
| <Modal.HeroImage src='/images/departments.svg' /> | ||
| <Box fontSize={20} fontWeight={700} lineHeight={28} mbe={28}> | ||
| {t('Enterprise_Departments_title')} | ||
| </Box> | ||
| {tabType === 'go-fully-featured' || tabType === 'go-fully-featured-registered' || tabType === 'upgrade-your-plan' | ||
| ? t('Enterprise_Departments_description_upgrade') | ||
| : t('Enterprise_Departments_description_free_trial')} | ||
| </Modal.Content> | ||
| <Modal.Footer> | ||
| {hasPermission('view-statistics') ? ( | ||
| <Modal.FooterControllers> | ||
| <Button is='a' href='https://rocket.chat/contact' external onClick={onClose} data-qa-id='btn-talk-to-sales'> | ||
| {t('Talk_to_sales')} | ||
| </Button> | ||
| <Button onClick={upgradeNowClick} primary data-qa-id='upgrade-now'> | ||
| {tabType === 'go-fully-featured' || tabType === 'go-fully-featured-registered' || tabType === 'upgrade-your-plan' | ||
| ? t('Start_free_trial') | ||
| : t('Learn_more')} | ||
| </Button> | ||
| </Modal.FooterControllers> | ||
| ) : ( | ||
|
MartinSchoeler marked this conversation as resolved.
Outdated
|
||
| <Box display='flex' width='100%' justifyContent='space-between' alignItems='center'> | ||
| Talk to your workspace admin about enabling departments. | ||
| <Button onClick={onClose} data-qa='button-close'> | ||
| {t('Close')} | ||
| </Button> | ||
| </Box> | ||
| )} | ||
| </Modal.Footer> | ||
| </Modal> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default EnterpriseDepartmentsModal; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
apps/meteor/client/views/omnichannel/departments/NewDepartment.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { useEndpoint, useTranslation } from '@rocket.chat/ui-contexts'; | ||
| import { useQuery } from '@tanstack/react-query'; | ||
| import type { MutableRefObject } from 'react'; | ||
| import React, { useEffect } from 'react'; | ||
|
|
||
| import { useHasLicenseModule } from '../../../../ee/client/hooks/useHasLicenseModule'; | ||
| import PageSkeleton from '../../../components/PageSkeleton'; | ||
| import EditDepartment from './EditDepartment'; | ||
| import UpgradeDepartments from './UpgradeDepartments'; | ||
|
|
||
| type NewDepartmentProps = { | ||
| id: string; | ||
| reload: () => void; | ||
| refetchRef: MutableRefObject<() => void>; | ||
| }; | ||
|
|
||
| const NewDepartment = ({ id, reload, refetchRef }: NewDepartmentProps) => { | ||
| const getDepartments = useEndpoint('GET', '/v1/livechat/department'); | ||
| const hasLicense = useHasLicenseModule('livechat-enterprise'); | ||
| const { data, refetch, isLoading } = useQuery(['getDepartments'], async () => getDepartments()); | ||
|
MartinSchoeler marked this conversation as resolved.
Outdated
MartinSchoeler marked this conversation as resolved.
Outdated
|
||
|
|
||
| useEffect(() => { | ||
| refetchRef.current = refetch; | ||
| }, [refetchRef, refetch]); | ||
|
|
||
| const t = useTranslation(); | ||
|
|
||
| if (isLoading || hasLicense === 'loading') { | ||
| return <PageSkeleton />; | ||
| } | ||
|
MartinSchoeler marked this conversation as resolved.
|
||
| if (!hasLicense && data?.total === 0) { | ||
| return <UpgradeDepartments />; | ||
| } | ||
| // TODO: remove allowedToForwardData and data props once the EditDepartment component is migrated to TS | ||
| return <EditDepartment id={id} reload={reload} title={t('New_Department')} allowedToForwardData={undefined} data={undefined} />; | ||
| }; | ||
|
|
||
| export default NewDepartment; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
apps/meteor/client/views/omnichannel/departments/UpgradeDepartments.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { useSetModal } from '@rocket.chat/ui-contexts'; | ||
| import React, { useEffect } from 'react'; | ||
|
|
||
| import EnterpriseDepartmentsModal from '../../../components/Omnichannel/modals/EnterpriseDepartmentsModal'; | ||
| import PageSkeleton from '../../../components/PageSkeleton'; | ||
|
|
||
| const UpgradeDepartments = () => { | ||
| const setModal = useSetModal(); | ||
|
|
||
| useEffect(() => setModal(<EnterpriseDepartmentsModal closeModal={(): void => setModal(null)} />), [setModal]); | ||
| return <PageSkeleton />; | ||
| }; | ||
|
|
||
| export default UpgradeDepartments; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.