Skip to content

Commit

Permalink
NAS-132875: Address SMB service API changes (#11151)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKarpov98 authored Dec 6, 2024
1 parent 38f2f0e commit efb4398
Show file tree
Hide file tree
Showing 95 changed files with 835 additions and 390 deletions.
3 changes: 1 addition & 2 deletions src/app/helptext/services/components/service-smb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ export const helptextServiceSmb = {

cifs_srv_unixcharset_tooltip: T('Default is UTF-8 which supports all characters in\
all languages.'),
cifs_srv_loglevel_tooltip: T('Record SMB service messages up to the specified log level. \
By default, error and warning level messages are logged.'),
cifs_srv_debug_tooltip: T('Use this option to log more detailed information about SMB.'),
cifs_srv_syslog_tooltip: T('Set to log authentication failures in <i>/var/log/messages</i>\
instead of the default of <i>/var/log/samba4/log.smbd</i>.'),
cifs_srv_localmaster_tooltip: T('Set to determine if the system participates in\
Expand Down
5 changes: 1 addition & 4 deletions src/app/interfaces/smb-config.interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { LogLevel } from 'app/enums/log-level.enum';
import { SmbEncryption } from 'app/enums/smb-encryption.enum';

export interface SmbConfig {
Expand All @@ -13,10 +12,8 @@ export interface SmbConfig {
guest: string;
id: number;
localmaster: boolean;
loglevel: LogLevel;
netbiosalias: string[];
netbiosname: string;
netbiosname_local: string;
next_rid: number;
ntlmv1_auth: boolean;
syslog: boolean;
Expand All @@ -27,4 +24,4 @@ export interface SmbConfig {

export type SmbConfigUpdate = {
multichannel?: boolean;
} & Omit<SmbConfig, 'cifs_SID' | 'id' | 'netbiosname_local' | 'next_rid'>;
} & Omit<SmbConfig, 'cifs_SID' | 'id' | 'next_rid'>;
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@
[required]="true"
></ix-select>

<ix-select
formControlName="loglevel"
[label]="'Log Level' | translate"
[tooltip]="tooltips.loglevel | translate"
[options]="logLevelOptions$"
></ix-select>
<ix-checkbox
formControlName="debug"
[label]="'Use Debug' | translate"
[tooltip]="tooltips.debug | translate"
></ix-checkbox>

<ix-checkbox
formControlName="syslog"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('ServiceSmbComponent', () => {
workgroup: 'WORKGROUP',
description: 'TrueNAS Server',
unixcharset: 'UTF-8',
loglevel: 'MINIMUM',
debug: true,
syslog: false,
aapl_extensions: false,
localmaster: true,
Expand All @@ -55,7 +55,6 @@ describe('ServiceSmbComponent', () => {
admin_group: null,
next_rid: 0,
multichannel: false,
netbiosname_local: 'truenas',
encryption: SmbEncryption.Negotiate,
} as SmbConfig),
mockCall('smb.unixcharset_choices', {
Expand Down Expand Up @@ -133,13 +132,13 @@ describe('ServiceSmbComponent', () => {
'File Mask': '',
'Guest Account': '',
'Local Master': true,
'Log Level': 'Minimum',
'NTLMv1 Auth': false,
'NetBIOS Alias': [],
'NetBIOS Name': 'truenas',
'Transport Encryption Behavior': 'Negotiate – only encrypt transport if explicitly requested by the SMB client',
Multichannel: false,
'UNIX Charset': 'UTF-8',
'Use Debug': true,
'Use Syslog Only': false,
Workgroup: 'WORKGROUP',
});
Expand Down Expand Up @@ -175,7 +174,7 @@ describe('ServiceSmbComponent', () => {
guest: 'nobody',
dirmask: '',
filemask: '',
loglevel: 'MINIMUM',
debug: true,
localmaster: true,
syslog: false,
multichannel: false,
Expand All @@ -191,8 +190,8 @@ describe('ServiceSmbComponent', () => {
const form = await loader.getHarness(IxFormHarness);
await form.fillForm({
'UNIX Charset': 'UTF-16',
'Log Level': 'Full',
'Use Syslog Only': true,
'Use Debug': true,
'Local Master': false,
'Enable Apple SMB2/3 Protocol Extensions': true,
'Administrators Group': 'test-group',
Expand Down Expand Up @@ -221,7 +220,7 @@ describe('ServiceSmbComponent', () => {
guest: 'nobody',
dirmask: '0777',
filemask: '0666',
loglevel: 'FULL',
debug: true,
localmaster: false,
syslog: true,
multichannel: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { TranslateService, TranslateModule } from '@ngx-translate/core';
import { of, Subscription } from 'rxjs';
import { map } from 'rxjs/operators';
import { RequiresRolesDirective } from 'app/directives/requires-roles/requires-roles.directive';
import { LogLevel } from 'app/enums/log-level.enum';
import { Role } from 'app/enums/role.enum';
import { SmbEncryption, smbEncryptionLabels } from 'app/enums/smb-encryption.enum';
import { choicesToOptions } from 'app/helpers/operators/options.operators';
Expand Down Expand Up @@ -81,7 +80,7 @@ export class ServiceSmbComponent implements OnInit {
enable_smb1: [false, []],
ntlmv1_auth: [false, []],
unixcharset: ['', []],
loglevel: [LogLevel.None, []],
debug: [false, []],
syslog: [false, []],
localmaster: [false, []],
guest: ['nobody', []],
Expand All @@ -104,7 +103,7 @@ export class ServiceSmbComponent implements OnInit {
enable_smb1: helptextServiceSmb.cifs_srv_enable_smb1_tooltip,
ntlmv1_auth: helptextServiceSmb.cifs_srv_ntlmv1_auth_tooltip,
unixcharset: helptextServiceSmb.cifs_srv_unixcharset_tooltip,
loglevel: helptextServiceSmb.cifs_srv_loglevel_tooltip,
debug: helptextServiceSmb.cifs_srv_debug_tooltip,
syslog: helptextServiceSmb.cifs_srv_syslog_tooltip,
localmaster: helptextServiceSmb.cifs_srv_localmaster_tooltip,
guest: helptextServiceSmb.cifs_srv_guest_tooltip,
Expand All @@ -116,14 +115,6 @@ export class ServiceSmbComponent implements OnInit {
multichannel: helptextServiceSmb.cifs_srv_multichannel_tooltip,
};

readonly logLevelOptions$ = of([
{ label: this.translate.instant('None'), value: LogLevel.None },
{ label: this.translate.instant('Minimum'), value: LogLevel.Minimum },
{ label: this.translate.instant('Normal'), value: LogLevel.Normal },
{ label: this.translate.instant('Full'), value: LogLevel.Full },
{ label: this.translate.instant('Debug'), value: LogLevel.Debug },
]);

readonly unixCharsetOptions$ = this.api.call('smb.unixcharset_choices').pipe(choicesToOptions());
readonly guestAccountOptions$ = this.api.call('user.query').pipe(
map((users) => users.map((user) => ({ label: user.username, value: user.username }))),
Expand Down
10 changes: 8 additions & 2 deletions src/app/pages/services/services.elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,43 @@ export const servicesElements = {
manualRenderElements: {
smb: {
hierarchy: [T('SMB')],
synonyms: [T('Samba')],
synonyms: [T('Samba'), T('SMB Service')],
anchor: 'service-smb',
},
ftp: {
hierarchy: [T('FTP')],
synonyms: [T('FTP Service')],
anchor: 'service-ftp',
},
iscsi: {
hierarchy: [T('iSCSI')],
synonyms: [T('iSCSI Service')],
anchor: 'service-iscsi',
},
nfs: {
hierarchy: [T('NFS')],
synonyms: [T('NFS Service')],
anchor: 'service-nfs',
},
snmp: {
hierarchy: [T('SNMP')],
synonyms: [T('SNMP Service')],
anchor: 'service-snmp',
},
ssh: {
hierarchy: [T('SSH')],
synonyms: [T('SSH Service')],
anchor: 'service-ssh',
},
ups: {
hierarchy: [T('UPS')],
synonyms: [T('UPS Service')],
anchor: 'service-ups',
},
smart: {
hierarchy: [T('S.M.A.R.T.')],
synonyms: [T('Smart Service'), T('Smart')],
anchor: 'service-smart',
synonyms: [T('Smart')],
},
},
} satisfies UiSearchableElement;
13 changes: 9 additions & 4 deletions src/assets/i18n/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -1862,6 +1862,7 @@
"FTP": "",
"FTP Host to connect to. Example: <i>ftp.example.com</i>.": "",
"FTP Port number. Leave blank to use the default port <i>21</i>.": "",
"FTP Service": "",
"Failed": "",
"Failed Authentication: {credentials}": "",
"Failed Disks:": "",
Expand Down Expand Up @@ -1962,7 +1963,6 @@
"From a key file": "",
"From {task_begin} to {task_end}": "",
"Front": "",
"Full": "",
"Full Admin": "",
"Full Control": "",
"Full Filesystem Replication": "",
Expand Down Expand Up @@ -2691,7 +2691,6 @@
"Middleware - Credentials": "",
"Middleware - Method": "",
"Min Poll": "",
"Minimum": "",
"Minimum Memory": "",
"Minimum Memory Size": "",
"Minimum Passive Port": "",
Expand Down Expand Up @@ -2742,6 +2741,7 @@
"NAA": "",
"NEW": "",
"NFS": "",
"NFS Service": "",
"NFS Sessions": "",
"NFS Share": "",
"NFS share created": "",
Expand Down Expand Up @@ -2973,7 +2973,6 @@
"Non-expiring": "",
"None": "",
"None requested": "",
"Normal": "",
"Normal VDEV type, used for primary storage operations. ZFS pools always have at least one DATA VDEV.": "",
"Not Set": "",
"Not Shared": "",
Expand Down Expand Up @@ -3362,7 +3361,6 @@
"Recommended number of data disks for optimal space allocation should be power of 2 (2, 4, 8, 16...).": "",
"Recommended when <i>Max. Poll</i> is greater than 10. Only use on personal NTP servers or those under direct control. <b>Do not</b> enable when using public NTP servers.": "",
"Reconnect": "",
"Record SMB service messages up to the specified log level. By default, error and warning level messages are logged.": "",
"Record Size": "",
"Recursive": "",
"Redfish administrative password.": "",
Expand Down Expand Up @@ -3652,6 +3650,7 @@
"SMTP port number. Typically <i>25,465</i> (secure SMTP), or <i>587</i> (submission).": "",
"SNMP": "",
"SNMP Community": "",
"SNMP Service": "",
"SNMP v3 Options": "",
"SNMP v3 Support": "",
"SNMPv3 Security Model": "",
Expand All @@ -3667,6 +3666,7 @@
"SSH Keypair updated": "",
"SSH Keypairs": "",
"SSH Keyscan": "",
"SSH Service": "",
"SSH Transfer Security": "",
"SSH Username.": "",
"SSH connection from the keychain": "",
Expand Down Expand Up @@ -4120,6 +4120,7 @@
"Slot {n}": "",
"Slot: {slot}": "",
"Smart": "",
"Smart Service": "",
"Smart Task": "",
"Smart Test Result": "",
"Smart Tests": "",
Expand Down Expand Up @@ -4682,6 +4683,7 @@
"UNIX Charset": "",
"UPS": "",
"UPS Mode": "",
"UPS Service": "",
"UPS Stats": "",
"UPS Utilization": "",
"URI of the ACME Server Directory. Choose a pre configured URI": "",
Expand Down Expand Up @@ -4800,6 +4802,7 @@
"Use Apple-style Character Encoding": "",
"Use Custom ACME Server Directory URI": "",
"Use DHCP. Unset to manually configure a static IPv4 connection.": "",
"Use Debug": "",
"Use Default Domain": "",
"Use FQDN for Logging": "",
"Use Preset": "",
Expand All @@ -4819,6 +4822,7 @@
"Use the encryption properties of the root dataset.": "",
"Use the format <i>A.B.C.D/E</i> where <i>E</i> is the CIDR mask.": "",
"Use this option to allow legacy SMB clients to connect to the server. Note that SMB1 is being deprecated and it is advised to upgrade clients to operating system versions that support modern versions of the SMB protocol.": "",
"Use this option to log more detailed information about SMB.": "",
"Used": "",
"Used Space": "",
"Used by clients in PASV mode. A default of <i>0</i> means any port above 1023.": "",
Expand Down Expand Up @@ -5135,6 +5139,7 @@
"iSCSI Extent": "",
"iSCSI Group": "",
"iSCSI Initiator": "",
"iSCSI Service": "",
"iSCSI Share": "",
"iSCSI Target": "",
"iSCSI Wizard": "",
Expand Down
Loading

0 comments on commit efb4398

Please sign in to comment.