mirror of
https://github.com/tubearchivist/tubearchivist.git
synced 2025-05-13 06:41:11 +00:00
Add 'having issues' help text to login after 10 seconds
This commit is contained in:
parent
862a854e64
commit
7abcfcc579
@ -15,6 +15,7 @@ const Login = () => {
|
|||||||
const [password, setPassword] = useState('');
|
const [password, setPassword] = useState('');
|
||||||
const [saveLogin, setSaveLogin] = useState(false);
|
const [saveLogin, setSaveLogin] = useState(false);
|
||||||
const [waitingForBackend, setWaitingForBackend] = useState(false);
|
const [waitingForBackend, setWaitingForBackend] = useState(false);
|
||||||
|
const [waitedCount, setWaitedCount] = useState(0);
|
||||||
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
||||||
|
|
||||||
const handleSubmit = async (event: { preventDefault: () => void }) => {
|
const handleSubmit = async (event: { preventDefault: () => void }) => {
|
||||||
@ -40,6 +41,8 @@ const Login = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
let retryCount = 0;
|
||||||
|
|
||||||
const backendCheckInterval = setInterval(async () => {
|
const backendCheckInterval = setInterval(async () => {
|
||||||
try {
|
try {
|
||||||
const auth = await loadAuth();
|
const auth = await loadAuth();
|
||||||
@ -59,6 +62,8 @@ const Login = () => {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('Checking backend availability: ', error);
|
console.log('Checking backend availability: ', error);
|
||||||
|
retryCount += 1;
|
||||||
|
setWaitedCount(retryCount);
|
||||||
setWaitingForBackend(true);
|
setWaitingForBackend(true);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@ -137,6 +142,35 @@ const Login = () => {
|
|||||||
|
|
||||||
{!waitingForBackend && <Button label="Login" type="submit" />}
|
{!waitingForBackend && <Button label="Login" type="submit" />}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
{waitedCount > 10 && (
|
||||||
|
<div className="info-box">
|
||||||
|
<div className="info-box-item">
|
||||||
|
<h2>Having issues?</h2>
|
||||||
|
|
||||||
|
<div className="help-text left-align">
|
||||||
|
<p>Please verify that you setup your environment correctly:</p>
|
||||||
|
<ul>
|
||||||
|
<li
|
||||||
|
onClick={() => {
|
||||||
|
navigator.clipboard.writeText(`TA_HOST=${window.location.origin}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
TA_HOST={window.location.origin}
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
onClick={() => {
|
||||||
|
navigator.clipboard.writeText('REDIS_CON=redis://archivist-redis:6379');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
REDIS_CON=redis://archivist-redis:6379
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<p className="login-links">
|
<p className="login-links">
|
||||||
<span>
|
<span>
|
||||||
<a href="https://github.com/tubearchivist/tubearchivist" target="_blank">
|
<a href="https://github.com/tubearchivist/tubearchivist" target="_blank">
|
||||||
|
@ -179,6 +179,10 @@ button:hover {
|
|||||||
padding: 5px 0 5px 1rem;
|
padding: 5px 0 5px 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.left-align {
|
||||||
|
text-align: start;
|
||||||
|
}
|
||||||
|
|
||||||
.help-text::before {
|
.help-text::before {
|
||||||
content: '?';
|
content: '?';
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user