Skip to content

Commit

Permalink
Merge pull request #33 from f5devcentral/v1.10.0
Browse files Browse the repository at this point in the history
1.10 work final
  • Loading branch information
DumpySquare authored Apr 30, 2024
2 parents 6edf74b + 13f251b commit 3ecb442
Show file tree
Hide file tree
Showing 28 changed files with 2,017 additions and 392 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
### Fixed


---

## [1.10.0] - (04-30-2024)

### Added

- Moved FAST templates to dedicated view outside of Citrix ADC exploring
- 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/...)
- refresh button for this view
- AFTON command to process bulk conversions
- This work flow is still in progress. There is a key difference in how the HTML view mutates the NS config data
- increased and streamlined ns app parameter mutating for FAST templates


### Fixed

- Logger now works with env logging levels of (info/warn/error/debug)
- Updated FAST templates from latest work/testing

---

## [1.8.0] - (04-10-2024)
Expand Down
30 changes: 28 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "F5 Flipper",
"description": "Breaking down Citrix NetScaler ADC configs",
"publisher": "F5DevCentral",
"version": "1.8.0",
"version": "1.10.0",
"keywords": [
"F5",
"F5Networks",
Expand All @@ -21,7 +21,6 @@
"theme": "light"
},
"activationEvents": [
"onCommand:f5-flipper.cfgExplore",
"onView:f5-ns-container"
],
"main": "./out/extLoader.js",
Expand Down Expand Up @@ -71,6 +70,10 @@
{
"id": "nsConfigView",
"name": "Citrix ADC/NS Config Explorer"
},
{
"id": "nsTemplatesView",
"name": "Citrix ADC/NS FAST Templates"
}
]
},
Expand Down Expand Up @@ -110,13 +113,26 @@
"category": "F5-Flipper",
"enablement": "view == nsConfigView"
},
{
"command": "f5-flipper.templateExploreRefresh",
"title": "Refresh",
"category": "F5-Flipper",
"icon": "$(refresh)",
"enablement": "view == nsTemplatesView"
},
{
"command": "f5-flipper.viewJson",
"title": "JSON Output",
"category": "F5-Flipper",
"icon": "$(json)",
"enablement": "view == nsConfigView"
},
{
"command": "f5-flipper.afton",
"title": "AFTON",
"category": "F5-Flipper",
"enablement": "view == nsConfigView"
},
{
"command": "f5-flipper.diagRulesOpen",
"title": "Citrix NS/ADC diagnostics: Open Rules",
Expand All @@ -127,6 +143,11 @@
],
"menus": {
"view/title": [
{
"command": "f5-flipper.templateExploreRefresh",
"when": "view == nsTemplatesView",
"group": "navigation"
},
{
"command": "f5-flipper.cfgExploreClear",
"when": "view == nsConfigView",
Expand All @@ -144,6 +165,11 @@
"when": "view == nsConfigView && viewItem =~ /(appsHeader|gslbHeader)/",
"group": "inline"
},
{
"command": "f5-flipper.afton",
"when": "view == nsConfigView && viewItem =~ /(appsHeader)/",
"group": "inline"
},
{
"command": "f5-flipper.viewJson",
"when": "view == nsConfigView && viewItem =~ /(nsApp|nsGSLB)/",
Expand Down
15 changes: 3 additions & 12 deletions src/CitrixADC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { digCsVservers } from './digCsVserver';
import { digLbVserver } from './digLbVserver';
import { digGslbVservers } from './digGslbVserver';
import { digCStoLBreferences } from './digCStoLbRefs';
import intLogger from './intLogger';
import { logger } from './logger';
import { AdcApp, AdcConfObj, AdcRegExTree, ConfigFile, Explosion, Stats } from './models'
import { countMainObjects } from './objectCounter';
Expand Down Expand Up @@ -201,7 +200,7 @@ export default class ADC extends EventEmitter {
sources: this.configFiles,
},
stats: this.stats, // add stats object
logs: await this.logs() // get all the processing logs
// logs: await this.logs() // get all the processing logs
}

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

/**
* Get processing logs
*/
async logs(): Promise<string[]> {
return intLogger.getLogs();
}


/**
* extracts app(s)
* @param app single app string
Expand Down Expand Up @@ -305,13 +296,13 @@ export default class ADC extends EventEmitter {
//found adc version, grab build (split off first line, then split build by spaces)
const build = config.split('\n')[0].split(' ')[2]

intLogger.info(`Recieved .conf file of version: ${this.adcVersion}`)
logger.info(`Recieved .conf file of version: ${this.adcVersion}`)

// return details
return [version[1], build];
} else {
const msg = 'citrix adc/ns version not detected, defaulting to v13.0'
intLogger.error(msg)
logger.error(msg)
return ['13.0', '000'];
// throw new Error(msg)
}
Expand Down
30 changes: 0 additions & 30 deletions src/codeLens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {
Event as VsEvent,
workspace
} from "vscode";
import { ext } from "./extensionVariables";
import { globSync } from 'glob';



Expand Down Expand Up @@ -100,36 +98,8 @@ export class NsCodeLensProvider implements CodeLensProvider {
)
);

// get template directory /templates/as3
// list file names *.yaml
// push a codeLens per file as3/tcp, as3/http, as3/https
const baseDir = path.join(__dirname, '..', 'templates', 'as3');
let filesPaths: string[] = globSync('*.yaml', { cwd: baseDir })

filesPaths.forEach((template) => {
template = template.split('.')[0]
const title = path.join('as3', template);
const thirdLine = new Range(2, 0, 2, 0);
codeLens.push(
new CodeLens(
secondLine,
{
command: 'f5-flipper.convert2AS3',
title,
arguments: [{document, template: title}]
}
)
);
})
}



// if (cDoc) {


// }

return codeLens;
}
}
10 changes: 8 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ import { NsDiag } from './nsDiag';
import { Hovers } from './hovers';
import { NsCodeLensProvider } from './codeLens';
import { FastCore } from './fastCore';
import { NsTemplateProvider } from './templateViewProvider';

ext.logger = logger;

// turn off console logging
logger.console = false;
ext.logger.console = false;
// turn off local logger buffer since vscode OUTPUT is the buffer
logger.buffer = false;

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


// initialize extension settings
await initSettings(context);

// load ext config to ext.settings.
await loadSettings();

Expand Down
6 changes: 5 additions & 1 deletion src/extensionVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { NsDiag } from './nsDiag';
import { NsCfgProvider } from './nsCfgViewProvider';
import { NsCodeLensProvider } from './codeLens';
import { FastCore } from './fastCore';
import { NsTemplateProvider } from './templateViewProvider';
import Logger from 'f5-conx-core/dist/logger';


/**
Expand All @@ -31,7 +33,9 @@ export namespace ext {
export let telemetry: Telemetry;
export let nsDiag: NsDiag;
export let fast: FastCore;
export let logger: Logger;
export let nsCfgProvider: NsCfgProvider;
export let nsTemplateProvider: NsTemplateProvider;
export let nsCodeLens: NsCodeLensProvider;
export let eventEmitterGlobal: EventEmitter;
export let connectBar: StatusBarItem;
Expand Down Expand Up @@ -123,7 +127,7 @@ export async function loadSettings() {
// plugin preview setting to view context
commands.executeCommand('setContext', 'f5-flipper.preview', ext.settings.preview);

process.env.F5_VSCODE_LOG_LEVEL = f5Cfg.get<string>('logLevel', 'INFO');
process.env.F5_VSCODE_FLIPPER_LOG_LEVEL = f5Cfg.get<string>('logLevel', 'INFO');

const tenv = f5Cfg.get<boolean>('TEEM', true).toString();
if(tenv === 'true') {
Expand Down
34 changes: 29 additions & 5 deletions src/fastCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { ext } from './extensionVariables';
import fast from '@f5devcentral/f5-fast-core';
import path from 'path';
import { FastWebView } from './fastWebView';
import { NsTemplateProvider } from './templateViewProvider';

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

this.panel = new FastWebView(ctx);


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

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

// window.showInformationMessage('conversion outputs are in development!')

logger.info('f5-flipper.convert2AS3, pulling up fast template');

this.panel.renderHTML(doc.document, doc.template);
const docText = JSON.parse(doc.document.getText());

this.panel.renderHTML(docText, doc.template);



}));



ext.nsTemplateProvider = new NsTemplateProvider(ctx);
const templateView = window.createTreeView('nsTemplatesView', {
treeDataProvider: ext.nsTemplateProvider,
showCollapseAll: true
});

ctx.subscriptions.push(commands.registerCommand('f5-flipper.templateExploreRefresh', async (text) => {
// logger.info('Refreshing NS FAST Templates view');
ext.nsTemplateProvider.refresh();
}));


ctx.subscriptions.push(commands.registerCommand('f5-flipper.afton', async (text) => {
// logger.info('Refreshing NS FAST Templates view');
const converted = ext.nsCfgProvider.bulk();
}));


}));
}

}
Expand Down
Loading

0 comments on commit 3ecb442

Please sign in to comment.