This commit is contained in:
parent
c9af6650fc
commit
5c976fc9d9
20 changed files with 41 additions and 85 deletions
|
@ -26,7 +26,7 @@ steps:
|
||||||
commands:
|
commands:
|
||||||
- ls -al
|
- ls -al
|
||||||
- cd web/fling
|
- cd web/fling
|
||||||
- npm install && CI=false npm run build
|
- npm install && npm run build
|
||||||
- tar czf fling-web-latest.tar.gz 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
|
- 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
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
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
|
driverClassName: org.h2.Driver
|
||||||
username: sa
|
username: sa
|
||||||
password:
|
password:
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import log from 'loglevel';
|
|
||||||
import React, {useState} from 'react';
|
import React, {useState} from 'react';
|
||||||
|
|
||||||
import admin_area from './resources/admin_area.svg';
|
import admin_area from './resources/admin_area.svg';
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
import React, {useState} from 'react';
|
import React from 'react';
|
||||||
import classNames from 'classnames';
|
|
||||||
|
|
||||||
import log from 'loglevel';
|
|
||||||
|
|
||||||
export default (props) => {
|
export default (props) => {
|
||||||
function renderError() {
|
function renderError() {
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import log from 'loglevel';
|
import React from 'react';
|
||||||
import React, {useState} from 'react';
|
|
||||||
|
|
||||||
import Navbar from './Navbar';
|
import Navbar from './Navbar';
|
||||||
import FlingList from './FlingList';
|
import FlingList from './FlingList';
|
||||||
import FlingContent from './FlingContent';
|
import FlingContent from './FlingContent';
|
||||||
|
|
||||||
import {useParams, BrowserRouter} from 'react-router-dom';
|
import {useParams} from 'react-router-dom';
|
||||||
|
|
||||||
export default function FlingAdmin() {
|
export default function FlingAdmin() {
|
||||||
let { fling } = useParams();
|
let { fling } = useParams();
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
import log from 'loglevel';
|
import log from 'loglevel';
|
||||||
import React, {useState, useEffect, useRef} from 'react';
|
import React, {useState, useEffect, useRef} from 'react';
|
||||||
import {useHistory, useLocation} from 'react-router-dom';
|
|
||||||
|
|
||||||
import classNames from 'classnames';
|
|
||||||
|
|
||||||
import {artifactClient} from '../../util/flingclient';
|
import {artifactClient} from '../../util/flingclient';
|
||||||
|
|
||||||
function FlingArtifactControl(props) {
|
function FlingArtifactControl(props) {
|
||||||
let history = useHistory();
|
|
||||||
let iframeContainer = useRef(null);
|
let iframeContainer = useRef(null);
|
||||||
|
|
||||||
function handleDelete(ev) {
|
function handleDelete(ev) {
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
import log from 'loglevel';
|
import log from 'loglevel';
|
||||||
import React, {useState, useEffect, useRef} from 'react';
|
import React from 'react';
|
||||||
import {Switch, Route, Redirect, BrowserRouter, useLocation, useParams, Link} from "react-router-dom";
|
import {Switch, Route, useLocation, Link} from "react-router-dom";
|
||||||
|
|
||||||
import classNames from 'classnames';
|
|
||||||
|
|
||||||
import {artifactClient} from '../../util/flingclient';
|
|
||||||
|
|
||||||
import FlingArtifacts from './FlingArtifacts';
|
import FlingArtifacts from './FlingArtifacts';
|
||||||
import Upload from './Upload';
|
import Upload from './Upload';
|
||||||
|
|
|
@ -7,7 +7,18 @@ import FlingTile from './FlingTile';
|
||||||
|
|
||||||
export default function FlingList(props) {
|
export default function FlingList(props) {
|
||||||
const [flings, setFlings] = useState([]);
|
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(
|
return(
|
||||||
<div className="panel">
|
<div className="panel">
|
||||||
|
@ -22,15 +33,5 @@ export default function FlingList(props) {
|
||||||
);
|
);
|
||||||
|
|
||||||
async function refreshFlingList() {
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import log from 'loglevel';
|
import log from 'loglevel';
|
||||||
import React, {useRef, useState} from 'react';
|
import React, {useRef} from 'react';
|
||||||
import classNames from 'classnames';
|
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';
|
import {flingClient} from '../../util/flingclient';
|
||||||
|
|
||||||
|
@ -10,9 +10,9 @@ function TileAction(props) {
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div className="tile-action dropdown">
|
<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" />
|
<i className="icon icon-more-vert" />
|
||||||
</a>
|
</button>
|
||||||
<ul className="menu text-left">
|
<ul className="menu text-left">
|
||||||
<li className="menu-item input-group">
|
<li className="menu-item input-group">
|
||||||
<div className="input-group">
|
<div className="input-group">
|
||||||
|
@ -30,9 +30,9 @@ function TileAction(props) {
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li className="menu-item">
|
<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
|
<i className="icon icon-delete mr-1" /> Remove
|
||||||
</a>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -76,6 +76,9 @@ export default function Login() {
|
||||||
case "password":
|
case "password":
|
||||||
setPassword(val);
|
setPassword(val);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
log.error(`Cannot handle change ${name}`);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import log from 'loglevel';
|
|
||||||
import React, {useState} from 'react';
|
import React, {useState} from 'react';
|
||||||
|
|
||||||
import New from './New';
|
import New from './New';
|
||||||
import request from '../../util/request';
|
|
||||||
import send from '../resources/send.svg';
|
import send from '../resources/send.svg';
|
||||||
|
|
||||||
export default function Navbar() {
|
export default function Navbar() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import log from 'loglevel';
|
import log from 'loglevel';
|
||||||
import React, {useState, useEffect, useRef} from 'react';
|
import React, {useState} from 'react';
|
||||||
|
|
||||||
import {flingClient} from '../../util/flingclient';
|
import {flingClient} from '../../util/flingclient';
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
import log from 'loglevel';
|
import log from 'loglevel';
|
||||||
import React, {useState, useEffect, useRef} from 'react';
|
import React, {useState, useEffect} from 'react';
|
||||||
import {useLocation, useHistory} from 'react-router-dom';
|
|
||||||
|
|
||||||
import classNames from 'classnames';
|
|
||||||
|
|
||||||
import {flingClient} from '../../util/flingclient';
|
import {flingClient} from '../../util/flingclient';
|
||||||
|
|
||||||
|
@ -14,13 +11,10 @@ export default function Settings(props) {
|
||||||
let [fling, setFling] = useState(defaultState());
|
let [fling, setFling] = useState(defaultState());
|
||||||
let [shareUrlUnique, setShareUrlUnique] = useState(true);
|
let [shareUrlUnique, setShareUrlUnique] = useState(true);
|
||||||
let [authCodeChangeable, setAuthCodeChangeable] = useState(false);
|
let [authCodeChangeable, setAuthCodeChangeable] = useState(false);
|
||||||
let location = useLocation();
|
let [reload, setReload] = useState(true);
|
||||||
let history = useHistory();
|
|
||||||
|
|
||||||
useEffect(() => loadSettings(), [props.activeFling]);
|
useEffect(() => {
|
||||||
|
if(props.activeFling && reload) {
|
||||||
function loadSettings() {
|
|
||||||
if(props.activeFling) {
|
|
||||||
flingClient.getFling(props.activeFling)
|
flingClient.getFling(props.activeFling)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
let f = {...fling, ...result};
|
let f = {...fling, ...result};
|
||||||
|
@ -32,14 +26,15 @@ export default function Settings(props) {
|
||||||
setFling(f);
|
setFling(f);
|
||||||
|
|
||||||
setAuthCodeChangeable(!f.authCode);
|
setAuthCodeChangeable(!f.authCode);
|
||||||
|
setReload(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}, [props.activeFling, reload, fling]);
|
||||||
|
|
||||||
function reloadSettings(ev) {
|
function reloadSettings(ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
setFling(defaultState());
|
setFling(defaultState());
|
||||||
loadSettings();
|
setReload(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetAuthCode(ev) {
|
function resetAuthCode(ev) {
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
import log from 'loglevel';
|
import log from 'loglevel';
|
||||||
import React, {useState, useEffect, useRef} from 'react';
|
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 {artifactClient} from '../../util/flingclient';
|
||||||
|
|
||||||
|
@ -155,8 +152,6 @@ export default function Upload(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleUpload() {
|
function handleUpload() {
|
||||||
let f = [...files];
|
|
||||||
|
|
||||||
files.forEach((file, idx) => {
|
files.forEach((file, idx) => {
|
||||||
artifactClient.postArtifact(props.activeFling, file)
|
artifactClient.postArtifact(props.activeFling, file)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import log from 'loglevel';
|
|
||||||
import React, {useRef, useState, useEffect} from 'react';
|
import React, {useRef, useState, useEffect} from 'react';
|
||||||
|
|
||||||
import {flingClient} from '../../util/flingclient';
|
import {flingClient} from '../../util/flingclient';
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import log from 'loglevel';
|
|
||||||
import React, {useState, useEffect} from 'react';
|
import React, {useState, useEffect} from 'react';
|
||||||
|
|
||||||
import {useParams, BrowserRouter} from 'react-router-dom';
|
import {useParams} from 'react-router-dom';
|
||||||
|
|
||||||
import {flingClient} from '../../util/flingclient';
|
import {flingClient} from '../../util/flingclient';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import log from 'loglevel';
|
import log from 'loglevel';
|
||||||
import React, {useState, useEffect, useRef} from 'react';
|
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';
|
import {flingClient, artifactClient} from '../../util/flingclient';
|
||||||
|
|
||||||
|
@ -33,10 +33,6 @@ function Artifacts(props) {
|
||||||
return d.toLocaleDateString();
|
return d.toLocaleDateString();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getArtifactInfo() {
|
|
||||||
return `${readableBytes(artifact.size)}, ${localizedDate(artifact.uploadTime)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div className="user-list-artifact">
|
<div className="user-list-artifact">
|
||||||
<div className="container">
|
<div className="container">
|
||||||
|
@ -208,8 +204,6 @@ function Upload(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleUpload() {
|
function handleUpload() {
|
||||||
let f = [...files];
|
|
||||||
|
|
||||||
files.forEach((file, idx) => {
|
files.forEach((file, idx) => {
|
||||||
artifactClient.postArtifact(props.fling.id, file)
|
artifactClient.postArtifact(props.fling.id, file)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
@ -280,11 +274,8 @@ export default function FlingUserList(props) {
|
||||||
let iframeContainer = useRef(null);
|
let iframeContainer = useRef(null);
|
||||||
let [infoText, setInfoText] = useState("");
|
let [infoText, setInfoText] = useState("");
|
||||||
let [inProgress, setInProgress] = useState(false);
|
let [inProgress, setInProgress] = useState(false);
|
||||||
let [downloadUrl, setDownloadUrl] = useState("");
|
|
||||||
|
|
||||||
useEffect(() => flingInfo(props.fling.id), [props.fling.id]);
|
useEffect((flingId) => {
|
||||||
|
|
||||||
function flingInfo(flingId) {
|
|
||||||
if(!flingId) return;
|
if(!flingId) return;
|
||||||
|
|
||||||
function readableBytes(bytes) {
|
function readableBytes(bytes) {
|
||||||
|
@ -313,7 +304,7 @@ export default function FlingUserList(props) {
|
||||||
|
|
||||||
setInfoText(`${localizedDate(props.fling.creationTime)} - ${countArtifacts} files - ${readableBytes(totalSize)}`);
|
setInfoText(`${localizedDate(props.fling.creationTime)} - ${countArtifacts} files - ${readableBytes(totalSize)}`);
|
||||||
});
|
});
|
||||||
}
|
}, [props.fling.id, props.fling.creationTime]);
|
||||||
|
|
||||||
function handleDownload(ev) {
|
function handleDownload(ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
@ -328,7 +319,6 @@ export default function FlingUserList(props) {
|
||||||
let frame = document.createElement("iframe");
|
let frame = document.createElement("iframe");
|
||||||
frame.src = downloadUrl;
|
frame.src = downloadUrl;
|
||||||
iframeContainer.current.appendChild(frame);
|
iframeContainer.current.appendChild(frame);
|
||||||
setDownloadUrl(downloadUrl);
|
|
||||||
setInProgress(false);
|
setInProgress(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,7 @@ import {useHistory, useLocation} from 'react-router-dom';
|
||||||
|
|
||||||
import request, {setAuth} from '../../util/request';
|
import request, {setAuth} from '../../util/request';
|
||||||
|
|
||||||
import Error from './Error';
|
|
||||||
|
|
||||||
export default function Unlock() {
|
export default function Unlock() {
|
||||||
const [errors, setErrors] = useState([]);
|
|
||||||
const [authCode, setAuthCode] = useState("");
|
const [authCode, setAuthCode] = useState("");
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
@ -23,7 +20,7 @@ export default function Unlock() {
|
||||||
history.replace(location.state.from);
|
history.replace(location.state.from);
|
||||||
})
|
})
|
||||||
.catch(err => {/* ignored */});
|
.catch(err => {/* ignored */});
|
||||||
}, [location]);
|
}, [location, history]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container-center">
|
<div className="container-center">
|
||||||
|
@ -54,8 +51,6 @@ export default function Unlock() {
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
log.error(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;
|
let val = ev.target.value;
|
||||||
setAuthCode(val);
|
setAuthCode(val);
|
||||||
};
|
};
|
||||||
|
|
||||||
function clearErrors() {
|
|
||||||
setErrors([]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import log from 'loglevel';
|
import log from 'loglevel';
|
||||||
import axios from 'axios';
|
|
||||||
|
|
||||||
import request from './request';
|
import request from './request';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import log from 'loglevel';
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import jwtDecode from 'jwt-decode';
|
import jwtDecode from 'jwt-decode';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue