@@ -177,6 +201,18 @@ exports[`pages/dashboard/CenterContent search filter 1`] = `
>
Dashboard
+
diff --git a/webapp/src/pages/dashboard/__snapshots__/dashboardPage.test.tsx.snap b/webapp/src/pages/dashboard/__snapshots__/dashboardPage.test.tsx.snap
index 2a4dc2385..44a1657d2 100644
--- a/webapp/src/pages/dashboard/__snapshots__/dashboardPage.test.tsx.snap
+++ b/webapp/src/pages/dashboard/__snapshots__/dashboardPage.test.tsx.snap
@@ -327,6 +327,18 @@ exports[`pages/dashboard/DashboardPage base case 1`] = `
>
Dashboard
+
diff --git a/webapp/src/pages/dashboard/centerContent.tsx b/webapp/src/pages/dashboard/centerContent.tsx
index 293bedea2..8168751bf 100644
--- a/webapp/src/pages/dashboard/centerContent.tsx
+++ b/webapp/src/pages/dashboard/centerContent.tsx
@@ -12,8 +12,10 @@ import {UserWorkspace} from '../../user'
import {useAppDispatch, useAppSelector} from '../../store/hooks'
import {getUserWorkspaceList, setUserWorkspaces} from '../../store/workspace'
import octoClient from '../../octoClient'
+import Switch from '../../widgets/switch'
import SearchIcon from '../../widgets/icons/search'
+import {UserSettings} from '../../userSettings'
const DashboardCenterContent = (): JSX.Element => {
const rawWorkspaces = useAppSelector
(getUserWorkspaceList) || []
@@ -21,6 +23,7 @@ const DashboardCenterContent = (): JSX.Element => {
const history = useHistory()
const intl = useIntl()
const [searchFilter, setSearchFilter] = useState('')
+ const [showEmptyWorkspaces, setShowEmptyWorkspaces] = useState(UserSettings.dashboardShowEmpty)
const initializeUserWorkspaces = async () => {
const userWorkspaces = await octoClient.getUserWorkspaces()
@@ -36,7 +39,7 @@ const DashboardCenterContent = (): JSX.Element => {
})
const userWorkspaces = rawWorkspaces.
- filter((workspace) => workspace.title.toLowerCase().includes(searchFilter) || workspace.boardCount.toString().includes(searchFilter)).
+ filter((workspace) => (workspace.boardCount > 0 || showEmptyWorkspaces) && (workspace.title.toLowerCase().includes(searchFilter) || workspace.boardCount.toString().includes(searchFilter))).
sort((a, b) => {
if ((a.boardCount === 0 && b.boardCount === 0) || (a.boardCount !== 0 && b.boardCount !== 0)) {
return a.title.localeCompare(b.title)
@@ -49,6 +52,16 @@ const DashboardCenterContent = (): JSX.Element => {
{intl.formatMessage({id: 'DashboardPage.title', defaultMessage: 'Dashboard'})}
+
+ {intl.formatMessage({id: 'DashboardPage.showEmpty', defaultMessage: 'Show empty'})}
+ {
+ UserSettings.dashboardShowEmpty = !showEmptyWorkspaces
+ setShowEmptyWorkspaces(!showEmptyWorkspaces)
+ }}
+ />
+