mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
Restrict taskType descriptors (#4605)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
597caba6bc
commit
0fe4b6a09f
@ -504,7 +504,8 @@ export function createModel (builder: Builder): void {
|
|||||||
name: board.string.BoardApplication,
|
name: board.string.BoardApplication,
|
||||||
description: board.string.ManageBoardStatuses,
|
description: board.string.ManageBoardStatuses,
|
||||||
icon: board.icon.Board,
|
icon: board.icon.Board,
|
||||||
baseClass: board.class.Board
|
baseClass: board.class.Board,
|
||||||
|
allowedTaskTypeDescriptors: [board.descriptors.Card]
|
||||||
},
|
},
|
||||||
board.descriptors.BoardType
|
board.descriptors.BoardType
|
||||||
)
|
)
|
||||||
|
@ -703,7 +703,8 @@ export function createModel (builder: Builder): void {
|
|||||||
name: lead.string.LeadApplication,
|
name: lead.string.LeadApplication,
|
||||||
description: lead.string.ManageFunnelStatuses,
|
description: lead.string.ManageFunnelStatuses,
|
||||||
icon: lead.icon.LeadApplication,
|
icon: lead.icon.LeadApplication,
|
||||||
baseClass: lead.class.Funnel
|
baseClass: lead.class.Funnel,
|
||||||
|
allowedTaskTypeDescriptors: [lead.descriptors.Lead]
|
||||||
},
|
},
|
||||||
lead.descriptors.FunnelType
|
lead.descriptors.FunnelType
|
||||||
)
|
)
|
||||||
|
@ -1779,7 +1779,8 @@ export function createModel (builder: Builder): void {
|
|||||||
description: recruit.string.ManageVacancyStatuses,
|
description: recruit.string.ManageVacancyStatuses,
|
||||||
icon: recruit.icon.RecruitApplication,
|
icon: recruit.icon.RecruitApplication,
|
||||||
editor: recruit.component.VacancyTemplateEditor,
|
editor: recruit.component.VacancyTemplateEditor,
|
||||||
baseClass: recruit.class.Vacancy
|
baseClass: recruit.class.Vacancy,
|
||||||
|
allowedTaskTypeDescriptors: [recruit.descriptors.Application]
|
||||||
},
|
},
|
||||||
recruit.descriptors.VacancyType
|
recruit.descriptors.VacancyType
|
||||||
)
|
)
|
||||||
|
@ -236,6 +236,8 @@ export class TProjectTypeDescriptor extends TDoc implements ProjectTypeDescripto
|
|||||||
description!: IntlString
|
description!: IntlString
|
||||||
icon!: Asset
|
icon!: Asset
|
||||||
editor?: AnyComponent
|
editor?: AnyComponent
|
||||||
|
allowedClassic?: boolean
|
||||||
|
allowedTaskTypeDescriptors?: Ref<TaskTypeDescriptor>[] // if undefined we allow all possible
|
||||||
baseClass!: Ref<Class<Task>>
|
baseClass!: Ref<Class<Task>>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -673,7 +673,8 @@ export function createModel (builder: Builder): void {
|
|||||||
description: tracker.string.ManageWorkflowStatuses,
|
description: tracker.string.ManageWorkflowStatuses,
|
||||||
icon: task.icon.Task,
|
icon: task.icon.Task,
|
||||||
baseClass: tracker.class.Project,
|
baseClass: tracker.class.Project,
|
||||||
allowedClassic: true
|
allowedClassic: true,
|
||||||
|
allowedTaskTypeDescriptors: [tracker.descriptors.Issue]
|
||||||
},
|
},
|
||||||
tracker.descriptors.ProjectType
|
tracker.descriptors.ProjectType
|
||||||
)
|
)
|
||||||
|
@ -57,7 +57,12 @@
|
|||||||
|
|
||||||
const taskTypeDescriptors = client
|
const taskTypeDescriptors = client
|
||||||
.getModel()
|
.getModel()
|
||||||
.findAllSync(task.class.TaskTypeDescriptor, { allowCreate: true })
|
.findAllSync(
|
||||||
|
task.class.TaskTypeDescriptor,
|
||||||
|
descriptor.allowedTaskTypeDescriptors
|
||||||
|
? { allowCreate: true, _id: { $in: descriptor.allowedTaskTypeDescriptors } }
|
||||||
|
: { allowCreate: true }
|
||||||
|
)
|
||||||
.filter((p) => hasResource(p._id as any as Resource<any>))
|
.filter((p) => hasResource(p._id as any as Resource<any>))
|
||||||
|
|
||||||
let { kind, name, targetClass, statusCategories, statuses, allowedAsChildOf } =
|
let { kind, name, targetClass, statusCategories, statuses, allowedAsChildOf } =
|
||||||
@ -176,24 +181,26 @@
|
|||||||
</span>
|
</span>
|
||||||
<TaskTypeKindEditor bind:kind />
|
<TaskTypeKindEditor bind:kind />
|
||||||
</div>
|
</div>
|
||||||
<div class="hulyModal-content__settingsSet-line">
|
{#if taskTypeDescriptors.length > 1}
|
||||||
<span class="label">
|
<div class="hulyModal-content__settingsSet-line">
|
||||||
<Label label={task.string.Type} />
|
<span class="label">
|
||||||
</span>
|
<Label label={task.string.Type} />
|
||||||
<ButtonMenu
|
</span>
|
||||||
selected={taskTypeDescriptor._id}
|
<ButtonMenu
|
||||||
items={descriptorItems}
|
selected={taskTypeDescriptor._id}
|
||||||
icon={taskTypeDescriptor.icon}
|
items={descriptorItems}
|
||||||
label={taskTypeDescriptor.name}
|
icon={taskTypeDescriptor.icon}
|
||||||
kind={'secondary'}
|
label={taskTypeDescriptor.name}
|
||||||
size={'large'}
|
kind={'secondary'}
|
||||||
on:selected={(evt) => {
|
size={'large'}
|
||||||
if (evt.detail != null) {
|
on:selected={(evt) => {
|
||||||
const tt = taskTypeDescriptors.find((tt) => tt._id === evt.detail)
|
if (evt.detail != null) {
|
||||||
if (tt) taskTypeDescriptor = tt
|
const tt = taskTypeDescriptors.find((tt) => tt._id === evt.detail)
|
||||||
}
|
if (tt) taskTypeDescriptor = tt
|
||||||
}}
|
}
|
||||||
/>
|
}}
|
||||||
</div>
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
@ -176,6 +176,7 @@ export interface ProjectTypeDescriptor extends Doc {
|
|||||||
icon: Asset
|
icon: Asset
|
||||||
editor?: AnyComponent
|
editor?: AnyComponent
|
||||||
allowedClassic?: boolean
|
allowedClassic?: boolean
|
||||||
|
allowedTaskTypeDescriptors?: Ref<TaskTypeDescriptor>[] // if undefined we allow all possible
|
||||||
baseClass: Ref<Class<Task>>
|
baseClass: Ref<Class<Task>>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user