Clear fields on Add New Package page after getting No Valid Versions error. (#6261)

This commit is contained in:
Cory Rivera
2019-07-03 14:29:26 -07:00
committed by GitHub
parent f19f21d547
commit 8a8cb3ab27

View File

@@ -109,12 +109,7 @@ export class AddNewPackageTab {
value: '',
placeHolder: this.SearchPlaceholder(this.dialog.currentPkgType)
});
await this.newPackagesName.updateProperties({ value: this.InvalidTextPlaceholder });
await this.newPackagesVersions.updateProperties({
values: [this.InvalidTextPlaceholder],
value: this.InvalidTextPlaceholder
});
await this.newPackagesSummary.updateProperties({ value: this.InvalidTextPlaceholder });
await this.setFieldsToEmpty();
} finally {
await this.toggleNewPackagesFields(true);
}
@@ -127,6 +122,19 @@ export class AddNewPackageTab {
await this.newPackagesSummaryLoader.updateProperties({ loading: !enable });
}
private async setFieldsToEmpty(): Promise<void> {
await this.newPackagesName.updateProperties({
value: this.InvalidTextPlaceholder
});
await this.newPackagesVersions.updateProperties({
values: [this.InvalidTextPlaceholder],
value: this.InvalidTextPlaceholder
});
await this.newPackagesSummary.updateProperties({
value: this.InvalidTextPlaceholder
});
}
private async loadNewPackageInfo(): Promise<void> {
await this.packageInstallButton.updateProperties({ enabled: false });
await this.toggleNewPackagesFields(false);
@@ -146,6 +154,7 @@ export class AddNewPackageTab {
this.dialog.showErrorMessage(
localize('managePackages.noVersionsFound',
"Could not find any valid versions for the specified package"));
await this.setFieldsToEmpty();
return;
}
@@ -164,17 +173,7 @@ export class AddNewPackageTab {
await this.packageInstallButton.updateProperties({ enabled: true });
} catch (err) {
this.dialog.showErrorMessage(utils.getErrorMessage(err));
await this.newPackagesName.updateProperties({
value: this.InvalidTextPlaceholder
});
await this.newPackagesVersions.updateProperties({
value: this.InvalidTextPlaceholder,
values: [this.InvalidTextPlaceholder],
});
await this.newPackagesSummary.updateProperties({
value: this.InvalidTextPlaceholder
});
await this.setFieldsToEmpty();
} finally {
await this.toggleNewPackagesFields(true);
}