tab context menu option to save split layouts as profiles - fixes #3468

This commit is contained in:
Eugene Pankov
2021-07-11 12:38:35 +02:00
parent 908f90cd52
commit 2706045cc2
9 changed files with 103 additions and 20 deletions

View File

@@ -57,7 +57,7 @@
.mb-4
.col-12.col-lg-8
.col-12.col-lg-8(*ngIf='this.profileProvider.settingsComponent')
ng-template(#placeholder)
.modal-footer

View File

@@ -16,7 +16,7 @@ const iconsClassList = Object.keys(iconsData).map(
template: require('./editProfileModal.component.pug'),
})
export class EditProfileModalComponent {
@Input() profile: Profile|ConfigProxy
@Input() profile: Profile & ConfigProxy
@Input() profileProvider: ProfileProvider
@Input() settingsComponent: new () => ProfileSettingsComponent
groupNames: string[]
@@ -41,17 +41,20 @@ export class EditProfileModalComponent {
ngOnInit () {
this._profile = this.profile
this.profile = this.profilesService.getConfigProxyForProfile(this.profile)
this.profile = this.profilesService.getConfigProxyForProfile(this.profile) as any
}
ngAfterViewInit () {
setTimeout(() => {
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.profileProvider.settingsComponent)
const componentRef = componentFactory.create(this.injector)
this.settingsComponentInstance = componentRef.instance
this.settingsComponentInstance.profile = this.profile
this.placeholder.insert(componentRef.hostView)
})
const componentType = this.profileProvider.settingsComponent
if (componentType) {
setTimeout(() => {
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentType)
const componentRef = componentFactory.create(this.injector)
this.settingsComponentInstance = componentRef.instance
this.settingsComponentInstance.profile = this.profile
this.placeholder.insert(componentRef.hostView)
})
}
}
groupTypeahead = (text$: Observable<string>) =>

View File

@@ -206,6 +206,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
ssh: 'secondary',
serial: 'success',
telnet: 'info',
'split-layout': 'primary',
}[this.profilesService.providerForProfile(profile)?.id ?? ''] ?? 'warning'
}
}