Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: renmaing and handler #12977

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions packages/fx-core/resource/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,11 @@
"core.createProjectQuestion.title": "New Project",
"core.createProjectQuestion.capability.botMessageExtension.label": "Start with a Bot",
"core.createProjectQuestion.capability.botMessageExtension.detail": "Create a message extension using Bot Framework",
"core.createProjectQuestion.capability.copilotPluginNewApiOption.label": "Start with a new API",
"core.createProjectQuestion.capability.copilotPluginNewApiOption.detail": "Create a plugin with a new API from Azure Functions",
"core.createProjectQuestion.capability.copilotPluginNewApiOption.label": "Start with a New API",
"core.createProjectQuestion.capability.copilotPluginNewApiOption.detail": "Create an action with a new API from Azure Functions",
"core.createProjectQuestion.capability.messageExtensionNewApiOption.detail": "Create a message extension with a new API from Azure Functions",
"core.createProjectQuestion.capability.copilotPluginApiSpecOption.label": "Start with an OpenAPI Description Document",
"core.createProjectQuestion.capability.copilotPluginApiSpecOption.detail": "Create a plugin from your existing API",
"core.createProjectQuestion.capability.copilotPluginApiSpecOption.detail": "Create an action from your existing API",
"core.createProjectQuestion.capability.messageExtensionApiSpecOption.detail": "Create a message extension from your existing API",
"core.createProjectQuestion.capability.customCopilotBasicOption.label": "Basic AI Chatbot",
"core.createProjectQuestion.capability.customCopilotBasicOption.detail": "Build a basic AI chatbot in Teams",
Expand Down Expand Up @@ -369,8 +369,8 @@
"core.createProjectQuestion.llmService.azureOpenAIDeploymentName.title": "Azure OpenAI Deployment Name",
"core.createProjectQuestion.llmService.azureOpenAIEndpoint.placeholder": "Input Azure OpenAI service endpoint now or set it later in the project",
"core.createProjectQuestion.llmService.azureOpenAIDeploymentName.placeholder": "Input Azure OpenAI deployment name now or set it later in the project",
"core.createProjectQuestion.apiPlugin.importPlugin.label": "Import from existing plugin",
"core.createProjectQuestion.apiPlugin.importPlugin.detail": "Import from existing API plugin file",
"core.createProjectQuestion.apiPlugin.importPlugin.label": "Import from an Existing Action",
"core.createProjectQuestion.apiPlugin.importPlugin.detail": "Import from an existing action file",
"core.createProjectQuestion.apiSpec.title": "OpenAPI Description Document",
"core.createProjectQuestion.apiSpec.placeholder": "Enter OpenAPI Description Document URL",
"core.createProjectQuestion.apiSpecInputUrl.label": "Enter OpenAPI Description Document Location",
Expand All @@ -395,18 +395,18 @@
"core.createProjectQuestion.apiSpec.multipleValidationErrors.vscode.message": "Incompatible OpenAPI description document. Check [output panel](command:fx-extension.showOutputChannel) for details.",
"core.createProjectQuestion.meArchitecture.title": "Architecture of Search Based Message Extension",
"core.createProjectQuestion.declarativeCopilot.title": "Create Declarative Agent",
"core.createProjectQuestion.declarativeCopilot.placeholder": "Add API plugin to your declarative agent",
"core.createProjectQuestion.declarativeCopilot.placeholder": "Add an action 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 action",
"core.createProjectQuestion.noPlugin.label": "No plugin",
"core.createProjectQuestion.addApiPlugin.title": "Add an Action",
"core.createProjectQuestion.addApiPlugin.placeholder": "Select how to add an action",
"core.createProjectQuestion.noPlugin.label": "No Action",
"core.createProjectQuestion.noPlugin.detail": "Create declarative agent only",
"core.createProjectQuestion.addPlugin.label": "Add action",
"core.createProjectQuestion.addPlugin.detail": "Create declarative agent with API plugin",
"core.createProjectQuestion.addPlugin.label": "Add an Action",
"core.createProjectQuestion.addPlugin.detail": "Create a declarative agent with an action",
"core.createProjectQuestion.addExistingPlugin.pluginManifest.title": "Import Manifest File",
"core.createProjectQuestion.addExistingPlugin.apiSpec.title": "Import OpenAPI Description Document",
"core.createProjectQuestion.addExistingPlugin.pluginManifest.placeholder": "Select your plugin manifest file",
"core.createProjectQuestion.addExistingPlugin.openApiSpec.placeholder": "Select OpenAPI description document used for your API plugin",
"core.createProjectQuestion.addExistingPlugin.pluginManifest.placeholder": "Select your action manifest file",
"core.createProjectQuestion.addExistingPlugin.openApiSpec.placeholder": "Select OpenAPI description document used for your action",
"core.createProjectQuestion.addPlugin.MissingRequiredProperty": "Invalid plugin manifest. Missing \"%s\"",
"core.createProjectQuestion.addPlugin.pluginManifestMissingApiSpec": "Invalid plugin manifest. Ensure the manifest has a runtime of \"%s\" and references a valid API description document.",
"core.createProjectQuestion.addPlugin.pluginManifestMultipleApiSpec": "Found multiple OpenAPI description documents: \"%s\".",
Expand Down Expand Up @@ -447,9 +447,9 @@
"core.SampleSelect.title": "Start from a sample",
"core.SampleSelect.placeholder": "Select a sample",
"core.SampleSelect.buttons.viewSamples": "View samples",
"core.addPlugin.success.vsc": "API plugin \"%s\" added to the project successfully.",
"core.addPlugin.success.vsc": "Action \"%s\" added to the project successfully.",
"core.addPlugin.success": "API plugin \"%s\" added to the project successfully. View plugin manifest in \"%s\".",
"core.addPlugin.success.viewPluginManifest": "View plugin manifest",
"core.addPlugin.success.viewPluginManifest": "View action manifest",
"core.scaffold.warning.summary": "We have detected following issues:\n%s",
"core.addPlugin.warning.manifestVariables": "Environment variables \"%s\" found in manifest of the added plugin. Ensure the values are set in .env file or system environment variables.",
"core.addPlugin.warning.apiSpecVariables": "Environment variables \"%s\" found in API specification of the added plugin. Ensure the values are set in .env file or system environment variables.",
Expand Down
2 changes: 1 addition & 1 deletion packages/fx-core/src/question/inputs/AddPluginInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { Inputs } from "@microsoft/teamsfx-api";

