Tenant list UI for Firewall Rules (#11539)

* Start on the tenant list

* continue work

* Finish up...

* Fix test

* Fix

* Fix tests

* Some PR feedback

* Move responsibilities around

* Fix comment
This commit is contained in:
Amir Omidi
2020-07-31 20:07:30 -07:00
committed by GitHub
parent 68e7a293ad
commit f941f9910b
15 changed files with 267 additions and 49 deletions

View File

@@ -138,11 +138,10 @@ export class FirewallRuleDialog extends Modal {
});
this._accountPickerService.addAccountStartEvent(() => this.spinner = true);
this._accountPickerService.onAccountSelectionChangeEvent((account) => this.onAccountSelectionChange(account));
this._accountPickerService.onTenantSelectionChangeEvent((tenantId) => this.onTenantSelectionChange(tenantId));
const azureAccountSection = DOM.append(body, DOM.$('.azure-account-section.new-section'));
const azureAccountLabel = localize('azureAccount', "Azure account");
this.createLabelElement(azureAccountSection, azureAccountLabel, true);
this._accountPickerService.renderAccountPicker(DOM.append(azureAccountSection, DOM.$('.dialog-input')));
this._accountPickerService.renderAccountPicker(azureAccountSection);
const firewallRuleSection = DOM.append(body, DOM.$('.firewall-rule-section.new-section'));
const firewallRuleLabel = localize('filewallRule', "Firewall rule");
@@ -215,7 +214,9 @@ export class FirewallRuleDialog extends Modal {
if (isHeader) {
className += ' header';
}
DOM.append(container, DOM.$(`.${className}`)).innerText = content;
const element = DOM.append(container, DOM.$(`.${className}`));
element.innerText = content;
return element;
}
// Update theming that is specific to firewall rule flyout body
@@ -289,6 +290,10 @@ export class FirewallRuleDialog extends Modal {
}
}
public onTenantSelectionChange(tenantId: string): void {
this.viewModel.selectedTenantId = tenantId;
}
public onServiceComplete() {
this._createButton.enabled = true;
this.spinner = false;

View File

@@ -60,7 +60,7 @@ export class FirewallRuleDialogController {
private async handleOnCreateFirewallRule(): Promise<void> {
const resourceProviderId = this._resourceProviderId;
try {
const tenantId = this._connection.azureTenantId;
const tenantId = this._firewallRuleDialog.viewModel.selectedTenantId;
const token = await this._accountManagementService.getAccountSecurityToken(this._firewallRuleDialog.viewModel.selectedAccount!, tenantId, AzureResource.ResourceManagement);
const securityTokenMappings = {
[tenantId]: token

View File

@@ -42,10 +42,6 @@
padding-bottom: 0px;
}
.modal .firewall-rule-dialog .azure-account-section {
height: 92px;
}
/* Firewall rule description section */
.modal .firewall-rule-dialog a:link {
text-decoration: underline;

View File

@@ -52,6 +52,7 @@ suite('Firewall rule dialog controller tests', () => {
mockFirewallRuleViewModel.setup(x => x.updateDefaultValues(TypeMoq.It.isAny()))
.returns((ipAddress) => undefined);
mockFirewallRuleViewModel.object.selectedAccount = account;
mockFirewallRuleViewModel.object.selectedTenantId = 'tenantId';
mockFirewallRuleViewModel.object.isIPAddressSelected = true;
// Create a mocked out instantiation service