File tree 3 files changed +31
-3
lines changed
backend/resource/container
3 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ func TestGetLogs(t *testing.T) {
331
331
LogLines : logs.LogLines {logs.LogLine {
332
332
Timestamp : "0" ,
333
333
Content : "an error message from api server" ,
334
- }, },
334
+ }},
335
335
Selection : logs.Selection {
336
336
ReferencePoint : logs.LogLineId {
337
337
LogTimestamp : "0" ,
Original file line number Diff line number Diff line change @@ -20,12 +20,33 @@ import {stateName} from '../../search/state';
20
20
export class SearchController {
21
21
/**
22
22
* @param {!ui.router.$state } $state
23
+ * @param {!kdUiRouter.$transitions } $transitions
23
24
* @ngInject
24
25
*/
25
- constructor ( $state ) {
26
+ constructor ( $state , $transitions ) {
26
27
/** @private {!ui.router.$state} */
27
28
this . state_ = $state ;
28
29
30
+ /** @private {!kdUiRouter.$transitions} */
31
+ this . transitions_ = $transitions ;
32
+
33
+ /** @export {string} */
34
+ this . query = '' ;
35
+ }
36
+
37
+ /**
38
+ * Register state change listener to empty search bar with every state change.
39
+ */
40
+ $onInit ( ) {
41
+ this . transitions_ . onStart ( { } , ( ) => {
42
+ this . clear ( ) ;
43
+ } ) ;
44
+ }
45
+
46
+ /**
47
+ * @export
48
+ */
49
+ clear ( ) {
29
50
this . query = '' ;
30
51
}
31
52
Original file line number Diff line number Diff line change 16
16
17
17
< form class ="kd-search "
18
18
ng-submit ="$ctrl.submit() ">
19
- < md-icon class ="kd-search-icon "> search</ md-icon >
19
+ < md-icon class ="kd-search-icon "
20
+ type ="submit "> search</ md-icon >
20
21
< input type ="search "
21
22
placeholder ="Search "
22
23
ng-model ="$ctrl.query "
24
+ ui-keydown ="{esc: '$ctrl.clear()'} "
23
25
required >
26
+ < md-icon class ="kd-search-icon "
27
+ ng-click ="$ctrl.clear() "
28
+ ng-show ="$ctrl.query ">
29
+ close
30
+ </ md-icon >
24
31
</ form >
You can’t perform that action at this time.
0 commit comments