Windows Azure Pack 管理ポータル拡張機能で新しいドロワーに項目を追加する方法

 

適用対象: Azure Pack Windows

[新しい追加] ドロワーは、新しいアイテムを作成するための管理ポータル ユーザー インターフェイスの中央の場所です。 拡張機能は、ユーザーが拡張機能を使用して新しいリソースを作成できるように、このドロワーにメニュー項目を提供する場合があります。メニュー内の項目は宣言によって追加され、追加後に変更または削除することはできません。 これらは、管理ポータルの任意の場所から使用できます。 宣言の推奨される場所は、拡張機能の初期化 JavaScript にあります。 詳細については、「Azure Pack Management Portal Client-Side Extension JavaScript Windows」を参照してください。

標準メニュー項目を追加するには

  1. 次のコードを使用して標準メニュー項目を追加します。

    menuItems: [
      {
        // ID of the menu item
        name: "WebDomain",
        // Text of the menu item
        displayName: "Web site domains",
        // ID of a template to show when the user hovers over the item (before they click it)
        preview: "createPreview",
        // Sub-menu (child menu) items take mostly the same parameters as parent menu items
        subMenu: [
          {
            name: "Create",
            displayName: "Create",
            // Function to run when the user clicks the item
            execute: global.DomainTenantExtension.CreateWizard.showCreateWizard,
            preview: "customCreatePreview"
          }
        ]
      }
    ]
    

クイック作成メニュー項目

クイック作成メニュー項目 ([新しい追加] ドロワーに短いフォームを表示してすぐにアイテムを作成する項目) では、ドロワーにレンダリングされるテンプレートの ID と、動作を定義する関数 (ユーザーが [OK] をクリックしたときに、テンプレートが表示されたときに実行する操作) を指定する必要があります。 など)。

クイック作成メニュー項目を追加するには

  1. 上記のコードを使用して、menuItems 配列に次のコードを追加して、クイック作成メニュー項目を追加します。

    {
      // ID of this menu item
      name: "QuickCreate",
      // Text displaye on top of the Quick Create template as a title
      displayName: "Quick Create a Domain",
      // Description text displayed when the user hovers over the item with their mouse
      description: "Quickly add a new domain by supplying a few details",
      // Template to render for the Quick Create form
      template: "quickcreate",
      // Menu item's text
      label:"Quick Create",
      // Context object for the template
      data: null,
    
      opening: function(object) {
        // Add logic here to run just before the template is rendered
      }
    
      open: function () {
        // Add logic here to run just after the template is rendered
        Shell.UI.Validation.setValidationContainer("#webDomainQuickCreateForm");
      },
    
      ok: function(object) {
        var dialogFields = object.fields;
    
        if (Shell.UI.Validation.validateContainer("#webDomainQuickCreateForm")) {
          createWebDomain(dialogFields);
        }
        return false;
      },
    
      cancel: function (object) {
        // Add logic here to run after the user dismisses the Quick Create form
        // Do nothing in this case
      }
    }
    

参照

Windows Azure Pack 管理ポータル拡張機能で一般的なタスクを実行する