Clean up warnings
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Armin Friedl 2020-06-21 13:44:33 +02:00
parent c9af6650fc
commit 5c976fc9d9
Signed by: armin
GPG key ID: 48C726EEE7FBCBC8
20 changed files with 41 additions and 85 deletions

View file

@ -26,7 +26,7 @@ steps:
commands:
- ls -al
- cd web/fling
- npm install && CI=false npm run build
- npm install && npm run build
- tar czf fling-web-latest.tar.gz build/
- curl --user "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file ./fling-web-latest.tar.gz https://nexus.friedl.net/repository/build-artifacts/fling-web-latest.tar.gz

View file

@ -1,6 +1,6 @@
spring:
datasource:
url: jdbc:h2:file:~/Desktop/testdb;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE;IFEXISTS=TRUE;
url: jdbc:h2:file:~/Desktop/testdb;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE;
driverClassName: org.h2.Driver
username: sa
password:

View file

@ -1,4 +1,3 @@
import log from 'loglevel';
import React, {useState} from 'react';
import admin_area from './resources/admin_area.svg';

View file

@ -1,7 +1,4 @@
import React, {useState} from 'react';
import classNames from 'classnames';
import log from 'loglevel';
import React from 'react';
export default (props) => {
function renderError() {

View file

@ -1,11 +1,10 @@
import log from 'loglevel';
import React, {useState} from 'react';
import React from 'react';
import Navbar from './Navbar';
import FlingList from './FlingList';
import FlingContent from './FlingContent';
import {useParams, BrowserRouter} from 'react-router-dom';
import {useParams} from 'react-router-dom';
export default function FlingAdmin() {
let { fling } = useParams();

View file

@ -1,13 +1,9 @@
import log from 'loglevel';
import React, {useState, useEffect, useRef} from 'react';
import {useHistory, useLocation} from 'react-router-dom';
import classNames from 'classnames';
import {artifactClient} from '../../util/flingclient';
function FlingArtifactControl(props) {
let history = useHistory();
let iframeContainer = useRef(null);
function handleDelete(ev) {

View file

@ -1,10 +1,6 @@
import log from 'loglevel';
import React, {useState, useEffect, useRef} from 'react';
import {Switch, Route, Redirect, BrowserRouter, useLocation, useParams, Link} from "react-router-dom";
import classNames from 'classnames';
import {artifactClient} from '../../util/flingclient';
import React from 'react';
import {Switch, Route, useLocation, Link} from "react-router-dom";
import FlingArtifacts from './FlingArtifacts';
import Upload from './Upload';

View file

@ -7,7 +7,18 @@ import FlingTile from './FlingTile';
export default function FlingList(props) {
const [flings, setFlings] = useState([]);
useEffect(() => { refreshFlingList(); }, []);
useEffect(() => { (async () => {
let flings = await flingClient.getFlings();
let newFlings = [];
for (let fling of flings) {
let flingTile = <FlingTile fling={fling}
key={fling.id}
refreshFlingListFn={refreshFlingList} />;
newFlings.push(flingTile);
}
setFlings(newFlings);
})(); } , []);
return(
<div className="panel">
@ -22,15 +33,5 @@ export default function FlingList(props) {
);
async function refreshFlingList() {
let flings = await flingClient.getFlings();
let newFlings = [];
for (let fling of flings) {
let flingTile = <FlingTile fling={fling}
key={fling.id}
refreshFlingListFn={refreshFlingList} />;
newFlings.push(flingTile);
}
setFlings(newFlings);
}
}

View file

@ -1,7 +1,7 @@
import log from 'loglevel';
import React, {useRef, useState} from 'react';
import React, {useRef} from 'react';
import classNames from 'classnames';
import {Switch, Route, Redirect, BrowserRouter, useLocation, useParams, NavLink} from "react-router-dom";
import {NavLink} from "react-router-dom";
import {flingClient} from '../../util/flingclient';
@ -10,9 +10,9 @@ function TileAction(props) {
return(
<div className="tile-action dropdown">
<a className="btn btn-link btn dropdown-toggle" tabIndex="0">
<button className="btn btn-link btn dropdown-toggle" tabIndex="0">
<i className="icon icon-more-vert" />
</a>
</button>
<ul className="menu text-left">
<li className="menu-item input-group">
<div className="input-group">
@ -30,9 +30,9 @@ function TileAction(props) {
</div>
</li>
<li className="menu-item">
<a href="#" className="text-warning" onClick={deleteFling}>
<button className="btn btn-link text-warning pl-0" onClick={deleteFling}>
<i className="icon icon-delete mr-1" /> Remove
</a>
</button>
</li>
</ul>
</div>

View file

@ -76,6 +76,9 @@ export default function Login() {
case "password":
setPassword(val);
break;
default:
log.error(`Cannot handle change ${name}`);
break;
}
};

View file

@ -1,8 +1,6 @@
import log from 'loglevel';
import React, {useState} from 'react';
import New from './New';
import request from '../../util/request';
import send from '../resources/send.svg';
export default function Navbar() {

View file

@ -1,5 +1,5 @@
import log from 'loglevel';
import React, {useState, useEffect, useRef} from 'react';
import React, {useState} from 'react';
import {flingClient} from '../../util/flingclient';

View file

@ -1,8 +1,5 @@
import log from 'loglevel';
import React, {useState, useEffect, useRef} from 'react';
import {useLocation, useHistory} from 'react-router-dom';
import classNames from 'classnames';
import React, {useState, useEffect} from 'react';
import {flingClient} from '../../util/flingclient';
@ -14,13 +11,10 @@ export default function Settings(props) {
let [fling, setFling] = useState(defaultState());
let [shareUrlUnique, setShareUrlUnique] = useState(true);
let [authCodeChangeable, setAuthCodeChangeable] = useState(false);
let location = useLocation();
let history = useHistory();
let [reload, setReload] = useState(true);
useEffect(() => loadSettings(), [props.activeFling]);
function loadSettings() {
if(props.activeFling) {
useEffect(() => {
if(props.activeFling && reload) {
flingClient.getFling(props.activeFling)
.then(result => {
let f = {...fling, ...result};
@ -32,14 +26,15 @@ export default function Settings(props) {
setFling(f);
setAuthCodeChangeable(!f.authCode);
setReload(false);
});
}
}
}, [props.activeFling, reload, fling]);
function reloadSettings(ev) {
ev.preventDefault();
setFling(defaultState());
loadSettings();
setReload(true);
}
function resetAuthCode(ev) {

View file

@ -1,8 +1,5 @@
import log from 'loglevel';
import React, {useState, useEffect, useRef} from 'react';
import {Switch, Route, Redirect, BrowserRouter, useLocation, useParams, Link} from "react-router-dom";
import classNames from 'classnames';
import {artifactClient} from '../../util/flingclient';
@ -155,8 +152,6 @@ export default function Upload(props) {
}
function handleUpload() {
let f = [...files];
files.forEach((file, idx) => {
artifactClient.postArtifact(props.activeFling, file)
.then(response => {

View file

@ -1,4 +1,3 @@
import log from 'loglevel';
import React, {useRef, useState, useEffect} from 'react';
import {flingClient} from '../../util/flingclient';

View file

@ -1,7 +1,6 @@
import log from 'loglevel';
import React, {useState, useEffect} from 'react';
import {useParams, BrowserRouter} from 'react-router-dom';
import {useParams} from 'react-router-dom';
import {flingClient} from '../../util/flingclient';

View file

@ -1,7 +1,7 @@
import log from 'loglevel';
import React, {useState, useEffect, useRef} from 'react';
import {Switch, Route, Redirect, BrowserRouter, useLocation, useParams, Link} from "react-router-dom";
import {Switch, Route, useLocation, Link} from "react-router-dom";
import {flingClient, artifactClient} from '../../util/flingclient';
@ -33,10 +33,6 @@ function Artifacts(props) {
return d.toLocaleDateString();
}
function getArtifactInfo() {
return `${readableBytes(artifact.size)}, ${localizedDate(artifact.uploadTime)}`;
}
return(
<div className="user-list-artifact">
<div className="container">
@ -208,8 +204,6 @@ function Upload(props) {
}
function handleUpload() {
let f = [...files];
files.forEach((file, idx) => {
artifactClient.postArtifact(props.fling.id, file)
.then(response => {
@ -280,11 +274,8 @@ export default function FlingUserList(props) {
let iframeContainer = useRef(null);
let [infoText, setInfoText] = useState("");
let [inProgress, setInProgress] = useState(false);
let [downloadUrl, setDownloadUrl] = useState("");
useEffect(() => flingInfo(props.fling.id), [props.fling.id]);
function flingInfo(flingId) {
useEffect((flingId) => {
if(!flingId) return;
function readableBytes(bytes) {
@ -313,7 +304,7 @@ export default function FlingUserList(props) {
setInfoText(`${localizedDate(props.fling.creationTime)} - ${countArtifacts} files - ${readableBytes(totalSize)}`);
});
}
}, [props.fling.id, props.fling.creationTime]);
function handleDownload(ev) {
ev.preventDefault();
@ -328,7 +319,6 @@ export default function FlingUserList(props) {
let frame = document.createElement("iframe");
frame.src = downloadUrl;
iframeContainer.current.appendChild(frame);
setDownloadUrl(downloadUrl);
setInProgress(false);
});
}

View file

@ -4,10 +4,7 @@ import {useHistory, useLocation} from 'react-router-dom';
import request, {setAuth} from '../../util/request';
import Error from './Error';
export default function Unlock() {
const [errors, setErrors] = useState([]);
const [authCode, setAuthCode] = useState("");
const history = useHistory();
const location = useLocation();
@ -23,7 +20,7 @@ export default function Unlock() {
history.replace(location.state.from);
})
.catch(err => {/* ignored */});
}, [location]);
}, [location, history]);
return (
<div className="container-center">
@ -54,8 +51,6 @@ export default function Unlock() {
})
.catch(error => {
log.error(error);
let response = error.response;
response.data && response.data.message && setErrors( prev => [response.data.message, ...prev] );
});
};
@ -63,8 +58,4 @@ export default function Unlock() {
let val = ev.target.value;
setAuthCode(val);
};
function clearErrors() {
setErrors([]);
}
}

View file

@ -1,5 +1,4 @@
import log from 'loglevel';
import axios from 'axios';
import request from './request';

View file

@ -1,4 +1,3 @@
import log from 'loglevel';
import axios from 'axios';
import jwtDecode from 'jwt-decode';