File tree Expand file tree Collapse file tree
java/de/kaleidox/workbench Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88import org .springframework .stereotype .Controller ;
99import org .springframework .ui .Model ;
1010import org .springframework .web .bind .annotation .GetMapping ;
11+ import org .springframework .web .bind .annotation .ModelAttribute ;
1112import org .springframework .web .bind .annotation .PathVariable ;
1213import org .springframework .web .bind .annotation .PostMapping ;
1314import org .springframework .web .bind .annotation .RequestMapping ;
1415import org .springframework .web .bind .annotation .RequestParam ;
1516import org .springframework .web .multipart .MultipartFile ;
1617
18+ import java .util .List ;
1719import java .util .Objects ;
1820
1921@ Controller
@@ -23,6 +25,11 @@ public class FlkConverterController {
2325 @ Autowired FlkConverter converter ;
2426 @ Autowired ObjectMapper objectMapper ;
2527
28+ @ ModelAttribute ("available" )
29+ public List <String > available () {
30+ return storage .all ().filter (str -> str .endsWith (".json" )).toList ();
31+ }
32+
2633 @ GetMapping
2734 public String upload () {
2835 return "flkConverter/upload" ;
Original file line number Diff line number Diff line change 11package de .kaleidox .workbench .model .abstr ;
22
33import java .io .InputStream ;
4+ import java .util .stream .Stream ;
45
56public interface StorageService {
67 /**
@@ -23,4 +24,9 @@ public interface StorageService {
2324 * @return the data from storage
2425 */
2526 InputStream load (String id );
27+
28+ /**
29+ * @return all existing data identifiers
30+ */
31+ Stream <String > all ();
2632}
Original file line number Diff line number Diff line change 1111import java .io .FileInputStream ;
1212import java .io .FileOutputStream ;
1313import java .io .InputStream ;
14+ import java .util .Arrays ;
1415import java .util .function .Predicate ;
16+ import java .util .stream .Stream ;
1517
1618@ Service
1719public class TempFileStorageService implements StorageService {
@@ -45,4 +47,9 @@ public boolean exists(String id) {
4547 public InputStream load (String id ) {
4648 return new FileInputStream (new File (baseDir , id ));
4749 }
50+
51+ @ Override
52+ public Stream <String > all () {
53+ return Arrays .stream (baseDir .list ());
54+ }
4855}
Original file line number Diff line number Diff line change 1616 </ tr >
1717 </ table >
1818 </ form >
19+ < div class ="ui-panel-2 ">
20+ < h2 > Vorhandene Scans:</ h2 >
21+ < ul >
22+ < li th:each ="id: ${available} "> < a th:href ="'/flk/'+${id} " th:text ="${id} "> </ a > </ li >
23+ </ ul >
24+ </ div >
1925</ div >
2026< div class ="ui-footer " th:insert ="~{/layout/footer} "> </ div >
2127</ body >
Original file line number Diff line number Diff line change 44|
55< a class ="clean-link " th:href ="@{/customers} "> Kunden</ a >
66|
7+ < a class ="clean-link " th:href ="@{/flk} "> Fluke</ a >
8+ |
79< a class ="clean-link " th:href ="@{/logout} "> Logout</ a >
You can’t perform that action at this time.
0 commit comments