Skip to content

Commit

Permalink
fix: set tab scope to config (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
hund030 authored Apr 14, 2021
1 parent 868cbf3 commit 87d64f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class FrontendProvision {
}

public static setTabScope(ctx: PluginContext, variables: ManifestVariables): void {
const tabScope = ctx.answers?.getString(QuestionKey.TabScope);
const tabScope = ctx.config.getString(QuestionKey.TabScope);
// Always overwrite these configs to support both local debug and remote debug
ctx.config.set(FrontendConfigInfo.ConfigurableTab, TabScopeManifest.getConfigurableTab(variables, tabScope));
ctx.config.set(FrontendConfigInfo.StaticTab, TabScopeManifest.getStaticTab(variables, tabScope));
Expand Down
5 changes: 4 additions & 1 deletion packages/fx-core/src/plugins/resource/frontend/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { Messages } from "./resources/messages";
import { FrontendScaffold as Scaffold, TemplateInfo } from "./ops/scaffold";
import { TeamsFxResult } from "./error-factory";
import { PreDeploySteps, ProgressHelper, ProvisionSteps, ScaffoldSteps } from "./utils/progress-helper";
import { tabScopeQuestion } from "./resources/questions";
import { QuestionKey, TabScope, tabScopeQuestion } from "./resources/questions";
import { ManifestVariables } from "./resources/tabScope";

export class FrontendPluginImpl {
Expand Down Expand Up @@ -68,6 +68,9 @@ export class FrontendPluginImpl {
templateInfo.scenario = FrontendPluginInfo.TemplateWithFunctionScenario;
}

const tabScope = ctx.answers?.getString(QuestionKey.TabScope) ?? TabScope.PersonalTab;
this.setConfigIfNotExists(ctx, QuestionKey.TabScope, tabScope);

const zip = await runWithErrorCatchAndThrow(
new GetTemplateError(),
async () => await Scaffold.getTemplateZip(ctx, templateInfo),
Expand Down

0 comments on commit 87d64f8

Please sign in to comment.