mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
fix: proper drive space header button logic (#5642)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
762483d7d5
commit
95f26f4978
@ -36,11 +36,13 @@
|
||||
const client = getClient()
|
||||
const query = createQuery()
|
||||
|
||||
const me = getCurrentAccount()
|
||||
|
||||
let loading = true
|
||||
let hasTeamspace = false
|
||||
query.query(
|
||||
document.class.Teamspace,
|
||||
{ archived: false },
|
||||
{ archived: false, members: me._id },
|
||||
(res) => {
|
||||
hasTeamspace = res.length > 0
|
||||
loading = false
|
||||
@ -73,7 +75,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
const dropdownItems = hasAccountRole(getCurrentAccount(), AccountRole.User)
|
||||
const dropdownItems = hasAccountRole(me, AccountRole.User)
|
||||
? [
|
||||
{ id: document.string.CreateDocument, label: document.string.CreateDocument },
|
||||
{ id: document.string.CreateTeamspace, label: document.string.CreateTeamspace }
|
||||
|
@ -28,8 +28,8 @@
|
||||
return name === ''
|
||||
}
|
||||
|
||||
export let space: Ref<Drive>
|
||||
export let parent: Ref<Folder>
|
||||
export let space: Ref<Drive> | undefined
|
||||
export let parent: Ref<Folder> | undefined
|
||||
|
||||
const id: Ref<Folder> = generateId()
|
||||
|
||||
@ -48,6 +48,10 @@
|
||||
}
|
||||
|
||||
async function create (): Promise<void> {
|
||||
if (_space === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
let path: Ref<Folder>[] = []
|
||||
|
||||
if (_parent != null && _parent !== drive.ids.Root) {
|
||||
@ -60,7 +64,7 @@
|
||||
|
||||
await client.createDoc(
|
||||
drive.class.Folder,
|
||||
space,
|
||||
_space,
|
||||
{
|
||||
name: getTitle(name),
|
||||
parent: _parent ?? drive.ids.Root,
|
||||
|
@ -25,13 +25,15 @@
|
||||
export let currentSpace: Ref<Drive> | undefined
|
||||
export let currentFragment: string | undefined
|
||||
|
||||
const me = getCurrentAccount()
|
||||
|
||||
const query = createQuery()
|
||||
|
||||
let loading = true
|
||||
let hasDrive = false
|
||||
query.query(
|
||||
drive.class.Drive,
|
||||
{ archived: false },
|
||||
{ archived: false, members: me._id },
|
||||
(res) => {
|
||||
hasDrive = res.length > 0
|
||||
loading = false
|
||||
@ -56,9 +58,7 @@
|
||||
}
|
||||
|
||||
async function handleCreateFolder (): Promise<void> {
|
||||
if (currentSpace !== undefined) {
|
||||
await createFolder(currentSpace, parent, true)
|
||||
}
|
||||
await createFolder(currentSpace, parent, true)
|
||||
}
|
||||
|
||||
async function handleUploadFile (): Promise<void> {
|
||||
@ -67,7 +67,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
const dropdownItems = hasAccountRole(getCurrentAccount(), AccountRole.User)
|
||||
const dropdownItems = hasAccountRole(me, AccountRole.User)
|
||||
? [
|
||||
{ id: drive.string.CreateDrive, label: drive.string.CreateDrive, icon: drive.icon.Drive },
|
||||
{ id: drive.string.CreateFolder, label: drive.string.CreateFolder, icon: drive.icon.Folder },
|
||||
|
@ -31,7 +31,7 @@ async function navigateToDoc (_id: Ref<Doc>, _class: Ref<Class<Doc>>): Promise<v
|
||||
}
|
||||
}
|
||||
|
||||
export async function createFolder (space: Ref<Drive>, parent: Ref<Folder>, open = false): Promise<void> {
|
||||
export async function createFolder (space: Ref<Drive> | undefined, parent: Ref<Folder>, open = false): Promise<void> {
|
||||
showPopup(CreateFolder, { space, parent }, 'top', async (id) => {
|
||||
if (open && id !== undefined && id !== null) {
|
||||
await navigateToDoc(id, drive.class.Folder)
|
||||
|
Loading…
Reference in New Issue
Block a user