more frontend formatting and logic for locations and rooms

This commit is contained in:
2022-03-28 22:47:37 -04:00
parent 02a9c6c99c
commit 36fe4ca701
10 changed files with 273 additions and 57 deletions

View File

@@ -174,3 +174,162 @@
{"level":"debug","time":"2022-03-27T22:47:19-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"32756", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"32756", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"level":"info","time":"2022-03-28T21:29:49-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-03-28T21:29:49-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-03-28T21:29:49-04:00","message":"Database and Config loaded, starting webserver..."}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"debug","time":"2022-03-28T21:39:28-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"304", "method":"GET", "path":"/photos/locations/Location1/Kitchen/Kitchen_cover.png"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"level":"debug","time":"2022-03-28T21:49:46-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"level":"info","time":"2022-03-28T21:56:28-04:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"level":"debug","time":"2022-03-28T21:56:30-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"level":"info","time":"2022-03-28T21:56:32-04:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"level":"info","time":"2022-03-28T21:57:37-04:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"level":"debug","time":"2022-03-28T21:57:39-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"level":"info","time":"2022-03-28T21:57:57-04:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"level":"debug","time":"2022-03-28T21:58:37-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"level":"debug","time":"2022-03-28T21:58:51-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"debug","time":"2022-03-28T22:00:03-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"level":"info","time":"2022-03-28T22:00:07-04:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"level":"debug","time":"2022-03-28T22:00:09-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"debug","time":"2022-03-28T22:01:05-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"debug","time":"2022-03-28T22:01:11-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location!} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location!}]"}
{"logtype":"webserver", "pid":"9768", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"info","time":"2022-03-28T22:02:35-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-03-28T22:02:35-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-03-28T22:02:35-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-03-28T22:03:23-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-03-28T22:03:23-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-03-28T22:03:23-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-03-28T22:04:03-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-03-28T22:04:03-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-03-28T22:04:03-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-03-28T22:05:23-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-03-28T22:05:23-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-03-28T22:05:23-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"debug","time":"2022-03-28T22:07:01-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location! Address:} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"16312", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"debug","time":"2022-03-28T22:07:15-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location! Address:} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"16312", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"debug","time":"2022-03-28T22:07:18-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location! Address:} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"16312", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"debug","time":"2022-03-28T22:07:53-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location! Address:} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"16312", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"16312", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"level":"info","time":"2022-03-28T22:08:26-04:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"16312", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"level":"debug","time":"2022-03-28T22:08:30-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location! Address:} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"16312", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"16312", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"logtype":"webserver", "pid":"16312", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/3"}
{"level":"debug","time":"2022-03-28T22:11:27-04:00","message":"Returning Locations: [{ID:3 Name:Location1 Description: CoverPhoto:Location1_cover.png Photos:[Location1_0.png Location1_1.png] Rooms:[] Notes:Notes for my location! Address:} {ID:4 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"16312", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"info","time":"2022-03-28T22:17:33-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-03-28T22:17:33-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-03-28T22:17:33-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-03-28T22:18:47-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-03-28T22:18:47-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-03-28T22:18:47-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"debug","time":"2022-03-28T22:18:53-04:00","message":"Returning Locations: []"}
{"logtype":"webserver", "pid":"28488", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"info","time":"2022-03-28T22:19:02-04:00","message":"Adding new location to database: %!(EXTRA main.Location={0 Location4 Location4_cover.png [Location4_0.png Location4_1.png] [] Notes for my location! })"}
{"level":"debug","time":"2022-03-28T22:19:02-04:00","message":"Adding new location: {0 Location4 Location4_cover.png [Location4_0.png Location4_1.png] [] Notes for my location! }"}
{"logtype":"webserver", "pid":"28488", "requestid":"", "status":"200", "method":"POST", "path":"/api/locations/new"}
{"level":"debug","time":"2022-03-28T22:19:11-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"28488", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"error","time":"2022-03-28T22:19:17-04:00","message":"Unable to fetch all rooms at location: not found"}
{"level":"error","error":"not found","time":"2022-03-28T22:19:17-04:00","message":"Unable to fetch location by id: 3 with error: not found"}
{"logtype":"webserver", "pid":"28488", "requestid":"", "status":"500", "method":"POST", "path":"/api/rooms/3/new"}
{"level":"info","time":"2022-03-28T22:19:22-04:00","message":"Adding new room to location: {%!s(int=0) Kitchen Location4/Kitchen/Kitchen_cover.png [Location4/Kitchen/Kitchen_0.png] Notes For My Room! [] [] %!s(int=1) Location4}"}
{"level":"debug","time":"2022-03-28T22:19:22-04:00","message":"Adding new Room: {0 Kitchen Location4/Kitchen/Kitchen_cover.png [Location4/Kitchen/Kitchen_0.png] Notes For My Room! [] [] 1 Location4}"}
{"logtype":"webserver", "pid":"28488", "requestid":"", "status":"200", "method":"POST", "path":"/api/rooms/1/new"}
{"level":"debug","time":"2022-03-28T22:19:28-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[{ID:0 Name:Kitchen Description: CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Notes:Notes For My Room! Cabinets:[] Items:[] LocationID:1 LocationName:Location4}] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"28488", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"info","time":"2022-03-28T22:19:46-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-03-28T22:19:46-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-03-28T22:19:46-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"debug","time":"2022-03-28T22:21:28-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[{ID:0 Name:Kitchen Description: CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Notes:Notes For My Room! Cabinets:[] Items:[] LocationID:1 LocationName:Location4}] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"debug","time":"2022-03-28T22:21:49-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[{ID:0 Name:Kitchen Description: CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Notes:Notes For My Room! Cabinets:[] Items:[] LocationID:1 LocationName:Location4}] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"level":"debug","time":"2022-03-28T22:24:42-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[{ID:0 Name:Kitchen Description: CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Notes:Notes For My Room! Cabinets:[] Items:[] LocationID:1 LocationName:Location4}] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"debug","time":"2022-03-28T22:25:08-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[{ID:0 Name:Kitchen Description: CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Notes:Notes For My Room! Cabinets:[] Items:[] LocationID:1 LocationName:Location4}] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"error","time":"2022-03-28T22:25:37-04:00","message":"Unable to fetch all rooms at location: not found"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"500", "method":"GET", "path":"/api/rooms/3"}
{"level":"info","time":"2022-03-28T22:25:42-04:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/photos/locations/Location4/Kitchen/Kitchen_cover.png"}
{"level":"debug","time":"2022-03-28T22:26:29-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[{ID:0 Name:Kitchen Description: CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Notes:Notes For My Room! Cabinets:[] Items:[] LocationID:1 LocationName:Location4}] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"info","time":"2022-03-28T22:26:30-04:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"304", "method":"GET", "path":"/photos/locations/Location4/Kitchen/Kitchen_cover.png"}
{"level":"debug","time":"2022-03-28T22:29:27-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[{ID:0 Name:Kitchen Description: CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Notes:Notes For My Room! Cabinets:[] Items:[] LocationID:1 LocationName:Location4}] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"info","time":"2022-03-28T22:29:27-04:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"level":"debug","time":"2022-03-28T22:29:29-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[{ID:0 Name:Kitchen Description: CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Notes:Notes For My Room! Cabinets:[] Items:[] LocationID:1 LocationName:Location4}] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"info","time":"2022-03-28T22:29:29-04:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"level":"debug","time":"2022-03-28T22:29:32-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[{ID:0 Name:Kitchen Description: CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Notes:Notes For My Room! Cabinets:[] Items:[] LocationID:1 LocationName:Location4}] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"info","time":"2022-03-28T22:29:32-04:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"level":"debug","time":"2022-03-28T22:29:55-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[{ID:0 Name:Kitchen Description: CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Notes:Notes For My Room! Cabinets:[] Items:[] LocationID:1 LocationName:Location4}] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"debug","time":"2022-03-28T22:30:26-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[{ID:0 Name:Kitchen Description: CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Notes:Notes For My Room! Cabinets:[] Items:[] LocationID:1 LocationName:Location4}] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/1"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"304", "method":"GET", "path":"/photos/locations/Location4/Kitchen/Kitchen_cover.png"}
{"level":"info","time":"2022-03-28T22:30:47-04:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/1"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/1"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/config"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/1"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/1"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/1"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms/1"}
{"level":"debug","time":"2022-03-28T22:40:36-04:00","message":"Returning Locations: [{ID:1 Name:Location4 Description: CoverPhoto:Location4_cover.png Photos:[Location4_0.png Location4_1.png] Rooms:[{ID:0 Name:Kitchen Description: CoverPhoto:Location4/Kitchen/Kitchen_cover.png Photos:[Location4/Kitchen/Kitchen_0.png] Notes:Notes For My Room! Cabinets:[] Items:[] LocationID:1 LocationName:Location4}] Notes:Notes for my location! Address:}]"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/locations"}
{"level":"info","time":"2022-03-28T22:40:37-04:00","message":"Getting all Rooms"}
{"logtype":"webserver", "pid":"24780", "requestid":"", "status":"200", "method":"GET", "path":"/api/rooms"}
{"level":"info","time":"2022-03-28T22:41:32-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-03-28T22:41:32-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-03-28T22:41:32-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-03-28T22:42:41-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-03-28T22:42:41-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-03-28T22:42:41-04:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2022-03-28T22:43:31-04:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2022-03-28T22:43:31-04:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:false UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2022-03-28T22:43:31-04:00","message":"Database and Config loaded, starting webserver..."}

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

View File

@@ -15,6 +15,13 @@ type Location struct {
Photos []string // A list of additional photos for the location
Rooms []Room
Notes string
Address string
SquareFeet int
Latitude string
Longitude string
DatePurchased string
PurchasePrice string
CurrentValue string
}
// Room is a containerized area at a location
@@ -27,6 +34,8 @@ type Room struct {
Notes string
Cabinets []Cabinet
Items []Item
SquareFeet int
LocationID int //Which location room is assigned to
LocationName string // Location name room belongs to

View File

@@ -2030,11 +2030,11 @@
}
},
"@mantine/core": {
"version": "4.0.9",
"resolved": "https://registry.npmjs.org/@mantine/core/-/core-4.0.9.tgz",
"integrity": "sha512-x7qEnot6dUqstby8G3Hn06zH39sAzC610qEUUThsw1a/UFJvHjr+UONcfDkBGX3XzcgsgOLn/HnOksUHE349fg==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@mantine/core/-/core-4.1.0.tgz",
"integrity": "sha512-uEHGssKveDgGHhbBrgVqp8o12m0oQGLBKH3D8bkrca1GB905ZHuj8CG+i/ojBhqdalfUwqcYGRpwwALtD+XfJg==",
"requires": {
"@mantine/styles": "4.0.9",
"@mantine/styles": "4.1.0",
"@popperjs/core": "^2.9.3",
"@radix-ui/react-scroll-area": "^0.1.1",
"clsx": "^1.1.1",
@@ -2043,9 +2043,9 @@
}
},
"@mantine/dates": {
"version": "4.0.9",
"resolved": "https://registry.npmjs.org/@mantine/dates/-/dates-4.0.9.tgz",
"integrity": "sha512-Dd+wsg6pVsdgeCNNqExhh9p+K651rh1/bAlClsdlPPOoOZzEDMM2U8cN2c4ZVJVbmAeF0spcF4dFLz9G3DX3yA==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@mantine/dates/-/dates-4.1.0.tgz",
"integrity": "sha512-kdKQ9PRGbYe1YhRlqWVUVGG7IKHjdIWMX3XhSFbWWLkfUxqSG4dhwNeAZIcbHXDZhFT9xIifFlBlDiN7JIOmtA==",
"requires": {
"@popperjs/core": "^2.9.3",
"clsx": "^1.1.1",
@@ -2053,31 +2053,31 @@
}
},
"@mantine/dropzone": {
"version": "4.0.9",
"resolved": "https://registry.npmjs.org/@mantine/dropzone/-/dropzone-4.0.9.tgz",
"integrity": "sha512-E9ULojgCUJ5tV4CoMKA7XNa6Qj67VWyXSAwaXWhDeOfMDQy8feYPIbC7lcHlbSo5nBm9IhzjXp5JMLDwRbxAPA==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@mantine/dropzone/-/dropzone-4.1.0.tgz",
"integrity": "sha512-ixu9VGg/dX5DO/BhyoSYH+9nwAmBTElBml7efClawMlvYaifhoOnNiEWykESwjGaGa6/tww0qxzd/ddsI9jEVQ==",
"requires": {
"react-dropzone": "^11.4.2"
}
},
"@mantine/hooks": {
"version": "4.0.9",
"resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-4.0.9.tgz",
"integrity": "sha512-b+IrevT05/nAM2H0iKWC9BP0gr/U8kF3U8Ge+EnvSFeSOWp/exm/Wy5toorQ83nQbmfCjkSAL5WDb6Jx0gI/Fg=="
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-4.1.0.tgz",
"integrity": "sha512-bvVvHDDfYqdIxl7n+lBBwSIkcqInv6kK+fxvEfFBOUEzN6KbpJaPdaYXP788x64uFbA7AODQjdtOhk3tMyQA8Q=="
},
"@mantine/notifications": {
"version": "4.0.9",
"resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-4.0.9.tgz",
"integrity": "sha512-pMM+Pb1p+OdfHl16XvT8jKer8AR/2puVpfO2AUXZ7iJWxycfYkq5vgGW9kY1lowp/B+iS1Cqc7fqwNLPo4HCnA==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-4.1.0.tgz",
"integrity": "sha512-2pdRiK4UVDSHeCcHLSY7GFyXXn4t9HkoVqypXPwybWDBeT6tSOry+5l/+/HKhOpSPktxWykr+4OACUhtBYn5dg==",
"requires": {
"clsx": "^1.1.1",
"react-transition-group": "^4.4.2"
}
},
"@mantine/styles": {
"version": "4.0.9",
"resolved": "https://registry.npmjs.org/@mantine/styles/-/styles-4.0.9.tgz",
"integrity": "sha512-pZIJ4lAl0RDbIYosJEJpEv2iYutlIDMlgoCOac32jB3GkY1iPu2mZjVTp5/aySLI1e/2hb0Pb+kHM58nnG82wA==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@mantine/styles/-/styles-4.1.0.tgz",
"integrity": "sha512-mWFNSE5DqE/5C9TDYIkQVbTef8QyWnW8a8MADHl6S52K0iGU8nqw4jnyozB+6y9JEIxdl+sp0o16L2JnAsq7bA==",
"requires": {
"@emotion/cache": "^11.7.1",
"@emotion/react": "^11.7.1",

View File

@@ -3,11 +3,11 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@mantine/core": "^4.0.9",
"@mantine/dates": "^4.0.9",
"@mantine/dropzone": "^4.0.9",
"@mantine/hooks": "^4.0.9",
"@mantine/notifications": "^4.0.9",
"@mantine/core": "^4.1.0",
"@mantine/dates": "^4.1.0",
"@mantine/dropzone": "^4.1.0",
"@mantine/hooks": "^4.1.0",
"@mantine/notifications": "^4.1.0",
"@testing-library/jest-dom": "^5.16.3",
"@testing-library/react": "^12.1.4",
"@testing-library/user-event": "^13.5.0",

View File

@@ -1,6 +1,6 @@
import React, {useState } from 'react';
import { useAtom } from 'jotai';
import { activePageAtom } from '../state/main';
import { activePageAtom, roomFilterAtom } from '../state/main';
import { Navbar, Text, Group, ThemeIcon, Button, UnstyledButton } from '@mantine/core';
import { Link } from 'react-router-dom';
import { createStyles } from '@mantine/styles';
@@ -39,6 +39,14 @@ const useStyles = createStyles((theme) => ({
function SideBar(props) {
const { classes } = useStyles();
const [activePage, setActivePage] = useAtom(activePageAtom)
const [roomFilter, setRoomFilter] = useAtom(roomFilterAtom)
const changeView = (newView) => {
if (newView === "rooms") {
setRoomFilter({})
}
setActivePage(newView)
}
return (
@@ -61,7 +69,7 @@ function SideBar(props) {
</Group>
</UnstyledButton> */}
<UnstyledButton component={Link} to="/rooms" className={activePage === "rooms" ? classes.activeButton : classes.button} onClick={() => setActivePage("rooms")} >
<UnstyledButton component={Link} to="/rooms" className={activePage === "rooms" ? classes.activeButton : classes.button} onClick={() => changeView("rooms")} >
<Group>
<BsMap />
<Text>Rooms</Text>

View File

@@ -1,7 +1,7 @@
import React, {useState, useEffect, useContext, createContext} from 'react';
import { useAtom } from 'jotai'
import { activePageAtom, roomFilterAtom, serverConfigAtom } from '../../state/main';
import { Text, Loader, Center, Card, Image, Badge, Button, SimpleGrid, Group } from '@mantine/core'
import { Text, Loader, Center, Card, Image, Badge, Button, SimpleGrid, Group, Title } from '@mantine/core'
import { useNavigate } from "react-router-dom";
import { useNotifications } from '@mantine/notifications';
@@ -46,10 +46,9 @@ function LocationsPage(props) {
}, [])
const navigateToRooms = (locationID) => {
console.log("Passedlocid: ", locationID)
const navigateToRooms = (locationID, locationName) => {
setActivePage("rooms")
setRoomsFilter({"locationID": locationID})
setRoomsFilter({"filterType": "location", "locationID": locationID, "commonName": "location", "metadata": locationName})
navigate("/rooms")
}
@@ -57,20 +56,25 @@ function LocationsPage(props) {
return (
<>
<Center>{ isLoading && <Loader size="xl" variant="bars" />}</Center>
<Center><Text>Locations</Text></Center>
<Center><Title order={1}>Locations</Title></Center>
<SimpleGrid cols={4} spacing="xl">
{ locations.map((location, idx) =>
<Card key={`${idx} - ${location.ID}`} component="a" onClick={() => navigateToRooms(location.ID)} shadow="sm" padding="md">
<Card key={`${idx} - ${location.ID}`} shadow="md" padding="md">
<Card.Section>
{location.CoverPhoto ? <Image src={`${serverConfig.baseURL}/photos/locations/${location.Name}/${location.CoverPhoto}`}></Image> : <Text>No Photo</Text>}
</Card.Section>
<Group position="apart">
<Text weight={500}>{location.Name}</Text>
{/* <Badge color="pink" variant="light">
On Sale
</Badge> */}
<Badge variant="light">
{ location.Rooms !== null && location.Rooms.length !== 0 && location.Rooms.length > 1 ? <Text>{location.Rooms.length} Rooms</Text> : <Text>{location.Rooms.length} Room</Text>}
</Badge>
</Group>
<Text size="sm">{location.Description}</Text>
<Group>
<Button onClick={() => navigateToRooms(location.ID, location.Name)}>View Details</Button>
<Button onClick={() => navigateToRooms(location.ID, location.Name)}>View Rooms</Button>
</Group>
</Card>
)}
</SimpleGrid>

View File

@@ -1,7 +1,7 @@
import React, {useState, useEffect, useContext, createContext} from 'react';
import { useAtom } from 'jotai'
import { roomFilterAtom, serverConfigAtom } from '../../state/main';
import { Text, Loader, Center, Card, Image, Badge, Button, SimpleGrid, Group } from '@mantine/core'
import { Text, Loader, Center, Card, Image, Badge, Button, SimpleGrid, Group, Title, ActionIcon } from '@mantine/core'
import { useLocation } from "react-router-dom";
import { useNotifications } from '@mantine/notifications';
@@ -47,20 +47,32 @@ function RoomsPage(props) {
fetchSettings();
}, [])
}, [roomFilter])
// Check if filter changes for this page and refresh results
useEffect(() => {
console.log("CURRENT ROOM FILTER: ", roomFilter)
}, [roomFilter, setFilter])
}, [roomFilter, setRoomFilter])
const removeFilterButton = (
<ActionIcon size="xs" color="blue" radius="xl" variant="transparent">
<Text>X</Text>
</ActionIcon>
);
return (
<>
<Center>{ isLoading && <Loader size="xl" variant="bars" />}</Center>
<Center><Text>Rooms</Text></Center>
<Center><Title order={1}>Rooms</Title></Center>
{ Object.keys(roomFilter).length !== 0 &&
<Badge sx={{ paddingLeft: 0 }} size="lg" radius="xl" color="teal" leftSection={removeFilterButton} onClick={() => {setRoomFilter({})}}>
Filter by {roomFilter.commonName}: {roomFilter.metadata}
</Badge>
}
<SimpleGrid cols={4} spacing="xl">
{ rooms.map((room, idx) =>
<Card key={`${room.ID}`} component="a" onClick={(e) => {}} shadow="sm" padding="md">
@@ -69,11 +81,23 @@ function RoomsPage(props) {
</Card.Section>
<Group position="apart">
<Text weight={500}>{room.Name}</Text>
<Group>
<Badge color="pink" variant="light">
{room.LocationName}
</Badge>
<Badge variant='light'>
{room.Cabinets === null ? 0 : room.Cabinets.length} Cabinets
</Badge>
<Badge color='teal' variant='light'>
{room.Cabinets === null ? 0 : room.Cabinets.length} Items
</Badge>
</Group>
</Group>
<Text size="sm">{room.Description}</Text>
<Group>
<Button onClick={() => console.log("test")}>View Details</Button>
<Button onClick={() => console.log("test")}>View Rooms</Button>
</Group>
</Card>
)}
</SimpleGrid>

View File

@@ -231,6 +231,18 @@ func (s *Server) AddNewRoomHandler(c *fiber.Ctx) error {
if err != nil {
return err
}
// Update our location in the db to add the new room as attached to the ID
loc, err = s.GetLocation(newRoom.LocationID)
if err != nil {
return err
}
roomList := loc.Rooms
roomList = append(roomList, newRoom)
err = s.Database.UpdateField(&Location{ID: newRoom.LocationID}, "Rooms", roomList)
if err != nil {
return err
}
s.Log.Debug().Msgf("Adding new Room: %v", newRoom)
return c.Status(fiber.StatusOK).SendString(fmt.Sprintf("New Room Created! %s", newRoom.Name))
}