mirror of
https://gitlab.com/ryzen-controller-team/ryzen-controller.git
synced 2024-12-22 18:13:28 +07:00
fix: Display an friendly message instead of loading indefinitely online presets.
Translations update consequently, they may not be accurate as I used google translate.
This commit is contained in:
parent
8fcbfc57a2
commit
605741b9c1
@ -24,6 +24,17 @@ function PresetOnline() {
|
||||
return <PresetOnlineLine preset={preset} key={`online_${index}_${presetName}_btn`} />;
|
||||
})}
|
||||
</ul>
|
||||
) : presetsOnlineContext.error && !presetsOnlineContext.loading ? (
|
||||
<Card title={getTranslation("PresetOnline.errorLoadingPresets", "Unable to load presets.")}>
|
||||
{getTranslation("PresetOnline.pleaseCheckInternetConnection", "Please check your internet connection.")}
|
||||
<br />
|
||||
<button
|
||||
className="uk-margin-small-bottom uk-button uk-button-small uk-button-default"
|
||||
onClick={() => presetsOnlineContext.update()}
|
||||
>
|
||||
{getTranslation("PresetOnline.retryLoadingPresetListBtn", "Retry")}
|
||||
</button>
|
||||
</Card>
|
||||
) : presetsOnlineContext.loading || !sysInfoContext?.signature ? (
|
||||
<div className="uk-flex uk-flex-center">
|
||||
<div uk-spinner="ratio: 2"></div>
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { createContext } from "react";
|
||||
|
||||
let context: PresetsOnlineContextType = {
|
||||
error: false,
|
||||
loading: true,
|
||||
list: [],
|
||||
update() {},
|
||||
|
@ -99,5 +99,8 @@
|
||||
"ryzenAdjBottomBar.createPreset": "新增预设",
|
||||
"ryzenAdjBottomBar.reset": "重置",
|
||||
"app.localeSelectorModalTitle": "更改语言",
|
||||
"appContext.newReleaseAvailable": "有新版本发布,请检查发布标签。"
|
||||
"appContext.newReleaseAvailable": "有新版本发布,请检查发布标签。",
|
||||
"PresetOnline.errorLoadingPresets": "无法加载预设。",
|
||||
"PresetOnline.retryLoadingPresetListBtn": "重试",
|
||||
"PresetOnline.pleaseCheckInternetConnection": "请检查您的互联网连接。"
|
||||
}
|
||||
|
@ -99,5 +99,8 @@
|
||||
"ryzenAdjBottomBar.createPreset": "Preset erstellen",
|
||||
"ryzenAdjBottomBar.reset": "Zurücksetzen",
|
||||
"app.localeSelectorModalTitle": "Sprache ändern",
|
||||
"appContext.newReleaseAvailable": "Eine neue Version ist verfügbar. Überprüfen Sie die Registerkarte Version."
|
||||
"appContext.newReleaseAvailable": "Eine neue Version ist verfügbar. Überprüfen Sie die Registerkarte Version.",
|
||||
"PresetOnline.errorLoadingPresets": "Presets können nicht geladen werden.",
|
||||
"PresetOnline.retryLoadingPresetListBtn": "Wiederholen",
|
||||
"PresetOnline.pleaseCheckInternetConnection": "Bitte überprüfe deine Internetverbindung."
|
||||
}
|
||||
|
@ -99,5 +99,8 @@
|
||||
"ryzenAdjBottomBar.createPreset": "Create preset",
|
||||
"ryzenAdjBottomBar.reset": "Reset",
|
||||
"app.localeSelectorModalTitle": "Change language",
|
||||
"appContext.newReleaseAvailable": "A new release is available, please check the release tab."
|
||||
"appContext.newReleaseAvailable": "A new release is available, please check the release tab.",
|
||||
"PresetOnline.errorLoadingPresets": "Unable to load presets.",
|
||||
"PresetOnline.retryLoadingPresetListBtn": "Retry",
|
||||
"PresetOnline.pleaseCheckInternetConnection": "Please check your internet connection."
|
||||
}
|
||||
|
@ -99,5 +99,8 @@
|
||||
"ryzenAdjBottomBar.reset": "Reset",
|
||||
"ryzenAdjBottomBar.createPreset": "Créer preset",
|
||||
"app.localeSelectorModalTitle": "Changer de langage",
|
||||
"appContext.newReleaseAvailable": "Une nouvelle version est disponible, vérifiez l'onglet releases."
|
||||
"appContext.newReleaseAvailable": "Une nouvelle version est disponible, vérifiez l'onglet releases.",
|
||||
"PresetOnline.errorLoadingPresets": "Impossible de charger les presets en ligne.",
|
||||
"PresetOnline.retryLoadingPresetListBtn": "Réessayer",
|
||||
"PresetOnline.pleaseCheckInternetConnection": "Veuillez vérifier votre connexion internet."
|
||||
}
|
||||
|
@ -99,5 +99,8 @@
|
||||
"ryzenAdjBottomBar.createPreset": "Preset oluştur",
|
||||
"ryzenAdjBottomBar.reset": "Sıfırla",
|
||||
"app.localeSelectorModalTitle": "Dil değiştir",
|
||||
"appContext.newReleaseAvailable": "Yeni bir sürüm mevcut, lütfen sürüm sekmesini kontrol edin."
|
||||
"appContext.newReleaseAvailable": "Yeni bir sürüm mevcut, lütfen sürüm sekmesini kontrol edin.",
|
||||
"PresetOnline.errorLoadingPresets": "Ön ayarlar yüklenemiyor.",
|
||||
"PresetOnline.retryLoadingPresetListBtn": "Yeniden Dene",
|
||||
"PresetOnline.pleaseCheckInternetConnection": "Lütfen internet bağlantınızı kontrol edin."
|
||||
}
|
||||
|
1
src/react-app-env.d.ts
vendored
1
src/react-app-env.d.ts
vendored
@ -114,6 +114,7 @@ type ApiPreset = {
|
||||
};
|
||||
|
||||
type PresetsOnlineContextType = {
|
||||
error: boolean;
|
||||
loading: boolean;
|
||||
list: Array<ApiPreset>;
|
||||
update(): void;
|
||||
|
@ -13,6 +13,7 @@ const uikit = window.require("uikit");
|
||||
class PresetsScene extends React.Component<{}, PresetsOnlineContextType> {
|
||||
_isMounted = false;
|
||||
state: PresetsOnlineContextType = {
|
||||
error: false,
|
||||
loading: false,
|
||||
list: [],
|
||||
update: this.updatePresetList.bind(this),
|
||||
@ -72,7 +73,10 @@ class PresetsScene extends React.Component<{}, PresetsOnlineContextType> {
|
||||
fetch(process.env.REACT_APP_SERVER_ENDPOINT + "/presets", requestOption)
|
||||
.then(response => response.json())
|
||||
.then((data: Array<ApiPreset>) => {
|
||||
if (this._isMounted) this.setState({ list: data, loading: false });
|
||||
if (this._isMounted) this.setState({ list: data, loading: false, error: false });
|
||||
})
|
||||
.catch(reason => {
|
||||
if (this._isMounted) this.setState({ error: true, loading: false });
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user