mirror of
https://github.com/balzack/databag.git
synced 2025-02-15 21:19:16 +00:00
adjust error messaging in dashboard
This commit is contained in:
parent
25c8e64a95
commit
7dd7d4b3eb
@ -28,7 +28,7 @@ console.log("IN DASHBOARD here");
|
|||||||
<>
|
<>
|
||||||
<div class="settings">
|
<div class="settings">
|
||||||
<SettingsButton type="text" size="small" icon={<ReloadOutlined />}
|
<SettingsButton type="text" size="small" icon={<ReloadOutlined />}
|
||||||
onClick={() => actions.getAccounts()}></SettingsButton>
|
onClick={() => actions.reload()}></SettingsButton>
|
||||||
</div>
|
</div>
|
||||||
<div class="settings">
|
<div class="settings">
|
||||||
<SettingsButton type="text" size="small" icon={<SettingOutlined />}
|
<SettingsButton type="text" size="small" icon={<SettingOutlined />}
|
||||||
@ -38,7 +38,7 @@ console.log("IN DASHBOARD here");
|
|||||||
<SettingsButton type="text" size="small" icon={<LogoutOutlined />}
|
<SettingsButton type="text" size="small" icon={<LogoutOutlined />}
|
||||||
onClick={() => actions.logout()}></SettingsButton>
|
onClick={() => actions.logout()}></SettingsButton>
|
||||||
</div>
|
</div>
|
||||||
{ state.errorMessage && (
|
{ (state.configError || state.accountsError) && (
|
||||||
<AlertIcon>
|
<AlertIcon>
|
||||||
<ExclamationCircleOutlined />
|
<ExclamationCircleOutlined />
|
||||||
</AlertIcon>
|
</AlertIcon>
|
||||||
@ -54,7 +54,7 @@ console.log("IN DASHBOARD here");
|
|||||||
<div class="settings">
|
<div class="settings">
|
||||||
<Tooltip placement="topRight" title="Reload Accounts">
|
<Tooltip placement="topRight" title="Reload Accounts">
|
||||||
<SettingsButton type="text" size="small" icon={<ReloadOutlined />}
|
<SettingsButton type="text" size="small" icon={<ReloadOutlined />}
|
||||||
onClick={() => actions.getAccounts()}></SettingsButton>
|
onClick={() => actions.reload()}></SettingsButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div class="settings">
|
<div class="settings">
|
||||||
@ -69,8 +69,15 @@ console.log("IN DASHBOARD here");
|
|||||||
onClick={() => actions.logout()}></SettingsButton>
|
onClick={() => actions.logout()}></SettingsButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
{ state.errorMessage && (
|
{ state.configError && (
|
||||||
<Tooltip placement="topRight" title={state.errorMessage}>
|
<Tooltip placement="topRight" title="failed to load accounts">
|
||||||
|
<AlertIcon class="alert">
|
||||||
|
<ExclamationCircleOutlined />
|
||||||
|
</AlertIcon>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
|
{ state.accountsError && (
|
||||||
|
<Tooltip placement="topRight" title="failed to load config">
|
||||||
<AlertIcon class="alert">
|
<AlertIcon class="alert">
|
||||||
<ExclamationCircleOutlined />
|
<ExclamationCircleOutlined />
|
||||||
</AlertIcon>
|
</AlertIcon>
|
||||||
|
@ -18,7 +18,8 @@ export function useDashboard() {
|
|||||||
enableAudio: null,
|
enableAudio: null,
|
||||||
enableVideo: null,
|
enableVideo: null,
|
||||||
|
|
||||||
errorMessage: null,
|
configError: false,
|
||||||
|
accountsError: false,
|
||||||
createToken: null,
|
createToken: null,
|
||||||
showSettings: false,
|
showSettings: false,
|
||||||
showCreate: false,
|
showCreate: false,
|
||||||
@ -91,7 +92,8 @@ export function useDashboard() {
|
|||||||
logout: () => {
|
logout: () => {
|
||||||
app.actions.clearAdmin();
|
app.actions.clearAdmin();
|
||||||
},
|
},
|
||||||
getAccounts: async () => {
|
reload: async () => {
|
||||||
|
await syncConfig();
|
||||||
await syncAccounts();
|
await syncAccounts();
|
||||||
},
|
},
|
||||||
setSettings: async () => {
|
setSettings: async () => {
|
||||||
@ -118,13 +120,12 @@ export function useDashboard() {
|
|||||||
const config = await getNodeConfig(app.state.adminToken);
|
const config = await getNodeConfig(app.state.adminToken);
|
||||||
const { storage, domain, keyType, pushSupported, enableImage, enableAudio, enableVideo } = config;
|
const { storage, domain, keyType, pushSupported, enableImage, enableAudio, enableVideo } = config;
|
||||||
const accountStorage = Math.ceil(storage / 1073741824);
|
const accountStorage = Math.ceil(storage / 1073741824);
|
||||||
updateState({ domain, accountStorage, keyType, enableImage, enableAudio, enableVideo, pushSupported });
|
updateState({ configError: false, domain, accountStorage, keyType, enableImage, enableAudio, enableVideo, pushSupported });
|
||||||
}
|
}
|
||||||
catch(err) {
|
catch(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
updateState({ errorMessage: 'failed to sync config' });
|
updateState({ configError: true });
|
||||||
}
|
}
|
||||||
updateState({ errorMessage: 'failed to sync config' });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const syncAccounts = async () => {
|
const syncAccounts = async () => {
|
||||||
@ -139,11 +140,11 @@ export function useDashboard() {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
updateState({ accounts });
|
updateState({ accounstError: false, accounts });
|
||||||
}
|
}
|
||||||
catch(err) {
|
catch(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
updateState({ errorMessage: 'failed to sync accounts' });
|
updateState({ accountsError: true });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user