Merge branch 'master' of https://github.com/sigonasr2/ngsplanner
This commit is contained in:
commit
9aae32d1a4
@ -1,6 +1,6 @@
|
|||||||
# NGS Planner
|
# NGS Planner
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
This tool was created for Phantasy Star Online 2: New Genesis. It is used to therorycraft builds and share them with other players!
|
This tool was created for Phantasy Star Online 2: New Genesis. It is used to therorycraft builds and share them with other players!
|
||||||
|
|
||||||
|
97
src/App.js
97
src/App.js
@ -451,7 +451,7 @@ function TableEditor(p) {
|
|||||||
function SubmitBoxes() {
|
function SubmitBoxes() {
|
||||||
if (!lockSubmission) {
|
if (!lockSubmission) {
|
||||||
setLockSubmission(true)
|
setLockSubmission(true)
|
||||||
axios.post(p.BACKENDURL+p.path,submitVals)
|
axios.post(p.BACKENDURL+p.path,{...submitVals,pass:p.password})
|
||||||
.then(()=>{
|
.then(()=>{
|
||||||
setSubmitVal("Clear")
|
setSubmitVal("Clear")
|
||||||
setUpdate(true)
|
setUpdate(true)
|
||||||
@ -476,7 +476,7 @@ function TableEditor(p) {
|
|||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
var promises=[]
|
var promises=[]
|
||||||
parse(fileData,{columns:true,skip_empty_lines:true}).forEach((entry)=>{
|
parse(fileData,{columns:true,skip_empty_lines:true}).forEach((entry)=>{
|
||||||
promises.push(axios.post(p.BACKENDURL+p.path,entry))
|
promises.push(axios.post(p.BACKENDURL+p.path,{...entry,pass:p.password}))
|
||||||
})
|
})
|
||||||
Promise.allSettled(promises)
|
Promise.allSettled(promises)
|
||||||
.then(()=>{
|
.then(()=>{
|
||||||
@ -497,7 +497,7 @@ function TableEditor(p) {
|
|||||||
if (update) {
|
if (update) {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
var dependency_map = {}
|
var dependency_map = {}
|
||||||
axios.get(p.BACKENDURL+p.path)
|
axios.get(p.BACKENDURL+p.path+"?pass="+p.password)
|
||||||
.then((data)=>{
|
.then((data)=>{
|
||||||
var cols = data.data.fields
|
var cols = data.data.fields
|
||||||
var rows = data.data.rows
|
var rows = data.data.rows
|
||||||
@ -507,7 +507,7 @@ function TableEditor(p) {
|
|||||||
var promise_list = []
|
var promise_list = []
|
||||||
|
|
||||||
cols.filter((col)=>col.name!=="id"&&col.name.includes("_id")).forEach((col)=>{
|
cols.filter((col)=>col.name!=="id"&&col.name.includes("_id")).forEach((col)=>{
|
||||||
promise_list.push(axios.get(p.BACKENDURL+"/"+col.name.replace("_id",""))
|
promise_list.push(axios.get(p.BACKENDURL+"/"+col.name.replace("_id","")+"?pass="+p.password)
|
||||||
.then((data)=>{
|
.then((data)=>{
|
||||||
dependency_map[col.name]=data.data.rows.sort((a,b)=>b.id-a.id)
|
dependency_map[col.name]=data.data.rows.sort((a,b)=>b.id-a.id)
|
||||||
}))
|
}))
|
||||||
@ -544,11 +544,12 @@ function TableEditor(p) {
|
|||||||
{<tr><td></td>{fields.map((col,i)=><td key={i}>{<InputBox includeBlankValue={true} data={dependencies[col.name]} callback4={
|
{<tr><td></td>{fields.map((col,i)=><td key={i}>{<InputBox includeBlankValue={true} data={dependencies[col.name]} callback4={
|
||||||
(f)=>{setSubmitVal({field:col.name,value:f});}}/>}</td>)}<input style={{position:'absolute',top:"-1000px"}}/><PlusCircle onClick={()=>{SubmitBoxes()}} className="submitbutton"/></tr>}
|
(f)=>{setSubmitVal({field:col.name,value:f});}}/>}</td>)}<input style={{position:'absolute',top:"-1000px"}}/><PlusCircle onClick={()=>{SubmitBoxes()}} className="submitbutton"/></tr>}
|
||||||
{data.map((dat)=><tr key={dat.id}>
|
{data.map((dat)=><tr key={dat.id}>
|
||||||
<td><XSquareFill className="webicon" onClick={()=>{axios.delete(p.BACKENDURL+p.path,{data:{id:dat.id}}).then(()=>{setUpdate(true)}).catch((err)=>{alert(err.response.data)})}}/></td>{fields.map((col,i)=><td key={dat.id+"_"+i} className="table-padding table">
|
<td><XSquareFill className="webicon" onClick={()=>{axios.delete(p.BACKENDURL+p.path,{data:{id:dat.id,pass:p.password}}).then(()=>{setUpdate(true)}).catch((err)=>{alert(err.response.data)})}}/></td>{fields.map((col,i)=><td key={dat.id+"_"+i} className="table-padding table">
|
||||||
<InputBox lockSubmission={lockSubmission} data={dependencies[col.name]} callback={(value)=>{
|
<InputBox lockSubmission={lockSubmission} data={dependencies[col.name]} callback={(value)=>{
|
||||||
return axios.patch(p.BACKENDURL+p.path,{
|
return axios.patch(p.BACKENDURL+p.path,{
|
||||||
[col.name]:value,
|
[col.name]:value,
|
||||||
id:dat.id
|
id:dat.id,
|
||||||
|
pass:p.password
|
||||||
})
|
})
|
||||||
}} value={String(dat[col.name])}/></td>)}</tr>)}
|
}} value={String(dat[col.name])}/></td>)}</tr>)}
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -565,7 +566,7 @@ function DatabaseEditor(p) {
|
|||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if (update) {
|
if (update) {
|
||||||
axios.get(p.BACKENDURL+"/databases")
|
axios.get(p.BACKENDURL+"/databases?pass="+p.password)
|
||||||
.then((data)=>{
|
.then((data)=>{
|
||||||
setDatabases(data.data)
|
setDatabases(data.data)
|
||||||
})
|
})
|
||||||
@ -584,7 +585,7 @@ function DatabaseEditor(p) {
|
|||||||
<button className="basichover" style={{backgroundColor:"navy"}} onClick={()=>{
|
<button className="basichover" style={{backgroundColor:"navy"}} onClick={()=>{
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
setMessage(<span style={{color:"black"}}>Uploading Test Database to Production...</span>)
|
setMessage(<span style={{color:"black"}}>Uploading Test Database to Production...</span>)
|
||||||
axios.post(p.BACKENDURL+"/databases/testtolive")
|
axios.post(p.BACKENDURL+"/databases/testtolive",{pass:p.password})
|
||||||
.then(()=>{
|
.then(()=>{
|
||||||
setMessage(<span style={{color:"green"}}>Success! Test Database is now live!</span>)
|
setMessage(<span style={{color:"green"}}>Success! Test Database is now live!</span>)
|
||||||
})
|
})
|
||||||
@ -598,7 +599,7 @@ function DatabaseEditor(p) {
|
|||||||
<button className="basichover" style={{backgroundColor:"maroon"}} onClick={()=>{
|
<button className="basichover" style={{backgroundColor:"maroon"}} onClick={()=>{
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
setMessage(<span style={{color:"black"}}>Restoring Test Database using Live Database...</span>)
|
setMessage(<span style={{color:"black"}}>Restoring Test Database using Live Database...</span>)
|
||||||
axios.post(p.BACKENDURL+"/databases/livetotest")
|
axios.post(p.BACKENDURL+"/databases/livetotest",{pass:p.password})
|
||||||
.then(()=>{
|
.then(()=>{
|
||||||
setMessage(<span style={{color:"green"}}>Success! Live Database has been applied to the Test Database!</span>)
|
setMessage(<span style={{color:"green"}}>Success! Live Database has been applied to the Test Database!</span>)
|
||||||
})
|
})
|
||||||
@ -612,7 +613,7 @@ function DatabaseEditor(p) {
|
|||||||
<button className="basichover" style={{backgroundColor:"darkgreen"}} onClick={()=>{
|
<button className="basichover" style={{backgroundColor:"darkgreen"}} onClick={()=>{
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
setMessage(<span style={{color:"black"}}>Backing up the Live database...</span>)
|
setMessage(<span style={{color:"black"}}>Backing up the Live database...</span>)
|
||||||
axios.post(p.BACKENDURL+"/databases/backup")
|
axios.post(p.BACKENDURL+"/databases/backup",{pass:p.password})
|
||||||
.then(()=>{
|
.then(()=>{
|
||||||
setMessage(<span style={{color:"green"}}>Success! Live Database has been saved!</span>)
|
setMessage(<span style={{color:"green"}}>Success! Live Database has been saved!</span>)
|
||||||
})
|
})
|
||||||
@ -641,7 +642,8 @@ function DatabaseEditor(p) {
|
|||||||
onClick={()=>{
|
onClick={()=>{
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
axios.post(p.BACKENDURL+"/databases/restorefrombackup",{
|
axios.post(p.BACKENDURL+"/databases/restorefrombackup",{
|
||||||
database:db.datname
|
database:db.datname,
|
||||||
|
pass:p.password
|
||||||
})
|
})
|
||||||
.then((data)=>{
|
.then((data)=>{
|
||||||
setMessage(<span style={{color:"green"}}>{"Success! Database has been set to the state from "+date}</span>)
|
setMessage(<span style={{color:"green"}}>{"Success! Database has been set to the state from "+date}</span>)
|
||||||
@ -661,7 +663,28 @@ function DatabaseEditor(p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function AdminPanel(p) {
|
function AdminPanel(p) {
|
||||||
|
const [verified,setVerified] = useState(false)
|
||||||
|
const [password,setPassword] = useState("")
|
||||||
return <div className="main">
|
return <div className="main">
|
||||||
|
{!verified?
|
||||||
|
<div className="w-75">
|
||||||
|
<img src={process.env.PUBLIC_URL+"/spinner.gif"} alt=""/>
|
||||||
|
<input type="password" value={password} onChange={(f)=>{setPassword(f.currentTarget.value)}} onKeyDown={(e)=>{
|
||||||
|
if (e.key==="Enter") {
|
||||||
|
axios.post(GetBackendURL(p)+"/passwordcheck",{
|
||||||
|
pass:password
|
||||||
|
})
|
||||||
|
.then((data)=>{
|
||||||
|
if (data.data.verified) {
|
||||||
|
setVerified(data.data.verified)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err)=>{
|
||||||
|
setVerified(false)
|
||||||
|
setPassword("")
|
||||||
|
})}}}></input>
|
||||||
|
<img src={process.env.PUBLIC_URL+"/spinner.gif"} alt=""/>
|
||||||
|
</div>:<>
|
||||||
<div className="w-25"><Box title="Navigation">
|
<div className="w-25"><Box title="Navigation">
|
||||||
<Table classes="adminNav">
|
<Table classes="adminNav">
|
||||||
<Link to={process.env.PUBLIC_URL+"/admin/class"}>Class</Link><br/>
|
<Link to={process.env.PUBLIC_URL+"/admin/class"}>Class</Link><br/>
|
||||||
@ -705,81 +728,81 @@ function AdminPanel(p) {
|
|||||||
</Table></Box></div>
|
</Table></Box></div>
|
||||||
<div className="w-75">
|
<div className="w-75">
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/class"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/class"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/class"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/class"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/classdata"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/classdata"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/class_level_data"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/class_level_data"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/classweaponcompatibility"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/classweaponcompatibility"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/class_weapon_type_data"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/class_weapon_type_data"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/photonarts"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/photonarts"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/photon_art"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/photon_art"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/weapons"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/weapons"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/weapon"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/weapon"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/weaponexistencedata"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/weaponexistencedata"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/weapon_existence_data"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/weapon_existence_data"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/weapontypes"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/weapontypes"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/weapon_type"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/weapon_type"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/armor"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/armor"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/armor"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/armor"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/potentials"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/potentials"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/potential"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/potential"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/potentialdata"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/potentialdata"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/potential_data"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/potential_data"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/builds"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/builds"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/builds"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/builds"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/skills"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/skills"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/skill"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/skill"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/skilltypes"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/skilltypes"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/skill_type"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/skill_type"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/skilldata"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/skilldata"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/skill_data"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/skill_data"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/classskills"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/classskills"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/class_skill"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/class_skill"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/classskilldata"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/classskilldata"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/class_skill_data"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/class_skill_data"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/augments"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/augments"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/augment"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/augment"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/augmenttypes"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/augmenttypes"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/augment_type"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/augment_type"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/enemydata"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/enemydata"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/enemy_data"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/enemy_data"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/food"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/food"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/food"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/food"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/foodmultipliers"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/foodmultipliers"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/food_mult"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/food_mult"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/roles"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/roles"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/roles"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/roles"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/users"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/users"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/users"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/users"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/database_audit"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/database_audit"}>
|
||||||
<TableEditor BACKENDURL={GetBackendURL(p)} path="/database_audit"/>
|
<TableEditor password={password} BACKENDURL={GetBackendURL(p)} path="/database_audit"/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={process.env.PUBLIC_URL+"/admin/database_manager"}>
|
<Route path={process.env.PUBLIC_URL+"/admin/database_manager"}>
|
||||||
<DatabaseEditor BACKENDURL={GetBackendURL(p)}/>
|
<DatabaseEditor password={password} BACKENDURL={GetBackendURL(p)}/>
|
||||||
</Route>
|
</Route>
|
||||||
</div>
|
</div></>}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user