Compartilhar via


Como exibir um assistente em um Windows extensão do Portal de Gerenciamento do Azure Pack

 

Aplica-se a: Windows Azure Pack

Os assistentes no portal são janelas modais de vários diálogos em que o usuário pode navegar para frente e para trás entre as caixas de diálogo. Os recursos incluem adicionar ou remover etapas dinamicamente em resposta às opções de escolha do usuário na etapa atual e impedir que os usuários se movam para a próxima etapa se a validação de sua entrada para a etapa atual falhar.

Para exibir um assistente

  1. Crie um modelo para cada etapa no assistente. Para obter mais informações, consulte Windows Portal de Gerenciamento do Azure Pack Client-Side Modelos de Extensão.

  2. Chame cdm.stepWizard. O exemplo a seguir demonstra os parâmetros e retornos de chamada mais comuns para 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" 
      });
    

Consulte Também

Executando tarefas comuns em um Windows extensão do Portal de Gerenciamento do Azure Pack