Experimental custom filter - select
	
		
			
	
		
	
	
		
	
		
			Some checks reported errors
		
		
	
	
		
			
				
	
				continuous-integration/drone Build was killed
				
			
		
		
	
	
				
					
				
			
		
			Some checks reported errors
		
		
	
	continuous-integration/drone Build was killed
				
			This commit is contained in:
		| @@ -1,37 +1,29 @@ | |||||||
| export default { | export default { | ||||||
|     template: ` |     template: ` | ||||||
|       <span> |       <select v-model="filter" class="v-select"> | ||||||
|         <select v-model="currentValue" style="width: 100px" |         <option value=""> </option> | ||||||
|         > |         <option v-for="option in params.options" :value="option"> | ||||||
|           <option v-for="option in options"> |  | ||||||
|            {{ option }} |            {{ option }} | ||||||
|         </option> |         </option> | ||||||
|           <option value=""/> |  | ||||||
|       </select> |       </select> | ||||||
|       </span> |  | ||||||
|     `, |     `, | ||||||
|     data: function () { |     data: function () { | ||||||
|         return { |         return { | ||||||
|             options: [], |             filter: '', | ||||||
|             currentValue: null, |  | ||||||
|         }; |         }; | ||||||
|     }, |     }, | ||||||
|     watch: { |  | ||||||
|         currentValue (newValue) { |  | ||||||
|             this.params.parentFilterInstance((instance) => { |  | ||||||
|                 instance.onFloatingFilterChanged('', newValue); |  | ||||||
|             }); |  | ||||||
|         } |  | ||||||
|     }, |  | ||||||
|     methods: { |     methods: { | ||||||
|         onParentModelChanged(parentModel) { |         updateFilter() { | ||||||
|             this.options = this.params.column.colDef.floatingFilterComponentParams.options |             this.params.filterChangedCallback(); | ||||||
|             // When the filter is empty we will receive a null value here |         }, | ||||||
|             if (!parentModel) { |  | ||||||
|                 this.currentValue = ''; |         doesFilterPass(params) { | ||||||
|             } else { |             const value = this.params.field.split('.').reduce((a, b) => a[b], params.data); | ||||||
|                 this.currentValue = parentModel.filter; |             return value === this.filter; | ||||||
|             } |         }, | ||||||
|         } |  | ||||||
|  |         isFilterActive() { | ||||||
|  |             return this.filter !== '' | ||||||
|  |         }, | ||||||
|     }, |     }, | ||||||
| }; | }; | ||||||
| @@ -24,11 +24,14 @@ import "ag-grid-community/styles//ag-grid.css"; | |||||||
| import "ag-grid-community/styles//ag-theme-material.css"; | import "ag-grid-community/styles//ag-theme-material.css"; | ||||||
| import ScreenshotCell from "./ScreenshotCell.js"; | import ScreenshotCell from "./ScreenshotCell.js"; | ||||||
| import ExamineLogModal from "./ExamineLogModal.vue"; | import ExamineLogModal from "./ExamineLogModal.vue"; | ||||||
|  | import ComboboxFilter from "./ComboboxFilter.js"; | ||||||
|  |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|   components: { |   components: { | ||||||
|     ExamineLogModal, |     ExamineLogModal, | ||||||
|     AgGridVue, |     AgGridVue, | ||||||
|  |     ComboboxFilter, | ||||||
|     ScreenshotCell: ScreenshotCell |     ScreenshotCell: ScreenshotCell | ||||||
|   }, |   }, | ||||||
|   data() { |   data() { | ||||||
| @@ -36,7 +39,6 @@ export default { | |||||||
|       examineLogContent: null, |       examineLogContent: null, | ||||||
|       gridApi: null, |       gridApi: null, | ||||||
|       gridColumnApi: null, |       gridColumnApi: null, | ||||||
|       rowData: [], |  | ||||||
|       defaultColDef: { |       defaultColDef: { | ||||||
|         width: 50, |         width: 50, | ||||||
|         initialPinned: true, |         initialPinned: true, | ||||||
| @@ -46,8 +48,11 @@ export default { | |||||||
|       currentRowCount: 0, |       currentRowCount: 0, | ||||||
|       comboBoxOptions: {}, |       comboBoxOptions: {}, | ||||||
|       viewRowCount: 20, |       viewRowCount: 20, | ||||||
|       comboBoxOptions: [], |     } | ||||||
|       columnDefs:  [ |   }, | ||||||
|  |   computed: { | ||||||
|  |     columnDefs() { | ||||||
|  |       return [ | ||||||
|         { |         { | ||||||
|           field: '@timestamp', |           field: '@timestamp', | ||||||
|           width: 70, |           width: 70, | ||||||
| @@ -57,19 +62,31 @@ export default { | |||||||
|           field: 'kubernetes.namespace', |           field: 'kubernetes.namespace', | ||||||
|           headerName: 'namespace', |           headerName: 'namespace', | ||||||
|           tooltipValueGetter: (params) => params.value, |           tooltipValueGetter: (params) => params.value, | ||||||
|           filter: true, |           filter: ComboboxFilter, | ||||||
|  |           filterParams: { | ||||||
|  |             options: this.comboBoxOptions['kubernetes.namespace'], | ||||||
|  |             field: 'kubernetes.namespace', | ||||||
|  |           } | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|           field: 'kubernetes.pod.name', |           field: 'kubernetes.pod.name', | ||||||
|           headerName: 'pod', |           headerName: 'pod', | ||||||
|           tooltipValueGetter: (params) => params.value, |           tooltipValueGetter: (params) => params.value, | ||||||
|           filter: true, |           filter: ComboboxFilter, | ||||||
|  |           filterParams: { | ||||||
|  |             options: this.comboBoxOptions['kubernetes.pod.name'], | ||||||
|  |             field: 'kubernetes.pod.name', | ||||||
|  |           } | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|           field: 'kubernetes.container.name', |           field: 'kubernetes.container.name', | ||||||
|           headerName: 'container', |           headerName: 'container', | ||||||
|           tooltipValueGetter: (params) => params.value, |           tooltipValueGetter: (params) => params.value, | ||||||
|           filter: true, |           filter: ComboboxFilter, | ||||||
|  |           filterParams: { | ||||||
|  |             options: this.comboBoxOptions['kubernetes.container.name'], | ||||||
|  |             field: 'kubernetes.container.name', | ||||||
|  |           } | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|           field: 'message', |           field: 'message', | ||||||
| @@ -78,8 +95,8 @@ export default { | |||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|           field: 'stream', |           field: 'stream', | ||||||
|         } |         }, | ||||||
|       ], |       ]; | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   created() { |   created() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user