Fix Actions (#2132)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2022-06-24 18:36:08 +06:00
committed by GitHub
parent 82c8d70d37
commit d935e9b963
48 changed files with 1219 additions and 356 deletions
@@ -49,7 +49,7 @@
let currentAssignee: Ref<Employee> | null = assignee
let issueStatuses: WithLookup<IssueStatus>[] | undefined
let parentIssue: Issue | undefined
export let parentIssue: Issue | undefined
let labels: TagReference[] = []
let objectId: Ref<Issue> = generateId()
@@ -14,24 +14,24 @@
-->
<script lang="ts">
import { AttachedData, FindOptions, SortingOrder } from '@anticrm/core'
import { Issue, IssueStatusCategory, Team, calcRank } from '@anticrm/tracker'
import { createQuery, getClient, ObjectPopup } from '@anticrm/presentation'
import { getClient, ObjectPopup } from '@anticrm/presentation'
import { calcRank, Issue, IssueStatusCategory } from '@anticrm/tracker'
import { Icon } from '@anticrm/ui'
import { createEventDispatcher } from 'svelte'
import tracker from '../plugin'
import { getIssueId } from '../utils'
export let value: Issue | AttachedData<Issue>
export let value: Issue | AttachedData<Issue> | Issue[]
export let width: 'medium' | 'large' | 'full' = 'large'
const client = getClient()
const spaceQuery = createQuery()
const dispatch = createEventDispatcher()
const options: FindOptions<Issue> = {
lookup: { status: tracker.class.IssueStatus },
lookup: { status: tracker.class.IssueStatus, space: tracker.class.Team },
sort: { modifiedOn: SortingOrder.Descending }
}
let team: Team | undefined
let statusCategoryById: Map<string, IssueStatusCategory> | undefined
async function updateIssueStatusCategories () {
@@ -41,32 +41,34 @@
}
async function onClose ({ detail: parentIssue }: CustomEvent<Issue | undefined | null>) {
if ('_id' in value && parentIssue !== undefined && parentIssue?._id !== value.attachedTo) {
let rank: string | null = null
const vv = Array.isArray(value) ? value : [value]
for (const docValue of vv) {
if ('_id' in docValue && parentIssue !== undefined && parentIssue?._id !== docValue.attachedTo) {
let rank: string | null = null
if (parentIssue) {
const lastAttachedIssue = await client.findOne<Issue>(
tracker.class.Issue,
{ attachedTo: parentIssue._id },
{ sort: { rank: SortingOrder.Descending } }
)
if (parentIssue) {
const lastAttachedIssue = await client.findOne<Issue>(
tracker.class.Issue,
{ attachedTo: parentIssue._id },
{ sort: { rank: SortingOrder.Descending } }
)
rank = calcRank(lastAttachedIssue, undefined)
rank = calcRank(lastAttachedIssue, undefined)
}
await client.update(docValue, {
attachedTo: parentIssue === null ? tracker.ids.NoParent : parentIssue._id,
...(rank ? { rank } : {})
})
}
await client.update(value, {
attachedTo: parentIssue === null ? tracker.ids.NoParent : parentIssue._id,
...(rank ? { rank } : {})
})
}
dispatch('close', parentIssue)
}
$: selected = 'attachedTo' in value ? value.attachedTo : undefined
$: ignoreObjects = '_id' in value ? [value._id] : []
$: selected = !Array.isArray(value) ? ('attachedTo' in value ? value.attachedTo : undefined) : undefined
$: ignoreObjects = !Array.isArray(value) ? ('_id' in value ? [value._id] : []) : undefined
$: updateIssueStatusCategories()
$: 'space' in value && spaceQuery.query(tracker.class.Team, { _id: value.space }, (res) => ([team] = res))
</script>
<ObjectPopup
@@ -79,14 +81,14 @@
create={undefined}
{ignoreObjects}
shadows={true}
width="large"
{width}
searchField="title"
on:update
on:close={onClose}
>
<svelte:fragment slot="item" let:item={issue}>
{@const { icon } = statusCategoryById?.get(issue.$lookup?.status.category) ?? {}}
{@const issueId = team && getIssueId(team, issue)}
{@const issueId = getIssueId(issue.$lookup.space, issue)}
{#if issueId && icon}
<div class="flex-center clear-mins w-full h-9">
<div class="icon mr-4 h-8">
@@ -195,7 +195,7 @@
{#each groupedIssues[category] as docObject (docObject._id)}
<div
bind:this={objectRefs[combinedGroupedIssues.findIndex((x) => x === docObject)]}
class="listGrid antiList__row row gap-2"
class="listGrid antiList__row row gap-2 flex-grow"
class:checking={selectedObjectIdsSet.has(docObject._id)}
class:mListGridFixed={selectedRowIndex === combinedGroupedIssues.findIndex((x) => x === docObject)}
class:mListGridSelected={selectedRowIndex === combinedGroupedIssues.findIndex((x) => x === docObject)}
@@ -254,7 +254,6 @@
value={getObjectValue(attributeModel.key, docObject) ?? ''}
{...attributeModel.props}
/>
<div class="grow-cell" />
{:else if attributeModel.props?.fixed}
<FixedColumn
width={propsWidth[attributeModel.key]}
@@ -67,19 +67,19 @@
{#if kind === 'list'}
<div class="priority-container" on:click={handlePriorityEditorOpened}>
<div class="icon">
{#if issuePriorities[value.priority].icon}<Icon icon={issuePriorities[value.priority].icon} {size} />{/if}
{#if issuePriorities[value.priority]?.icon}<Icon icon={issuePriorities[value.priority]?.icon} {size} />{/if}
</div>
{#if shouldShowLabel}
<span class="overflow-label label">
<Label label={issuePriorities[value.priority].label} />
<Label label={issuePriorities[value.priority]?.label} />
</span>
{/if}
</div>
{:else}
<Button
showTooltip={isEditable ? { label: tracker.string.SetPriority } : undefined}
label={shouldShowLabel ? issuePriorities[value.priority].label : undefined}
icon={issuePriorities[value.priority].icon}
label={shouldShowLabel ? issuePriorities[value.priority]?.label : undefined}
icon={issuePriorities[value.priority]?.icon}
{justify}
{width}
{size}
@@ -13,13 +13,20 @@
// limitations under the License.
-->
<script lang="ts">
import { WithLookup } from '@anticrm/core'
import { IssueStatus } from '@anticrm/tracker'
import { Icon } from '@anticrm/ui'
export let value: IssueStatus | undefined
export let value: WithLookup<IssueStatus> | undefined
</script>
{#if value}
<span class="overflow-label">
{value.name}
</span>
<div class="flex-presenter">
{#if value.$lookup?.category?.icon}
<Icon icon={value.$lookup?.category?.icon} size={'medium'} />
{/if}
<span class="overflow-label" class:ml-2={value.$lookup?.category?.icon !== undefined}>
{value.name}
</span>
</div>
{/if}
@@ -20,7 +20,9 @@
</script>
{#if value}
<span class="titleLabel" class:mTitleLabelWithMargin={shouldUseMargin} title={value.title}>{value.title}</span>
<span class="titleLabel flex-grow" class:mTitleLabelWithMargin={shouldUseMargin} title={value.title}
>{value.title}</span
>
{/if}
<style lang="scss">