Skip to content

Commit

Permalink
NAS-125374 / 24.04 / Add more autocomplete suggestions for event data (
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKarpov98 authored Dec 6, 2023
1 parent ac679db commit 957984c
Show file tree
Hide file tree
Showing 95 changed files with 1,716 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@
</a>

<span
*ngIf="inputArea.textContent.length > 0"
*ngIf="isEditorEmpty"
class="reset-icon reset-input"
(click)="onResetInput()"
>
<ix-icon name="mdi-close-circle"></ix-icon>
<ix-icon
name="mdi-close-circle"
tabindex="0"
(keydown.enter)="onResetInput()"
></ix-icon>
</span>

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '@angular/core';
import { autocompletion, closeBrackets, startCompletion } from '@codemirror/autocomplete';
import { EditorState } from '@codemirror/state';
import { EditorView } from '@codemirror/view';
import { EditorView, placeholder } from '@codemirror/view';
import { format } from 'date-fns';
import { QueryFilters } from 'app/interfaces/query-api.interface';
import { IxSimpleChanges } from 'app/interfaces/simple-changes.interface';
Expand Down Expand Up @@ -39,6 +39,9 @@ export class AdvancedSearchComponent<T> implements OnInit, OnChanges {
queryInputValue: string;
private editorView: EditorView;

get isEditorEmpty(): boolean {
return (this.editorView.state.doc as unknown as { text: string[] })?.text?.[0] !== '';
}
showDatePicker$ = this.advancedSearchAutocomplete.showDatePicker$;

constructor(
Expand Down Expand Up @@ -86,6 +89,7 @@ export class AdvancedSearchComponent<T> implements OnInit, OnChanges {
EditorView.lineWrapping,
updateListener,
closeBrackets(),
placeholder('Service = "SMB" AND Event = "CLOSE"'),
],
}),
parent: this.inputArea.nativeElement,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@
class="reset-icon reset-input"
(click)="resetInput()"
>
<ix-icon name="mdi-close-circle"></ix-icon>
<ix-icon
name="mdi-close-circle"
tabindex="0"
(keydown.enter)="resetInput()"
></ix-icon>
</span>
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,13 @@ export class AdvancedSearchAutocompleteService<T> {
anchor = anchor + 2;
}

if (/\s/.test(updatedValue) && !/^["']|["']$/.test(updatedValue)) {
updatedValue = `"${updatedValue}"`;
anchor = anchor + 2;
}

this.editorView?.dispatch({
changes: {
from,
to,
insert: updatedValue,
},
changes: { from, to, insert: updatedValue },
selection: { anchor },
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface SearchProperty<T> {
* Nested properties are supported: 'user.first_name'.
*/
// TODO: Add support for nested properties.
property: keyof T;
property: keyof T | string;
propertyType: PropertyType;

valueSuggestions$?: Observable<Option[]>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function searchProperties<T>(properties: SearchProperty<T>[]): SearchProp
}

export function textProperty<T>(
property: keyof T,
property: keyof T | string,
label: string,
valueSuggestions$?: Observable<Option[]>,
): SearchProperty<T> {
Expand Down
20 changes: 20 additions & 0 deletions src/app/pages/audit/components/audit/audit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,26 @@ export class AuditComponent implements OnInit, AfterViewInit, OnDestroy {
value: `"${value}"`,
}))),
),
textProperty('event.event_data.host', this.translate.instant('SMB - Host')),
textProperty('event.event_data.clientAccount', this.translate.instant('SMB - Client Account')),
textProperty('event.event_data.file.path', this.translate.instant('SMB - File Path')),
textProperty('event.event_data.src_file.path', this.translate.instant('SMB - Source File Path')),
textProperty('event.event_data.dst_file.path', this.translate.instant('SMB - Destination File Path')),
textProperty('event.event_data.file.handle.type', this.translate.instant('SMB - File Handle Type')),
textProperty('event.event_data.file.handle.value', this.translate.instant('SMB - File Handle Value')),
textProperty('event.event_data.unix_token.uid', this.translate.instant('SMB - UNIX Token UID')),
textProperty('event.event_data.unix_token.gid', this.translate.instant('SMB - UNIX Token GID')),
textProperty('event.event_data.unix_token.groups', this.translate.instant('SMB - UNIX Token Groups')),
textProperty('event.event_data.result.type', this.translate.instant('SMB - Result Type')),
textProperty('event.event_data.result.value_raw', this.translate.instant('SMB - Result Raw Value')),
textProperty('event.event_data.result.value_parsed', this.translate.instant('SMB - Result Parsed Value')),
textProperty('event.event_data.vers.major', this.translate.instant('SMB - Vers Major')),
textProperty('event.event_data.vers.minor', this.translate.instant('SMB - Vers Minor')),
textProperty('event.event_data.vers.minor', this.translate.instant('SMB - Vers Minor')),
textProperty('event.event_data.operations.create', this.translate.instant('SMB - Operation Create')),
textProperty('event.event_data.operations.close', this.translate.instant('SMB - Operation Close')),
textProperty('event.event_data.operations.read', this.translate.instant('SMB - Operation Read')),
textProperty('event.event_data.operations.write', this.translate.instant('SMB - Operation Write')),
]);
this.cdr.markForCheck();
});
Expand Down
19 changes: 19 additions & 0 deletions src/assets/i18n/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -3027,7 +3027,26 @@
"SHOW STATUS": "",
"SID": "",
"SMB": "",
"SMB - Client Account": "",
"SMB - Destination File Path": "",
"SMB - File Handle Type": "",
"SMB - File Handle Value": "",
"SMB - File Path": "",
"SMB - Host": "",
"SMB - Operation Close": "",
"SMB - Operation Create": "",
"SMB - Operation Read": "",
"SMB - Operation Write": "",
"SMB - Primary Domain": "",
"SMB - Result Parsed Value": "",
"SMB - Result Raw Value": "",
"SMB - Result Type": "",
"SMB - Source File Path": "",
"SMB - UNIX Token GID": "",
"SMB - UNIX Token Groups": "",
"SMB - UNIX Token UID": "",
"SMB - Vers Major": "",
"SMB - Vers Minor": "",
"SMB Service": "",
"SMB multichannel allows servers to use multiple network connections simultaneously by combining the bandwidth of several network interface cards (NICs) for better performance. SMB multichannel does not function if you combine NICs into a LAGG. <a href=\"https://www.truenas.com/docs/scale/scaletutorials/shares/smb/smbmultichannel/\" target=\"_blank\">Read more in docs</a>": "",
"SMB/NFSv4": "",
Expand Down
19 changes: 19 additions & 0 deletions src/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3027,7 +3027,26 @@
"SHOW STATUS": "",
"SID": "",
"SMB": "",
"SMB - Client Account": "",
"SMB - Destination File Path": "",
"SMB - File Handle Type": "",
"SMB - File Handle Value": "",
"SMB - File Path": "",
"SMB - Host": "",
"SMB - Operation Close": "",
"SMB - Operation Create": "",
"SMB - Operation Read": "",
"SMB - Operation Write": "",
"SMB - Primary Domain": "",
"SMB - Result Parsed Value": "",
"SMB - Result Raw Value": "",
"SMB - Result Type": "",
"SMB - Source File Path": "",
"SMB - UNIX Token GID": "",
"SMB - UNIX Token Groups": "",
"SMB - UNIX Token UID": "",
"SMB - Vers Major": "",
"SMB - Vers Minor": "",
"SMB Service": "",
"SMB multichannel allows servers to use multiple network connections simultaneously by combining the bandwidth of several network interface cards (NICs) for better performance. SMB multichannel does not function if you combine NICs into a LAGG. <a href=\"https://www.truenas.com/docs/scale/scaletutorials/shares/smb/smbmultichannel/\" target=\"_blank\">Read more in docs</a>": "",
"SMB/NFSv4": "",
Expand Down
19 changes: 19 additions & 0 deletions src/assets/i18n/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -3027,7 +3027,26 @@
"SHOW STATUS": "",
"SID": "",
"SMB": "",
"SMB - Client Account": "",
"SMB - Destination File Path": "",
"SMB - File Handle Type": "",
"SMB - File Handle Value": "",
"SMB - File Path": "",
"SMB - Host": "",
"SMB - Operation Close": "",
"SMB - Operation Create": "",
"SMB - Operation Read": "",
"SMB - Operation Write": "",
"SMB - Primary Domain": "",
"SMB - Result Parsed Value": "",
"SMB - Result Raw Value": "",
"SMB - Result Type": "",
"SMB - Source File Path": "",
"SMB - UNIX Token GID": "",
"SMB - UNIX Token Groups": "",
"SMB - UNIX Token UID": "",
"SMB - Vers Major": "",
"SMB - Vers Minor": "",
"SMB Service": "",
"SMB multichannel allows servers to use multiple network connections simultaneously by combining the bandwidth of several network interface cards (NICs) for better performance. SMB multichannel does not function if you combine NICs into a LAGG. <a href=\"https://www.truenas.com/docs/scale/scaletutorials/shares/smb/smbmultichannel/\" target=\"_blank\">Read more in docs</a>": "",
"SMB/NFSv4": "",
Expand Down
19 changes: 19 additions & 0 deletions src/assets/i18n/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -3027,7 +3027,26 @@
"SHOW STATUS": "",
"SID": "",
"SMB": "",
"SMB - Client Account": "",
"SMB - Destination File Path": "",
"SMB - File Handle Type": "",
"SMB - File Handle Value": "",
"SMB - File Path": "",
"SMB - Host": "",
"SMB - Operation Close": "",
"SMB - Operation Create": "",
"SMB - Operation Read": "",
"SMB - Operation Write": "",
"SMB - Primary Domain": "",
"SMB - Result Parsed Value": "",
"SMB - Result Raw Value": "",
"SMB - Result Type": "",
"SMB - Source File Path": "",
"SMB - UNIX Token GID": "",
"SMB - UNIX Token Groups": "",
"SMB - UNIX Token UID": "",
"SMB - Vers Major": "",
"SMB - Vers Minor": "",
"SMB Service": "",
"SMB multichannel allows servers to use multiple network connections simultaneously by combining the bandwidth of several network interface cards (NICs) for better performance. SMB multichannel does not function if you combine NICs into a LAGG. <a href=\"https://www.truenas.com/docs/scale/scaletutorials/shares/smb/smbmultichannel/\" target=\"_blank\">Read more in docs</a>": "",
"SMB/NFSv4": "",
Expand Down
19 changes: 19 additions & 0 deletions src/assets/i18n/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -3027,7 +3027,26 @@
"SHOW STATUS": "",
"SID": "",
"SMB": "",
"SMB - Client Account": "",
"SMB - Destination File Path": "",
"SMB - File Handle Type": "",
"SMB - File Handle Value": "",
"SMB - File Path": "",
"SMB - Host": "",
"SMB - Operation Close": "",
"SMB - Operation Create": "",
"SMB - Operation Read": "",
"SMB - Operation Write": "",
"SMB - Primary Domain": "",
"SMB - Result Parsed Value": "",
"SMB - Result Raw Value": "",
"SMB - Result Type": "",
"SMB - Source File Path": "",
"SMB - UNIX Token GID": "",
"SMB - UNIX Token Groups": "",
"SMB - UNIX Token UID": "",
"SMB - Vers Major": "",
"SMB - Vers Minor": "",
"SMB Service": "",
"SMB multichannel allows servers to use multiple network connections simultaneously by combining the bandwidth of several network interface cards (NICs) for better performance. SMB multichannel does not function if you combine NICs into a LAGG. <a href=\"https://www.truenas.com/docs/scale/scaletutorials/shares/smb/smbmultichannel/\" target=\"_blank\">Read more in docs</a>": "",
"SMB/NFSv4": "",
Expand Down
19 changes: 19 additions & 0 deletions src/assets/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -3027,7 +3027,26 @@
"SHOW STATUS": "",
"SID": "",
"SMB": "",
"SMB - Client Account": "",
"SMB - Destination File Path": "",
"SMB - File Handle Type": "",
"SMB - File Handle Value": "",
"SMB - File Path": "",
"SMB - Host": "",
"SMB - Operation Close": "",
"SMB - Operation Create": "",
"SMB - Operation Read": "",
"SMB - Operation Write": "",
"SMB - Primary Domain": "",
"SMB - Result Parsed Value": "",
"SMB - Result Raw Value": "",
"SMB - Result Type": "",
"SMB - Source File Path": "",
"SMB - UNIX Token GID": "",
"SMB - UNIX Token Groups": "",
"SMB - UNIX Token UID": "",
"SMB - Vers Major": "",
"SMB - Vers Minor": "",
"SMB Service": "",
"SMB multichannel allows servers to use multiple network connections simultaneously by combining the bandwidth of several network interface cards (NICs) for better performance. SMB multichannel does not function if you combine NICs into a LAGG. <a href=\"https://www.truenas.com/docs/scale/scaletutorials/shares/smb/smbmultichannel/\" target=\"_blank\">Read more in docs</a>": "",
"SMB/NFSv4": "",
Expand Down
19 changes: 19 additions & 0 deletions src/assets/i18n/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3027,7 +3027,26 @@
"SHOW STATUS": "",
"SID": "",
"SMB": "",
"SMB - Client Account": "",
"SMB - Destination File Path": "",
"SMB - File Handle Type": "",
"SMB - File Handle Value": "",
"SMB - File Path": "",
"SMB - Host": "",
"SMB - Operation Close": "",
"SMB - Operation Create": "",
"SMB - Operation Read": "",
"SMB - Operation Write": "",
"SMB - Primary Domain": "",
"SMB - Result Parsed Value": "",
"SMB - Result Raw Value": "",
"SMB - Result Type": "",
"SMB - Source File Path": "",
"SMB - UNIX Token GID": "",
"SMB - UNIX Token Groups": "",
"SMB - UNIX Token UID": "",
"SMB - Vers Major": "",
"SMB - Vers Minor": "",
"SMB Service": "",
"SMB multichannel allows servers to use multiple network connections simultaneously by combining the bandwidth of several network interface cards (NICs) for better performance. SMB multichannel does not function if you combine NICs into a LAGG. <a href=\"https://www.truenas.com/docs/scale/scaletutorials/shares/smb/smbmultichannel/\" target=\"_blank\">Read more in docs</a>": "",
"SMB/NFSv4": "",
Expand Down
19 changes: 19 additions & 0 deletions src/assets/i18n/br.json
Original file line number Diff line number Diff line change
Expand Up @@ -3027,7 +3027,26 @@
"SHOW STATUS": "",
"SID": "",
"SMB": "",
"SMB - Client Account": "",
"SMB - Destination File Path": "",
"SMB - File Handle Type": "",
"SMB - File Handle Value": "",
"SMB - File Path": "",
"SMB - Host": "",
"SMB - Operation Close": "",
"SMB - Operation Create": "",
"SMB - Operation Read": "",
"SMB - Operation Write": "",
"SMB - Primary Domain": "",
"SMB - Result Parsed Value": "",
"SMB - Result Raw Value": "",
"SMB - Result Type": "",
"SMB - Source File Path": "",
"SMB - UNIX Token GID": "",
"SMB - UNIX Token Groups": "",
"SMB - UNIX Token UID": "",
"SMB - Vers Major": "",
"SMB - Vers Minor": "",
"SMB Service": "",
"SMB multichannel allows servers to use multiple network connections simultaneously by combining the bandwidth of several network interface cards (NICs) for better performance. SMB multichannel does not function if you combine NICs into a LAGG. <a href=\"https://www.truenas.com/docs/scale/scaletutorials/shares/smb/smbmultichannel/\" target=\"_blank\">Read more in docs</a>": "",
"SMB/NFSv4": "",
Expand Down
19 changes: 19 additions & 0 deletions src/assets/i18n/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3027,7 +3027,26 @@
"SHOW STATUS": "",
"SID": "",
"SMB": "",
"SMB - Client Account": "",
"SMB - Destination File Path": "",
"SMB - File Handle Type": "",
"SMB - File Handle Value": "",
"SMB - File Path": "",
"SMB - Host": "",
"SMB - Operation Close": "",
"SMB - Operation Create": "",
"SMB - Operation Read": "",
"SMB - Operation Write": "",
"SMB - Primary Domain": "",
"SMB - Result Parsed Value": "",
"SMB - Result Raw Value": "",
"SMB - Result Type": "",
"SMB - Source File Path": "",
"SMB - UNIX Token GID": "",
"SMB - UNIX Token Groups": "",
"SMB - UNIX Token UID": "",
"SMB - Vers Major": "",
"SMB - Vers Minor": "",
"SMB Service": "",
"SMB multichannel allows servers to use multiple network connections simultaneously by combining the bandwidth of several network interface cards (NICs) for better performance. SMB multichannel does not function if you combine NICs into a LAGG. <a href=\"https://www.truenas.com/docs/scale/scaletutorials/shares/smb/smbmultichannel/\" target=\"_blank\">Read more in docs</a>": "",
"SMB/NFSv4": "",
Expand Down
19 changes: 19 additions & 0 deletions src/assets/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -3027,7 +3027,26 @@
"SHOW STATUS": "",
"SID": "",
"SMB": "",
"SMB - Client Account": "",
"SMB - Destination File Path": "",
"SMB - File Handle Type": "",
"SMB - File Handle Value": "",
"SMB - File Path": "",
"SMB - Host": "",
"SMB - Operation Close": "",
"SMB - Operation Create": "",
"SMB - Operation Read": "",
"SMB - Operation Write": "",
"SMB - Primary Domain": "",
"SMB - Result Parsed Value": "",
"SMB - Result Raw Value": "",
"SMB - Result Type": "",
"SMB - Source File Path": "",
"SMB - UNIX Token GID": "",
"SMB - UNIX Token Groups": "",
"SMB - UNIX Token UID": "",
"SMB - Vers Major": "",
"SMB - Vers Minor": "",
"SMB Service": "",
"SMB multichannel allows servers to use multiple network connections simultaneously by combining the bandwidth of several network interface cards (NICs) for better performance. SMB multichannel does not function if you combine NICs into a LAGG. <a href=\"https://www.truenas.com/docs/scale/scaletutorials/shares/smb/smbmultichannel/\" target=\"_blank\">Read more in docs</a>": "",
"SMB/NFSv4": "",
Expand Down
Loading

0 comments on commit 957984c

Please sign in to comment.