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: '',
|
key: '',
|
||||||
presenter: drive.component.ResourcePresenter,
|
presenter: drive.component.ResourcePresenter,
|
||||||
label: drive.string.Name,
|
label: drive.string.Name,
|
||||||
sortingKey: 'name'
|
sortingKey: 'title'
|
||||||
},
|
},
|
||||||
'$lookup.file.size',
|
'$lookup.file.size',
|
||||||
'comments',
|
'comments',
|
||||||
@ -366,7 +366,7 @@ function defineResource (builder: Builder): void {
|
|||||||
}
|
}
|
||||||
} as FindOptions<Resource>,
|
} as FindOptions<Resource>,
|
||||||
configOptions: {
|
configOptions: {
|
||||||
hiddenKeys: ['name', 'parent', 'path', 'file', 'versions'],
|
hiddenKeys: ['title', 'parent', 'path', 'file', 'versions'],
|
||||||
sortable: true
|
sortable: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -393,7 +393,7 @@ function defineResource (builder: Builder): void {
|
|||||||
viewOptions: {
|
viewOptions: {
|
||||||
groupBy: [],
|
groupBy: [],
|
||||||
orderBy: [
|
orderBy: [
|
||||||
['name', SortingOrder.Ascending],
|
['title', SortingOrder.Ascending],
|
||||||
['$lookup.file.size', SortingOrder.Ascending],
|
['$lookup.file.size', SortingOrder.Ascending],
|
||||||
['$lookup.file.modifiedOn', SortingOrder.Descending]
|
['$lookup.file.modifiedOn', SortingOrder.Descending]
|
||||||
],
|
],
|
||||||
@ -404,14 +404,14 @@ function defineResource (builder: Builder): void {
|
|||||||
key: '',
|
key: '',
|
||||||
presenter: drive.component.ResourcePresenter,
|
presenter: drive.component.ResourcePresenter,
|
||||||
label: drive.string.Name,
|
label: drive.string.Name,
|
||||||
sortingKey: 'name'
|
sortingKey: 'title'
|
||||||
},
|
},
|
||||||
'$lookup.file.size',
|
'$lookup.file.size',
|
||||||
'$lookup.file.modifiedOn',
|
'$lookup.file.modifiedOn',
|
||||||
'createdBy'
|
'createdBy'
|
||||||
],
|
],
|
||||||
configOptions: {
|
configOptions: {
|
||||||
hiddenKeys: ['name', 'parent', 'path', 'file', 'versions'],
|
hiddenKeys: ['title', 'parent', 'path', 'file', 'versions'],
|
||||||
sortable: true
|
sortable: true
|
||||||
},
|
},
|
||||||
/* eslint-disable @typescript-eslint/consistent-type-assertions */
|
/* eslint-disable @typescript-eslint/consistent-type-assertions */
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Analytics } from '@hcengineering/analytics'
|
import { Analytics } from '@hcengineering/analytics'
|
||||||
import { AccountRole, Ref, Space, getCurrentAccount, hasAccountRole } from '@hcengineering/core'
|
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 { 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 view from '@hcengineering/view'
|
||||||
|
|
||||||
import { onDestroy } from 'svelte'
|
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
|
$: label = draftExists || !closed ? tracker.string.ResumeDraft : tracker.string.NewIssue
|
||||||
$: dropdownItems = hasAccountRole(getCurrentAccount(), AccountRole.User)
|
$: dropdownItems = hasAccountRole(getCurrentAccount(), AccountRole.User)
|
||||||
? [
|
? [
|
||||||
@ -86,6 +94,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="antiNav-subheader">
|
<div class="antiNav-subheader">
|
||||||
|
{#if projectExists}
|
||||||
<ButtonWithDropdown
|
<ButtonWithDropdown
|
||||||
icon={IconAdd}
|
icon={IconAdd}
|
||||||
justify={'left'}
|
justify={'left'}
|
||||||
@ -110,6 +119,20 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</ButtonWithDropdown>
|
</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>
|
</div>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
@ -326,25 +326,14 @@ async function deleteProject (project: Project | undefined): Promise<void> {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const anyIssue = await client.findOne(tracker.class.Issue, { space: project._id })
|
const anyIssue = await client.findOne(tracker.class.Issue, { space: project._id })
|
||||||
if (anyIssue !== undefined) {
|
|
||||||
showPopup(MessageBox, {
|
showPopup(MessageBox, {
|
||||||
label: tracker.string.ArchiveProjectName,
|
label: tracker.string.ArchiveProjectName,
|
||||||
labelProps: { name: project.name },
|
labelProps: { name: project.name },
|
||||||
message: tracker.string.ProjectHasIssues,
|
message: anyIssue !== undefined ? tracker.string.ProjectHasIssues : tracker.string.ArchiveProjectConfirm,
|
||||||
action: async () => {
|
action: async () => {
|
||||||
await client.update(project, { archived: true })
|
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 })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,11 +42,12 @@
|
|||||||
(res) => {
|
(res) => {
|
||||||
configurationRaw = res
|
configurationRaw = res
|
||||||
configurationsLoading = false
|
configurationsLoading = false
|
||||||
|
loading = configurationsLoading || preferencesLoading
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchPreferences (viewlet: Viewlet): void {
|
function fetchPreferences (configurationRaw: Viewlet[]): void {
|
||||||
preferencesLoading = preferenceQuery.query(
|
preferencesLoading = preferenceQuery.query(
|
||||||
view.class.ViewletPreference,
|
view.class.ViewletPreference,
|
||||||
{
|
{
|
||||||
@ -56,6 +57,7 @@
|
|||||||
(res) => {
|
(res) => {
|
||||||
preference = res
|
preference = res
|
||||||
preferencesLoading = false
|
preferencesLoading = false
|
||||||
|
loading = configurationsLoading || preferencesLoading
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -81,7 +83,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$: fetchConfigurations(viewlet)
|
$: fetchConfigurations(viewlet)
|
||||||
$: fetchPreferences(viewlet)
|
$: fetchPreferences(configurationRaw)
|
||||||
|
|
||||||
$: updateConfiguration(configurationRaw, preference)
|
$: updateConfiguration(configurationRaw, preference)
|
||||||
|
|
||||||
@ -90,6 +92,8 @@
|
|||||||
|
|
||||||
{#if viewlet?.$lookup?.descriptor?.component}
|
{#if viewlet?.$lookup?.descriptor?.component}
|
||||||
{#if loading}
|
{#if loading}
|
||||||
|
{configurationsLoading}
|
||||||
|
{preferencesLoading}
|
||||||
<Loading />
|
<Loading />
|
||||||
{:else}
|
{:else}
|
||||||
<Component
|
<Component
|
||||||
|
Loading…
Reference in New Issue
Block a user