feat: add navigateToAuthentication method to navigation API (#6603)

Signed-off-by: Denis Golovin <dgolovin@users.noreply.github.com>
Co-authored-by: Florent BENOIT <fbenoit@redhat.com>
This commit is contained in:
Denis Golovin 2024-04-02 19:20:13 -07:00 committed by GitHub
parent 6df4181208
commit 689b3f80eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 18 additions and 0 deletions

View file

@ -4157,6 +4157,11 @@ declare module '@podman-desktop/api' {
* @see {@link window.createWebviewPanel createWebviewPanel} for creating a Webview
*/
export function navigateToWebview(webviewId: string): Promise<void>;
/**
* Navigate to Authentication settings page
*/
export function navigateToAuthentication(): Promise<void>;
}
/**

View file

@ -1216,6 +1216,9 @@ export class ExtensionLoader {
navigateToWebview: async (webviewId: string): Promise<void> => {
await this.navigationManager.navigateToWebview(webviewId);
},
navigateToAuthentication: async (): Promise<void> => {
await this.navigationManager.navigateToAuthentication();
},
};
const version = app.getVersion();

View file

@ -207,4 +207,10 @@ export class NavigationManager {
},
});
}
async navigateToAuthentication(): Promise<void> {
this.navigateTo({
page: NavigationPage.AUTHENTICATION,
});
}
}

View file

@ -32,4 +32,5 @@ export enum NavigationPage {
TROUBLESHOOTING = 'troubleshooting',
HELP = 'help',
WEBVIEW = 'webview',
AUTHENTICATION = 'authentication',
}

View file

@ -79,5 +79,8 @@ export const handleNavigation = (page: NavigationPage, parameters?: { [key: stri
case NavigationPage.WEBVIEW:
router.goto(`/webviews/${parameters?.['id']}`);
break;
case NavigationPage.AUTHENTICATION:
router.goto('/preferences/authentication-providers');
break;
}
};