Skip to content

Commit

Permalink
feat: update create new project UI (#12847)
Browse files Browse the repository at this point in the history
* feat: update create new project UI
  • Loading branch information
anchenyi authored Dec 5, 2024
1 parent 6e70d9e commit 64bb5b1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
7 changes: 4 additions & 3 deletions packages/fx-core/resource/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@
"core.createProjectQuestion.projectType.copilotHelp.label": "Don't know how to start? Use GitHub Copilot Chat",
"core.createProjectQuestion.projectType.copilotHelp.detail": "Chat with GitHub Copilot to get started on your Teams app and agent",
"core.createProjectQuestion.projectType.copilotGroup.title": "Use GitHub Copilot",
"core.createProjectQuestion.projectType.createGroup.title": "Create",
"core.createProjectQuestion.projectType.createGroup.aiAgent": "AI Agent",
"core.createProjectQuestion.projectType.createGroup.m365Apps": "Apps for Microsoft 365",
"core.createProjectQuestion.projectType.declarativeAgent.label": "Declarative Agent",
"core.createProjectQuestion.projectType.declarativeAgent.detail": "Create your own agent by declaring instructions, actions, & knowledge to suit your needs.",
"core.createProjectQuestion.title": "New Project",
Expand Down Expand Up @@ -399,10 +400,10 @@
"core.createProjectQuestion.declarativeCopilot.placeholder": "Add API plugin to your declarative agent",
"core.createProjectQuestion.createApiPlugin.title": "Create API Plugin",
"core.createProjectQuestion.addApiPlugin.title": "Add API Plugin",
"core.createProjectQuestion.addApiPlugin.placeholder": "Select how to add plugin",
"core.createProjectQuestion.addApiPlugin.placeholder": "Select how to add action",
"core.createProjectQuestion.noPlugin.label": "No plugin",
"core.createProjectQuestion.noPlugin.detail": "Create declarative agent only",
"core.createProjectQuestion.addPlugin.label": "Add plugin",
"core.createProjectQuestion.addPlugin.label": "Add action",
"core.createProjectQuestion.addPlugin.detail": "Create declarative agent with API plugin",
"core.createProjectQuestion.addExistingPlugin.pluginManifest.title": "Import Manifest File",
"core.createProjectQuestion.addExistingPlugin.apiSpec.title": "Import OpenAPI Description Document",
Expand Down
32 changes: 20 additions & 12 deletions packages/fx-core/src/question/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ export enum QuestionNames {
PluginOpenApiSpecFilePath = "plugin-opeanapi-spec-path",
}

export enum ProjectTypeGroup {
AIAgent = "AI Agent",
M365Apps = "Apps for Microsoft 365",
}

export const AppNamePattern =
'^(?=(.*[\\da-zA-Z]){2})[a-zA-Z][^"<>:\\?/*&|\u0000-\u001F]*[^"\\s.<>:\\?/*&|\u0000-\u001F]$';

Expand Down Expand Up @@ -182,10 +187,13 @@ export class ScratchOptions {
}

export class ProjectTypeOptions {
static getCreateGroupName(): string | undefined {
return featureFlagManager.getBooleanValue(FeatureFlags.ChatParticipantUIEntries)
? getLocalizedString("core.createProjectQuestion.projectType.createGroup.title")
: undefined;
static getCreateGroupName(group: ProjectTypeGroup): string | undefined {
switch (group) {
case ProjectTypeGroup.AIAgent:
return getLocalizedString("core.createProjectQuestion.projectType.createGroup.aiAgent");
case ProjectTypeGroup.M365Apps:
return getLocalizedString("core.createProjectQuestion.projectType.createGroup.m365Apps");
}
}
static tab(platform?: Platform): OptionItem {
return {
Expand All @@ -194,7 +202,7 @@ export class ProjectTypeOptions {
"core.TabOption.label"
)}`,
detail: getLocalizedString("core.createProjectQuestion.projectType.tab.detail"),
groupName: ProjectTypeOptions.getCreateGroupName(),
groupName: ProjectTypeOptions.getCreateGroupName(ProjectTypeGroup.M365Apps),
};
}

Expand All @@ -205,7 +213,7 @@ export class ProjectTypeOptions {
"core.createProjectQuestion.projectType.bot.label"
)}`,
detail: getLocalizedString("core.createProjectQuestion.projectType.bot.detail"),
groupName: ProjectTypeOptions.getCreateGroupName(),
groupName: ProjectTypeOptions.getCreateGroupName(ProjectTypeGroup.M365Apps),
};
}

Expand All @@ -218,7 +226,7 @@ export class ProjectTypeOptions {
detail: getLocalizedString(
"core.createProjectQuestion.projectType.messageExtension.copilotEnabled.detail"
),
groupName: ProjectTypeOptions.getCreateGroupName(),
groupName: ProjectTypeOptions.getCreateGroupName(ProjectTypeGroup.M365Apps),
};
}

Expand All @@ -229,7 +237,7 @@ export class ProjectTypeOptions {
"core.createProjectQuestion.projectType.outlookAddin.label"
)}`,
detail: getLocalizedString("core.createProjectQuestion.projectType.outlookAddin.detail"),
groupName: ProjectTypeOptions.getCreateGroupName(),
groupName: ProjectTypeOptions.getCreateGroupName(ProjectTypeGroup.M365Apps),
};
}

Expand All @@ -240,7 +248,7 @@ export class ProjectTypeOptions {
"core.createProjectQuestion.projectType.officeAddin.label"
)}`,
detail: getLocalizedString("core.createProjectQuestion.projectType.officeAddin.detail"),
groupName: ProjectTypeOptions.getCreateGroupName(),
groupName: ProjectTypeOptions.getCreateGroupName(ProjectTypeGroup.M365Apps),
};
}

