Hide QuickConnect options when not available

This commit is contained in:
Bill Thornton 2020-11-30 17:13:05 -05:00
parent 4a516337b5
commit 05b0a2518e
4 changed files with 24 additions and 3 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

@ -263,6 +263,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();

View File

@ -49,7 +49,7 @@
</a>
<a is="emby-linkbutton" data-ripple="false" href="#" style="display:block;padding:0;margin:0;" class="lnkQuickConnectPreferences listItem-border">
<a is="emby-linkbutton" data-ripple="false" href="#" style="display:block;padding:0;margin:0;" class="lnkQuickConnectPreferences listItem-border hide">
<div class="listItem">
<em class="material-icons listItemIcon listItemIcon-transparent">tap_and_play</em>
<div class="listItemBody">

View File

@ -41,6 +41,16 @@ export default function (view, params) {
page.querySelector('.selectServer').classList.add('hide');
}
ApiClient.getQuickConnect('Status')
.then(status => {
if (status !== 'Unavailable') {
page.querySelector('.lnkQuickConnectPreferences').classList.remove('hide');
}
})
.catch(() => {
console.debug('Failed to get QuickConnect status');
});
ApiClient.getUser(userId).then(function (user) {
page.querySelector('.headerUsername').innerHTML = user.Name;
if (user.Policy.IsAdministrator && !layoutManager.tv) {