@@ -20,6 +20,7 @@ import type {
2020 NavigationItem ,
2121 ServerConfig ,
2222 TabData ,
23+ TabPage ,
2324} from "../../common/types.js" ;
2425import defaultIcon from "../img/icon.png" ;
2526
@@ -81,7 +82,7 @@ export class ServerManagerView {
8182 loading : Set < string > ;
8283 activeTabIndex : number ;
8384 tabs : ServerOrFunctionalTab [ ] ;
84- functionalTabs : Map < string , number > ;
85+ functionalTabs : Map < TabPage , number > ;
8586 tabIndex : number ;
8687 presetOrgs : string [ ] ;
8788 preferenceView ?: PreferenceView ;
@@ -333,7 +334,7 @@ export class ServerManagerView {
333334 server . url ,
334335 i ,
335336 ) ;
336- tab . setName ( serverConfig . alias ) ;
337+ tab . setLabel ( serverConfig . alias ) ;
337338 tab . setIcon ( DomainUtil . iconAsUrl ( serverConfig . icon ) ) ;
338339 ( await tab . webview ) . setUnsupportedMessage (
339340 DomainUtil . getUnsupportedMessage ( serverConfig ) ,
@@ -376,7 +377,7 @@ export class ServerManagerView {
376377 const tab = new ServerTab ( {
377378 role : "server" ,
378379 icon : DomainUtil . iconAsUrl ( server . icon ) ,
379- name : server . alias ,
380+ label : server . alias ,
380381 $root : this . $tabsContainer ,
381382 onClick : this . activateLastTab . bind ( this , index ) ,
382383 index,
@@ -558,18 +559,19 @@ export class ServerManagerView {
558559 }
559560
560561 async openFunctionalTab ( tabProperties : {
561- name : string ;
562+ label : string ;
563+ page : TabPage ;
562564 materialIcon : string ;
563565 makeView : ( ) => Promise < Element > ;
564566 destroyView : ( ) => void ;
565567 } ) : Promise < void > {
566- if ( this . functionalTabs . has ( tabProperties . name ) ) {
567- await this . activateTab ( this . functionalTabs . get ( tabProperties . name ) ! ) ;
568+ if ( this . functionalTabs . has ( tabProperties . page ) ) {
569+ await this . activateTab ( this . functionalTabs . get ( tabProperties . page ) ! ) ;
568570 return ;
569571 }
570572
571573 const index = this . tabs . length ;
572- this . functionalTabs . set ( tabProperties . name , index ) ;
574+ this . functionalTabs . set ( tabProperties . page , index ) ;
573575
574576 const tabIndex = this . getTabIndex ( ) ;
575577 const $view = await tabProperties . makeView ( ) ;
@@ -579,13 +581,14 @@ export class ServerManagerView {
579581 new FunctionalTab ( {
580582 role : "function" ,
581583 materialIcon : tabProperties . materialIcon ,
582- name : tabProperties . name ,
584+ label : tabProperties . label ,
585+ page : tabProperties . page ,
583586 $root : this . $tabsContainer ,
584587 index,
585588 tabIndex,
586589 onClick : this . activateTab . bind ( this , index ) ,
587590 onDestroy : async ( ) => {
588- await this . destroyTab ( tabProperties . name , index ) ;
591+ await this . destroyFunctionalTab ( tabProperties . page , index ) ;
589592 tabProperties . destroyView ( ) ;
590593 } ,
591594 $view,
@@ -596,14 +599,15 @@ export class ServerManagerView {
596599 // closed when the functional tab DOM is ready, handled in webview.js
597600 this . $webviewsContainer . classList . remove ( "loaded" ) ;
598601
599- await this . activateTab ( this . functionalTabs . get ( tabProperties . name ) ! ) ;
602+ await this . activateTab ( this . functionalTabs . get ( tabProperties . page ) ! ) ;
600603 }
601604
602605 async openSettings (
603606 navigationItem : NavigationItem = "General" ,
604607 ) : Promise < void > {
605608 await this . openFunctionalTab ( {
606- name : "Settings" ,
609+ page : "Settings" ,
610+ label : "Settings" ,
607611 materialIcon : "settings" ,
608612 makeView : async ( ) => {
609613 this . preferenceView = await PreferenceView . create ( ) ;
@@ -622,7 +626,8 @@ export class ServerManagerView {
622626 async openAbout ( ) : Promise < void > {
623627 let aboutView : AboutView ;
624628 await this . openFunctionalTab ( {
625- name : "About" ,
629+ page : "About" ,
630+ label : "About" ,
626631 materialIcon : "sentiment_very_satisfied" ,
627632 async makeView ( ) {
628633 aboutView = await AboutView . create ( ) ;
@@ -660,7 +665,8 @@ export class ServerManagerView {
660665 get tabsForIpc ( ) : TabData [ ] {
661666 return this . tabs . map ( ( tab ) => ( {
662667 role : tab . properties . role ,
663- name : tab . properties . name ,
668+ page : tab . properties . page ,
669+ label : tab . properties . label ,
664670 index : tab . properties . index ,
665671 } ) ) ;
666672 }
@@ -680,7 +686,7 @@ export class ServerManagerView {
680686 // If old tab is functional tab Settings, remove focus from the settings icon at sidebar bottom
681687 if (
682688 this . tabs [ this . activeTabIndex ] . properties . role === "function" &&
683- this . tabs [ this . activeTabIndex ] . properties . name === "Settings"
689+ this . tabs [ this . activeTabIndex ] . properties . page === "Settings"
684690 ) {
685691 this . $settingsButton . classList . remove ( "active" ) ;
686692 }
@@ -722,7 +728,7 @@ export class ServerManagerView {
722728 this . $loadingIndicator . classList . toggle ( "hidden" , ! loading ) ;
723729 }
724730
725- async destroyTab ( name : string , index : number ) : Promise < void > {
731+ async destroyFunctionalTab ( page : TabPage , index : number ) : Promise < void > {
726732 const tab = this . tabs [ index ] ;
727733 if ( tab instanceof ServerTab && ( await tab . webview ) . loading ) {
728734 return ;
@@ -731,7 +737,7 @@ export class ServerManagerView {
731737 await tab . destroy ( ) ;
732738
733739 delete this . tabs [ index ] ; // eslint-disable-line @typescript-eslint/no-array-delete
734- this . functionalTabs . delete ( name ) ;
740+ this . functionalTabs . delete ( page ) ;
735741
736742 // Issue #188: If the functional tab was not focused, do not activate another tab.
737743 if ( this . activeTabIndex === index ) {
@@ -1053,7 +1059,7 @@ export class ServerManagerView {
10531059 for ( const [ index , domain ] of DomainUtil . getDomains ( ) . entries ( ) ) {
10541060 if ( domain . url === serverURL ) {
10551061 const tab = this . tabs [ index ] ;
1056- if ( tab instanceof ServerTab ) tab . setName ( realmName ) ;
1062+ if ( tab instanceof ServerTab ) tab . setLabel ( realmName ) ;
10571063 domain . alias = realmName ;
10581064 DomainUtil . updateDomain ( index , domain ) ;
10591065 // Update the realm name also on the Window menu
0 commit comments