diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3171cc0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,46 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+# dependencies
+**/node_modules
+# testing
+**/coverage
+# production
+**/build
+# misc
+**/.DS_Store
+npm-debug.log*
+**/yarn-debug.log*
+**/yarn-error.log*
+# Created by https://www.toptal.com/developers/gitignore/api/webstorm
+# Edit at https://www.toptal.com/developers/gitignore?templates=webstorm
+### WebStorm ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+# User-specific stuff
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+.idea/**/*.xml
+.idea/**/*.iml
+# Generated files
+.idea/**/contentModel.xml
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+# Sonarlint plugin
+.idea/**/sonarlint/
+# SonarQube Plugin
+.idea/**/sonarIssues.xml
+# Markdown Navigator plugin
+.idea/**/markdown-navigator.xml
+.idea/**/markdown-navigator-enh.xml
+.idea/**/markdown-navigator/
+# Cache file creation bug
+# See https://youtrack.jetbrains.com/issue/JBR-2257
+.idea/$CACHE_FILE$
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..b58b603
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,5 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..28a804d
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..7f9b010
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/todo-frontend.iml b/.idea/todo-frontend.iml
new file mode 100644
index 0000000..24643cc
--- /dev/null
+++ b/.idea/todo-frontend.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..48e341a
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,3 @@
+{
+ "lockfileVersion": 1
+}
diff --git a/static/.gitignore b/static/.gitignore
deleted file mode 100644
index e4231c8..0000000
--- a/static/.gitignore
+++ /dev/null
@@ -1,126 +0,0 @@
-# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
-
-# dependencies
-/node_modules
-/.pnp
-.pnp.js
-
-# testing
-/coverage
-
-# production
-/build
-
-# misc
-.DS_Store
-.env.local
-.env.development.local
-.env.test.local
-.env.production.local
-
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-
-
-# Created by https://www.toptal.com/developers/gitignore/api/webstorm
-# Edit at https://www.toptal.com/developers/gitignore?templates=webstorm
-
-### WebStorm ###
-# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
-# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
-
-# User-specific stuff
-.idea/**/workspace.xml
-.idea/**/tasks.xml
-.idea/**/usage.statistics.xml
-.idea/**/dictionaries
-.idea/**/shelf
-.idea/*.xml
-
-# Generated files
-.idea/**/contentModel.xml
-
-# Sensitive or high-churn files
-.idea/**/dataSources/
-.idea/**/dataSources.ids
-.idea/**/dataSources.local.xml
-.idea/**/sqlDataSources.xml
-.idea/**/dynamic.xml
-.idea/**/uiDesigner.xml
-.idea/**/dbnavigator.xml
-
-# Gradle
-.idea/**/gradle.xml
-.idea/**/libraries
-
-# Gradle and Maven with auto-import
-# When using Gradle or Maven with auto-import, you should exclude module files,
-# since they will be recreated, and may cause churn. Uncomment if using
-# auto-import.
-# .idea/artifacts
-# .idea/compiler.xml
-# .idea/jarRepositories.xml
-# .idea/modules.xml
-# .idea/*.iml
-# .idea/modules
-# *.iml
-# *.ipr
-
-# CMake
-cmake-build-*/
-
-# Mongo Explorer plugin
-.idea/**/mongoSettings.xml
-
-# File-based project format
-*.iws
-
-# IntelliJ
-out/
-
-# mpeltonen/sbt-idea plugin
-.idea_modules/
-
-# JIRA plugin
-atlassian-ide-plugin.xml
-
-# Cursive Clojure plugin
-.idea/replstate.xml
-
-# Crashlytics plugin (for Android Studio and IntelliJ)
-com_crashlytics_export_strings.xml
-crashlytics.properties
-crashlytics-build.properties
-fabric.properties
-
-# Editor-based Rest Client
-.idea/httpRequests
-
-# Android studio 3.1+ serialized cache file
-.idea/caches/build_file_checksums.ser
-
-### WebStorm Patch ###
-# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
-
-# *.iml
-# modules.xml
-# .idea/misc.xml
-# *.ipr
-
-# Sonarlint plugin
-.idea/**/sonarlint/
-
-# SonarQube Plugin
-.idea/**/sonarIssues.xml
-
-# Markdown Navigator plugin
-.idea/**/markdown-navigator.xml
-.idea/**/markdown-navigator-enh.xml
-.idea/**/markdown-navigator/
-
-# Cache file creation bug
-# See https://youtrack.jetbrains.com/issue/JBR-2257
-.idea/$CACHE_FILE$
-
-# End of https://www.toptal.com/developers/gitignore/api/webstorm
diff --git a/static/src/component/board/card/index.jsx b/static/src/component/board/card/index.jsx
index 17931f6..308edaa 100644
--- a/static/src/component/board/card/index.jsx
+++ b/static/src/component/board/card/index.jsx
@@ -3,13 +3,14 @@ import Task from "../task";
import '../../../css/Card.css';
function Card(props) {
- const {subject, tasks, move} = props;
+ const {subject, tasks, move, remove} = props;
return (
{subject}
{
tasks.map(task => {
- return
+ return
})
}
diff --git a/static/src/component/board/task/index.jsx b/static/src/component/board/task/index.jsx
index bc3abbf..cf8a136 100644
--- a/static/src/component/board/task/index.jsx
+++ b/static/src/component/board/task/index.jsx
@@ -5,22 +5,27 @@ import {isDone, isTodo, toToggledValue} from "../../../utility/status";
import Button from "../../atom/Button";
function Task(props) {
- const {title, subject, id, move} = props;
+ const {title, subject, id, priority, assignee, created, move, remove} = props;
const onClick = (event) => {
event.stopPropagation();
const toggledValue = toToggledValue(subject);
move(id, toggledValue);
};
+ function handle(event) {
+ remove(id);
+ }
return (
{
isTodo(subject) &&
}
- {title}
+ {title} {String(priority)+'순위'}
+ {assignee} {created}
{
isDone(subject) &&
}
+
);
}
diff --git a/static/src/page/Board.jsx b/static/src/page/Board.jsx
index d6967d3..c490e3e 100644
--- a/static/src/page/Board.jsx
+++ b/static/src/page/Board.jsx
@@ -5,6 +5,7 @@ import '../css/Board.css';
import moveTo from "../service/moveTo";
import {Link} from "react-router-dom";
import {toName, toToggleName} from '../utility/status';
+import deleteCard from "../service/deleteCard";
function Board() {
const [cards, updateCards] = useState({});
@@ -25,19 +26,64 @@ function Board() {
const changedStatus = toName(result.status);
cards[changedStatus].push(result);
+ // case 1:
+ // const changedCards = await getCards();
+ // updateCards({
+ // todo: changedCards.todo,
+ // done: changedCards.done
+ // });
+
+ // case 2:
+ cards.todo.sort(function (a, b) {
+ return a.priority-b.priority;
+ });
+ cards.done.sort(function (a, b) {
+ return a.priority-b.priority;
+ });
+
updateCards({
todo: cards.todo,
done: cards.done
});
}
};
+ function remove(id) {
+ const todo = cards.todo;
+ const done = cards.done;
+
+ let index = todo.findIndex((value) => {
+ return value.id === id;
+ });
+ if(index!==-1) {
+ todo.splice(index, 1);
+ const isSuccesses = deleteCard(id);
+ if (!isSuccesses) {
+ alert('NotFound(todo)');
+ }
+ }
+ else{
+ index = done.findIndex((value) => {
+ return value.id === id;
+ });
+ done.splice(index, 1);
+ const isSuccesses = deleteCard(id);
+ if (!isSuccesses) {
+ alert('NotFound(done)');
+ }
+ }
+
+ updateCards({
+ "todo": cards.todo,
+ "done": cards.done
+ });
+ }
return (
{
Object.entries(cards).map(([subject, tasks]) => {
- return ;
+ return ;
})
}
diff --git a/static/src/page/Enrollment.jsx b/static/src/page/Enrollment.jsx
index e30a456..45cfdbc 100644
--- a/static/src/page/Enrollment.jsx
+++ b/static/src/page/Enrollment.jsx
@@ -6,19 +6,31 @@ import Input from "../component/atom/Input";
function Enrollment({history}) {
const [title, setTitle] = useState('');
+ const [assignee, setAssignee] = useState('');
+ const [priority, setPriority] = useState('2');
- const onChange = (event) => {
+ const onChangeTitle = (event) => {
event.stopPropagation();
setTitle(event.target.value);
};
+ const onChangeAssignee = (event) => {
+ event.stopPropagation();
+ setAssignee(event.target.value);
+ }
+
+ const onChangePriority = (event) => {
+ event.stopPropagation();
+ setPriority(event.target.value);
+ }
+
const onPreviousClick = (event) => {
event.stopPropagation();
history.goBack();
};
const add = async () => {
- const isSuccesses = await createCard(title);
+ const isSuccesses = await createCard(title, assignee, priority);
if (isSuccesses) {
history.goBack();
} else {
@@ -41,13 +53,26 @@ function Enrollment({history}) {
const onClearClick = (event) => {
event.stopPropagation();
setTitle('');
+ setAssignee('');
+ document.getElementById("priority").value = 2;
+ setPriority('2');
};
return (
-
+
+
+
+
diff --git a/static/src/service/createCard.js b/static/src/service/createCard.js
index 0cef56a..dfa327f 100644
--- a/static/src/service/createCard.js
+++ b/static/src/service/createCard.js
@@ -1,4 +1,4 @@
-async function createCard(title) {
+async function createCard(title, assignee, priority) {
try {
const response = await fetch('/todo/cards', {
method: 'POST',
@@ -7,7 +7,7 @@ async function createCard(title) {
headers: {
'Content-Type': 'application/json; charset=utf-8',
},
- body: JSON.stringify({ title }),
+ body: JSON.stringify({ title, assignee, priority }),
});
return response.status === 201;
diff --git a/static/src/service/deleteCard.js b/static/src/service/deleteCard.js
new file mode 100644
index 0000000..7b66864
--- /dev/null
+++ b/static/src/service/deleteCard.js
@@ -0,0 +1,17 @@
+async function deleteCard(id) {
+ try {
+ const response = await fetch(`/todo/cards/${id}`, {
+ method: 'DELETE',
+ credentials: 'include',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json; utf-8',
+ },
+ });
+ return response.status === 201;
+ } catch (e) {
+ return false;
+ }
+}
+
+export default deleteCard;