-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtclCore.ts
134 lines (102 loc) · 4.49 KB
/
tclCore.ts
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
* Copyright 2020. F5 Networks, Inc. See End User License Agreement ("EULA") for
* license terms. Notwithstanding anything to the contrary in the EULA, Licensee
* may copy and modify this software product for its internal business purposes.
* Further, Licensee may upload, publish and distribute the modified version of
* the software product on devcentral.f5.com or github.com/f5devcentral.
*/
'use strict';
import {
window,
commands,
ExtensionContext
} from "vscode";
import { ext } from "./extensionVariables";
import { TclTreeProvider } from "./treeViewsProviders/tclTreeProvider";
import { logger } from './logger';
/**
* core tcl commands functionality
*/
export default function tclCore(context: ExtensionContext) {
/**
* ###########################################################################
*
* TTTTTTT CCCCC LL
* TTT CC C LL
* TTT CC LL
* TTT CC C LL
* TTT CCCCC LLLLLLL
*
* ############################################################################
* http://patorjk.com/software/taag/#p=display&h=0&f=Letters&t=FAST
*/
const tclTreeProvider = new TclTreeProvider();
const tctTreeView = window.createTreeView('as3Tasks', {
treeDataProvider: tclTreeProvider,
showCollapseAll: true
});
commands.registerCommand('f5.refreshTclTree', () => tclTreeProvider.refresh());
// --- IRULE COMMANDS ---
context.subscriptions.push(commands.registerCommand('f5-tcl.getRule', async (rule) => {
return tclTreeProvider.displayRule(rule);
}));
context.subscriptions.push(commands.registerCommand('f5-tcl.deleteRule', async (rule) => {
return tclTreeProvider.deleteRule(rule);
}));
// --- ICALL Script COMMANDS ---
context.subscriptions.push(commands.registerCommand('f5-tcl.getIcallscript', async (icallscript) => {
return tclTreeProvider.displayIcallscript(icallscript);
}));
context.subscriptions.push(commands.registerCommand('f5-tcl.deleteIcallscript', async (icallscript) => {
return tclTreeProvider.deleteIcallscript(icallscript);
}));
// --- TMSH Script COMMANDS ---
context.subscriptions.push(commands.registerCommand('f5-tcl.getTMSHscript', async (tmshscript) => {
return tclTreeProvider.displayTMSHscript(tmshscript);
}));
context.subscriptions.push(commands.registerCommand('f5-tcl.deleteTMSHscript', async (tmshscript) => {
return tclTreeProvider.deleteTMSHscript(tmshscript);
}));
// --- IAPP COMMANDS ---
context.subscriptions.push(commands.registerCommand('f5-tcl.getApp', async (item) => {
logger.debug('f5-tcl.getApp command: ', item);
return ext.panel.render(item);
}));
context.subscriptions.push(commands.registerCommand('f5-tcl.getTemplate', async (item) => {
// returns json view of iApp Template
return ext.panel.render(item);
}));
context.subscriptions.push(commands.registerCommand('f5-tcl.getTMPL', async (item) => {
// gets the original .tmpl output
const temp = await tclTreeProvider.getTMPL(item);
tclTreeProvider.displayTMPL(temp);
}));
context.subscriptions.push(commands.registerCommand('f5-tcl.iAppRedeploy', async (item) => {
const temp = await tclTreeProvider.iAppRedeploy(item);
/**
* setup appropriate response
* - if no error - nothing
* - if error, editor/pop-up to show error
*/
// return utils.displayJsonInEditor(item);
}));
context.subscriptions.push(commands.registerCommand('f5-tcl.iAppDelete', async (item) => {
const temp = await tclTreeProvider.iAppDelete(item);
tclTreeProvider.refresh();
}));
context.subscriptions.push(commands.registerCommand('f5-tcl.postTMPL', async (item) => {
const resp: any = await tclTreeProvider.postTMPL(item);
window.showInformationMessage(resp);
return resp;
}));
context.subscriptions.push(commands.registerCommand('f5-tcl.deleteTMPL', async (item) => {
const resp: any = await tclTreeProvider.deleteTMPL(item);
return resp;
}));
context.subscriptions.push(commands.registerCommand('f5-tcl.mergeTCL', async (item) => {
await tclTreeProvider.mergeTCL(item);
}));
context.subscriptions.push(commands.registerCommand('f5-tcl.replaceTCL', async (item) => {
await tclTreeProvider.mergeTCL(item, true);
}));
}