diff --git a/src/app/helptext/system/advanced.ts b/src/app/helptext/system/advanced.ts index a83ed748d21..17e7622cbcb 100644 --- a/src/app/helptext/system/advanced.ts +++ b/src/app/helptext/system/advanced.ts @@ -159,4 +159,8 @@ The system only sends logs matching this level or higher.', tooltip: T('The preconfigured system Certificate to use for authenticating\ the TLS protocol connection to the remote system log server.'), }, + + syslog_tls_certificate_authority: { + placeholder: T('Syslog TLS Certificate Authority'), + }, }; diff --git a/src/app/pages/storage/volumes/volume-status/volume-status.component.ts b/src/app/pages/storage/volumes/volume-status/volume-status.component.ts index 3dd1b0046ab..7b7a6c606c1 100644 --- a/src/app/pages/storage/volumes/volume-status/volume-status.component.ts +++ b/src/app/pages/storage/volumes/volume-status/volume-status.component.ts @@ -229,12 +229,11 @@ export class VolumeStatusComponent implements OnInit { id: 'edit', label: helptext.actions_label.edit, onClick: (row) => { - const pIndex = row.name.lastIndexOf('p'); - const diskName = pIndex > -1 ? row.name.substring(0, pIndex) : row.name; + const devname = this.trimDiskName(this.getLeaf(row.name), 'p'); this.ws.call('disk.query', [ [ - ['devname', '=', diskName], + ['devname', '=', devname], ], ]).subscribe((res) => { this.editDiskRoute.push(this.pk, 'edit', res[0].identifier); @@ -246,12 +245,7 @@ export class VolumeStatusComponent implements OnInit { id: 'offline', label: helptext.actions_label.offline, onClick: (row) => { - let name = row.name; - // if use path as name, show the full path - if (!_.startsWith(name, '/')) { - const pIndex = name.lastIndexOf('p'); - name = pIndex > -1 ? name.substring(0, pIndex) : name; - } + const name = this.trimDiskName(row.name, 'p'); this.dialogService.confirm( helptext.offline_disk.title, helptext.offline_disk.message + name + '?' + (this.pool.encrypt == 0 ? '' : helptext.offline_disk.encryptPoolWarning), @@ -279,8 +273,7 @@ export class VolumeStatusComponent implements OnInit { id: 'online', label: helptext.actions_label.online, onClick: (row) => { - const pIndex = row.name.lastIndexOf('p'); - const diskName = pIndex > -1 ? row.name.substring(0, pIndex) : row.name; + const diskName = this.trimDiskName(row.name, 'p'); this.dialogService.confirm( helptext.online_disk.title, @@ -309,11 +302,7 @@ export class VolumeStatusComponent implements OnInit { id: 'replace', label: helptext.actions_label.replace, onClick: (row) => { - let name = row.name; - if (!_.startsWith(name, '/')) { - const pIndex = name.lastIndexOf('p'); - name = pIndex > -1 ? name.substring(0, pIndex) : name; - } + const name = this.trimDiskName(row.name, 'p'); const pk = this.pk; _.find(this.replaceDiskFormFields, { name: 'label' }).value = row.guid; @@ -358,11 +347,7 @@ export class VolumeStatusComponent implements OnInit { id: 'remove', label: helptext.actions_label.remove, onClick: (row) => { - let diskName = row.name; - if (!_.startsWith(row.name, '/')) { - const pIndex = row.name.lastIndexOf('p'); - diskName = pIndex > -1 ? row.name.substring(0, pIndex) : row.name; - } + const diskName = this.trimDiskName(row.name, 'p'); this.dialogService.confirm( helptext.remove_disk.title, @@ -390,8 +375,7 @@ export class VolumeStatusComponent implements OnInit { id: 'detach', label: helptext.actions_label.detach, onClick: (row) => { - const pIndex = row.name.lastIndexOf('p'); - const diskName = pIndex > -1 ? row.name.substring(0, pIndex) : row.name; + const diskName = this.trimDiskName(row.name, 'p'); this.dialogService.confirm( helptext.detach_disk.title, @@ -484,11 +468,7 @@ export class VolumeStatusComponent implements OnInit { id: 'Remove', label: helptext.actions_label.remove, onClick: (row) => { - let diskName = row.name; - if (!_.startsWith(row.name, '/')) { - const pIndex = row.name.lastIndexOf('p'); - diskName = pIndex > -1 ? row.name.substring(0, pIndex) : row.name; - } + const diskName = this.trimDiskName(row.name, 'p'); this.dialogService.confirm( helptext.remove_disk.title, @@ -608,4 +588,12 @@ export class VolumeStatusComponent implements OnInit { return this.localeService.formatDateTime(new Date(data.$date)); } } + + private getLeaf(url: string): string { + return url.split('/').pop(); + } + + private trimDiskName(diskName: string, trimSubstring: string): string { + return _.startsWith(diskName, '/') ? diskName : diskName.split(trimSubstring)[0]; + } } diff --git a/src/app/pages/system/advanced/advanced.component.ts b/src/app/pages/system/advanced/advanced.component.ts index 10ff6406c21..3e94412fe49 100644 --- a/src/app/pages/system/advanced/advanced.component.ts +++ b/src/app/pages/system/advanced/advanced.component.ts @@ -355,6 +355,21 @@ export class AdvancedComponent implements OnDestroy { }, ], }, + { + type: 'select', + name: 'syslog_tls_certificate_authority', + placeholder: helptext_system_advanced.syslog_tls_certificate_authority.placeholder, + options: [], + relation: [ + { + action: 'SHOW', + when: [{ + name: 'syslog_transport', + value: 'TLS', + }], + }, + ], + }, ], }, { name: 'divider', divider: true }, @@ -413,6 +428,12 @@ export class AdvancedComponent implements OnDestroy { syslog_tls_certificate_field.options.push({ label: cert.name, value: cert.id }); } }); + const syslog_tls_certificate_authority_field = this.fieldSets.config('syslog_tls_certificate_authority'); + this.ws.call('certificateauthority.query').subscribe((certs) => { + for (const cert of certs) { + syslog_tls_certificate_authority_field.options.push({ label: cert.name, value: cert.id }); + } + }); } afterInit(entityEdit: any) { this.ws.call('failover.licensed').subscribe((is_ha) => {