如何在 Windows Azure Pack 管理入口網站延伸模組中顯示精靈
適用于:Windows Azure Pack
入口網站中的精靈是多對話方塊強制回應視窗,使用者可以在對話方塊之間向前和返回巡覽。 功能包括動態新增或移除步驟,以回應使用者在目前步驟中選擇選項,並防止使用者在目前步驟的輸入驗證失敗時移至下一個步驟。
顯示精靈
為精靈中的每個步驟建立範本。 如需詳細資訊,請參閱Windows Azure Pack Management Portal Client-Side 擴充功能範本。
呼叫 cdm.stepWizard。 下列範例示範 cdm.stepWizard 最常見的參數和回呼。
cdm.stepWizard({ extension: "DomainTenantExtension", steps: [{ template: "createStep1", data: data, // Called when the step is first created onStepCreated: function () { wizard = this; }, // Called each time the step is displayed onStepActivate: step1Activate, // Called before the wizard moves to the next step onNextStep: function () { return Shell.UI.Validation.validateContainer("#dm-create-step1"); } }], // Called when the user clicks the "Finish" button on the last step onComplete: function () { var newPassword, newResellerPortalUrl; newPassword = $("#dm-password").val(); newResellerPortalUrl = registerReseller ? $("#dm-portalUrl").val() : null; // Call whatever backend function we need to. In our example, it returns a promise promise = callback(newPassword, newResellerPortalUrl); // Create a new Progress Operation object var progressOperation = new Shell.UI.ProgressOperation( // Title of operation "Registering endpoint...", // Initial status. null = default null, // Is indeterministic? (Does it NOT provide a % complete) true); // This adds the progress operation we set up earlier to the visible list of PrOp's Shell.UI.ProgressOperations.add(progressOperation); promise .done(function() { // When the operation succeeds, complete the progress operation progressOperation.complete( "Successfully registered the endpoint.", Shell.UI.InteractionSeverity.information); }) .fail(function() { // When the operation fails, complete the progress operation progressOperation.complete( "Failed to register the endpoint.", Shell.UI.InteractionSeverity.error, Shell.UI.InteractionBehavior.ok); }); } }, { // Other supported sized include large, medium & small size: "mediumplus" });