mirror of
https://github.com/hcengineering/platform.git
synced 2025-02-25 14:22:40 +00:00
Tracker: Issue List – Status presenter (#1383)
Signed-off-by: Artyom Grigorovich <grigorovichartyom@gmail.com>
This commit is contained in:
parent
1c321d2da5
commit
7dfb59b230
@ -101,6 +101,14 @@
|
|||||||
|
|
||||||
object.priority = newPriority
|
object.priority = newPriority
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleStatusChanged = (newStatus: IssueStatus | undefined) => {
|
||||||
|
if (newStatus === undefined) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
object.status = newStatus
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- canSave: object.title.length > 0 && _space != null -->
|
<!-- canSave: object.title.length > 0 && _space != null -->
|
||||||
@ -135,7 +143,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div slot="pool" class="flex-row-center text-sm gap-1-5">
|
<div slot="pool" class="flex-row-center text-sm gap-1-5">
|
||||||
<StatusSelector bind:status={object.status} />
|
<StatusSelector status={object.status} onStatusChange={handleStatusChanged} />
|
||||||
<PrioritySelector priority={object.priority} onPriorityChange={handlePriorityChanged} />
|
<PrioritySelector priority={object.priority} onPriorityChange={handlePriorityChanged} />
|
||||||
<UserBox
|
<UserBox
|
||||||
_class={contact.class.Employee}
|
_class={contact.class.Employee}
|
||||||
|
@ -14,11 +14,14 @@
|
|||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { IssueStatus } from '@anticrm/tracker'
|
import { IssueStatus } from '@anticrm/tracker'
|
||||||
import { Button, showPopup, SelectPopup } from '@anticrm/ui'
|
import { Button, Icon, Label, showPopup, SelectPopup } from '@anticrm/ui'
|
||||||
import { issueStatuses } from '../utils'
|
import { issueStatuses } from '../utils'
|
||||||
import tracker from '../plugin'
|
import tracker from '../plugin'
|
||||||
|
|
||||||
export let status: IssueStatus
|
export let status: IssueStatus
|
||||||
|
export let kind: 'button' | 'icon' = 'button'
|
||||||
|
export let shouldShowLabel: boolean = true
|
||||||
|
export let onStatusChange: ((newStatus: IssueStatus | undefined) => void) | undefined = undefined
|
||||||
|
|
||||||
const statusesInfo = [
|
const statusesInfo = [
|
||||||
IssueStatus.Backlog,
|
IssueStatus.Backlog,
|
||||||
@ -28,25 +31,34 @@
|
|||||||
IssueStatus.Canceled
|
IssueStatus.Canceled
|
||||||
].map((s) => ({ id: s, ...issueStatuses[s] }))
|
].map((s) => ({ id: s, ...issueStatuses[s] }))
|
||||||
|
|
||||||
function handleStatusChange (id: any) {
|
const handleStatusEditorOpened = (event: Event) => {
|
||||||
if (id !== undefined) {
|
showPopup(
|
||||||
status = id
|
SelectPopup,
|
||||||
}
|
{ value: statusesInfo, placeholder: tracker.string.SetStatus, searchable: true },
|
||||||
|
event.currentTarget,
|
||||||
|
onStatusChange
|
||||||
|
)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#if kind === 'button'}
|
||||||
<Button
|
<Button
|
||||||
label={issueStatuses[status].label}
|
label={shouldShowLabel ? issueStatuses[status].label : undefined}
|
||||||
icon={issueStatuses[status].icon}
|
icon={issueStatuses[status].icon}
|
||||||
width="min-content"
|
width="min-content"
|
||||||
size="small"
|
size="small"
|
||||||
kind="no-border"
|
kind="no-border"
|
||||||
on:click={(ev) => {
|
on:click={handleStatusEditorOpened}
|
||||||
showPopup(
|
|
||||||
SelectPopup,
|
|
||||||
{ value: statusesInfo, placeholder: tracker.string.SetStatus, searchable: true },
|
|
||||||
ev.currentTarget,
|
|
||||||
handleStatusChange
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
|
{:else if kind === 'icon'}
|
||||||
|
<div class="flex-presenter" on:click={handleStatusEditorOpened}>
|
||||||
|
<div class="icon">
|
||||||
|
<Icon icon={issueStatuses[status].icon} size={'small'} />
|
||||||
|
</div>
|
||||||
|
{#if shouldShowLabel}
|
||||||
|
<div class="label nowrap">
|
||||||
|
<Label label={issueStatuses[status].label} />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
config={[
|
config={[
|
||||||
{ key: '', presenter: tracker.component.PriorityPresenter, props: { currentSpace } },
|
{ key: '', presenter: tracker.component.PriorityPresenter, props: { currentSpace } },
|
||||||
{ key: '', presenter: tracker.component.IssuePresenter, props: { currentTeam } },
|
{ key: '', presenter: tracker.component.IssuePresenter, props: { currentTeam } },
|
||||||
|
{ key: '', presenter: tracker.component.StatusPresenter, props: { currentSpace } },
|
||||||
{ key: '', presenter: tracker.component.TitlePresenter },
|
{ key: '', presenter: tracker.component.TitlePresenter },
|
||||||
{ key: 'modifiedOn', presenter: tracker.component.ModificationDatePresenter },
|
{ key: 'modifiedOn', presenter: tracker.component.ModificationDatePresenter },
|
||||||
{
|
{
|
||||||
|
@ -183,7 +183,7 @@
|
|||||||
|
|
||||||
.listGrid {
|
.listGrid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 4rem 6rem auto 4rem 2rem;
|
grid-template-columns: 4rem 5rem 2rem auto 4rem 2rem;
|
||||||
height: 3.25rem;
|
height: 3.25rem;
|
||||||
color: var(--theme-caption-color);
|
color: var(--theme-caption-color);
|
||||||
border-bottom: 1px solid var(--theme-button-border-hovered);
|
border-bottom: 1px solid var(--theme-button-border-hovered);
|
||||||
@ -225,6 +225,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.checkBox {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0.03rem;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
background-color: rgba(247, 248, 248, 0.5);
|
||||||
|
opacity: 0;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.gridElement {
|
.gridElement {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -232,7 +246,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.priorityPresenter {
|
.priorityPresenter {
|
||||||
padding-left: 0.5rem;
|
padding-left: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.issuePresenter {
|
.issuePresenter {
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
<!--
|
||||||
|
// Copyright © 2022 Hardcore Engineering Inc.
|
||||||
|
//
|
||||||
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License. You may
|
||||||
|
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
-->
|
||||||
|
<script lang="ts">
|
||||||
|
import { Ref } from '@anticrm/core'
|
||||||
|
import { Issue, IssueStatus, Team } from '@anticrm/tracker'
|
||||||
|
import { getClient } from '@anticrm/presentation'
|
||||||
|
import tracker from '../../plugin'
|
||||||
|
import StatusSelector from '../StatusSelector.svelte'
|
||||||
|
|
||||||
|
export let value: Issue
|
||||||
|
export let currentSpace: Ref<Team> | undefined = undefined
|
||||||
|
|
||||||
|
const client = getClient()
|
||||||
|
|
||||||
|
const handleStatusChanged = async (newStatus: IssueStatus | undefined) => {
|
||||||
|
if (newStatus === undefined) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentIssue = await client.findOne(tracker.class.Issue, { space: currentSpace, _id: value._id })
|
||||||
|
|
||||||
|
if (currentIssue === undefined) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
await client.update(currentIssue, { status: newStatus })
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if value}
|
||||||
|
<StatusSelector kind={'icon'} shouldShowLabel={false} status={value.status} onStatusChange={handleStatusChanged} />
|
||||||
|
{/if}
|
@ -14,28 +14,10 @@
|
|||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Issue } from '@anticrm/tracker'
|
import type { Issue } from '@anticrm/tracker'
|
||||||
import { Icon } from '@anticrm/ui'
|
|
||||||
import { issueStatuses } from '../../utils'
|
|
||||||
|
|
||||||
export let value: Issue
|
export let value: Issue
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if value}
|
{#if value}
|
||||||
<div class="titlePresenter">
|
|
||||||
<div class="icon">
|
|
||||||
<Icon icon={issueStatuses[value.status].icon} size={'small'} />
|
|
||||||
</div>
|
|
||||||
<span class="label nowrap" title={value.title}>{value.title}</span>
|
<span class="label nowrap" title={value.title}>{value.title}</span>
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.titlePresenter {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
margin-right: 0.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@ -28,6 +28,8 @@ import Views from './components/views/Views.svelte'
|
|||||||
import IssuePresenter from './components/issues/IssuePresenter.svelte'
|
import IssuePresenter from './components/issues/IssuePresenter.svelte'
|
||||||
import TitlePresenter from './components/issues/TitlePresenter.svelte'
|
import TitlePresenter from './components/issues/TitlePresenter.svelte'
|
||||||
import PriorityPresenter from './components/issues/PriorityPresenter.svelte'
|
import PriorityPresenter from './components/issues/PriorityPresenter.svelte'
|
||||||
|
import StatusPresenter from './components/issues/StatusPresenter.svelte'
|
||||||
|
|
||||||
import ModificationDatePresenter from './components/issues/ModificationDatePresenter.svelte'
|
import ModificationDatePresenter from './components/issues/ModificationDatePresenter.svelte'
|
||||||
import EditIssue from './components/issues/EditIssue.svelte'
|
import EditIssue from './components/issues/EditIssue.svelte'
|
||||||
import NewIssueHeader from './components/NewIssueHeader.svelte'
|
import NewIssueHeader from './components/NewIssueHeader.svelte'
|
||||||
@ -47,6 +49,7 @@ export default async (): Promise<Resources> => ({
|
|||||||
TitlePresenter,
|
TitlePresenter,
|
||||||
ModificationDatePresenter,
|
ModificationDatePresenter,
|
||||||
PriorityPresenter,
|
PriorityPresenter,
|
||||||
|
StatusPresenter,
|
||||||
EditIssue,
|
EditIssue,
|
||||||
NewIssueHeader
|
NewIssueHeader
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,7 @@ export default mergeIds(trackerId, tracker, {
|
|||||||
TitlePresenter: '' as AnyComponent,
|
TitlePresenter: '' as AnyComponent,
|
||||||
ModificationDatePresenter: '' as AnyComponent,
|
ModificationDatePresenter: '' as AnyComponent,
|
||||||
PriorityPresenter: '' as AnyComponent,
|
PriorityPresenter: '' as AnyComponent,
|
||||||
|
StatusPresenter: '' as AnyComponent,
|
||||||
EditIssue: '' as AnyComponent,
|
EditIssue: '' as AnyComponent,
|
||||||
CreateTeam: '' as AnyComponent,
|
CreateTeam: '' as AnyComponent,
|
||||||
NewIssueHeader: '' as AnyComponent
|
NewIssueHeader: '' as AnyComponent
|
||||||
|
Loading…
Reference in New Issue
Block a user