Expand All @@ -251,7 +259,7 @@ export class ProjectTypeOptions {
"core.createProjectQuestion.projectType.officeAddin.label"
)}`,
detail: getLocalizedString("core.createProjectQuestion.projectType.officeAddin.detail"),
groupName: ProjectTypeOptions.getCreateGroupName(),
groupName: ProjectTypeOptions.getCreateGroupName(ProjectTypeGroup.M365Apps),
};
}

Expand All @@ -270,7 +278,7 @@ export class ProjectTypeOptions {
"core.createProjectQuestion.projectType.declarativeAgent.label"
)}`,
detail: getLocalizedString("core.createProjectQuestion.projectType.declarativeAgent.detail"),
groupName: ProjectTypeOptions.getCreateGroupName(),
groupName: ProjectTypeOptions.getCreateGroupName(ProjectTypeGroup.AIAgent),
};
}

Expand All @@ -281,7 +289,7 @@ export class ProjectTypeOptions {
platform === Platform.VSCode ? "$(teamsfx-custom-copilot) " : ""
}${getLocalizedString("core.createProjectQuestion.projectType.customCopilot.label")}`,
detail: getLocalizedString("core.createProjectQuestion.projectType.customCopilot.detail"),
groupName: ProjectTypeOptions.getCreateGroupName(),
groupName: ProjectTypeOptions.getCreateGroupName(ProjectTypeGroup.AIAgent),
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/fx-core/tests/question/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ describe("scaffold question", () => {
const select = question as SingleSelectQuestion;
const options = await select.dynamicOptions!(inputs);
assert.isTrue(options.length === 6);
assert.isUndefined((options as OptionItem[])[0].groupName);
assert.isNotEmpty((options as OptionItem[])[0].groupName);
return ok({ type: "success", result: ProjectTypeOptions.bot().id });
} else if (question.name === QuestionNames.Capabilities) {
const select = question as SingleSelectQuestion;
Expand Down Expand Up @@ -3594,7 +3594,7 @@ describe("scaffold question", () => {
const options = await select.dynamicOptions!(inputs);
assert.isTrue(options.length === 7);
assert.equal(
getLocalizedString("core.createProjectQuestion.projectType.createGroup.title"),
getLocalizedString("core.createProjectQuestion.projectType.createGroup.aiAgent"),
(options as OptionItem[])[0].groupName
);
return ok({ type: "success", result: ProjectTypeOptions.bot().id });
Expand Down
6 changes: 3 additions & 3 deletions packages/vscode-extension/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@
"teamstoolkit.commandsTreeViewProvider.guideTitle": "View How-to Guides",
"teamstoolkit.commandsTreeViewProvider.manageCollaboratorTitle": "Manage Collaborator",
"teamstoolkit.commandsTreeViewProvider.manageCollaboratorDescription": "Manage M365 Teams App (with Microsoft Entra app) Collaborators",
"teamstoolkit.commandsTreeViewProvider.addPluginTitle": "Add Plugin",
"teamstoolkit.commandsTreeViewProvider.addPluginDescription": "Add plugin in declarative agent",
"teamstoolkit.commandsTreeViewProvider.addPlugin.running": "Adding plugin...",
"teamstoolkit.commandsTreeViewProvider.addPluginTitle": "Add Action",
"teamstoolkit.commandsTreeViewProvider.addPluginDescription": "Add action in declarative agent",
"teamstoolkit.commandsTreeViewProvider.addPlugin.running": "Adding action...",
"teamstoolkit.commandsTreeViewProvider.addWebpartTitle": "Add SPFx Web Part",
"teamstoolkit.commandsTreeViewProvider.officeDevDeployTitle": "Deploy",
"teamstoolkit.commandsTreeViewProvider.officeDevDeployDescription": "Deploy",
Expand Down

0 comments on commit 64bb5b1

Please sign in to comment.