Enabled Azure Arc data controller upgrade for direct and indirect mode (#19060)

* Fixed a connect to Server typo

* Added upgrade tab with description and title. Table is still stuck loading.

* Renamed backups to upgrades.

* Removed loading icon

* Table appearing and not stuck loading

* Saving for now to upgrade arc and azcli versions

* Added upgrade confirmation dialog, populated dummy data and added upgrade apis.

* Added parsing of versions and current version from listupgrades

* Upgrade itself not working, but added upgrade as a part of azure cli api.

* Table now populating with release dates and version numbers. Upgrade button only shows for appropriate cells. Upgrade done but no release version column.

* Changed text using PM advice

* Removed comments from controllerUpgrades.ts

* Replaced code in upgradecontroller.ts and made refresh work

* Removed one call to handleTablesUpdated

* Removed some code in upgradeControllers.ts and it still works

* removing more code for pitr refresh from upgradeController.ts

* Created and used UpgradeModel even though it is empty

* Added upgrademodel

* PR comments addressed

Co-authored-by: Candice Ye <canye@microsoft.com>
This commit is contained in:
Candice Ye
2022-04-18 17:52:43 -07:00
committed by GitHub
parent 21315a8a5d
commit a8f2039fb6
10 changed files with 528 additions and 3 deletions

View File

@@ -0,0 +1,93 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as azdata from 'azdata';
import { Deferred } from '../../common/promise';
import * as loc from '../../localizedConstants';
import * as vscode from 'vscode';
import { cssStyles } from '../../constants';
import { InitializingComponent } from '../components/initializingComponent';
import { UpgradeModel } from '../../models/miaaModel';
import { ControllerModel } from '../../models/controllerModel';
export class UpgradeController extends InitializingComponent {
protected modelBuilder!: azdata.ModelBuilder;
private pitrSettings: UpgradeModel = [];
protected _completionPromise = new Deferred<UpgradeModel | undefined>();
protected disposables: vscode.Disposable[] = [];
constructor(protected _controllerModel: ControllerModel) {
super();
}
public showDialog(dialogTitle: string): azdata.window.Dialog {
const dialog = azdata.window.createModelViewDialog(dialogTitle, dialogTitle, 'narrow', 'flyout');
dialog.cancelButton.onClick(() => this.handleCancel());
dialog.registerContent(async view => {
this.modelBuilder = view.modelBuilder;
const areYouSure = this.modelBuilder.text().withProps({
value: loc.areYouSure,
CSSStyles: { ...cssStyles.title, 'margin-block-start': '0px', 'margin-block-end': '0px', 'max-width': 'auto' },
}).component();
const areYouSureInfo = this.modelBuilder.text().withProps({
value: loc.upgradeDialog,
CSSStyles: { ...cssStyles.text, 'margin-block-start': '0px', 'max-width': 'auto' }
}).component();
const upgradeDialog = this.modelBuilder.flexContainer().withLayout({ flexWrap: 'wrap' }).component();
upgradeDialog.addItem(areYouSureInfo, { CSSStyles: { 'margin-right': '5px' } });
const monitorUpgradeInfo = this.modelBuilder.text().withProps({
value: loc.monitorUpgrade,
CSSStyles: { ...cssStyles.text, 'margin-block-start': '0px', 'max-width': 'auto' }
}).component();
upgradeDialog.addItem(monitorUpgradeInfo, { CSSStyles: { 'margin-right': '5px' } });
const monitorUpgradeCommandInfo = this.modelBuilder.text().withProps({
value: 'kubectl get datacontrollers -A',
CSSStyles: { ...cssStyles.code, 'margin-block-start': '0px', 'max-width': 'auto' }
}).component();
upgradeDialog.addItem(monitorUpgradeCommandInfo, { CSSStyles: { 'margin-right': '5px' } });
let formModel = this.modelBuilder.formContainer()
.withFormItems([{
components: [
{
component: areYouSure
},
{
component: upgradeDialog
}
],
title: ''
}]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel);
this.initialized = true;
});
dialog.okButton.label = loc.upgrade;
dialog.cancelButton.label = loc.cancel;
dialog.registerCloseValidator(async () => await this.validate());
dialog.okButton.onClick(() => {
this._completionPromise.resolve(this.pitrSettings);
});
azdata.window.openDialog(dialog);
return dialog;
}
public async validate(): Promise<boolean> {
return true;
}
private handleCancel(): void {
this._completionPromise.resolve(undefined);
}
public waitForClose(): Promise<UpgradeModel | undefined> {
return this._completionPromise.promise;
}
}