PLATF-8339: Allow test project editing (#8350)

* PLATF-8339: Support test project editing

Signed-off-by: Artem Savchenko <armisav@gmail.com>

---------

Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
Artyom Savchenko 2025-03-26 20:35:38 +07:00 committed by GitHub
parent f6860b4323
commit ad3db6a65b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 39 additions and 5 deletions

View File

@ -24,6 +24,7 @@ import workbench from '@hcengineering/model-workbench'
import print from '@hcengineering/model-print'
import tracker from '@hcengineering/model-tracker'
import { type ViewOptionsModel } from '@hcengineering/view'
import contact from '@hcengineering/contact'
import { testManagementId, type TestPlanItem, type TestResult } from '@hcengineering/test-management'
@ -336,6 +337,25 @@ function defineTestSuite (builder: Builder): void {
},
testManagement.action.RunSelectedTests
)
createAction(
builder,
{
action: testManagement.actionImpl.EditProject,
label: testManagement.string.EditProject,
icon: contact.icon.Edit,
input: 'focus',
category: testManagement.category.TestProject,
target: testManagement.class.TestProject,
visibilityTester: view.function.CanEditSpace,
query: {},
context: {
mode: ['context', 'browser'],
group: 'edit'
}
},
testManagement.action.EditProject
)
}
function defineTestCase (builder: Builder): void {

View File

@ -24,7 +24,8 @@ export default mergeIds(testManagementId, testManganement, {
category: {
TestSuite: '' as Ref<ActionCategory>,
TestCase: '' as Ref<ActionCategory>,
TestResult: '' as Ref<ActionCategory>
TestResult: '' as Ref<ActionCategory>,
TestProject: '' as Ref<ActionCategory>
},
component: {
CreateTestCase: '' as AnyComponent,

View File

@ -114,6 +114,7 @@
description,
private: isPrivate,
icon,
color,
members,
owners,
archived: false
@ -139,6 +140,9 @@
if (data.icon !== project?.icon) {
update.icon = data.icon
}
if (data.color !== project?.color && isColorSelected) {
update.color = data.color
}
if (data.members.length !== project?.members.length) {
update.members = data.members
} else {

View File

@ -45,7 +45,7 @@ import TestPlanItemPresenter from './components/test-plan/TestPlanItemPresenter.
import CreateTestRunButton from './components/test-run/CreateTestRunButton.svelte'
import RunTestPlanButton from './components/test-plan/RunTestPlanButton.svelte'
import { CreateChildTestSuiteAction, EditTestSuiteAction, RunSelectedTestsAction } from './utils'
import { CreateChildTestSuiteAction, EditTestSuiteAction, RunSelectedTestsAction, EditProjectAction } from './utils'
import { resolveLocation, getAttachedObjectLink } from './navigation'
export default async (): Promise<Resources> => ({
@ -92,6 +92,7 @@ export default async (): Promise<Resources> => ({
actionImpl: {
CreateChildTestSuite: CreateChildTestSuiteAction,
EditTestSuite: EditTestSuiteAction,
RunSelectedTests: RunSelectedTestsAction
RunSelectedTests: RunSelectedTestsAction,
EditProject: EditProjectAction
}
})

View File

@ -128,3 +128,9 @@ export async function RunSelectedTestsAction (docs: TestCase[] | TestCase): Prom
console.error('No test cases selected')
}
}
export async function EditProjectAction (project: TestProject | undefined): Promise<void> {
if (project !== undefined) {
showPopup(CreateProject, { project })
}
}

View File

@ -55,12 +55,14 @@ export const testManagementPlugin = plugin(testManagementId, {
DeleteTestCase: '' as Ref<Action<Doc, any>>,
CreateChildTestSuite: '' as Ref<Action>,
EditTestSuite: '' as Ref<Action>,
RunSelectedTests: '' as Ref<Action>
RunSelectedTests: '' as Ref<Action>,
EditProject: '' as Ref<Action>
},
actionImpl: {
CreateChildTestSuite: '' as ViewAction,
EditTestSuite: '' as ViewAction,
RunSelectedTests: '' as ViewAction
RunSelectedTests: '' as ViewAction,
EditProject: '' as ViewAction
},
icon: {
TestManagement: '' as Asset,