forked from redhat-developer/vscode-openshift-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.ts
More file actions
37 lines (33 loc) · 1.98 KB
/
application.ts
File metadata and controls
37 lines (33 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*-----------------------------------------------------------------------------------------------
* Copyright (c) Red Hat, Inc. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*-----------------------------------------------------------------------------------------------*/
import { window } from 'vscode';
import OpenShiftItem from './openshiftItem';
import { OpenShiftObject } from '../odo';
import { Command } from "../odo/command";
import { Progress } from '../util/progress';
import { vsCommand, VsCommandError } from '../vscommand';
export class Application extends OpenShiftItem {
@vsCommand('openshift.app.describe', true)
static async describe(treeItem: OpenShiftObject): Promise<void> {
const application = await Application.getOpenShiftCmdData(treeItem,
"Select Application you want to describe");
if (application) Application.odo.executeInTerminal(Command.describeApplication(application.getParent().getName(), application.getName()), undefined, `OpenShift: Describe '${application.getName()}' Application`);
}
@vsCommand('openshift.app.delete', true)
static async del(treeItem: OpenShiftObject): Promise<string> {
const application = await Application.getOpenShiftCmdData(treeItem,
"Select Application to delete");
if (application) {
const appName = application.getName();
const value = await window.showWarningMessage(`Do you want to delete Application '${appName}'?`, 'Yes', 'Cancel');
if (value === 'Yes') {
return Progress.execFunctionWithProgress(`Deleting the Application '${appName}'`, () => Application.odo.deleteApplication(application))
.then(() => `Application '${appName}' successfully deleted`)
.catch((err) => Promise.reject(new VsCommandError(`Failed to delete Application with error '${err}'`)));
}
}
return null;
}
}