File tree Expand file tree Collapse file tree 6 files changed +26
-1
lines changed
java/com/rookout/tutorial Expand file tree Collapse file tree 6 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,15 @@ public ResponseEntity<?> updateTodo(@RequestBody TodoRecord updatingTodoRecord)
44
44
entities .put ("status" , "ok" );
45
45
return new ResponseEntity <>(entities , HttpStatus .OK );
46
46
}
47
+
48
+ @ RequestMapping (value = "/todos/remove_all" , method = RequestMethod .DELETE )
49
+ public ResponseEntity <?>deleteAll () {
50
+ logger .info ("Removing all items" );
51
+ todos .remove_all ();
52
+ Map <String , String > entities = new HashMap <>();
53
+ entities .put ("status" , "ok" );
54
+ return new ResponseEntity <>(entities , HttpStatus .OK );
55
+ }
47
56
48
57
@ RequestMapping (value = "/todos/{todoId}" , method = RequestMethod .DELETE )
49
58
public ResponseEntity <?> deleteTodo (@ PathVariable ("todoId" ) String todoId ) {
@@ -58,6 +67,7 @@ public ResponseEntity<?> deleteTodo(@PathVariable("todoId") String todoId) {
58
67
return new ResponseEntity <>(entities , HttpStatus .OK );
59
68
}
60
69
70
+
61
71
@ RequestMapping (value = "/todos/clear_completed" , method = RequestMethod .DELETE )
62
72
public ResponseEntity <?> clearCompletedTodos () throws InterruptedException {
63
73
tracingHandler .createChildSpansActivity ();
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ public boolean remove(TodoRecord todoRecord) {
26
26
return todoStorage .remove (todoRecord );
27
27
}
28
28
29
+ public boolean remove_all () {
30
+ return todoStorage .removeAll (todoStorage );
31
+ }
32
+
29
33
public TodoRecord findById (String todoRecordId ) {
30
34
for (TodoRecord record : todoStorage ) {
31
35
if (record .getId ().equals (todoRecordId )) {
Original file line number Diff line number Diff line change 1
1
spring.application.name =tutorial-java
2
- opentracing.jaeger.udp-sender.host =jaeger-agent
2
+ opentracing.jaeger.udp-sender.host =localhost
3
3
opentracing.jaeger.udp-sender.port =6831
Original file line number Diff line number Diff line change @@ -372,6 +372,9 @@ html .clear-completed:active {
372
372
.info a : hover {
373
373
text-decoration : underline;
374
374
}
375
+ .clear-all-items {
376
+ cursor : pointer;
377
+ }
375
378
376
379
/*
377
380
Hack to remove background from Mobile Safari.
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ <h1>todos</h1>
42
42
</ section >
43
43
< footer class ="info ">
44
44
< p > Double-click to edit a todo</ p >
45
+ < p class ="clear-all-items " v-on:click ="removeAll() "> Click here to remove all items</ p >
46
+
45
47
</ footer >
46
48
47
49
</ div >
Original file line number Diff line number Diff line change @@ -56,6 +56,12 @@ $().ready(() => {
56
56
break ;
57
57
}
58
58
} ,
59
+ removeAll ( ) {
60
+ const action = $ . ajax ( '/todos/remove_all' , {
61
+ method : 'DELETE'
62
+ } ) ;
63
+ this . reloadOnFinish ( action ) ;
64
+ } ,
59
65
clearCompleted ( e ) {
60
66
const action = $ . ajax ( '/todos/clear_completed' , {
61
67
method : 'DELETE'
You can’t perform that action at this time.
0 commit comments