Browse Source

update ui to now use the new metadata api

Mark deVilliers 2 years ago
parent
commit
edb838ce9f
4 changed files with 25 additions and 29 deletions
  1. 7 8
      ui/node.js
  2. 11 12
      ui/search.js
  3. 3 5
      ui/src/Decoders.elm
  4. 4 4
      ui/src/Search.elm

+ 7 - 8
ui/node.js

@@ -14210,9 +14210,9 @@ var _rundis$elm_bootstrap$Bootstrap_Table$tbody = F2(
14210 14210
 			{attributes: attributes, rows: rows});
14211 14211
 	});
14212 14212
 
14213
-var _user$project$Decoders$Item = F5(
14214
-	function (a, b, c, d, e) {
14215
-		return {key: a, location: b, sample: c, tags: d, uid: e};
14213
+var _user$project$Decoders$Item = F4(
14214
+	function (a, b, c, d) {
14215
+		return {subject: a, location: b, sample: c, tags: d};
14216 14216
 	});
14217 14217
 var _user$project$Decoders$Location = F5(
14218 14218
 	function (a, b, c, d, e) {
@@ -14264,17 +14264,16 @@ var _user$project$Decoders$decodeLocation = A6(
14264 14264
 	A2(_elm_lang$core$Json_Decode$field, 'scheme', _elm_lang$core$Json_Decode$string),
14265 14265
 	A2(_elm_lang$core$Json_Decode$field, 'uid', _elm_lang$core$Json_Decode$string),
14266 14266
 	_elm_lang$core$Json_Decode$succeed(_user$project$Decoders$Unknown));
14267
-var _user$project$Decoders$decodeItem = A6(
14268
-	_elm_lang$core$Json_Decode$map5,
14267
+var _user$project$Decoders$decodeItem = A5(
14268
+	_elm_lang$core$Json_Decode$map4,
14269 14269
 	_user$project$Decoders$Item,
14270
-	A2(_elm_lang$core$Json_Decode$field, 'key', _elm_lang$core$Json_Decode$string),
14270
+	A2(_elm_lang$core$Json_Decode$field, 'subject', _elm_lang$core$Json_Decode$string),
14271 14271
 	A2(_elm_lang$core$Json_Decode$field, 'location', _user$project$Decoders$decodeLocation),
14272 14272
 	A2(_elm_lang$core$Json_Decode$field, 'sample', _elm_lang$core$Json_Decode$string),
14273 14273
 	A2(
14274 14274
 		_elm_lang$core$Json_Decode$field,
14275 14275
 		'tags',
14276
-		_elm_lang$core$Json_Decode$list(_elm_lang$core$Json_Decode$string)),
14277
-	A2(_elm_lang$core$Json_Decode$field, 'uid', _elm_lang$core$Json_Decode$string));
14276
+		_elm_lang$core$Json_Decode$list(_elm_lang$core$Json_Decode$string)));
14278 14277
 var _user$project$Decoders$decodeItems = _elm_lang$core$Json_Decode$list(_user$project$Decoders$decodeItem);
14279 14278
 var _user$project$Decoders$JsNull = {ctor: 'JsNull'};
14280 14279
 var _user$project$Decoders$JsObject = function (a) {

+ 11 - 12
ui/search.js

@@ -10438,9 +10438,9 @@ var _elm_lang$http$Http$StringPart = F2(
10438 10438
 	});
10439 10439
 var _elm_lang$http$Http$stringPart = _elm_lang$http$Http$StringPart;
10440 10440
 
10441
-var _user$project$Decoders$Item = F5(
10442
-	function (a, b, c, d, e) {
10443
-		return {key: a, location: b, sample: c, tags: d, uid: e};
10441
+var _user$project$Decoders$Item = F4(
10442
+	function (a, b, c, d) {
10443
+		return {subject: a, location: b, sample: c, tags: d};
10444 10444
 	});
10445 10445
 var _user$project$Decoders$Location = F5(
10446 10446
 	function (a, b, c, d, e) {
@@ -10492,17 +10492,16 @@ var _user$project$Decoders$decodeLocation = A6(
10492 10492
 	A2(_elm_lang$core$Json_Decode$field, 'scheme', _elm_lang$core$Json_Decode$string),
10493 10493
 	A2(_elm_lang$core$Json_Decode$field, 'uid', _elm_lang$core$Json_Decode$string),
10494 10494
 	_elm_lang$core$Json_Decode$succeed(_user$project$Decoders$Unknown));
10495
-var _user$project$Decoders$decodeItem = A6(
10496
-	_elm_lang$core$Json_Decode$map5,
10495
+var _user$project$Decoders$decodeItem = A5(
10496
+	_elm_lang$core$Json_Decode$map4,
10497 10497
 	_user$project$Decoders$Item,
10498
-	A2(_elm_lang$core$Json_Decode$field, 'key', _elm_lang$core$Json_Decode$string),
10498
+	A2(_elm_lang$core$Json_Decode$field, 'subject', _elm_lang$core$Json_Decode$string),
10499 10499
 	A2(_elm_lang$core$Json_Decode$field, 'location', _user$project$Decoders$decodeLocation),
10500 10500
 	A2(_elm_lang$core$Json_Decode$field, 'sample', _elm_lang$core$Json_Decode$string),
10501 10501
 	A2(
10502 10502
 		_elm_lang$core$Json_Decode$field,
10503 10503
 		'tags',
10504
-		_elm_lang$core$Json_Decode$list(_elm_lang$core$Json_Decode$string)),
10505
-	A2(_elm_lang$core$Json_Decode$field, 'uid', _elm_lang$core$Json_Decode$string));
10504
+		_elm_lang$core$Json_Decode$list(_elm_lang$core$Json_Decode$string)));
10506 10505
 var _user$project$Decoders$decodeItems = _elm_lang$core$Json_Decode$list(_user$project$Decoders$decodeItem);
10507 10506
 var _user$project$Decoders$JsNull = {ctor: 'JsNull'};
10508 10507
 var _user$project$Decoders$JsObject = function (a) {
@@ -10642,7 +10641,7 @@ var _user$project$Search$updateRight = F3(
10642 10641
 				A3(
10643 10642
 					_elm_community$list_extra$List_Extra$updateIf,
10644 10643
 					function (n) {
10645
-						return _elm_lang$core$Native_Utils.eq(n.uid, item.uid);
10644
+						return _elm_lang$core$Native_Utils.eq(n.subject, item.subject);
10646 10645
 					},
10647 10646
 					function (t) {
10648 10647
 						return _elm_lang$core$Native_Utils.update(
@@ -10669,7 +10668,7 @@ var _user$project$Search$entitlementRequestEncoder = function (item) {
10669 10668
 				_0: {
10670 10669
 					ctor: '_Tuple2',
10671 10670
 					_0: 'subject',
10672
-					_1: _elm_lang$core$Json_Encode$string(item.key)
10671
+					_1: _elm_lang$core$Json_Encode$string(item.subject)
10673 10672
 				},
10674 10673
 				_1: {ctor: '[]'}
10675 10674
 			}
@@ -10781,7 +10780,7 @@ var _user$project$Search$getTimeSeriesData = function (item) {
10781 10780
 			_user$project$Search$nodeURLFromLocation(item.location),
10782 10781
 			'/data/'),
10783 10782
 		_elm_lang$http$Http$jsonBody(
10784
-			_user$project$Search$getTimeSeriesEncoder(item.key)),
10783
+			_user$project$Search$getTimeSeriesEncoder(item.subject)),
10785 10784
 		_user$project$Decoders$decodeDataResponse);
10786 10785
 	return A2(
10787 10786
 		_elm_lang$http$Http$send,
@@ -11073,7 +11072,7 @@ var _user$project$Search$drawFiltered = F2(
11073 11072
 										{ctor: '[]'},
11074 11073
 										{
11075 11074
 											ctor: '::',
11076
-											_0: _elm_lang$html$Html$text(item.key),
11075
+											_0: _elm_lang$html$Html$text(item.subject),
11077 11076
 											_1: {
11078 11077
 												ctor: '::',
11079 11078
 												_0: _elm_lang$html$Html$text(' '),

+ 3 - 5
ui/src/Decoders.elm

@@ -14,22 +14,20 @@ decodeItems =
14 14
 
15 15
 
16 16
 type alias Item =
17
-    { key : String
17
+    { subject : String
18 18
     , location : Location
19 19
     , sample : String
20 20
     , tags : List String
21
-    , uid : String
22 21
     }
23 22
 
24 23
 
25 24
 decodeItem : Json.Decode.Decoder Item
26 25
 decodeItem =
27
-    Json.Decode.map5 Item
28
-        (Json.Decode.field "key" Json.Decode.string)
26
+    Json.Decode.map4 Item
27
+        (Json.Decode.field "subject" Json.Decode.string)
29 28
         (Json.Decode.field "location" decodeLocation)
30 29
         (Json.Decode.field "sample" Json.Decode.string)
31 30
         (Json.Decode.field "tags" (Json.Decode.list Json.Decode.string))
32
-        (Json.Decode.field "uid" Json.Decode.string)
33 31
 
34 32
 
35 33
 type alias Location =

+ 4 - 4
ui/src/Search.elm

@@ -175,7 +175,7 @@ getTimeSeriesData : Decoders.Item -> Cmd Msg
175 175
 getTimeSeriesData item =
176 176
     let
177 177
         request =
178
-            Http.post (nodeURLFromLocation (item.location) ++ "/data/") (Http.jsonBody (getTimeSeriesEncoder item.key)) Decoders.decodeDataResponse
178
+            Http.post (nodeURLFromLocation (item.location) ++ "/data/") (Http.jsonBody (getTimeSeriesEncoder item.subject)) Decoders.decodeDataResponse
179 179
     in
180 180
         Http.send (ViewGraphCompleted item) request
181 181
 
@@ -184,7 +184,7 @@ entitlementRequestEncoder : Decoders.Item -> Json.Encode.Value
184 184
 entitlementRequestEncoder item =
185 185
     Json.Encode.object
186 186
         [ ( "level", Json.Encode.string "can-access" )
187
-        , ( "subject", Json.Encode.string item.key )
187
+        , ( "subject", Json.Encode.string item.subject )
188 188
         ]
189 189
 
190 190
 
@@ -257,7 +257,7 @@ drawFiltered tag items =
257 257
             in
258 258
                 div []
259 259
                     [ div [] [ text (t) ]
260
-                    , div [] <| List.map (\item -> div [] [ text item.key, text " ", drawViewerWidget (item) ]) filtered
260
+                    , div [] <| List.map (\item -> div [] [ text item.subject, text " ", drawViewerWidget (item) ]) filtered
261 261
                     , div [] [ button [ onClick RefreshMetadata ] [ text "new search" ] ]
262 262
                     ]
263 263
 
@@ -293,7 +293,7 @@ updateRight items item right =
293 293
                 location2 =
294 294
                     { location1 | right = right }
295 295
             in
296
-                Just (List.Extra.updateIf (\n -> n.uid == item.uid) (\t -> { t | location = location2 }) all)
296
+                Just (List.Extra.updateIf (\n -> n.subject == item.subject) (\t -> { t | location = location2 }) all)
297 297
 
298 298
 
299 299
 uniqueLocations : Decoders.Items -> List String