UBERF-4957: Fix status colors (#4369)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-01-17 15:18:10 +07:00 committed by GitHub
parent fd24ac2158
commit 12924cb79c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 9 deletions

View File

@ -31,7 +31,7 @@
showPopup, showPopup,
themeStore themeStore
} from '@hcengineering/ui' } from '@hcengineering/ui'
import { ColorsPopup, IconPicker, ObjectPresenter } from '@hcengineering/view-resources' import { ColorsPopup, IconPicker, ObjectPresenter, statusStore } from '@hcengineering/view-resources'
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
import task from '../../plugin' import task from '../../plugin'
import StatusesPopup from './StatusesPopup.svelte' import StatusesPopup from './StatusesPopup.svelte'
@ -77,12 +77,12 @@
if (res == null) { if (res == null) {
return return
} }
const targetColor = type.statuses.find((p) => p._id === state._id) const targetColors = type.statuses.filter((p) => p._id === state._id)
if (targetColor !== undefined) { for (const targetColor of targetColors) {
targetColor.color = res targetColor.color = res
await client.update(type, { statuses: type.statuses })
type = type
} }
await client.update(type, { statuses: type.statuses })
type = type
}) })
} }
@ -174,11 +174,12 @@
const projectStatus = getProjectStatus(type, state, categoriesMap) const projectStatus = getProjectStatus(type, state, categoriesMap)
showPopup(IconPicker, { icon: projectStatus?.icon, color: projectStatus?.color, icons }, el, async (result) => { showPopup(IconPicker, { icon: projectStatus?.icon, color: projectStatus?.color, icons }, el, async (result) => {
if (result !== undefined && result !== null) { if (result !== undefined && result !== null) {
const targetColor = type.statuses.find((p) => p._id === state._id) const targetColors = type.statuses.filter((p) => p._id === state._id)
if (targetColor !== undefined) { for (const targetColor of targetColors) {
targetColor.color = result.color targetColor.color = result.color
targetColor.icon = result.icon targetColor.icon = result.icon
console.log(result.color) }
if (targetColors.length > 0) {
await client.update(type, { statuses: type.statuses }) await client.update(type, { statuses: type.statuses })
type = type type = type
} }

View File

@ -145,7 +145,12 @@ export function calculateStatuses (
taskTypes: Map<Ref<TaskType>, Data<TaskType>>, taskTypes: Map<Ref<TaskType>, Data<TaskType>>,
override: Array<{ taskTypeId: Ref<TaskType>, statuses: Array<Ref<Status>> }> override: Array<{ taskTypeId: Ref<TaskType>, statuses: Array<Ref<Status>> }>
): ProjectStatus[] { ): ProjectStatus[] {
const stIds = new Map(projectType.statuses.map((p) => [p._id, p])) const stIds = new Map<Ref<Status>, ProjectStatus>()
for (const s of projectType.statuses) {
if (!stIds.has(s._id)) {
stIds.set(s._id, s)
}
}
const processed = new Set<string>() const processed = new Set<string>()
const result: ProjectStatus[] = [] const result: ProjectStatus[] = []