Skip to content

Commit 3ecb442

Browse files
authored
Merge pull request #33 from f5devcentral/v1.10.0
1.10 work final
2 parents 6edf74b + 13f251b commit 3ecb442

28 files changed

+2017
-392
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,25 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
1818
### Fixed
1919

2020

21+
---
22+
23+
## [1.10.0] - (04-30-2024)
24+
25+
### Added
26+
27+
- Moved FAST templates to dedicated view outside of Citrix ADC exploring
28+
- This includes a dedicated folder for templates with each template name aliging with the different major NS app protocol types (ANY/SSL/TCP/UDP/RDP/...)
29+
- refresh button for this view
30+
- AFTON command to process bulk conversions
31+
- This work flow is still in progress. There is a key difference in how the HTML view mutates the NS config data
32+
- increased and streamlined ns app parameter mutating for FAST templates
33+
34+
35+
### Fixed
36+
37+
- Logger now works with env logging levels of (info/warn/error/debug)
38+
- Updated FAST templates from latest work/testing
39+
2140
---
2241

2342
## [1.8.0] - (04-10-2024)

package.json

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "F5 Flipper",
44
"description": "Breaking down Citrix NetScaler ADC configs",
55
"publisher": "F5DevCentral",
6-
"version": "1.8.0",
6+
"version": "1.10.0",
77
"keywords": [
88
"F5",
99
"F5Networks",
@@ -21,7 +21,6 @@
2121
"theme": "light"
2222
},
2323
"activationEvents": [
24-
"onCommand:f5-flipper.cfgExplore",
2524
"onView:f5-ns-container"
2625
],
2726
"main": "./out/extLoader.js",
@@ -71,6 +70,10 @@
7170
{
7271
"id": "nsConfigView",
7372
"name": "Citrix ADC/NS Config Explorer"
73+
},
74+
{
75+
"id": "nsTemplatesView",
76+
"name": "Citrix ADC/NS FAST Templates"
7477
}
7578
]
7679
},
@@ -110,13 +113,26 @@
110113
"category": "F5-Flipper",
111114
"enablement": "view == nsConfigView"
112115
},
116+
{
117+
"command": "f5-flipper.templateExploreRefresh",
118+
"title": "Refresh",
119+
"category": "F5-Flipper",
120+
"icon": "$(refresh)",
121+
"enablement": "view == nsTemplatesView"
122+
},
113123
{
114124
"command": "f5-flipper.viewJson",
115125
"title": "JSON Output",
116126
"category": "F5-Flipper",
117127
"icon": "$(json)",
118128
"enablement": "view == nsConfigView"
119129
},
130+
{
131+
"command": "f5-flipper.afton",
132+
"title": "AFTON",
133+
"category": "F5-Flipper",
134+
"enablement": "view == nsConfigView"
135+
},
120136
{
121137
"command": "f5-flipper.diagRulesOpen",
122138
"title": "Citrix NS/ADC diagnostics: Open Rules",
@@ -127,6 +143,11 @@
127143
],
128144
"menus": {
129145
"view/title": [
146+
{
147+
"command": "f5-flipper.templateExploreRefresh",
148+
"when": "view == nsTemplatesView",
149+
"group": "navigation"
150+
},
130151
{
131152
"command": "f5-flipper.cfgExploreClear",
132153
"when": "view == nsConfigView",
@@ -144,6 +165,11 @@
144165
"when": "view == nsConfigView && viewItem =~ /(appsHeader|gslbHeader)/",
145166
"group": "inline"
146167
},
168+
{
169+
"command": "f5-flipper.afton",
170+
"when": "view == nsConfigView && viewItem =~ /(appsHeader)/",
171+
"group": "inline"
172+
},
147173
{
148174
"command": "f5-flipper.viewJson",
149175
"when": "view == nsConfigView && viewItem =~ /(nsApp|nsGSLB)/",

src/CitrixADC.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { digCsVservers } from './digCsVserver';
99
import { digLbVserver } from './digLbVserver';
1010
import { digGslbVservers } from './digGslbVserver';
1111
import { digCStoLBreferences } from './digCStoLbRefs';
12-
import intLogger from './intLogger';
1312
import { logger } from './logger';
1413
import { AdcApp, AdcConfObj, AdcRegExTree, ConfigFile, Explosion, Stats } from './models'
1514
import { countMainObjects } from './objectCounter';
@@ -201,7 +200,7 @@ export default class ADC extends EventEmitter {
201200
sources: this.configFiles,
202201
},
203202
stats: this.stats, // add stats object
204-
logs: await this.logs() // get all the processing logs
203+
// logs: await this.logs() // get all the processing logs
205204
}
206205

207206
if (apps.length > 0) {
@@ -215,14 +214,6 @@ export default class ADC extends EventEmitter {
215214
return retObj;
216215
}
217216

218-
/**
219-
* Get processing logs
220-
*/
221-
async logs(): Promise<string[]> {
222-
return intLogger.getLogs();
223-
}
224-
225-
226217
/**
227218
* extracts app(s)
228219
* @param app single app string
@@ -305,13 +296,13 @@ export default class ADC extends EventEmitter {
305296
//found adc version, grab build (split off first line, then split build by spaces)
306297
const build = config.split('\n')[0].split(' ')[2]
307298

308-
intLogger.info(`Recieved .conf file of version: ${this.adcVersion}`)
299+
logger.info(`Recieved .conf file of version: ${this.adcVersion}`)
309300

310301
// return details
311302
return [version[1], build];
312303
} else {
313304
const msg = 'citrix adc/ns version not detected, defaulting to v13.0'
314-
intLogger.error(msg)
305+
logger.error(msg)
315306
return ['13.0', '000'];
316307
// throw new Error(msg)
317308
}

src/codeLens.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import {
1111
Event as VsEvent,
1212
workspace
1313
} from "vscode";
14-
import { ext } from "./extensionVariables";
15-
import { globSync } from 'glob';
1614

1715

1816

@@ -100,36 +98,8 @@ export class NsCodeLensProvider implements CodeLensProvider {
10098
)
10199
);
102100

103-
// get template directory /templates/as3
104-
// list file names *.yaml
105-
// push a codeLens per file as3/tcp, as3/http, as3/https
106-
const baseDir = path.join(__dirname, '..', 'templates', 'as3');
107-
let filesPaths: string[] = globSync('*.yaml', { cwd: baseDir })
108-
109-
filesPaths.forEach((template) => {
110-
template = template.split('.')[0]
111-
const title = path.join('as3', template);
112-
const thirdLine = new Range(2, 0, 2, 0);
113-
codeLens.push(
114-
new CodeLens(
115-
secondLine,
116-
{
117-
command: 'f5-flipper.convert2AS3',
118-
title,
119-
arguments: [{document, template: title}]
120-
}
121-
)
122-
);
123-
})
124101
}
125102

126-
127-
128-
// if (cDoc) {
129-
130-
131-
// }
132-
133103
return codeLens;
134104
}
135105
}

src/extension.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ import { NsDiag } from './nsDiag';
2121
import { Hovers } from './hovers';
2222
import { NsCodeLensProvider } from './codeLens';
2323
import { FastCore } from './fastCore';
24+
import { NsTemplateProvider } from './templateViewProvider';
25+
26+
ext.logger = logger;
2427

2528
// turn off console logging
26-
logger.console = false;
29+
ext.logger.console = false;
30+
// turn off local logger buffer since vscode OUTPUT is the buffer
31+
logger.buffer = false;
2732

2833
// create OUTPUT channel
2934
const f5FlipperOutputChannel = window.createOutputChannel('f5-flipper');
@@ -52,9 +57,10 @@ export async function activateInternal(context: ExtensionContext) {
5257
userInfo: JSON.stringify(os.userInfo())
5358
});
5459

60+
5561
// initialize extension settings
5662
await initSettings(context);
57-
63+
5864
// load ext config to ext.settings.
5965
await loadSettings();
6066

src/extensionVariables.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import { NsDiag } from './nsDiag';
1919
import { NsCfgProvider } from './nsCfgViewProvider';
2020
import { NsCodeLensProvider } from './codeLens';
2121
import { FastCore } from './fastCore';
22+
import { NsTemplateProvider } from './templateViewProvider';
23+
import Logger from 'f5-conx-core/dist/logger';
2224

2325

2426
/**
@@ -31,7 +33,9 @@ export namespace ext {
3133
export let telemetry: Telemetry;
3234
export let nsDiag: NsDiag;
3335
export let fast: FastCore;
36+
export let logger: Logger;
3437
export let nsCfgProvider: NsCfgProvider;
38+
export let nsTemplateProvider: NsTemplateProvider;
3539
export let nsCodeLens: NsCodeLensProvider;
3640
export let eventEmitterGlobal: EventEmitter;
3741
export let connectBar: StatusBarItem;
@@ -123,7 +127,7 @@ export async function loadSettings() {
123127
// plugin preview setting to view context
124128
commands.executeCommand('setContext', 'f5-flipper.preview', ext.settings.preview);
125129

126-
process.env.F5_VSCODE_LOG_LEVEL = f5Cfg.get<string>('logLevel', 'INFO');
130+
process.env.F5_VSCODE_FLIPPER_LOG_LEVEL = f5Cfg.get<string>('logLevel', 'INFO');
127131

128132
const tenv = f5Cfg.get<boolean>('TEEM', true).toString();
129133
if(tenv === 'true') {

src/fastCore.ts

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { ext } from './extensionVariables';
1919
import fast from '@f5devcentral/f5-fast-core';
2020
import path from 'path';
2121
import { FastWebView } from './fastWebView';
22+
import { NsTemplateProvider } from './templateViewProvider';
2223

2324
/**
2425
* Provides command to download github releases of this extension so users can easily access beta versions for testing
@@ -31,18 +32,41 @@ export class FastCore {
3132

3233
this.panel = new FastWebView(ctx);
3334

34-
3535
ctx.subscriptions.push(commands.registerCommand('f5-flipper.convert2AS3', async (doc) => {
3636

3737
ext.telemetry.capture({ command: 'f5-flipper.convert2AS3' });
3838

39-
// window.showInformationMessage('conversion outputs are in development!')
40-
4139
logger.info('f5-flipper.convert2AS3, pulling up fast template');
4240

43-
this.panel.renderHTML(doc.document, doc.template);
41+
const docText = JSON.parse(doc.document.getText());
42+
43+
this.panel.renderHTML(docText, doc.template);
44+
45+
46+
47+
}));
48+
49+
50+
51+
ext.nsTemplateProvider = new NsTemplateProvider(ctx);
52+
const templateView = window.createTreeView('nsTemplatesView', {
53+
treeDataProvider: ext.nsTemplateProvider,
54+
showCollapseAll: true
55+
});
56+
57+
ctx.subscriptions.push(commands.registerCommand('f5-flipper.templateExploreRefresh', async (text) => {
58+
// logger.info('Refreshing NS FAST Templates view');
59+
ext.nsTemplateProvider.refresh();
60+
}));
61+
62+
63+
ctx.subscriptions.push(commands.registerCommand('f5-flipper.afton', async (text) => {
64+
// logger.info('Refreshing NS FAST Templates view');
65+
const converted = ext.nsCfgProvider.bulk();
66+
}));
67+
4468

45-
}));
69+
4670
}
4771

4872
}

0 commit comments

Comments
 (0)