mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Close QuickConnect dialog after login
This commit is contained in:
parent
394a3d9f49
commit
a16d5111b3
3 changed files with 29 additions and 8 deletions
|
@ -13,10 +13,11 @@ import template from './dialog.template.html';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function showDialog(options) {
|
function showDialog(options = { dialogOptions: {}, buttons: [] }) {
|
||||||
const dialogOptions = {
|
const dialogOptions = {
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
scrollY: false
|
scrollY: false,
|
||||||
|
...options.dialogOptions
|
||||||
};
|
};
|
||||||
|
|
||||||
const enableTvLayout = layoutManager.tv;
|
const enableTvLayout = layoutManager.tv;
|
||||||
|
|
|
@ -360,14 +360,17 @@ import '../../assets/css/scrollstyles.css';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createDialog(options) {
|
export function createDialog(options = {}) {
|
||||||
options = options || {};
|
|
||||||
|
|
||||||
// If there's no native dialog support, use a plain div
|
// If there's no native dialog support, use a plain div
|
||||||
// Also not working well in samsung tizen browser, content inside not clickable
|
// Also not working well in samsung tizen browser, content inside not clickable
|
||||||
// Just go ahead and always use a plain div because we're seeing issues overlaying absoltutely positioned content over a modal dialog
|
// Just go ahead and always use a plain div because we're seeing issues overlaying absoltutely positioned content over a modal dialog
|
||||||
const dlg = document.createElement('div');
|
const dlg = document.createElement('div');
|
||||||
|
|
||||||
|
// Add an id so we can access the dialog element
|
||||||
|
if (options.id) {
|
||||||
|
dlg.id = options.id;
|
||||||
|
}
|
||||||
|
|
||||||
dlg.classList.add('focuscontainer');
|
dlg.classList.add('focuscontainer');
|
||||||
dlg.classList.add('hide');
|
dlg.classList.add('hide');
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ import '../../../elements/emby-checkbox/emby-checkbox';
|
||||||
import Dashboard from '../../../scripts/clientUtils';
|
import Dashboard from '../../../scripts/clientUtils';
|
||||||
import ServerConnections from '../../../components/ServerConnections';
|
import ServerConnections from '../../../components/ServerConnections';
|
||||||
import toast from '../../../components/toast/toast';
|
import toast from '../../../components/toast/toast';
|
||||||
|
import dialogHelper from '../../../components/dialogHelper/dialogHelper';
|
||||||
|
import baseAlert from '../../../components/alert';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
@ -49,9 +51,12 @@ import toast from '../../../components/toast/toast';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dashboard.alert({
|
baseAlert({
|
||||||
message: globalize.translate('QuickConnectAuthorizeCode', json.Code),
|
dialogOptions: {
|
||||||
title: globalize.translate('QuickConnect')
|
id: 'quickConnectAlert'
|
||||||
|
},
|
||||||
|
title: globalize.translate('QuickConnect'),
|
||||||
|
text: globalize.translate('QuickConnectAuthorizeCode', json.Code)
|
||||||
});
|
});
|
||||||
|
|
||||||
const connectUrl = apiClient.getUrl('/QuickConnect/Connect?Secret=' + json.Secret);
|
const connectUrl = apiClient.getUrl('/QuickConnect/Connect?Secret=' + json.Secret);
|
||||||
|
@ -64,11 +69,23 @@ import toast from '../../../components/toast/toast';
|
||||||
|
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
|
|
||||||
|
// Close the QuickConnect dialog
|
||||||
|
const dlg = document.getElementById('quickConnectAlert');
|
||||||
|
if (dlg) {
|
||||||
|
dialogHelper.close(dlg);
|
||||||
|
}
|
||||||
|
|
||||||
const result = await apiClient.quickConnect(data.Authentication);
|
const result = await apiClient.quickConnect(data.Authentication);
|
||||||
onLoginSuccessful(result.User.Id, result.AccessToken, apiClient);
|
onLoginSuccessful(result.User.Id, result.AccessToken, apiClient);
|
||||||
}, function (e) {
|
}, function (e) {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
|
|
||||||
|
// Close the QuickConnect dialog
|
||||||
|
const dlg = document.getElementById('quickConnectAlert');
|
||||||
|
if (dlg) {
|
||||||
|
dialogHelper.close(dlg);
|
||||||
|
}
|
||||||
|
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: globalize.translate('QuickConnectDeactivated'),
|
message: globalize.translate('QuickConnectDeactivated'),
|
||||||
title: globalize.translate('HeaderError')
|
title: globalize.translate('HeaderError')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue