Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cloud/api/mock/mockHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const routes: MockRoute[] = [
folders: folders.map(populateFolder),
docs: docs,
tags: [],
smartFolders: [],
dashboardFolders: [],
appEvents: [],
}
},
Expand Down
30 changes: 30 additions & 0 deletions src/cloud/api/pages/teams/dashboard/list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { GeneralAppProps } from '../../../../interfaces/api'
import { callApi } from '../../../../lib/client'
import { GetInitialPropsParameters } from '../../../../interfaces/pages'
import querystring from 'querystring'
import { SerializedDashboardFolder } from '../../../../interfaces/db/dashboardFolder'

export type DashboardFolderShowPageResponseBody = GeneralAppProps & {
dashboardFolders: SerializedDashboardFolder[]
}

export async function getDashboardFolderShowPageData({
pathname,
search,
signal,
}: GetInitialPropsParameters) {
const [, teamId] = pathname.split('/')

const data = await callApi<DashboardFolderShowPageResponseBody>(
'api/pages/teams/dashboard/folders/list',
{
search: {
...querystring.parse(search),
teamId,
},
signal,
}
)

return data
}
11 changes: 7 additions & 4 deletions src/cloud/api/pages/teams/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ export async function getTeamIndexPageData({
signal,
}: GetInitialPropsParameters) {
const [, teamId] = pathname.split('/')
const data = await callApi<TeamShowPageResponseBody>('api/pages/teams/show', {
search: search + `&teamId=${teamId}`,
signal,
})
const data = await callApi<TeamShowPageResponseBody>(
'api/pages/teams/dashboard/show',
{
search: search + `&teamId=${teamId}`,
signal,
}
)

return data
}
Expand Down
31 changes: 0 additions & 31 deletions src/cloud/api/pages/teams/smart-folders.ts

This file was deleted.

75 changes: 75 additions & 0 deletions src/cloud/api/teams/dashboard/folders.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { callApi } from '../../../lib/client'
import {
SerializedDashboardFolder,
SerializedPrimaryCondition,
} from '../../../interfaces/db/dashboardFolder'

export interface CreateDashboardFolderRequestBody {
name: string
condition: SerializedPrimaryCondition
private: boolean
}

export interface CreateDashboardFolderResponseBody {
dashboardFolder: SerializedDashboardFolder
}

export async function createDashboardFolder(
body: CreateDashboardFolderRequestBody & { teamId: string }
) {
const data = await callApi<CreateDashboardFolderResponseBody>(
`/api/dashboard/folders`,
{
json: body,
method: 'post',
}
)

return data
}

export interface UpdateDashboardFolderRequestBody {
name: string
condition: SerializedPrimaryCondition
private: boolean
}

export interface UpdateDashboardFolderResponseBody {
dashboardFolder: SerializedDashboardFolder
}

export async function updateDashboardFolder(
dashboardFolder: SerializedDashboardFolder,
body: CreateDashboardFolderRequestBody
) {
const data = await callApi<CreateDashboardFolderResponseBody>(
`/api/dashboard/folders/${dashboardFolder.id}`,
{
json: body,
method: 'put',
}
)

return data
}

export interface UpdateDashboardFolderRequestBody {
name: string
condition: SerializedPrimaryCondition
private: boolean
}

export interface UpdateDashboardFolderResponseBody {
dashboardFolder: SerializedDashboardFolder
}

export async function deleteDashboardFolder(dashboardFolder: { id: string }) {
const data = await callApi<CreateDashboardFolderResponseBody>(
`/api/dashboard/folders/${dashboardFolder.id}`,
{
method: 'delete',
}
)

return data
}
4 changes: 2 additions & 2 deletions src/cloud/api/teams/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import querystring from 'querystring'
import { SerializedTag } from '../../../interfaces/db/tag'
import { SerializedWorkspace } from '../../../interfaces/db/workspace'
import { callApi } from '../../../lib/client'
import { SerializedSmartFolder } from '../../../interfaces/db/smartFolder'
import { SerializedDashboardFolder } from '../../../interfaces/db/dashboardFolder'
import { SerializedAppEvent } from '../../../interfaces/db/appEvents'

export interface MoveResourceRequestBody {
Expand Down Expand Up @@ -41,7 +41,7 @@ export interface GetResourcesResponseBody {
docs: SerializedDocWithBookmark[]
workspaces: SerializedWorkspace[]
tags?: SerializedTag[]
smartFolders?: SerializedSmartFolder[]
dashboardFolders?: SerializedDashboardFolder[]
appEvents?: SerializedAppEvent[]
}

Expand Down
81 changes: 0 additions & 81 deletions src/cloud/api/teams/smart-folder.ts

This file was deleted.

16 changes: 16 additions & 0 deletions src/cloud/components/Application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
mdiLogoutVariant,
mdiMagnify,
mdiPlusCircleOutline,
mdiViewDashboardOutline,
mdiWeb,
} from '@mdi/js'
import { buildIconUrl } from '../api/files'
Expand Down Expand Up @@ -78,6 +79,7 @@ import {
InPageSearchContainer,
} from './molecules/PageSearch/InPageSearchPortal'
import SidebarToggleButton from './SidebarToggleButton'
import { getTeamURL } from '../lib/utils/patterns'

interface ApplicationProps {
className?: string
Expand Down Expand Up @@ -296,6 +298,7 @@ const Application = ({
}, [])

const sidebarHeader = useMemo(() => {
const teamUrl = team != null ? getTeamURL(team) : ''
return (
<>
<SidebarHeader
Expand All @@ -319,6 +322,17 @@ const Application = ({
id: 'sidebar__button__search',
active: showSearchScreen,
},
{
label: translate(lngKeys.GeneralDashboard),
icon: mdiViewDashboardOutline,
variant: 'transparent',
labelHref: teamUrl,
labelClick: () => push(teamUrl),
id: 'sidebar__button__inbox',
active: pathname === teamUrl,
pastille:
team != null && counts[team.id] ? counts[team.id] : undefined,
},
{
label: translate(lngKeys.GeneralInbox),
icon: mdiInbox,
Expand Down Expand Up @@ -355,6 +369,8 @@ const Application = ({
team,
translate,
showSearchScreen,
push,
pathname,
])

const sidebarFooter = useMemo(() => {
Expand Down
Loading