mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-06 07:23:26 +00:00
viewlet fixes (#7934)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
2d10797cf7
commit
62dfae97cb
@ -349,7 +349,7 @@ function defineResource (builder: Builder): void {
|
||||
key: '',
|
||||
presenter: drive.component.ResourcePresenter,
|
||||
label: drive.string.Name,
|
||||
sortingKey: 'name'
|
||||
sortingKey: 'title'
|
||||
},
|
||||
'$lookup.file.size',
|
||||
'comments',
|
||||
@ -366,7 +366,7 @@ function defineResource (builder: Builder): void {
|
||||
}
|
||||
} as FindOptions<Resource>,
|
||||
configOptions: {
|
||||
hiddenKeys: ['name', 'parent', 'path', 'file', 'versions'],
|
||||
hiddenKeys: ['title', 'parent', 'path', 'file', 'versions'],
|
||||
sortable: true
|
||||
}
|
||||
},
|
||||
@ -393,7 +393,7 @@ function defineResource (builder: Builder): void {
|
||||
viewOptions: {
|
||||
groupBy: [],
|
||||
orderBy: [
|
||||
['name', SortingOrder.Ascending],
|
||||
['title', SortingOrder.Ascending],
|
||||
['$lookup.file.size', SortingOrder.Ascending],
|
||||
['$lookup.file.modifiedOn', SortingOrder.Descending]
|
||||
],
|
||||
@ -404,14 +404,14 @@ function defineResource (builder: Builder): void {
|
||||
key: '',
|
||||
presenter: drive.component.ResourcePresenter,
|
||||
label: drive.string.Name,
|
||||
sortingKey: 'name'
|
||||
sortingKey: 'title'
|
||||
},
|
||||
'$lookup.file.size',
|
||||
'$lookup.file.modifiedOn',
|
||||
'createdBy'
|
||||
],
|
||||
configOptions: {
|
||||
hiddenKeys: ['name', 'parent', 'path', 'file', 'versions'],
|
||||
hiddenKeys: ['title', 'parent', 'path', 'file', 'versions'],
|
||||
sortable: true
|
||||
},
|
||||
/* eslint-disable @typescript-eslint/consistent-type-assertions */
|
||||
|
@ -15,9 +15,9 @@
|
||||
<script lang="ts">
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import { AccountRole, Ref, Space, getCurrentAccount, hasAccountRole } from '@hcengineering/core'
|
||||
import { MultipleDraftController, getClient } from '@hcengineering/presentation'
|
||||
import { MultipleDraftController, createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { TrackerEvents } from '@hcengineering/tracker'
|
||||
import { ButtonWithDropdown, IconAdd, IconDropdown, SelectPopupValueType, showPopup } from '@hcengineering/ui'
|
||||
import { Button, ButtonWithDropdown, IconAdd, IconDropdown, SelectPopupValueType, showPopup } from '@hcengineering/ui'
|
||||
import view from '@hcengineering/view'
|
||||
|
||||
import { onDestroy } from 'svelte'
|
||||
@ -44,6 +44,14 @@
|
||||
})
|
||||
}
|
||||
|
||||
const query = createQuery()
|
||||
|
||||
let projectExists = false
|
||||
|
||||
query.query(tracker.class.Project, {}, (res) => {
|
||||
projectExists = res.length > 0
|
||||
})
|
||||
|
||||
$: label = draftExists || !closed ? tracker.string.ResumeDraft : tracker.string.NewIssue
|
||||
$: dropdownItems = hasAccountRole(getCurrentAccount(), AccountRole.User)
|
||||
? [
|
||||
@ -86,30 +94,45 @@
|
||||
</script>
|
||||
|
||||
<div class="antiNav-subheader">
|
||||
<ButtonWithDropdown
|
||||
icon={IconAdd}
|
||||
justify={'left'}
|
||||
kind={'primary'}
|
||||
{label}
|
||||
on:click={newIssue}
|
||||
{dropdownItems}
|
||||
dropdownIcon={IconDropdown}
|
||||
on:dropdown-selected={(ev) => {
|
||||
dropdownItemSelected(ev.detail)
|
||||
}}
|
||||
mainButtonId={'new-issue'}
|
||||
showTooltipMain={{
|
||||
direction: 'bottom',
|
||||
label,
|
||||
keys
|
||||
}}
|
||||
>
|
||||
<div slot="content" class="draft-circle-container">
|
||||
{#if draftExists}
|
||||
<div class="draft-circle" />
|
||||
{/if}
|
||||
</div>
|
||||
</ButtonWithDropdown>
|
||||
{#if projectExists}
|
||||
<ButtonWithDropdown
|
||||
icon={IconAdd}
|
||||
justify={'left'}
|
||||
kind={'primary'}
|
||||
{label}
|
||||
on:click={newIssue}
|
||||
{dropdownItems}
|
||||
dropdownIcon={IconDropdown}
|
||||
on:dropdown-selected={(ev) => {
|
||||
dropdownItemSelected(ev.detail)
|
||||
}}
|
||||
mainButtonId={'new-issue'}
|
||||
showTooltipMain={{
|
||||
direction: 'bottom',
|
||||
label,
|
||||
keys
|
||||
}}
|
||||
>
|
||||
<div slot="content" class="draft-circle-container">
|
||||
{#if draftExists}
|
||||
<div class="draft-circle" />
|
||||
{/if}
|
||||
</div>
|
||||
</ButtonWithDropdown>
|
||||
{:else}
|
||||
<Button
|
||||
icon={IconAdd}
|
||||
justify="left"
|
||||
kind="primary"
|
||||
label={tracker.string.CreateProject}
|
||||
width="100%"
|
||||
on:click={() => {
|
||||
showPopup(tracker.component.CreateProject, {}, 'top', () => {
|
||||
closed = true
|
||||
})
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -326,25 +326,14 @@ async function deleteProject (project: Project | undefined): Promise<void> {
|
||||
})
|
||||
} else {
|
||||
const anyIssue = await client.findOne(tracker.class.Issue, { space: project._id })
|
||||
if (anyIssue !== undefined) {
|
||||
showPopup(MessageBox, {
|
||||
label: tracker.string.ArchiveProjectName,
|
||||
labelProps: { name: project.name },
|
||||
message: tracker.string.ProjectHasIssues,
|
||||
action: async () => {
|
||||
await client.update(project, { archived: true })
|
||||
}
|
||||
})
|
||||
} else {
|
||||
showPopup(MessageBox, {
|
||||
label: tracker.string.ArchiveProjectName,
|
||||
labelProps: { name: project.name },
|
||||
message: tracker.string.ArchiveProjectConfirm,
|
||||
action: async () => {
|
||||
await client.update(project, { archived: true })
|
||||
}
|
||||
})
|
||||
}
|
||||
showPopup(MessageBox, {
|
||||
label: tracker.string.ArchiveProjectName,
|
||||
labelProps: { name: project.name },
|
||||
message: anyIssue !== undefined ? tracker.string.ProjectHasIssues : tracker.string.ArchiveProjectConfirm,
|
||||
action: async () => {
|
||||
await client.update(project, { archived: true })
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,11 +42,12 @@
|
||||
(res) => {
|
||||
configurationRaw = res
|
||||
configurationsLoading = false
|
||||
loading = configurationsLoading || preferencesLoading
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
function fetchPreferences (viewlet: Viewlet): void {
|
||||
function fetchPreferences (configurationRaw: Viewlet[]): void {
|
||||
preferencesLoading = preferenceQuery.query(
|
||||
view.class.ViewletPreference,
|
||||
{
|
||||
@ -56,6 +57,7 @@
|
||||
(res) => {
|
||||
preference = res
|
||||
preferencesLoading = false
|
||||
loading = configurationsLoading || preferencesLoading
|
||||
}
|
||||
)
|
||||
}
|
||||
@ -81,7 +83,7 @@
|
||||
}
|
||||
|
||||
$: fetchConfigurations(viewlet)
|
||||
$: fetchPreferences(viewlet)
|
||||
$: fetchPreferences(configurationRaw)
|
||||
|
||||
$: updateConfiguration(configurationRaw, preference)
|
||||
|
||||
@ -90,6 +92,8 @@
|
||||
|
||||
{#if viewlet?.$lookup?.descriptor?.component}
|
||||
{#if loading}
|
||||
{configurationsLoading}
|
||||
{preferencesLoading}
|
||||
<Loading />
|
||||
{:else}
|
||||
<Component
|
||||
|
Loading…
Reference in New Issue
Block a user