Browse Source

clear graph between searches

Mark deVilliers 2 years ago
parent
commit
f462b6ba63
3 changed files with 19 additions and 11 deletions
  1. 3 3
      ui/search.html
  2. 12 7
      ui/search.js
  3. 4 1
      ui/src/Search.elm

+ 3 - 3
ui/search.html

@@ -20,7 +20,9 @@
20 20
   app.ports.unsafeDrawGraph.subscribe(function(data) {
21 21
       drawGraph(data)
22 22
   });
23
-
23
+  app.ports.clearGraph.subscribe(function(data) {
24
+      document.getElementById("graph").innerHTML = "";
25
+  });
24 26
 
25 27
   function drawGraph( data ){
26 28
 
@@ -31,8 +33,6 @@
31 33
     }
32 34
 
33 35
     MG.data_graphic({
34
-        //title: "Downloads",
35
-        //description: "This graphic shows a time-series of downloads.",
36 36
         data: prepared,
37 37
         width: 600,
38 38
         height: 250,

+ 12 - 7
ui/search.js

@@ -10684,6 +10684,11 @@ var _user$project$Search$unsafeDrawGraph = _elm_lang$core$Native_Platform.outgoi
10684 10684
 				return {value: v.value, date: v.date};
10685 10685
 			});
10686 10686
 	});
10687
+var _user$project$Search$clearGraph = _elm_lang$core$Native_Platform.outgoingPort(
10688
+	'clearGraph',
10689
+	function (v) {
10690
+		return v;
10691
+	});
10687 10692
 var _user$project$Search$Model = F2(
10688 10693
 	function (a, b) {
10689 10694
 		return {all: a, filter: b};
@@ -10930,14 +10935,14 @@ var _user$project$Search$update = F2(
10930 10935
 							{
10931 10936
 								all: _elm_lang$core$Maybe$Just(_p5._0._0)
10932 10937
 							}),
10933
-						_1: _elm_lang$core$Platform_Cmd$none
10938
+						_1: _user$project$Search$clearGraph('only-for-the-compiler')
10934 10939
 					};
10935 10940
 				} else {
10936 10941
 					return _elm_lang$core$Native_Utils.crashCase(
10937 10942
 						'Search',
10938 10943
 						{
10939
-							start: {line: 65, column: 5},
10940
-							end: {line: 117, column: 45}
10944
+							start: {line: 68, column: 5},
10945
+							end: {line: 120, column: 45}
10941 10946
 						},
10942 10947
 						_p5)(
10943 10948
 						_elm_lang$core$Basics$toString(_p5._0._0));
@@ -10988,8 +10993,8 @@ var _user$project$Search$update = F2(
10988 10993
 						return _elm_lang$core$Native_Utils.crashCase(
10989 10994
 							'Search',
10990 10995
 							{
10991
-								start: {line: 65, column: 5},
10992
-								end: {line: 117, column: 45}
10996
+								start: {line: 68, column: 5},
10997
+								end: {line: 120, column: 45}
10993 10998
 							},
10994 10999
 							_p5)(
10995 11000
 							_elm_lang$core$Basics$toString(_p5._1._0));
@@ -11012,8 +11017,8 @@ var _user$project$Search$update = F2(
11012 11017
 					return _elm_lang$core$Native_Utils.crashCase(
11013 11018
 						'Search',
11014 11019
 						{
11015
-							start: {line: 65, column: 5},
11016
-							end: {line: 117, column: 45}
11020
+							start: {line: 68, column: 5},
11021
+							end: {line: 120, column: 45}
11017 11022
 						},
11018 11023
 						_p5)(
11019 11024
 						_elm_lang$core$Basics$toString(_p5._0._0));

+ 4 - 1
ui/src/Search.elm

@@ -23,6 +23,9 @@ main =
23 23
 port unsafeDrawGraph : List FloatDataItem -> Cmd msg
24 24
 
25 25
 
26
+port clearGraph : String -> Cmd msg
27
+
28
+
26 29
 
27 30
 -- MODEL
28 31
 
@@ -70,7 +73,7 @@ update msg model =
70 73
             ( { model | filter = Nothing }, getAllMetadata )
71 74
 
72 75
         RefreshMetadataCompleted (Ok items) ->
73
-            ( { model | all = Just items }, Cmd.none )
76
+            ( { model | all = Just items }, clearGraph "only-for-the-compiler" )
74 77
 
75 78
         RefreshMetadataCompleted (Err httpError) ->
76 79
             Debug.crash (toString httpError)