1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #2155 from thornbill/quickconnect-enhancements

Improve QuickConnect ux
This commit is contained in:
Joshua M. Boniface 2020-12-04 20:27:24 -05:00 committed by GitHub
commit c383c8075a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 92 additions and 60 deletions

View file

@ -37,8 +37,8 @@
<button is="emby-button" type="button" class="raised cancel block btnManual">
<span>${ButtonManualLogin}</span>
</button>
<button is="emby-button" type="button" class="raised cancel block btnQuick">
<button is="emby-button" type="button" class="raised cancel block btnQuick hide">
<span>${ButtonUseQuickConnect}</span>
</button>

View file

@ -11,6 +11,8 @@ import '../../../elements/emby-checkbox/emby-checkbox';
import Dashboard from '../../../scripts/clientUtils';
import ServerConnections from '../../../components/ServerConnections';
import toast from '../../../components/toast/toast';
import dialogHelper from '../../../components/dialogHelper/dialogHelper';
import baseAlert from '../../../components/alert';
/* eslint-disable indent */
@ -49,9 +51,12 @@ import toast from '../../../components/toast/toast';
return false;
}
Dashboard.alert({
message: globalize.translate('QuickConnectAuthorizeCode', json.Code),
title: globalize.translate('QuickConnect')
baseAlert({
dialogOptions: {
id: 'quickConnectAlert'
},
title: globalize.translate('QuickConnect'),
text: globalize.translate('QuickConnectAuthorizeCode', json.Code)
});
const connectUrl = apiClient.getUrl('/QuickConnect/Connect?Secret=' + json.Secret);
@ -64,11 +69,23 @@ import toast from '../../../components/toast/toast';
clearInterval(interval);
// Close the QuickConnect dialog
const dlg = document.getElementById('quickConnectAlert');
if (dlg) {
dialogHelper.close(dlg);
}
const result = await apiClient.quickConnect(data.Authentication);
onLoginSuccessful(result.User.Id, result.AccessToken, apiClient);
}, function (e) {
clearInterval(interval);
// Close the QuickConnect dialog
const dlg = document.getElementById('quickConnectAlert');
if (dlg) {
dialogHelper.close(dlg);
}
Dashboard.alert({
message: globalize.translate('QuickConnectDeactivated'),
title: globalize.translate('HeaderError')
@ -263,6 +280,17 @@ import toast from '../../../components/toast/toast';
}
const apiClient = getApiClient();
apiClient.getQuickConnect('Status')
.then(status => {
if (status !== 'Unavailable') {
view.querySelector('.btnQuick').classList.remove('hide');
}
})
.catch(() => {
console.debug('Failed to get QuickConnect status');
});
apiClient.getPublicUsers().then(function (users) {
if (users.length) {
showVisualForm();