Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto select device for RTR if only one device available #26

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions components/crowdstrike-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ polarity.export = PolarityComponent.extend({
actions: {
changeTab: function (tabName) {
this.set('activeTab', tabName);

// If there is only one device, select it in the drop down automatically
if(tabName === 'rtr' && this.get('details.hosts.devices.length') === 1){
const selectedDevice = this.get('details.hosts.devices.0')
this.set('state.rtr.selectedDevice', selectedDevice);
this.set('state.rtr.selectedDeviceId', selectedDevice.device_id);
}
},
changeScriptTab: function (tabName) {
if (this.get('activeScriptTab') === tabName) {
Expand Down
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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "crowdstrike",
"version": "3.7.1",
"version": "3.7.2",
"main": "./integration.js",
"private": true,
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions templates/crowdstrike-block.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@
>
<option selected value="">-- Select a Host --</option>
{{#each details.hosts.devices as |device|}}
<option value="{{device.device_id}}">{{device.hostname}}</option>
<option value="{{device.device_id}}" selected="{{if (eq device.device_id state.rtr.selectedDeviceId) "true"}}">{{device.hostname}}</option>
{{/each}}
</select>
{{fa-icon icon="chevron-down" fixedWidth=true class="select-arrow"}}
Expand Down Expand Up @@ -684,7 +684,7 @@
<div class="info-bar-pill">
<span class="info-bar-key">Domain</span>
<span class="info-bar-value">
{{#if state.rtr.selectedDevice}}
{{#if (and state.rtr.selectedDevice state.rtr.selectedDevice.machine_domain)}}
{{state.rtr.selectedDevice.machine_domain}}
{{else}}
--
Expand Down
Loading