Skip to content

Commit 9a0dc6c

Browse files
authored
3.13 (#218)
* diag rule tweak * version bump and deps update * #206 tweaks * teem tweak * remoteCommand #211 * next api disable * final 3.13 update * test tweaks
1 parent dc381de commit 9a0dc6c

File tree

10 files changed

+302
-176
lines changed

10 files changed

+302
-176
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,32 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
1313

1414
### Added
1515

16+
- [RFE] Can't delete tmsh scripts #214
17+
1618
### Changed
1719

20+
21+
### Fixed
22+
23+
- [RFE] Config Explorer doesn't include cipher groups with the applications #213
24+
25+
---
26+
27+
## [3.13.0] - (06-20-2023)
28+
29+
### Added
30+
31+
- [RFE] add history to remote command execute #211
32+
1833
### Fixed
1934

35+
- f5-corkscrew v1.3.0
36+
- [BUG] Monitor no more display in Config explorer #217
37+
- deps updates
38+
- [BUG] Error running command f5.addHost: command 'f5.addHost' not found. #206
39+
- [BUG] Error connecting to BIG-IP --- TypeError: Cannot read properties of undefined (reading 'paths') #215
40+
41+
2042
---
2143

2244
## [3.12.1] - (05-24-2022)

diagRules/tmosXcRules.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"code": "9929",
9595
"severity": "Warning",
9696
"title": "TMOS Route Domain not supported",
97-
"message": "Route domains are note support in XC",
97+
"message": "Route domains are not support in XC",
9898
"regex": "destination [\\S]+%(\\d{1,2}):\\d{1,5}"
9999
},
100100
{

package-lock.json

Lines changed: 97 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "The F5 Extension",
44
"description": "Supercharge your F5 automation development",
55
"publisher": "F5DevCentral",
6-
"version": "3.12.2",
6+
"version": "3.13.0",
77
"keywords": [
88
"F5",
99
"F5Networks",
@@ -58,8 +58,8 @@
5858
"@types/mocha": "^7.0.1",
5959
"@types/node": "^14.18.1",
6060
"@types/vscode": "^1.63.0",
61-
"@typescript-eslint/eslint-plugin": "^5.10.0",
62-
"@typescript-eslint/parser": "^5.10.0",
61+
"@typescript-eslint/eslint-plugin": "^5.60.0",
62+
"@typescript-eslint/parser": "^5.60.0",
6363
"@vscode/test-electron": "^2.2.1",
6464
"eslint": "^8.12.0",
6565
"glob": "^7.1.6",
@@ -73,7 +73,7 @@
7373
"@f5devcentral/f5-fast-core": "^0.19.1",
7474
"ajv": "^8.11.2",
7575
"f5-conx-core": "^0.17.2",
76-
"f5-corkscrew": "^1.1.3",
76+
"f5-corkscrew": "^1.2.0",
7777
"js-yaml": "^4.0.0",
7878
"keytar": "^7.9.0",
7979
"openapi-data-validator": "^2.0.44"
@@ -99,7 +99,7 @@
9999
"activationEvents": [
100100
"*"
101101
],
102-
"main": "./out/extLoader.js",
102+
"main": "./out/extension.js",
103103
"contributes": {
104104
"snippets": [
105105
{
@@ -206,7 +206,7 @@
206206
{
207207
"id": "nxtApiView",
208208
"name": "NEXT API",
209-
"when": "f5.preview"
209+
"when": "false"
210210
},
211211
{
212212
"id": "fastView",
@@ -643,6 +643,7 @@
643643
{
644644
"command": "f5.refreshNextApiTree",
645645
"title": "Refresh NEXT OPENAPI View",
646+
"enablement": "false",
646647
"category": "F5",
647648
"icon": "$(refresh)"
648649
},

src/extLoader.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ const perfStats: PerfStats = {
1515
// Object.defineProperty(exports, "__esModule", { value: true });
1616

1717
import { ExtensionContext } from 'vscode';
18-
import { activateInternal, deactivateInternal } from './extension';
18+
import {
19+
activate as activateInternal,
20+
deactivate as deactivateInternal
21+
} from './extension';
1922

2023
// while this may load the code/references, it will be empty
2124
import { ext } from './extensionVariables';

src/extension.ts

Lines changed: 130 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
Range,
2828
Position,
2929
languages,
30+
ThemeIcon,
3031
} from 'vscode';
3132
import jsYaml from 'js-yaml';
3233
import * as path from 'path';
@@ -64,6 +65,7 @@ import { Telemetry } from './telemetry';
6465
import { XcDiag } from './tmosXcDiag';
6566
import { NextApi } from './nextApi';
6667
import { CodeLensProvider } from './codeLens';
68+
import { createRequire } from 'module';
6769

6870
// turn off console logging
6971
logger.console = false;
@@ -78,7 +80,7 @@ logger.output = function (log: string) {
7880

7981

8082
// provide extension functions for activation
81-
export async function activateInternal(context: ExtensionContext) {
83+
export async function activate(context: ExtensionContext) {
8284

8385
process.on('unhandledRejection', error => {
8486
logger.error('--- unhandledRejection ---', error);
@@ -141,7 +143,7 @@ export async function activateInternal(context: ExtensionContext) {
141143

142144
new CfCore(context);
143145

144-
new NextApi(context, ext.eventEmitterGlobal);
146+
// new NextApi(context, ext.eventEmitterGlobal);
145147

146148
languages.registerCodeLensProvider({
147149
language: 'json',
@@ -932,32 +934,132 @@ export async function activateInternal(context: ExtensionContext) {
932934

933935
ext.telemetry.capture({ command: 'f5.remoteCommand' });
934936

935-
// todo: add a setting to hold the command and future history
936-
await window.showQuickPick(
937-
[
938-
'cat /config/bigip.conf',
939-
'cat bigip.license',
940-
'tail -100 /var/log/ltm',
941-
'tmsh show /apm license'
942-
],{
943-
ignoreFocusOut: true,
944-
title: 'Enter command to execute on the BIG-IP'
945-
})
946-
.then(async cmd => {
947-
948-
if (cmd) {
949-
950-
await ext.f5Client?.https(`/mgmt/tm/util/bash`, {
951-
method: 'POST',
952-
data: {
953-
command: 'run',
954-
utilCmdArgs: `-c '${cmd}'`
955-
}
956-
})
957-
.then(resp => ext.panel.render(resp.data.commandResult))
958-
.catch(err => logger.error('bash command failed:', err));
937+
// get the cmd history from vscode global state
938+
const histary: string[] = context.globalState.get('f5-rc-history', []);
939+
940+
const historyDefaults = [
941+
'cat /config/bigip.conf',
942+
'cat bigip.license',
943+
'tail -100 /var/log/ltm',
944+
'tmsh show /apm license'
945+
];
946+
947+
const cmd = await new Promise((resolve) => {
948+
949+
const qp = window.createQuickPick()
950+
951+
//build all the history items with delete buttons
952+
const i = histary.map(label => ({
953+
label,
954+
buttons: [{ iconPath: new ThemeIcon("trash"), tooltip: "Remove this item" }]
955+
}))
956+
957+
// build all the defaults (no delete button)
958+
const ii = historyDefaults.map(label => ({ label }))
959+
960+
// spread all the options together
961+
qp.items = [...i, ...ii];
962+
963+
// allow focus out
964+
qp.ignoreFocusOut = true;
965+
966+
// event for history button (trash)
967+
qp.onDidTriggerItemButton(async (_button) => {
968+
969+
// isolat the value
970+
const item = _button.item.label;
971+
972+
// filter out this button item from the history array
973+
const newHistary = histary.filter(x => x !== item)
974+
// clear the history array
975+
histary.length = 0
976+
// spread all the filtered records back into the history array
977+
histary.push(...newHistary)
978+
979+
// rerun the command to get new values
980+
return commands.executeCommand('f5.remoteCommand')
981+
982+
}),
983+
984+
qp.onDidAccept(a => {
985+
986+
// main quick pick object
987+
const b = qp;
988+
// if new item typed in
989+
const bv = b.value;
990+
// if existing item selected;
991+
const bs = b.selectedItems[0]?.label;
992+
993+
resolve(bv || bs);
994+
qp.hide();
995+
})
996+
997+
qp.show();
998+
}) as string;
999+
1000+
if (cmd) {
1001+
1002+
// console.log(cmd)
1003+
1004+
await ext.f5Client?.https(`/mgmt/tm/util/bash`, {
1005+
method: 'POST',
1006+
data: {
1007+
command: 'run',
1008+
utilCmdArgs: `-c '${cmd}'`
9591009
}
960-
});
1010+
})
1011+
.then(resp => {
1012+
1013+
// render the output for the user
1014+
ext.panel.render(resp.data.commandResult)
1015+
1016+
// is command part of the historyDefaults
1017+
const isDefaultCmd = historyDefaults.indexOf(cmd);
1018+
1019+
if (isDefaultCmd < 0) {
1020+
1021+
//is command already in the history
1022+
const idx = histary.indexOf(cmd)
1023+
1024+
// command is not in history
1025+
if(idx < 0) {
1026+
1027+
// add the cmd to the top of the history array
1028+
histary.unshift(cmd)
1029+
1030+
} else {
1031+
1032+
// command found in history
1033+
// remove command by index
1034+
histary.splice(idx, 1)
1035+
// re-add command back to the top
1036+
histary.unshift(cmd)
1037+
}
1038+
1039+
// if we exceed 5, remove oldest
1040+
if (histary.length > 5) histary.pop();
1041+
1042+
// save the array to the vscode global state
1043+
context.globalState.update('f5-rc-history', histary)
1044+
}
1045+
1046+
})
1047+
.catch(err => logger.error('bash command failed:', err));
1048+
}
1049+
1050+
1051+
// }
1052+
1053+
1054+
1055+
// // merge the history and defaults to disply for user, with latest history on top
1056+
// await window.showQuickPick([...histary, ...historyDefaults], {
1057+
// ignoreFocusOut: true,
1058+
// title: 'Enter command to execute on the BIG-IP'
1059+
// })
1060+
// .then(async cmd => {
1061+
1062+
9611063

9621064
}));
9631065

@@ -969,6 +1071,6 @@ export async function activateInternal(context: ExtensionContext) {
9691071

9701072

9711073
// this method is called when your extension is deactivated
972-
export async function deactivateInternal(context: ExtensionContext) {
1074+
export async function deactivate(context: ExtensionContext) {
9731075
// log deactivation event
9741076
}

src/extensionVariables.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export async function loadSettings() {
169169

170170
process.env.F5_VSCODE_LOG_LEVEL = f5Cfg.get('logLevel');
171171

172-
process.env[ext.teemEnv] = f5Cfg.get('f5.TEEM')!;
172+
process.env[ext.teemEnv] = f5Cfg.get('TEEM');
173173

174174
process.env.F5_CONX_CORE_REJECT_UNAUTORIZED = f5Cfg.get('rejectUnauthorizedBIGIP')!.toString();
175175

0 commit comments

Comments
 (0)