mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Implemented device group selection on data grid.
This commit is contained in:
parent
c14d91085e
commit
eb72c5142c
@ -5,7 +5,7 @@
|
||||
<div id="gridControlsWrapper">
|
||||
<div>
|
||||
<label>Device Group:</label>
|
||||
<select asp-items="Model.DeviceGroups" class="form-control" style="width: 200px">
|
||||
<select id="deviceGroupSelect" asp-items="Model.DeviceGroups" class="form-control" style="width: 200px">
|
||||
<option value="">All</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -65,7 +65,18 @@ export function AddOrUpdateDevice(device: Device) {
|
||||
};
|
||||
UpdateDeviceCounts();
|
||||
}
|
||||
export function ApplyFilter(filterString: string) {
|
||||
export function ApplyGroupFilter(groupID: string) {
|
||||
for (var i = 0; i < DataSource.length; i++) {
|
||||
var row = document.getElementById(DataSource[i].ID);
|
||||
if (!groupID || DataSource[i].DeviceGroupID == groupID) {
|
||||
row.classList.remove("hidden");
|
||||
}
|
||||
else {
|
||||
row.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
}
|
||||
export function ApplySearchFilter(filterString: string) {
|
||||
for (var i = 0; i < DataSource.length; i++) {
|
||||
for (var key in DataSource[i]) {
|
||||
var value = DataSource[i][key];
|
||||
@ -74,7 +85,7 @@ export function ApplyFilter(filterString: string) {
|
||||
}
|
||||
|
||||
var row = document.getElementById(DataSource[i].ID);
|
||||
if (DataSource[i][key].toString().toLowerCase().includes(filterString)) {
|
||||
if (value.toString().toLowerCase().includes(filterString)) {
|
||||
row.classList.remove("hidden");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ export function ApplyInputEventHandlers() {
|
||||
clickToggleAllDevices();
|
||||
clickStartRemoteControlButton();
|
||||
consoleTabSelected();
|
||||
deviceGroupSelectChanged();
|
||||
|
||||
window.addEventListener("resize", ev => {
|
||||
PositionCommandCompletionWindow();
|
||||
@ -152,7 +153,7 @@ function inputOnCommandTextArea() {
|
||||
function inputOnFilterTextBox() {
|
||||
document.querySelector("#gridFilter").addEventListener("input", (e) => {
|
||||
var currentText = (e.currentTarget as HTMLInputElement).value.toLowerCase();
|
||||
DataGrid.ApplyFilter(currentText);
|
||||
DataGrid.ApplySearchFilter(currentText);
|
||||
})
|
||||
}
|
||||
function consoleTabSelected() {
|
||||
@ -179,4 +180,10 @@ function clickStartRemoteControlButton() {
|
||||
WebCommands.find(x => x.Name == "RemoteControl").Execute([]);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function deviceGroupSelectChanged() {
|
||||
UI.DeviceGroupSelect.addEventListener("change", (ev) => {
|
||||
DataGrid.ApplyGroupFilter(UI.DeviceGroupSelect.value);
|
||||
});
|
||||
}
|
||||
@ -18,6 +18,7 @@ export var TabContentWrapper = document.getElementById("tabContentWrapper") as H
|
||||
export var ConsoleFrame = document.getElementById("consoleFrame") as HTMLDivElement;
|
||||
export var ConsoleTab = document.getElementById("consoleTab") as HTMLAnchorElement;
|
||||
export var ConsoleAlert = document.getElementById("consoleAlert") as HTMLAnchorElement;
|
||||
export var DeviceGroupSelect = document.getElementById("deviceGroupSelect") as HTMLSelectElement;
|
||||
|
||||
|
||||
export function AddConsoleOutput(strOutputMessage:string) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user