mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 11:01:54 +03:00
[UBER-70] Remove old Projects section from Workspace/templates (#3302)
Signed-off-by: Sergei Ogorelkov <sergei.ogorelkov@icloud.com>
This commit is contained in:
parent
8a670155db
commit
b36e6b1ea7
@ -15,9 +15,9 @@
|
||||
|
||||
import { Class, Doc, Domain, Ref, Space, TxOperations, DOMAIN_STATUS } from '@hcengineering/core'
|
||||
import { createOrUpdate, MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@hcengineering/model'
|
||||
import core from '@hcengineering/model-core'
|
||||
import core, { DOMAIN_SPACE } from '@hcengineering/model-core'
|
||||
import tags from '@hcengineering/model-tags'
|
||||
import { createKanban, DoneStateTemplate, genRanks, KanbanTemplate, StateTemplate } from '@hcengineering/task'
|
||||
import { DoneStateTemplate, genRanks, KanbanTemplate, StateTemplate } from '@hcengineering/task'
|
||||
import { DOMAIN_TASK, DOMAIN_KANBAN } from '.'
|
||||
import task from './plugin'
|
||||
|
||||
@ -127,66 +127,8 @@ async function createDefaultSequence (tx: TxOperations): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
async function createDefaultKanbanTemplate (tx: TxOperations): Promise<Ref<KanbanTemplate>> {
|
||||
const defaultKanban = {
|
||||
states: [
|
||||
{ color: 9, name: 'Open' },
|
||||
{ color: 10, name: 'In Progress' },
|
||||
{ color: 1, name: 'Under review' },
|
||||
{ color: 0, name: 'Done' },
|
||||
{ color: 11, name: 'Invalid' }
|
||||
],
|
||||
doneStates: [
|
||||
{ isWon: true, name: 'Won' },
|
||||
{ isWon: false, name: 'Lost' }
|
||||
]
|
||||
}
|
||||
|
||||
return await createKanbanTemplate(tx, {
|
||||
kanbanId: task.template.DefaultProject,
|
||||
space: task.space.ProjectTemplates as Ref<Doc> as Ref<Space>,
|
||||
title: 'Default project',
|
||||
description: '',
|
||||
shortDescription: '',
|
||||
states: defaultKanban.states,
|
||||
doneStates: defaultKanban.doneStates
|
||||
})
|
||||
}
|
||||
|
||||
async function createDefaultKanban (tx: TxOperations): Promise<void> {
|
||||
const current = await tx.findOne(task.class.Kanban, {
|
||||
attachedTo: task.space.TasksPublic
|
||||
})
|
||||
if (current !== undefined) return
|
||||
const defaultTmpl = await createDefaultKanbanTemplate(tx)
|
||||
await createKanban(tx, task.space.TasksPublic, defaultTmpl)
|
||||
}
|
||||
|
||||
async function createSpace (tx: TxOperations): Promise<void> {
|
||||
const currentTemplate = await tx.findOne(core.class.Space, {
|
||||
_id: task.space.ProjectTemplates
|
||||
})
|
||||
if (currentTemplate === undefined) {
|
||||
await tx.createDoc(
|
||||
task.class.KanbanTemplateSpace,
|
||||
core.space.Space,
|
||||
{
|
||||
name: task.string.Projects,
|
||||
description: task.string.ManageProjectStatues,
|
||||
icon: task.component.TemplatesIcon,
|
||||
private: false,
|
||||
members: [],
|
||||
archived: false
|
||||
},
|
||||
task.space.ProjectTemplates
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
async function createDefaults (tx: TxOperations): Promise<void> {
|
||||
await createSpace(tx)
|
||||
await createDefaultSequence(tx)
|
||||
await createDefaultKanban(tx)
|
||||
}
|
||||
|
||||
async function migrateTodoItems (client: MigrationClient): Promise<void> {
|
||||
@ -237,6 +179,8 @@ export const taskOperation: MigrateOperation = {
|
||||
{ _class: { $in: [...stateTemplateClasses, ...doneStateTemplatesClasses] }, title: { $exists: true } },
|
||||
{ $rename: { title: 'name' } }
|
||||
)
|
||||
|
||||
await client.delete(DOMAIN_SPACE, 'task:space:ProjectTemplates' as Space['_id'])
|
||||
},
|
||||
async upgrade (client: MigrationUpgradeClient): Promise<void> {
|
||||
const tx = new TxOperations(client, core.account.System)
|
||||
|
@ -17,7 +17,7 @@
|
||||
import type { Ref, Space } from '@hcengineering/core'
|
||||
import { mergeIds } from '@hcengineering/platform'
|
||||
import { TagCategory } from '@hcengineering/tags'
|
||||
import { KanbanTemplate, taskId } from '@hcengineering/task'
|
||||
import { taskId } from '@hcengineering/task'
|
||||
import task from '@hcengineering/task-resources/src/plugin'
|
||||
import type { AnyComponent } from '@hcengineering/ui'
|
||||
import type { Action, ActionCategory, ViewAction, Viewlet } from '@hcengineering/view'
|
||||
@ -47,7 +47,6 @@ export default mergeIds(taskId, task, {
|
||||
TaskPresenter: '' as AnyComponent,
|
||||
KanbanTemplatePresenter: '' as AnyComponent,
|
||||
KanbanCard: '' as AnyComponent,
|
||||
TemplatesIcon: '' as AnyComponent,
|
||||
StatePresenter: '' as AnyComponent,
|
||||
DoneStatePresenter: '' as AnyComponent,
|
||||
StateEditor: '' as AnyComponent,
|
||||
@ -64,9 +63,6 @@ export default mergeIds(taskId, task, {
|
||||
space: {
|
||||
TasksPublic: '' as Ref<Space>
|
||||
},
|
||||
template: {
|
||||
DefaultProject: '' as Ref<KanbanTemplate>
|
||||
},
|
||||
viewlet: {
|
||||
TableIssue: '' as Ref<Viewlet>,
|
||||
KanbanIssue: '' as Ref<Viewlet>
|
||||
|
@ -32,7 +32,6 @@
|
||||
"MarkAsUndone": "Mark as undone",
|
||||
"Kanban": "Kanban",
|
||||
"ApplicationLabelTask": "Tasks",
|
||||
"Projects": "Projects",
|
||||
"ProjectNamePlaceholder": "Project name",
|
||||
"TaskNamePlaceholder": "The boring task",
|
||||
"TodoDescriptionPlaceholder": "todo...",
|
||||
@ -63,7 +62,6 @@
|
||||
"States": "States",
|
||||
"NoDoneState": "Not done",
|
||||
"ManageStatusesWithin": "Manage application statuses within",
|
||||
"ManageProjectStatues": "Manage project statues",
|
||||
"UnarchiveConfirm": "Do you want to unarchive?",
|
||||
"ArchiveConfirm": "Do you want to archive?",
|
||||
"StatusDelete": "Delete status",
|
||||
|
@ -32,7 +32,6 @@
|
||||
"MarkAsUndone": "Отметить невыполненным",
|
||||
"Kanban": "Канбан",
|
||||
"ApplicationLabelTask": "Задачи",
|
||||
"Projects": "Проекты",
|
||||
"ProjectNamePlaceholder": "Название проекта",
|
||||
"TaskNamePlaceholder": "Задача",
|
||||
"TodoDescriptionPlaceholder": "todo...",
|
||||
@ -63,7 +62,6 @@
|
||||
"States": "Статусы",
|
||||
"NoDoneState": "Не завершено",
|
||||
"ManageStatusesWithin": "Управление статусами для",
|
||||
"ManageProjectStatues": "Управление статусами задачи",
|
||||
"UnarchiveConfirm": "Вы действительно хотите разархивировать?",
|
||||
"ArchiveConfirm": "Вы действительно хотите архивировать?",
|
||||
"StatusDelete": "Удалить статус",
|
||||
|
@ -30,7 +30,6 @@ import StatusTableView from './components/StatusTableView.svelte'
|
||||
import TaskHeader from './components/TaskHeader.svelte'
|
||||
import TaskPresenter from './components/TaskPresenter.svelte'
|
||||
import KanbanTemplatePresenter from './components/KanbanTemplatePresenter.svelte'
|
||||
import TemplatesIcon from './components/TemplatesIcon.svelte'
|
||||
import TodoItemPresenter from './components/todos/TodoItemPresenter.svelte'
|
||||
import TodoItemsPopup from './components/todos/TodoItemsPopup.svelte'
|
||||
import Todos from './components/todos/Todos.svelte'
|
||||
@ -54,7 +53,6 @@ export default async (): Promise<Resources> => ({
|
||||
TaskPresenter,
|
||||
KanbanTemplatePresenter,
|
||||
Dashboard,
|
||||
TemplatesIcon,
|
||||
KanbanView,
|
||||
StatePresenter,
|
||||
StateEditor,
|
||||
|
@ -226,8 +226,6 @@ const task = plugin(taskId, {
|
||||
MarkAsUndone: '' as IntlString,
|
||||
Kanban: '' as IntlString,
|
||||
ApplicationLabelTask: '' as IntlString,
|
||||
Projects: '' as IntlString,
|
||||
ManageProjectStatues: '' as IntlString,
|
||||
TodoItems: '' as IntlString,
|
||||
AssignedToMe: '' as IntlString,
|
||||
Dashboard: '' as IntlString
|
||||
@ -268,7 +266,6 @@ const task = plugin(taskId, {
|
||||
Task: '' as Ref<Task>
|
||||
},
|
||||
space: {
|
||||
ProjectTemplates: '' as Ref<KanbanTemplateSpace>,
|
||||
Sequence: '' as Ref<Space>
|
||||
},
|
||||
component: {
|
||||
|
Loading…
Reference in New Issue
Block a user