diff --git a/interface/src/api/endpoints.ts b/interface/src/api/endpoints.ts index d3b2a4c93..99940bb14 100644 --- a/interface/src/api/endpoints.ts +++ b/interface/src/api/endpoints.ts @@ -9,7 +9,7 @@ export const ACCESS_TOKEN = 'access_token'; export const alovaInstance = createAlova({ statesHook: ReactHook, // timeout: 3000, // 3 seconds before throwing a timeout error, default is 0 = none - // cacheFor: null, // disable cache + cacheFor: null, // disable cache // cacheFor: { // GET: { // mode: 'memory', @@ -22,7 +22,7 @@ export const alovaInstance = createAlova({ method.config.headers.Authorization = 'Bearer ' + localStorage.getItem(ACCESS_TOKEN); } - // for simulating vrey slow networks + // for simulating very slow networks // return new Promise((resolve) => { // const random = 3000 + Math.random() * 2000; // setTimeout(resolve, Math.floor(random)); diff --git a/interface/src/app/settings/DownloadUpload.tsx b/interface/src/app/settings/DownloadUpload.tsx index 10c457a30..a4a4daafe 100644 --- a/interface/src/app/settings/DownloadUpload.tsx +++ b/interface/src/app/settings/DownloadUpload.tsx @@ -126,7 +126,7 @@ const DownloadUpload = () => { {LL.UPLOAD_TEXT()}. - + ); }; diff --git a/interface/src/app/settings/Version.tsx b/interface/src/app/settings/Version.tsx index b852bcacf..7fbfbf2d0 100644 --- a/interface/src/app/settings/Version.tsx +++ b/interface/src/app/settings/Version.tsx @@ -21,13 +21,19 @@ import { } from '@mui/material'; import * as SystemApi from 'api/system'; -import { callAction } from 'api/app'; +import { API, callAction } from 'api/app'; import { getDevVersion, getStableVersion } from 'api/system'; import { dialogStyle } from 'CustomTheme'; import { useRequest } from 'alova/client'; +import type { APIcall } from 'app/main/types'; import SystemMonitor from 'app/status/SystemMonitor'; -import { FormLoader, SectionContent, useLayoutTitle } from 'components'; +import { + FormLoader, + SectionContent, + SingleUpload, + useLayoutTitle +} from 'components'; import { useI18nContext } from 'i18n/i18n-react'; const Version = () => { @@ -116,6 +122,19 @@ const Version = () => { } } + const { send: sendAPI } = useRequest((data: APIcall) => API(data), { + immediate: false + }); + + const doRestart = async () => { + setRestarting(true); + await sendAPI({ device: 'system', cmd: 'restart', id: 0 }).catch( + (error: Error) => { + toast.error(error.message); + } + ); + }; + const getBinURL = () => { if (!internetLive) { return ''; @@ -417,6 +436,10 @@ const Version = () => { )} {renderInstallDialog()} + + {LL.UPLOAD()} + + ); diff --git a/interface/src/components/upload/DragNdrop.tsx b/interface/src/components/upload/DragNdrop.tsx index 0896ac6b5..e2cfa2abc 100644 --- a/interface/src/components/upload/DragNdrop.tsx +++ b/interface/src/components/upload/DragNdrop.tsx @@ -10,7 +10,7 @@ import { useI18nContext } from 'i18n/i18n-react'; import './dragNdrop.css'; -const DragNdrop = ({ onFileSelected }) => { +const DragNdrop = ({ text, onFileSelected }) => { const [file, setFile] = useState(); const [dragged, setDragged] = useState(false); const inputRef = useRef(null); @@ -73,7 +73,7 @@ const DragNdrop = ({ onFileSelected }) => { >
-

{LL.UPLOAD_DRAG()}

+

{text}

{ +const SingleUpload = ({ text, doRestart }) => { const [md5, setMd5] = useState(); const [file, setFile] = useState(); const { LL } = useI18nContext(); @@ -73,7 +73,7 @@ const SingleUpload = ({ doRestart }) => { ) : ( - + )} {md5 && ( diff --git a/interface/src/i18n/cz/index.ts b/interface/src/i18n/cz/index.ts index c77a54e0c..43fb309b4 100644 --- a/interface/src/i18n/cz/index.ts +++ b/interface/src/i18n/cz/index.ts @@ -187,7 +187,7 @@ const cz: Translation = { COMPACT: 'Kompaktní', DOWNLOAD_SETTINGS_TEXT: 'Vytvořte zálohu svého nastavení a konfigurace', UPLOAD_TEXT: 'Nahrajte nový soubor firmwaru (.bin) nebo záložní soubor (.json)', - UPLOAD_DROP_TEXT: 'Přetáhněte soubor nebo klikněte sem', + UPLOAD_DROP_TEXT: 'Drop a firmware .bin file or click here', // TODO translate ERROR: 'Neočekávaná chyba, zkuste to prosím znovu', TIME_SET: 'Čas nastaven', MANAGE_USERS: 'Spravovat uživatele', diff --git a/interface/src/i18n/de/index.ts b/interface/src/i18n/de/index.ts index 2c76b6e26..3fd9dbe66 100644 --- a/interface/src/i18n/de/index.ts +++ b/interface/src/i18n/de/index.ts @@ -187,7 +187,7 @@ const de: Translation = { COMPACT: 'Kompakte Darstellung', DOWNLOAD_SETTINGS_TEXT: 'Erstellen Sie eine Sicherung Ihrer Konfigurationen und Einstellungen', UPLOAD_TEXT: 'Laden Sie eine neue Firmware-Datei (.bin) oder eine Sicherungsdatei (.json) hoch', - UPLOAD_DROP_TEXT: 'Klicken Sie hier, oder ziehen Sie eine Datei hierher.', + UPLOAD_DROP_TEXT: 'Drop a firmware .bin file or click here', // TODO translate ERROR: 'Unerwarteter Fehler, bitte versuchen Sie es erneut.', TIME_SET: 'Zeit gesetzt', MANAGE_USERS: 'Nutzerverwaltung', diff --git a/interface/src/i18n/en/index.ts b/interface/src/i18n/en/index.ts index 895a1eb0d..9bb53b5f0 100644 --- a/interface/src/i18n/en/index.ts +++ b/interface/src/i18n/en/index.ts @@ -187,7 +187,7 @@ const en: Translation = { COMPACT: 'Compact', DOWNLOAD_SETTINGS_TEXT: 'Create a backup of your configuration and settings', UPLOAD_TEXT: 'Upload a new firmware file (.bin) or a backup file (.json)', - UPLOAD_DROP_TEXT: 'Drop file or click here', + UPLOAD_DROP_TEXT: 'Drop a firmware .bin file or click here', ERROR: 'Unexpected Error, please try again', TIME_SET: 'Time set', MANAGE_USERS: 'Manage Users', diff --git a/interface/src/i18n/fr/index.ts b/interface/src/i18n/fr/index.ts index 5391c9695..f71c5df74 100644 --- a/interface/src/i18n/fr/index.ts +++ b/interface/src/i18n/fr/index.ts @@ -187,7 +187,7 @@ const fr: Translation = { COMPACT: 'Compact', DOWNLOAD_SETTINGS_TEXT: 'Create a backup of your configuration and settings', // TODO translate UPLOAD_TEXT: 'Upload a new firmware file (.bin) or a backup file (.json)', // TODO translate - UPLOAD_DROP_TEXT: 'Déposer le fichier ou cliquer ici', + UPLOAD_DROP_TEXT: 'Drop a firmware .bin file or click here', // TODO translate ERROR: 'Erreur inattendue, veuillez réessayer', TIME_SET: 'Time set', MANAGE_USERS: 'Gérer les utilisateurs', diff --git a/interface/src/i18n/it/index.ts b/interface/src/i18n/it/index.ts index 6a396a254..6b9fdf94d 100644 --- a/interface/src/i18n/it/index.ts +++ b/interface/src/i18n/it/index.ts @@ -187,7 +187,7 @@ const it: Translation = { COMPACT: 'Compact', DOWNLOAD_SETTINGS_TEXT: 'Create a backup of your configuration and settings', // TODO translate UPLOAD_TEXT: 'Upload a new firmware file (.bin) or a backup file (.json)', // TODO translate - UPLOAD_DROP_TEXT: 'Trascina il file o clicca qui', + UPLOAD_DROP_TEXT: 'Drop a firmware .bin file or click here', // TODO translate ERROR: 'Errore Inaspettato, prego tenta ancora', TIME_SET: 'Imposta Ora', MANAGE_USERS: 'Gestione Utenti', diff --git a/interface/src/i18n/nl/index.ts b/interface/src/i18n/nl/index.ts index 64f7f2329..59397b5fd 100644 --- a/interface/src/i18n/nl/index.ts +++ b/interface/src/i18n/nl/index.ts @@ -187,7 +187,7 @@ const nl: Translation = { COMPACT: 'Compact', DOWNLOAD_SETTINGS_TEXT: 'Maak een back-up van uw configuratie en instellingen', UPLOAD_TEXT: 'Upload een nieuw firmwarebestand (.bin) of een back-upbestand (.json)', - UPLOAD_DROP_TEXT: 'Sleep bestand hierheen of klik hier', + UPLOAD_DROP_TEXT: 'Sleep en firmware .bin bestand hierheen of klik hier', ERROR: 'Onverwachte fout, probeer opnieuw', TIME_SET: 'Tijd ingesteld', MANAGE_USERS: 'Beheer Gebruikers', diff --git a/interface/src/i18n/no/index.ts b/interface/src/i18n/no/index.ts index 76ff8c327..e0a72faf4 100644 --- a/interface/src/i18n/no/index.ts +++ b/interface/src/i18n/no/index.ts @@ -187,7 +187,7 @@ const no: Translation = { COMPACT: 'Komprimere', DOWNLOAD_SETTINGS_TEXT: 'Create a backup of your configuration and settings', // TODO translate UPLOAD_TEXT: 'Upload a new firmware file (.bin) or a backup file (.json)', // TODO translate - UPLOAD_DROP_TEXT: 'Slipp fil eller klikk her', + UPLOAD_DROP_TEXT: 'Drop a firmware .bin file or click here', // TODO translate ERROR: 'Ukjent feil, prøv igjen', TIME_SET: 'Still in tid', MANAGE_USERS: 'Administrer Brukere', diff --git a/interface/src/i18n/pl/index.ts b/interface/src/i18n/pl/index.ts index 035596252..b872ff2ef 100644 --- a/interface/src/i18n/pl/index.ts +++ b/interface/src/i18n/pl/index.ts @@ -187,7 +187,7 @@ const pl: BaseTranslation = { COMPACT: 'Kompaktowy', DOWNLOAD_SETTINGS_TEXT: 'Create a backup of your configuration and settings', // TODO translate UPLOAD_TEXT: 'Upload a new firmware file (.bin) or a backup file (.json)', // TODO translate - UPLOAD_DROP_TEXT: 'Przeciągnij tutaj plik lub kliknij', + UPLOAD_DROP_TEXT: 'Drop a firmware .bin file or click here', // TODO translate ERROR: 'Nieoczekiwany błąd, spróbuj ponownie!', TIME_SET: 'Zegar został ustawiony.', MANAGE_USERS: 'Zarządzanie użytkownikami', diff --git a/interface/src/i18n/sk/index.ts b/interface/src/i18n/sk/index.ts index 5f76534ec..128a7ebad 100644 --- a/interface/src/i18n/sk/index.ts +++ b/interface/src/i18n/sk/index.ts @@ -187,7 +187,7 @@ const sk: Translation = { COMPACT: 'Kompaktné', DOWNLOAD_SETTINGS_TEXT: 'Vytvorte zálohu svojej konfigurácie a nastavení', UPLOAD_TEXT: 'Nahrajte nový súbor firmvéru (.bin) alebo súbor zálohy (.json)', - UPLOAD_DROP_TEXT: 'Potiahnuť a pripnúť súbor alebo kliknúť sem', + UPLOAD_DROP_TEXT: 'Drop a firmware .bin file or click here', // TODO translate ERROR: 'Neočakávaná chyba, prosím skúste to znova', TIME_SET: 'Nastavený čas', MANAGE_USERS: 'Správa používateľov', diff --git a/interface/src/i18n/sv/index.ts b/interface/src/i18n/sv/index.ts index 6e0b4d234..0bf283a76 100644 --- a/interface/src/i18n/sv/index.ts +++ b/interface/src/i18n/sv/index.ts @@ -187,7 +187,7 @@ const sv: Translation = { COMPACT: 'Komprimerad', DOWNLOAD_SETTINGS_TEXT: 'Skapa en säkerhetskopia av din konfiguration och inställningar', UPLOAD_TEXT: 'Ladda upp en ny firmwarefil (.bin) eller en säkerhetskopiafil (.json)', - UPLOAD_DROP_TEXT: 'Släpp fil eller klicka här', + UPLOAD_DROP_TEXT: 'Drop a firmware .bin file or click here', // TODO translate ERROR: 'Okänt fel, var god försök igen', TIME_SET: 'Ställ in tid', MANAGE_USERS: 'Användare', diff --git a/interface/src/i18n/tr/index.ts b/interface/src/i18n/tr/index.ts index 3f2d6e089..f7e9e7f77 100644 --- a/interface/src/i18n/tr/index.ts +++ b/interface/src/i18n/tr/index.ts @@ -187,7 +187,7 @@ const tr: Translation = { COMPACT: 'Sıkışık', DOWNLOAD_SETTINGS_TEXT: 'Create a backup of your configuration and settings', // TODO translate UPLOAD_TEXT: 'Upload a new firmware file (.bin) or a backup file (.json)', // TODO translate - UPLOAD_DROP_TEXT: 'Buraya tıklayın yada dosyayı sürükleyip bırakın', + UPLOAD_DROP_TEXT: 'Drop a firmware .bin file or click here', // TODO translate ERROR: 'Beklenemedik hata, lütfen tekrar deneyin.', TIME_SET: 'Zaman ayarı', MANAGE_USERS: 'Kullanıcıları yönet',