mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-22 16:27:22 +00: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 { Class, Doc, Domain, Ref, Space, TxOperations, DOMAIN_STATUS } from '@hcengineering/core'
|
||||||
import { createOrUpdate, MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@hcengineering/model'
|
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 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 { DOMAIN_TASK, DOMAIN_KANBAN } from '.'
|
||||||
import task from './plugin'
|
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> {
|
async function createDefaults (tx: TxOperations): Promise<void> {
|
||||||
await createSpace(tx)
|
|
||||||
await createDefaultSequence(tx)
|
await createDefaultSequence(tx)
|
||||||
await createDefaultKanban(tx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function migrateTodoItems (client: MigrationClient): Promise<void> {
|
async function migrateTodoItems (client: MigrationClient): Promise<void> {
|
||||||
@ -237,6 +179,8 @@ export const taskOperation: MigrateOperation = {
|
|||||||
{ _class: { $in: [...stateTemplateClasses, ...doneStateTemplatesClasses] }, title: { $exists: true } },
|
{ _class: { $in: [...stateTemplateClasses, ...doneStateTemplatesClasses] }, title: { $exists: true } },
|
||||||
{ $rename: { title: 'name' } }
|
{ $rename: { title: 'name' } }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
await client.delete(DOMAIN_SPACE, 'task:space:ProjectTemplates' as Space['_id'])
|
||||||
},
|
},
|
||||||
async upgrade (client: MigrationUpgradeClient): Promise<void> {
|
async upgrade (client: MigrationUpgradeClient): Promise<void> {
|
||||||
const tx = new TxOperations(client, core.account.System)
|
const tx = new TxOperations(client, core.account.System)
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
import type { Ref, Space } from '@hcengineering/core'
|
import type { Ref, Space } from '@hcengineering/core'
|
||||||
import { mergeIds } from '@hcengineering/platform'
|
import { mergeIds } from '@hcengineering/platform'
|
||||||
import { TagCategory } from '@hcengineering/tags'
|
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 task from '@hcengineering/task-resources/src/plugin'
|
||||||
import type { AnyComponent } from '@hcengineering/ui'
|
import type { AnyComponent } from '@hcengineering/ui'
|
||||||
import type { Action, ActionCategory, ViewAction, Viewlet } from '@hcengineering/view'
|
import type { Action, ActionCategory, ViewAction, Viewlet } from '@hcengineering/view'
|
||||||
@ -47,7 +47,6 @@ export default mergeIds(taskId, task, {
|
|||||||
TaskPresenter: '' as AnyComponent,
|
TaskPresenter: '' as AnyComponent,
|
||||||
KanbanTemplatePresenter: '' as AnyComponent,
|
KanbanTemplatePresenter: '' as AnyComponent,
|
||||||
KanbanCard: '' as AnyComponent,
|
KanbanCard: '' as AnyComponent,
|
||||||
TemplatesIcon: '' as AnyComponent,
|
|
||||||
StatePresenter: '' as AnyComponent,
|
StatePresenter: '' as AnyComponent,
|
||||||
DoneStatePresenter: '' as AnyComponent,
|
DoneStatePresenter: '' as AnyComponent,
|
||||||
StateEditor: '' as AnyComponent,
|
StateEditor: '' as AnyComponent,
|
||||||
@ -64,9 +63,6 @@ export default mergeIds(taskId, task, {
|
|||||||
space: {
|
space: {
|
||||||
TasksPublic: '' as Ref<Space>
|
TasksPublic: '' as Ref<Space>
|
||||||
},
|
},
|
||||||
template: {
|
|
||||||
DefaultProject: '' as Ref<KanbanTemplate>
|
|
||||||
},
|
|
||||||
viewlet: {
|
viewlet: {
|
||||||
TableIssue: '' as Ref<Viewlet>,
|
TableIssue: '' as Ref<Viewlet>,
|
||||||
KanbanIssue: '' as Ref<Viewlet>
|
KanbanIssue: '' as Ref<Viewlet>
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
"MarkAsUndone": "Mark as undone",
|
"MarkAsUndone": "Mark as undone",
|
||||||
"Kanban": "Kanban",
|
"Kanban": "Kanban",
|
||||||
"ApplicationLabelTask": "Tasks",
|
"ApplicationLabelTask": "Tasks",
|
||||||
"Projects": "Projects",
|
|
||||||
"ProjectNamePlaceholder": "Project name",
|
"ProjectNamePlaceholder": "Project name",
|
||||||
"TaskNamePlaceholder": "The boring task",
|
"TaskNamePlaceholder": "The boring task",
|
||||||
"TodoDescriptionPlaceholder": "todo...",
|
"TodoDescriptionPlaceholder": "todo...",
|
||||||
@ -63,7 +62,6 @@
|
|||||||
"States": "States",
|
"States": "States",
|
||||||
"NoDoneState": "Not done",
|
"NoDoneState": "Not done",
|
||||||
"ManageStatusesWithin": "Manage application statuses within",
|
"ManageStatusesWithin": "Manage application statuses within",
|
||||||
"ManageProjectStatues": "Manage project statues",
|
|
||||||
"UnarchiveConfirm": "Do you want to unarchive?",
|
"UnarchiveConfirm": "Do you want to unarchive?",
|
||||||
"ArchiveConfirm": "Do you want to archive?",
|
"ArchiveConfirm": "Do you want to archive?",
|
||||||
"StatusDelete": "Delete status",
|
"StatusDelete": "Delete status",
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
"MarkAsUndone": "Отметить невыполненным",
|
"MarkAsUndone": "Отметить невыполненным",
|
||||||
"Kanban": "Канбан",
|
"Kanban": "Канбан",
|
||||||
"ApplicationLabelTask": "Задачи",
|
"ApplicationLabelTask": "Задачи",
|
||||||
"Projects": "Проекты",
|
|
||||||
"ProjectNamePlaceholder": "Название проекта",
|
"ProjectNamePlaceholder": "Название проекта",
|
||||||
"TaskNamePlaceholder": "Задача",
|
"TaskNamePlaceholder": "Задача",
|
||||||
"TodoDescriptionPlaceholder": "todo...",
|
"TodoDescriptionPlaceholder": "todo...",
|
||||||
@ -63,7 +62,6 @@
|
|||||||
"States": "Статусы",
|
"States": "Статусы",
|
||||||
"NoDoneState": "Не завершено",
|
"NoDoneState": "Не завершено",
|
||||||
"ManageStatusesWithin": "Управление статусами для",
|
"ManageStatusesWithin": "Управление статусами для",
|
||||||
"ManageProjectStatues": "Управление статусами задачи",
|
|
||||||
"UnarchiveConfirm": "Вы действительно хотите разархивировать?",
|
"UnarchiveConfirm": "Вы действительно хотите разархивировать?",
|
||||||
"ArchiveConfirm": "Вы действительно хотите архивировать?",
|
"ArchiveConfirm": "Вы действительно хотите архивировать?",
|
||||||
"StatusDelete": "Удалить статус",
|
"StatusDelete": "Удалить статус",
|
||||||
|
@ -30,7 +30,6 @@ import StatusTableView from './components/StatusTableView.svelte'
|
|||||||
import TaskHeader from './components/TaskHeader.svelte'
|
import TaskHeader from './components/TaskHeader.svelte'
|
||||||
import TaskPresenter from './components/TaskPresenter.svelte'
|
import TaskPresenter from './components/TaskPresenter.svelte'
|
||||||
import KanbanTemplatePresenter from './components/KanbanTemplatePresenter.svelte'
|
import KanbanTemplatePresenter from './components/KanbanTemplatePresenter.svelte'
|
||||||
import TemplatesIcon from './components/TemplatesIcon.svelte'
|
|
||||||
import TodoItemPresenter from './components/todos/TodoItemPresenter.svelte'
|
import TodoItemPresenter from './components/todos/TodoItemPresenter.svelte'
|
||||||
import TodoItemsPopup from './components/todos/TodoItemsPopup.svelte'
|
import TodoItemsPopup from './components/todos/TodoItemsPopup.svelte'
|
||||||
import Todos from './components/todos/Todos.svelte'
|
import Todos from './components/todos/Todos.svelte'
|
||||||
@ -54,7 +53,6 @@ export default async (): Promise<Resources> => ({
|
|||||||
TaskPresenter,
|
TaskPresenter,
|
||||||
KanbanTemplatePresenter,
|
KanbanTemplatePresenter,
|
||||||
Dashboard,
|
Dashboard,
|
||||||
TemplatesIcon,
|
|
||||||
KanbanView,
|
KanbanView,
|
||||||
StatePresenter,
|
StatePresenter,
|
||||||
StateEditor,
|
StateEditor,
|
||||||
|
@ -226,8 +226,6 @@ const task = plugin(taskId, {
|
|||||||
MarkAsUndone: '' as IntlString,
|
MarkAsUndone: '' as IntlString,
|
||||||
Kanban: '' as IntlString,
|
Kanban: '' as IntlString,
|
||||||
ApplicationLabelTask: '' as IntlString,
|
ApplicationLabelTask: '' as IntlString,
|
||||||
Projects: '' as IntlString,
|
|
||||||
ManageProjectStatues: '' as IntlString,
|
|
||||||
TodoItems: '' as IntlString,
|
TodoItems: '' as IntlString,
|
||||||
AssignedToMe: '' as IntlString,
|
AssignedToMe: '' as IntlString,
|
||||||
Dashboard: '' as IntlString
|
Dashboard: '' as IntlString
|
||||||
@ -268,7 +266,6 @@ const task = plugin(taskId, {
|
|||||||
Task: '' as Ref<Task>
|
Task: '' as Ref<Task>
|
||||||
},
|
},
|
||||||
space: {
|
space: {
|
||||||
ProjectTemplates: '' as Ref<KanbanTemplateSpace>,
|
|
||||||
Sequence: '' as Ref<Space>
|
Sequence: '' as Ref<Space>
|
||||||
},
|
},
|
||||||
component: {
|
component: {
|
||||||
|
Loading…
Reference in New Issue
Block a user