Commit 1192c2b7 authored by ras19's avatar ras19
Browse files

Still trying to figure out frontend backend connection for assigning projects to users [RS, EW]

parent 7c0abf69
Pipeline #202595 passed with stage
in 1 minute and 5 seconds
{
"files": {
"main.css": "/static/react/css/main.953731b2.chunk.css",
"main.js": "/static/react/js/main.9211b1b7.chunk.js",
"main.js.map": "/static/react/js/main.9211b1b7.chunk.js.map",
"main.js": "/static/react/js/main.90c98816.chunk.js",
"main.js.map": "/static/react/js/main.90c98816.chunk.js.map",
"runtime-main.js": "/static/react/js/runtime-main.2ec97bd9.js",
"runtime-main.js.map": "/static/react/js/runtime-main.2ec97bd9.js.map",
"js/2.d2190c59.chunk.js": "/static/react/js/2.d2190c59.chunk.js",
......@@ -17,6 +17,6 @@
"js/runtime-main.2ec97bd9.js",
"js/2.d2190c59.chunk.js",
"css/main.953731b2.chunk.css",
"js/main.9211b1b7.chunk.js"
"js/main.90c98816.chunk.js"
]
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/static/react/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/static/react/logo192.png"/><link rel="manifest" href="/static/react/manifest.json"/><title>React App</title><script>window.token="{{DRP_token}}"</script><link href="/static/react/css/main.953731b2.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,u,i=r[0],c=r[1],l=r[2],s=0,p=[];s<i.length;s++)u=i[s],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&p.push(o[u][0]),o[u]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return a.push.apply(a,l||[]),t()}function t(){for(var e,r=0;r<a.length;r++){for(var t=a[r],n=!0,i=1;i<t.length;i++){var c=t[i];0!==o[c]&&(n=!1)}n&&(a.splice(r--,1),e=u(u.s=t[0]))}return e}var n={},o={1:0},a=[];function u(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,u),t.l=!0,t.exports}u.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var a,i=document.createElement("script");i.charset="utf-8",i.timeout=120,u.nc&&i.setAttribute("nonce",u.nc),i.src=function(e){return u.p+"js/"+({}[e]||e)+"."+{3:"b496c8d9"}[e]+".chunk.js"}(e);var c=new Error;a=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+a+")",c.name="ChunkLoadError",c.type=n,c.request=a,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){a({type:"timeout",target:i})}),12e4);i.onerror=i.onload=a,document.head.appendChild(i)}return Promise.all(r)},u.m=e,u.c=n,u.d=function(e,r,t){u.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,r){if(1&r&&(e=u(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(u.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)u.d(t,n,function(r){return e[r]}.bind(null,n));return t},u.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(r,"a",r),r},u.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},u.p="/static/react/",u.oe=function(e){throw console.error(e),e};var i=this["webpackJsonpinaglobe-dashboard"]=this["webpackJsonpinaglobe-dashboard"]||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([])</script><script src="/static/react/js/2.d2190c59.chunk.js"></script><script src="/static/react/js/main.9211b1b7.chunk.js"></script></body></html>
\ No newline at end of file
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/static/react/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/static/react/logo192.png"/><link rel="manifest" href="/static/react/manifest.json"/><title>React App</title><script>window.token="{{DRP_token}}"</script><link href="/static/react/css/main.953731b2.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,u,i=r[0],c=r[1],l=r[2],s=0,p=[];s<i.length;s++)u=i[s],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&p.push(o[u][0]),o[u]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return a.push.apply(a,l||[]),t()}function t(){for(var e,r=0;r<a.length;r++){for(var t=a[r],n=!0,i=1;i<t.length;i++){var c=t[i];0!==o[c]&&(n=!1)}n&&(a.splice(r--,1),e=u(u.s=t[0]))}return e}var n={},o={1:0},a=[];function u(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,u),t.l=!0,t.exports}u.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var a,i=document.createElement("script");i.charset="utf-8",i.timeout=120,u.nc&&i.setAttribute("nonce",u.nc),i.src=function(e){return u.p+"js/"+({}[e]||e)+"."+{3:"b496c8d9"}[e]+".chunk.js"}(e);var c=new Error;a=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+a+")",c.name="ChunkLoadError",c.type=n,c.request=a,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){a({type:"timeout",target:i})}),12e4);i.onerror=i.onload=a,document.head.appendChild(i)}return Promise.all(r)},u.m=e,u.c=n,u.d=function(e,r,t){u.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,r){if(1&r&&(e=u(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(u.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)u.d(t,n,function(r){return e[r]}.bind(null,n));return t},u.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(r,"a",r),r},u.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},u.p="/static/react/",u.oe=function(e){throw console.error(e),e};var i=this["webpackJsonpinaglobe-dashboard"]=this["webpackJsonpinaglobe-dashboard"]||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([])</script><script src="/static/react/js/2.d2190c59.chunk.js"></script><script src="/static/react/js/main.90c98816.chunk.js"></script></body></html>
\ No newline at end of file
......@@ -11,6 +11,7 @@ const CreateProject = () => {
const [files, setFiles] = useState("");
const [selectUsers, setSelectUsers] = useState([]);
const [username, setUsername] = useState("");
const [pid, setPid] = useState("");
const history = useHistory();
......@@ -26,24 +27,24 @@ const CreateProject = () => {
headers: { "Content-Type": "application/json" },
body: JSON.stringify(newProject)
}).then(response => {
const project_id = response.json().id
selectUsers.map(user => {
setUsername(user.username)
const assign_project = { username, project_id };
console.log("The username is " + {username})
console.log("The project_id is " + {project_id})
fetch("/user_project", {
method: 'POST',
headers: { "Content-Type": "application/json" },
body: JSON.stringify(assign_project)
})
})
}).then(() => {
history.push('/');
console.log(response.json())
}).then(data => {
console.log(data)
})
// selectUsers.map(user => {
// setUsername(user.username)
// const assign_project = { username, project_id };
// console.log("The username is " + {username})
// console.log("The project_id is " + {project_id})
// fetch("/user_project", {
// method: 'POST',
// headers: { "Content-Type": "application/json" },
// body: JSON.stringify(assign_project)
// })
// })
}
return (
......
......@@ -7,6 +7,9 @@ const ProjectDetails = () => {
const history = useHistory();
const { data: project, error, isPending } = useFetch("/projects/" + id)
const { data: user_project_assignments, errorAssignment, isPendingAssignment } = useFetch("/user_project")
const users = user_project_assignments.filter(user_project => (user_project.id === id))
const handleRemove = e => {
e.preventDefault()
......@@ -16,41 +19,53 @@ const ProjectDetails = () => {
return (
<div className="project-details">
{ isPending && <h2>Loading...</h2> }
{ project && <h2>{project.name}</h2> }
{ project && <button style={{
{isPending && <h2>Loading...</h2>}
{project && <h2>{project.name}</h2>}
{project && <button style={{
fontSize: '20px',
color: '#fff',
marginBottom: '30px',
marginright: '10px',
borderRadius: '8px',
backgroundColor: '#f1b535'
}}>Status: {project.status}</button> }
{ project && <button style={{
}}>Status: {project.status}</button>}
{project && <button style={{
fontSize: '20px',
color: '#fff',
marginBottom: '30px',
marginRight: '10px',
borderRadius: '8px',
backgroundColor: '#595bc0'
}}>{project.tag}</button> }
{ project && <h4>Location: {project.location}</h4> }
{ project && <button onClick={(e) => {
}}>{project.tag}</button>}
{project && <h4>Location: {project.location}</h4>}
{project && <button onClick={(e) => {
e.preventDefault();
window.open(project.files, "_blank");
}}>Documents</button> }
{ project && <p>{project.description}</p> }
}}>Documents</button>}
{project && <p>{project.description}</p>}
<h2>Volunteers working on this project</h2>
<div>
{users.map((username) => (
<div key={username}>
<div>
<h2>{username}</h2>
</div>
</div>
))}
</div>
<div className="project-tasks">
{ project && <Link to={`/projects/${project.id}/tasks`} className="view-tasks-button">View Tasks</Link> }
{project && <Link to={`/projects/${project.id}/tasks`} className="view-tasks-button">View Tasks</Link>}
{ project && <Link to={`/projects/${project.id}/add-task`} className="add-task-button">Add Task</Link> }
{project && <Link to={`/projects/${project.id}/add-task`} className="add-task-button">Add Task</Link>}
</div>
<div>
{ project && <button onClick={handleRemove}>Delete project</button> }
{project && <button onClick={handleRemove}>Delete project</button>}
{ project && <Link to={`/edit-project/${project.id}`} className="edit-project-button">Edit project</Link> }
{project && <Link to={`/edit-project/${project.id}`} className="edit-project-button">Edit project</Link>}
</div>
</div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment