Skip to content

Commit

Permalink
Add IP address action
Browse files Browse the repository at this point in the history
  • Loading branch information
electrikmilk committed Apr 26, 2024
1 parent 213f37b commit 866dfb3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import Dictionary from "~/actions/dictionary";
import GetDictionary from "~/actions/get-dictionary";
import GetDictionaryValue from "~/actions/get-dictionary-value";
import setDictionaryValue from "~/actions/set-dictionary-value";
import GetIpAddress from "~/actions/get-ip-address";

interface ActionDefinitions {
[key: string]: ActionDefinition
Expand Down Expand Up @@ -83,6 +84,7 @@ export let actions: ActionDefinitions = {
'detect.dictionary': GetDictionary,
'getvalueforkey': GetDictionaryValue,
'setvalueforkey': setDictionaryValue,
'getipaddress': GetIpAddress,
};

export function actionText(value: string): HTMLElement {
Expand Down
23 changes: 23 additions & 0 deletions src/actions/get-ip-address.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {renderActionHeader, renderParameters} from "~/render";
import {actions} from "~/actions";

interface GetIPAddress {
WFIPAddressTypeOption: string | object
WFIPAddressSourceOption: string | object
}

export default {
title: "Get current IP address",
color: 'white',
background: '#007aff',
icon: 'house_fill',
render: (container: HTMLElement, params: GetIPAddress) => {
const action = renderActionHeader(actions['getipaddress']);
action.appendChild(renderParameters(actions['getipaddress'], {
'Address': params.WFIPAddressSourceOption ?? 'IPv4',
'Type': params.WFIPAddressTypeOption ?? 'External'
}));

return action;
}
}

0 comments on commit 866dfb3

Please sign in to comment.