Skip to content

Commit

Permalink
Merge pull request #27 from f5devcentral/v1.5.0
Browse files Browse the repository at this point in the history
3.25 work
  • Loading branch information
DumpySquare authored Mar 25, 2024
2 parents 8551f5a + fb6d1e4 commit 0d5f391
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 19 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
### Fixed


---

## [1.5.0] - (03-25-2024)

### Added
- A second report that is better formated for capturing application output
- added line count to application description in view list

### Changed
- sorting application list by name (alpha-descending)

---

## [1.4.0] - (03-21-2024)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion 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.4.0",
"version": "1.5.0",
"keywords": [
"F5",
"F5Networks",
Expand Down Expand Up @@ -93,6 +93,11 @@
"icon": "$(output)",
"enablement": "view == nsConfigView"
},
{
"command": "f5-flipper.report2",
"title": "Flipper Report 2",
"category": "F5-Flipper"
},
{
"command": "f5-flipper.csv",
"title": "CSV",
Expand Down
43 changes: 43 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,49 @@ export async function activateInternal(context: ExtensionContext) {
}));

// context.subscriptions.push(disposable);

context.subscriptions.push(commands.registerCommand('f5-flipper.report2', async (text) => {

// build report header
const report: any = {
hostname: ext.nsCfgProvider.explosion.hostname,
repo: context.extension.packageJSON.repository.url,
issues: context.extension.packageJSON.bugs.url,
extensionVersion: context.extension.packageJSON.version,
id: ext.nsCfgProvider.explosion.id,
inputFileType: ext.nsCfgProvider.explosion.inputFileType,
dateTime: ext.nsCfgProvider.explosion.dateTime,
stats: ext.nsCfgProvider.explosion.stats,
appCount: ext.nsCfgProvider.explosion.config.apps.length
}


// build apps
const apps = []
for (const app of ext.nsCfgProvider.explosion.config.apps) {
const appCopy = JSON.parse(JSON.stringify(app))
delete appCopy.lines;
delete appCopy.diagnostics

apps.push(appCopy)

}

report.apps = apps;

// put all the content together
const content = JSON.stringify( report, undefined, 4);

// var vDoc: Uri = Uri.parse("untitled:" + 'CitrixADC_Report2.yml');
return await workspace.openTextDocument({ language: 'json', content})
.then(async (doc) => {
await window.showTextDocument(doc);
// this.documents.push(doc); // add the document to this class doc list
return doc;
});


}))
}


Expand Down
32 changes: 16 additions & 16 deletions src/nsCfgViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export class NsCfgProvider implements TreeDataProvider<NsCfgApp> {
if (element.label === 'Apps') {
this.explosion.config.apps.filter(x => x.type === 'cs' || x.type === 'lb')
.forEach(app => {
const descA = [app.type]
const descA = [`(${app.lines.length})`, app.type]
descA.push(`${app.ipAddress}:${app.port}`);
const desc = descA.join(' - ');
const clonedApp = JSON.parse(JSON.stringify(app));
Expand Down Expand Up @@ -258,21 +258,21 @@ export class NsCfgProvider implements TreeDataProvider<NsCfgApp> {
));
})

// prep for a future flag
if (true) {
// sort tree items based on app IP, descending to put all the 0.0.0.0 at the bottom
treeItems.sort((a, b) => {
const x = a.label;
const y = b.label;
const xIp = this.explosion.config.apps.find(f => f.name === x);
const yIp = this.explosion.config.apps.find(f => f.name === y);
// https://stackoverflow.com/questions/48618635/require-sorting-on-ip-address-using-js
const num1 = Number(xIp.ipAddress.split(".").map((num) => (`000${num}`).slice(-3)).join(""));
const num2 = Number(yIp.ipAddress.split(".").map((num) => (`000${num}`).slice(-3)).join(""));
return num2 - num1; // return descending
});
}
treeItems;
// // prep for a future flag
// if (true) {
// // sort tree items based on app IP, descending to put all the 0.0.0.0 at the bottom
// treeItems.sort((a, b) => {
// const x = a.label;
// const y = b.label;
// const xIp = this.explosion.config.apps.find(f => f.name === x);
// const yIp = this.explosion.config.apps.find(f => f.name === y);
// // https://stackoverflow.com/questions/48618635/require-sorting-on-ip-address-using-js
// const num1 = Number(xIp.ipAddress.split(".").map((num) => (`000${num}`).slice(-3)).join(""));
// const num2 = Number(yIp.ipAddress.split(".").map((num) => (`000${num}`).slice(-3)).join(""));
// return num2 - num1; // return descending
// });
// }
sortTreeItems(treeItems);

} else if (element.label === 'GSLB') {

Expand Down

0 comments on commit 0d5f391

Please sign in to comment.