Skip to content

Commit

Permalink
hostsV2 work + device icons
Browse files Browse the repository at this point in the history
  • Loading branch information
DumpySquare committed Mar 18, 2021
1 parent f762e0f commit 38cadad
Show file tree
Hide file tree
Showing 9 changed files with 223 additions and 136 deletions.
Binary file added images/BIG-IQ-sticker_transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/big-iq-centralized-mngmnt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions images/f5_open.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions images/f5_open_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions images/f5_open_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package-lock.json

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

27 changes: 26 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "The F5 Extension",
"description": "Supercharge your F5 automation development",
"publisher": "F5DevCentral",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"keywords": [
"F5",
"F5Networks",
Expand Down Expand Up @@ -162,6 +162,31 @@
"type": "string",
"description": "short device label"
},
"details": {
"type": "object",
"description": "device details",
"product": {
"type": "string"
},
"platformMarketingName": {
"type": "string"
},
"version": {
"type": "string"
},
"hostname": {
"type": "string"
},
"managementAddress": {
"type": "string"
},
"platform": {
"type": "string"
},
"physicalMemory": {
"type": "string"
}
},
"onConnect": {
"type": "array",
"description": "List of terminal/bash commands to execute at connect",
Expand Down
43 changes: 3 additions & 40 deletions src/devicesCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export default function devicesCore(context: ExtensionContext) {
ext.keyTar.setPassword('f5Hosts', device.device, password);

logger.debug('F5 Connect Discovered', connect);
ext.hostsTreeProvider.connectedDevice = ext.f5Client;
ext.hostsTreeProvider.refresh();
ext.as3Tree.refresh();
})
Expand All @@ -138,6 +139,7 @@ export default function devicesCore(context: ExtensionContext) {
}
// refresh host view to clear any dropdown menus
ext.hostsTreeProvider.refresh();
ext.hostsTreeProvider.connectedDevice = undefined;
}));

context.subscriptions.push(commands.registerCommand('f5.clearPassword', async (item) => {
Expand All @@ -154,46 +156,7 @@ export default function devicesCore(context: ExtensionContext) {
}));

context.subscriptions.push(commands.registerCommand('f5.editHost', async (hostID) => {

logger.debug(`Edit Host command: ${JSON.stringify(hostID)}`);

let bigipHosts: { device: string }[] | undefined = workspace.getConfiguration().get('f5.hosts');
logger.debug(`Current bigipHosts: ${JSON.stringify(bigipHosts)}`);

window.showInputBox({
prompt: 'Update Device/BIG-IP/Host',
value: hostID.label,
ignoreFocusOut: true
})
.then(input => {

logger.debug('user input', input);

if (input === undefined || bigipHosts === undefined) {
// throw new Error('Update device inputBox cancelled');
logger.warn('Update device inputBox cancelled');
return;
}

const deviceRex = /^[\w-.]+@[\w-.]+(:[0-9]+)?$/;
const devicesString = JSON.stringify(bigipHosts);

if (!devicesString.includes(`\"${input}\"`) && deviceRex.test(input)) {

bigipHosts.forEach((item: { device: string; }) => {
if (item.device === hostID.label) {
item.device = input;
}
});

workspace.getConfiguration().update('f5.hosts', bigipHosts, ConfigurationTarget.Global);
setTimeout(() => { ext.hostsTreeProvider.refresh(); }, 300);
} else {

window.showErrorMessage('Already exists or invalid format: <user>@<host/ip>:<port>');
}
});

return await ext.hostsTreeProvider.editDevice(hostID);
}));


Expand Down
Loading

0 comments on commit 38cadad

Please sign in to comment.