Skip to content

Commit 5f7c022

Browse files
mohitsumandgolovin
authored andcommitted
fix typos and add error warning (#1139)
* fix typos and add error warning * replace showErrorMessage with throw new Error()
1 parent de7f4a4 commit 5f7c022

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

src/odo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ export class OdoImpl implements Odo {
11251125
const result2 = await this.execute(getPreviosOdoResourceNames('ServiceInstance'), __dirname, false);
11261126
const sis = result2.stdout.split('\n');
11271127
if ((result2.stdout !== '' && sis.length > 0) || (result1.stdout !== '' && dcs.length > 0)) {
1128-
const choice = await window.showWarningMessage(`Some of resources in cluster must be updated to work with latest release of OpenShift Connector Extension.`, 'Update', 'Don\'t show it again', 'Help', 'Cancel');
1128+
const choice = await window.showWarningMessage(`Some of the resources in cluster must be updated to work with latest release of OpenShift Connector Extension.`, 'Update', 'Don\'t show it again', 'Help', 'Cancel');
11291129
if (choice === 'Help') {
11301130
open('https://github.com/redhat-developer/vscode-openshift-tools/wiki/Migration-to-v0.1.0');
11311131
this.subject.next(new OdoEventImpl('changed', this.getClusters()[0]));

src/openshift/component.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export class Component extends OpenShiftItem {
300300
if (undeployRequired) {
301301
let choice: string;
302302
do {
303-
choice = await window.showWarningMessage('This Component must be undeployed before new version is pushed, because it was created and deployed with previous version ot the extension.', 'Undeploy', 'Help', 'Cancel');
303+
choice = await window.showWarningMessage('This Component must be undeployed before new version is pushed, because it was created and deployed with previous version of the extension.', 'Undeploy', 'Help', 'Cancel');
304304
switch (choice) {
305305
case 'Undeploy':
306306
await Component.undeploy(component);
@@ -562,11 +562,9 @@ export class Component extends OpenShiftItem {
562562
const componentJson = JSON.parse(componentResult.stdout).items[0];
563563
const componentType = componentJson.metadata.annotations['app.kubernetes.io/component-source-type'];
564564
if (componentType === ComponentType.BINARY) {
565-
window.showInformationMessage('Import for binary OpenShift Components is not supported.');
566-
return;
565+
return 'Import for binary OpenShift Components is not supported.';
567566
} else if (componentType !== ComponentType.GIT && componentType !== ComponentType.LOCAL) {
568-
window.showInformationMessage(`Cannot import unknown Component type '${componentType}'.`);
569-
return;
567+
throw new Error(`Cannot import unknown Component type '${componentType}'.`);
570568
}
571569

572570
const workspaceFolder = await selectWorkspaceFolder();
@@ -578,7 +576,7 @@ export class Component extends OpenShiftItem {
578576
// annotations:
579577
// app.kubernetes.io/component-source-type: binary
580578
// app.openshift.io/vcs-uri: 'file:///helloworld.war'
581-
// verify if local file exists and ask for correct location
579+
// not supported yet
582580

583581
// metadata:
584582
// annotations:
@@ -589,14 +587,7 @@ export class Component extends OpenShiftItem {
589587
// annotations:
590588
// app.kubernetes.io/component-source-type: git
591589
// app.kubernetes.io/url: 'https://github.com/dgolovin/nodejs-ex'
592-
// if (componentJson.annotations['app.kubernetes.io/component-source-type'] === ComponentType.BINARY) {
593-
// const binaryUri = Uri.parse(componentJson.annotations['app.openshift.io/vcs-uri']);
594-
// if (path.isAbsolute(binaryUri.fsPath)) {
595590

596-
// } else {
597-
598-
// }
599-
// await Component.odo.execute(Command.createBinaryComponent(prjName, appName, componentJson.metadata.labels['app.kubernetes.io/name'], componentJson.metadata.labels['app.openshift.io/runtime-version'], compName, 'binary-location', workspaceFolder.fsPath));
600591
if (componentType === ComponentType.GIT) {
601592
const bcResult = await Component.odo.execute(`oc get bc/${componentJson.metadata.name} -o json`);
602593
const bcJson = JSON.parse(bcResult.stdout);
@@ -648,9 +639,9 @@ export class Component extends OpenShiftItem {
648639
} else {
649640
workspace.updateWorkspaceFolders(workspace.workspaceFolders? workspace.workspaceFolders.length : 0 , null, { uri: workspaceFolder });
650641
}
651-
return `Component '${compName}' was sucessfully imported.`;
642+
return `Component '${compName}' was successfully imported.`;
652643
} catch (errGetCompJson) {
653-
return `Component import failed with error '${errGetCompJson.message}'.`;
644+
throw new Error(`Component import failed with error '${errGetCompJson.message}'.`);
654645
}
655646
}); // create component with the same name
656647
}

0 commit comments

Comments
 (0)