export interface AddPluginInputs extends Inputs {
/** @description Add API Plugin */
/** @description Add an Action */
"api-plugin-type"?: "api-spec" | "existing-plugin";
/** @description Import Manifest File */
"plugin-manifest-path"?: string;
Expand Down
6 changes: 3 additions & 3 deletions packages/vscode-extension/src/controls/openWelcomePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { globalStateGet, globalStateUpdate } from "@microsoft/teamsfx-core";
import * as vscode from "vscode";
import { TelemetryTriggerFrom } from "../telemetry/extTelemetryEvents";
import { openBuildIntelligentAppsWalkthroughHandler } from "../handlers/walkthrough";
import { openWelcomeHandler } from "../handlers/controlHandlers";
import { openWelcomeHandler, defaultWelcomePageKey } from "../handlers/controlHandlers";

const welcomePageKey = "ms-teams-vscode-extension.welcomePage.shown";

Expand All @@ -17,7 +17,7 @@ export async function openWelcomePageAfterExtensionInstallation(): Promise<void>

// Let's show!
await globalStateUpdate(welcomePageKey, true);
await openWelcomeHandler([TelemetryTriggerFrom.Auto]);
await openBuildIntelligentAppsWalkthroughHandler([TelemetryTriggerFrom.Auto]);
await openWelcomeHandler(TelemetryTriggerFrom.Auto, defaultWelcomePageKey);
await openBuildIntelligentAppsWalkthroughHandler(TelemetryTriggerFrom.Auto);
await vscode.commands.executeCommand("workbench.view.extension.teamsfx");
}
25 changes: 17 additions & 8 deletions packages/vscode-extension/src/handlers/controlHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import { getWalkThroughId } from "../utils/projectStatusUtils";
import { getTriggerFromProperty } from "../utils/telemetryUtils";
import { getDefaultString } from "../utils/localizeUtils";

export const defaultWelcomePageKey = "defaultWelcomePage";

