Skip to content

Commit 95f4875

Browse files
authored
telemetry/nextApi clean up (#220)
1 parent 9a0dc6c commit 95f4875

File tree

7 files changed

+111
-123
lines changed

7 files changed

+111
-123
lines changed

.github/workflows/main.yml

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches: [main]
66

77
env:
8-
NODE_VERSION: 16.x
8+
NODE_VERSION: 16
99

1010
jobs:
1111

@@ -29,16 +29,18 @@ jobs:
2929

3030
package-release-publish:
3131
runs-on: ubuntu-latest
32+
permissions:
33+
contents: write
3234
environment: publishing
3335
# needs: test
3436
name: Package-Release-Publish
3537
steps:
3638

3739
- name: Checkout code
38-
uses: actions/checkout@v2
40+
uses: actions/checkout@v3
3941

4042
- name: setup node.js ${{ env.NODE_VERSION }}
41-
uses: actions/setup-node@v2
43+
uses: actions/setup-node@v3
4244
with:
4345
node-version: ${{ env.NODE_VERSION }}
4446

@@ -51,10 +53,11 @@ jobs:
5153
- name: install open-vsix marketplace cli (ovsx)
5254
run: npm install -g ovsx
5355

54-
- name: install teem keys
55-
run: echo "${{ secrets.TEEM_KEY }}" >> TEEM_KEY
56+
# - name: install teem keys
57+
# run: echo "${{ secrets.TEEM_KEY }}" >> TEEM_KEY
5658

5759
- name: package extension
60+
id: vsce
5861
run: vsce package
5962

6063
- name: get extension path
@@ -66,43 +69,42 @@ jobs:
6669
- name: get extension version
6770
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
6871

69-
- name: capture latest release notes
70-
run: |
71-
echo "RELEASE_NOTE<<EOF" >> $GITHUB_ENV
72-
echo "$(node src/scripts/changelog.js)" >> $GITHUB_ENV
73-
echo "" >> $GITHUB_ENV
74-
echo "See [CHANGE LOG](https://github.com/f5devcentral/vscode-f5/blob/main/README.md) for full details and history." >> $GITHUB_ENV
75-
echo "" >> $GITHUB_ENV
76-
echo 'EOF' >> $GITHUB_ENV
72+
# https://github.com/marketplace/actions/changelog-reader
73+
- name: Get Changelog Entry
74+
id: changelog_reader
75+
uses: mindsers/changelog-reader-action@v2
76+
with:
77+
validation_level: warn
78+
version: ${{ env.PACKAGE_VERSION }}
79+
path: ./CHANGELOG.md
7780

7881
- name: create upload artifacts
79-
uses: actions/upload-artifact@v2
82+
uses: actions/upload-artifact@v3
8083
with:
8184
path: ${{ env.VSIX_PATH }}
8285
name: ${{ env.VSIX_NAME }}
8386

8487
- name: create github release
85-
uses: actions/create-release@v1
88+
uses: ncipollo/release-action@v1
8689
id: create_release
87-
env:
88-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8990
with:
90-
tag_name: v${{ env.PACKAGE_VERSION }}
91-
release_name: ${{ env.VSIX_NAME }}
92-
body: "${{env.RELEASE_NOTE}}"
91+
tag: v${{ env.PACKAGE_VERSION }}
92+
name: ${{ env.VSIX_NAME }}
93+
body: "${{ steps.changelog_reader.outputs.changes }}"
94+
artifacts: ${{ env.VSIX_NAME }}
9395
draft: false
9496
prerelease: false
9597

96-
- name: upload releases
97-
uses: actions/upload-release-asset@v1
98-
env:
99-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100-
PUBLISH_TOKEN: ${{ secrets.MARKETPLACE_PUBLISH_KEY }}
101-
with:
102-
upload_url: ${{ steps.create_release.outputs.upload_url }}
103-
asset_path: ${{ env.VSIX_PATH }}
104-
asset_name: ${{ env.VSIX_NAME }}
105-
asset_content_type: application/zip
98+
# - name: upload releases
99+
# uses: actions/upload-release-asset@v1
100+
# env:
101+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
# PUBLISH_TOKEN: ${{ secrets.MARKETPLACE_PUBLISH_KEY }}
103+
# with:
104+
# upload_url: ${{ steps.create_release.outputs.upload_url }}
105+
# asset_path: ${{ env.VSIX_PATH }}
106+
# asset_name: ${{ env.VSIX_NAME }}
107+
# asset_content_type: application/zip
106108

107109
- name: publish to marketplace
108110
run: vsce publish -i ${{ env.VSIX_PATH }} -p ${{ secrets.MARKETPLACE_PUBLISH_KEY }}

CHANGELOG.md

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

2525
---
2626

27+
## [3.13.1] - (06-21-2023)
28+
29+
### Changed
30+
31+
- updated github actions for testing/building/deployment of extension to marketplace
32+
33+
### Fixed
34+
35+
- [BUG] Error running command f5.addHost: command 'f5.addHost' not found. #206 (continued...)
36+
- more nextApi and telemetry clean up
37+
38+
---
39+
2740
## [3.13.0] - (06-20-2023)
2841

2942
### Added

package.json

Lines changed: 1 addition & 17 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.13.0",
6+
"version": "3.13.1",
77
"keywords": [
88
"F5",
99
"F5Networks",
@@ -181,10 +181,6 @@
181181
{
182182
"view": "cfgTree",
183183
"contents": "Import TMOS Config to explore.\n[Import .conf/UCS/QKVIEW from local file](command:f5.cfgExplore)\n[Documentation](https://f5devcentral.github.io/vscode-f5/#/config_explorer)"
184-
},
185-
{
186-
"view": "nxtApiView",
187-
"contents": "Connect to a NEXT instance to explore OpenAPI.\n[Browse CM OPENAPI (local)](command:f5.refreshNextApiTreeLocal)"
188184
}
189185
],
190186
"views": {
@@ -640,13 +636,6 @@
640636
"category": "F5",
641637
"icon": "$(refresh)"
642638
},
643-
{
644-
"command": "f5.refreshNextApiTree",
645-
"title": "Refresh NEXT OPENAPI View",
646-
"enablement": "false",
647-
"category": "F5",
648-
"icon": "$(refresh)"
649-
},
650639
{
651640
"command": "f5.cfgExploreRefresh",
652641
"title": "Refresh Config Explorer",
@@ -1079,11 +1068,6 @@
10791068
"when": "view == iqView",
10801069
"group": "navigation"
10811070
},
1082-
{
1083-
"command": "f5.refreshNextApiTree",
1084-
"when": "view == nxtApiView",
1085-
"group": "navigation"
1086-
},
10871071
{
10881072
"command": "f5.refreshTclTree",
10891073
"when": "view == as3Tasks",

src/devicesCore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export default function devicesCore(context: ExtensionContext, f5OutputChannel:
182182

183183
ext.as3Tree.refresh();
184184
// nextApiProvider.refresh();
185-
commands.executeCommand('f5.refreshNextApiTree');
185+
// commands.executeCommand('f5.refreshNextApiTree');
186186
})
187187
.catch(err => {
188188
logger.error('Connect/Discover failed', err);

src/extension.ts

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
/**
2-
* Copyright 2021 F5 Networks, Inc.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
171
'use strict';
182

193
import {
@@ -62,10 +46,10 @@ import { getText } from './utils/utils';
6246
import { CfCore } from './cfCore';
6347
import { As3Core } from './as3Core';
6448
import { Telemetry } from './telemetry';
65-
import { XcDiag } from './tmosXcDiag';
66-
import { NextApi } from './nextApi';
49+
// import { XcDiag } from './tmosXcDiag';
50+
// import { NextApi } from './nextApi';
6751
import { CodeLensProvider } from './codeLens';
68-
import { createRequire } from 'module';
52+
// import { createRequire } from 'module';
6953

7054
// turn off console logging
7155
logger.console = false;
@@ -82,6 +66,11 @@ logger.output = function (log: string) {
8266
// provide extension functions for activation
8367
export async function activate(context: ExtensionContext) {
8468

69+
// create the telemetry service
70+
ext.telemetry = new Telemetry(context);
71+
// initialize telemetry service
72+
// await ext.telemetry.init();
73+
8574
process.on('unhandledRejection', error => {
8675
logger.error('--- unhandledRejection ---', error);
8776
ext.telemetry.capture({ unhandledRejection: JSON.stringify(error) });
@@ -124,11 +113,6 @@ export async function activate(context: ExtensionContext) {
124113
// do we prefer the class style of importing core blocks?
125114
new ChangeVersion(context, ext.extHttp);
126115

127-
// create the telemetry service
128-
ext.telemetry = new Telemetry(context);
129-
// initialize telemetry service
130-
await ext.telemetry.init();
131-
132116
logger.debug(`telemtry instance details`, ext.telemetry.telemetryBase());
133117

134118
new Hovers(context, ext.eventEmitterGlobal);
@@ -981,18 +965,18 @@ export async function activate(context: ExtensionContext) {
981965

982966
}),
983967

984-
qp.onDidAccept(a => {
968+
qp.onDidAccept(a => {
985969

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;
970+
// main quick pick object
971+
const b = qp;
972+
// if new item typed in
973+
const bv = b.value;
974+
// if existing item selected;
975+
const bs = b.selectedItems[0]?.label;
992976

993-
resolve(bv || bs);
994-
qp.hide();
995-
})
977+
resolve(bv || bs);
978+
qp.hide();
979+
})
996980

997981
qp.show();
998982
}) as string;
@@ -1022,7 +1006,7 @@ export async function activate(context: ExtensionContext) {
10221006
const idx = histary.indexOf(cmd)
10231007

10241008
// command is not in history
1025-
if(idx < 0) {
1009+
if (idx < 0) {
10261010

10271011
// add the cmd to the top of the history array
10281012
histary.unshift(cmd)

src/nextApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ export class NextApi {
5858
const nextApiTreeView = window.createTreeView('nxtApiView', {
5959
treeDataProvider: this.nextApiTreeProvider,
6060
});
61-
context.subscriptions.push(commands.registerCommand('f5.refreshNextApiTree', () => this.nextApiTreeProvider.refresh()));
61+
// context.subscriptions.push(commands.registerCommand('f5.refreshNextApiTree', () => this.nextApiTreeProvider.refresh()));
6262

63-
context.subscriptions.push(commands.registerCommand('f5.refreshNextApiTreeLocal', () => this.nextApiTreeProvider.refresh('local')));
63+
// context.subscriptions.push(commands.registerCommand('f5.refreshNextApiTreeLocal', () => this.nextApiTreeProvider.refresh('local')));
6464

6565

6666
// not registered in pjson file...

src/telemetry.ts

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ export class Telemetry {
2121
https: ExtHttp;
2222
ctx: ExtensionContext;
2323

24-
apiKey: string | undefined;
24+
apiKey = Buffer.from([
25+
'bW1oSlUyc0Nk',
26+
'NjNCem5YQVh',
27+
'EaDRreExJ',
28+
'eWZJTW0zQXI='
29+
].join(''), 'base64').toString();
2530

2631
/**
2732
* standard vscode f5 document type param
@@ -136,43 +141,43 @@ export class Telemetry {
136141
}
137142

138143

139-
/**
140-
* loads api key from file or secret
141-
*/
142-
async init() {
143-
144-
const keyFileName = 'F5_TEEM';
145-
const keyFileNamePath = path.join(this.ctx.extensionPath, keyFileName);
146-
147-
// console.log(`Looking for ${keyFileName} file at`, keyFileNamePath);
148-
149-
await fs.promises.readFile(keyFileNamePath)
150-
.then(key => {
151-
this.ctx.secrets.store(keyFileName, key.toString());
152-
// console.log(`${keyFileName} FILE FOUND AND KEY STORED AS SECRET:`, key.toString());
153-
})
154-
.then(() => {
155-
// console.log(`Deleting ${keyFileName} FILE`);
156-
fs.unlinkSync(keyFileNamePath);
157-
})
158-
.catch( async e => {
159-
// console.log(`${keyFileName} FILE NOT FOUND`, e.message);
160-
const str = [
161-
'bW1oSlUyc0Nk',
162-
'NjNCem5YQVh',
163-
'EaDRreExJ',
164-
'eWZJTW0zQXI='
165-
].join('');
166-
await this.ctx.secrets.store(keyFileName, Buffer.from(str, 'base64').toString());
167-
});
168-
169-
// set the api key
170-
this.apiKey = await this.ctx.secrets.get(keyFileName);
171-
172-
// console.log(`---${this.apiKey}---`);
173-
174-
return;
175-
}
144+
// /**
145+
// * loads api key from file or secret
146+
// */
147+
// async init() {
148+
149+
// const keyFileName = 'F5_TEEM';
150+
// const keyFileNamePath = path.join(this.ctx.extensionPath, keyFileName);
151+
152+
// // console.log(`Looking for ${keyFileName} file at`, keyFileNamePath);
153+
154+
// await fs.promises.readFile(keyFileNamePath)
155+
// .then(key => {
156+
// this.ctx.secrets.store(keyFileName, key.toString());
157+
// // console.log(`${keyFileName} FILE FOUND AND KEY STORED AS SECRET:`, key.toString());
158+
// })
159+
// .then(() => {
160+
// // console.log(`Deleting ${keyFileName} FILE`);
161+
// fs.unlinkSync(keyFileNamePath);
162+
// })
163+
// .catch( async e => {
164+
// // console.log(`${keyFileName} FILE NOT FOUND`, e.message);
165+
// const str = [
166+
// 'bW1oSlUyc0Nk',
167+
// 'NjNCem5YQVh',
168+
// 'EaDRreExJ',
169+
// 'eWZJTW0zQXI='
170+
// ].join('');
171+
// await this.ctx.secrets.store(keyFileName, Buffer.from(str, 'base64').toString());
172+
// });
173+
174+
// // set the api key
175+
// this.apiKey = await this.ctx.secrets.get(keyFileName);
176+
177+
// // console.log(`---${this.apiKey}---`);
178+
179+
// return;
180+
// }
176181

177182
private createExtHttps() {
178183

0 commit comments

Comments
 (0)