Skip to content

Commit c4472a1

Browse files
msivasubramaniaanvrubezhny
authored andcommitted
moved validation under onDid method
1 parent 0503047 commit c4472a1

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/deployment.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,26 +152,26 @@ export class Deployment {
152152

153153
disposables.push(inputBox.onDidHide(() => resolve(null)));
154154

155-
disposables.push(inputBox.onDidChangeValue(async (e) => {
155+
disposables.push(inputBox.onDidChangeValue((e) => {
156156
if (validator.isURL(inputBox.value)) {
157157
inputBox.validationMessage = undefined;
158158
} else {
159159
inputBox.validationMessage = 'Please enter a valid URL';
160160
}
161161

162-
//check the mentioned url has image referece
163-
inputBox.validationMessage = 'Checking the image info'
164-
inputBox.enabled = false;
165-
if (! await Oc.Instance.hasImageInfo(inputBox.value)) {
166-
inputBox.validationMessage = 'Image referece is not valid'
167-
} else {
168-
inputBox.validationMessage = undefined;
169-
}
170-
inputBox.enabled = true;
171-
172162
}));
173163

174-
disposables.push(inputBox.onDidAccept((e) => {
164+
disposables.push(inputBox.onDidAccept(async (_e) => {
165+
166+
//check url has image
167+
if (inputBox.validationMessage === undefined && inputBox.value !== undefined) {
168+
if (! await Oc.Instance.hasImageInfo(inputBox.value)) {
169+
inputBox.validationMessage = 'Image referece is not valid'
170+
} else {
171+
inputBox.validationMessage = undefined;
172+
}
173+
}
174+
175175
if (inputBox.validationMessage === undefined && inputBox.value !== undefined) {
176176
resolve(inputBox.value);
177177
inputBox.hide();

0 commit comments

Comments
 (0)