export async function openLifecycleTreeview(args?: any[]) {
ExtTelemetry.sendTelemetryEvent(
TelemetryEvent.ClickOpenLifecycleTreeview,
Expand All @@ -38,6 +40,8 @@ export async function openLifecycleTreeview(args?: any[]) {
}
}

// args[0] is telemetry trigger from
// args[1] is whether to open default welcome page. Pass const var defaultWelcomePageKey to open default welcome page.
export async function openWelcomeHandler(...args: unknown[]): Promise<Result<unknown, FxError>> {
ExtTelemetry.sendTelemetryEvent(TelemetryEvent.GetStarted, getTriggerFromProperty(args));
// Open different walkthrough depending on the project type
Expand Down Expand Up @@ -74,21 +78,26 @@ export async function openWelcomeHandler(...args: unknown[]): Promise<Result<unk
"TeamsDevApp.ms-teams-vscode-extension#buildIntelligentApps"
);
return Promise.resolve(ok(data));
} else {
return await selectWalkthrough(args);
}
}

export async function selectWalkthrough(...args: unknown[]): Promise<Result<unknown, FxError>> {
const TeamsToolkitOptionLabel = getDefaultString("teamstoolkit.walkthroughs.title");
const BuildNotificationBotWalkthroughArgs = "SideBar";
if (args.length > 0 && args[0] == BuildNotificationBotWalkthroughArgs) {
if (args.length > 0 && args[0] == (TelemetryTriggerFrom.SideBar as string)) {
const data = await vscode.commands.executeCommand(
"workbench.action.openWalkthrough",
getWalkThroughId()
);
return Promise.resolve(ok(data));
}
if (args.length > 1 && args[1] == defaultWelcomePageKey) {
const data = await vscode.commands.executeCommand(
"workbench.action.openWalkthrough",
getWalkThroughId()
);
return Promise.resolve(ok(data));
}
return await selectWalkthrough(args);
}

export async function selectWalkthrough(...args: unknown[]): Promise<Result<unknown, FxError>> {
const TeamsToolkitOptionLabel = getDefaultString("teamstoolkit.walkthroughs.title");
const BuildingIntelligentAppsLabel = getDefaultString(
"teamstoolkit.walkthroughs.buildIntelligentApps.title"
);
Expand Down
17 changes: 17 additions & 0 deletions packages/vscode-extension/test/handlers/controlHandlers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { PanelType } from "../../src/controls/PanelType";
import { WebviewPanel } from "../../src/controls/webviewPanel";
import * as globalVariables from "../../src/globalVariables";
import {
defaultWelcomePageKey,
openFolderHandler,
openLifecycleTreeview,
openSamplesHandler,
Expand All @@ -20,6 +21,7 @@ import { ExtTelemetry } from "../../src/telemetry/extTelemetry";
import {
TelemetryEvent,
TelemetryProperty,
TelemetryTriggerFrom,
TelemetryUpdateAppReason,
} from "../../src/telemetry/extTelemetryEvents";
import * as commonUtils from "../../src/utils/commonUtils";
Expand Down Expand Up @@ -52,6 +54,21 @@ describe("Control Handlers", () => {
);
});

it("opens default walkthrough", async () => {
sandbox.stub(featureFlagManager, "getBooleanValue").returns(false);
sandbox.stub(manifestUtils, "readAppManifest").resolves(ok({} as TeamsAppManifest));
sandbox.stub(manifestUtils, "getCapabilities").returns(["bot"]);
const executeCommands = sandbox.stub(vscode.commands, "executeCommand");
const sendTelemetryEvent = sandbox.stub(ExtTelemetry, "sendTelemetryEvent");
await openWelcomeHandler(TelemetryTriggerFrom.Auto, defaultWelcomePageKey);

sandbox.assert.calledOnceWithExactly(
executeCommands,
"workbench.action.openWalkthrough",
"TeamsDevApp.ms-teams-vscode-extension#teamsToolkitGetStarted"
);
});

it("opens normal walkthrough -SideBar", async () => {
sandbox.stub(featureFlagManager, "getBooleanValue").returns(false);
sandbox.stub(manifestUtils, "readAppManifest").resolves(ok({} as TeamsAppManifest));
Expand Down
Loading