如何在Windows Azure Pack 管理入口網站方案使用者介面內顯示組態資訊
適用于:Windows Azure Pack
<<載入資源頁面時,需要 ExtensionName >> .ServiceOffer.js。 此檔案會定義初始化、執行命令的命令和行為,並處理頁面的 onOfferSaving 事件。
主要函式是 initializeServiceOffer,它會從主機接收設定,並更新使用者介面,並執行由底部功能區中資源提供者所定義的命令 executeCommand。
顯示組態資訊
使用下列程式碼實作ServiceOffer.js:
/*globals window,parent,jQuery,document,setTimeout*/ /// <dictionary>jslint,iframe, Addon, </dictionary> /// <disable>JS2076.IdentifierIsMiscased</disable> // for 'Editions' (function ($, global, undefined) { "use strict"; // Executes the commands defined by the resource provider in the bottom command ribbon function executeCommand(commandId, commandParameter) { var i; switch (commandId) { case "X.addAddon": showAddAddonWizard(); break; case "X.editAddon": showEditAddonWizard(); break; case "X.deleteAddon": showDeleteAddonConfirmation(); break; case "X.addEdition": showAddEditionWizard(); break; case "X.editEdition": showEditEditionWizard(); break; case "X.deleteEdition": showDeleteEditionConfirmation(); break; updateAnytingNeededByExtension(); } } // Called after "Save" command for plan is invoked, but before it is sent to a resource provider. Do final validation here and throw an exception if there is an error</summary> function onOfferSaving() { if (!cachedServiceOffer || !cachedServiceOffer.Editions || cachedServiceOffer.Editions.length === 0) { throw resources.InvalidQuotasNoGroup; } } // Receives config from host and updates the UI function initializeServiceOffer(serviceOffer, planEntityType) { } function initializePage() { global.ServiceOffer.registerExtension({ initializeServiceOffer: initializeServiceOffer, onOfferSaving: onOfferSaving, executeCommand: executeCommand }); } $(document).ready(initializePage); })(jQuery, this);