Experimental combobox, pagination
This commit is contained in:
parent
274620c994
commit
b2439a7a49
37
frontend/src/components/ComboboxFilter.js
Normal file
37
frontend/src/components/ComboboxFilter.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
export default {
|
||||||
|
template: `
|
||||||
|
<span>
|
||||||
|
<select v-model="currentValue" style="width: 100px"
|
||||||
|
>
|
||||||
|
<option v-for="option in options">
|
||||||
|
{{ option }}
|
||||||
|
</option>
|
||||||
|
<option value=""/>
|
||||||
|
</select>
|
||||||
|
</span>
|
||||||
|
`,
|
||||||
|
data: function () {
|
||||||
|
return {
|
||||||
|
options: [],
|
||||||
|
currentValue: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
currentValue (newValue) {
|
||||||
|
this.params.parentFilterInstance((instance) => {
|
||||||
|
instance.onFloatingFilterChanged('', newValue);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onParentModelChanged(parentModel) {
|
||||||
|
this.options = this.params.column.colDef.floatingFilterComponentParams.options
|
||||||
|
// When the filter is empty we will receive a null value here
|
||||||
|
if (!parentModel) {
|
||||||
|
this.currentValue = '';
|
||||||
|
} else {
|
||||||
|
this.currentValue = parentModel.filter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
@ -6,10 +6,11 @@
|
|||||||
@grid-ready="onGridReady"
|
@grid-ready="onGridReady"
|
||||||
:defaultColDef="defaultColDef"
|
:defaultColDef="defaultColDef"
|
||||||
:columnDefs="columnDefs"
|
:columnDefs="columnDefs"
|
||||||
|
:pagination="true"
|
||||||
|
:paginationAutoPageSize=true
|
||||||
:row-data="null"
|
:row-data="null"
|
||||||
:supress-horisontal-scroll="true"
|
:supress-horisontal-scroll="true"
|
||||||
:enable-scrolling="true"
|
:enable-scrolling="true"
|
||||||
:get-row-id="(params) => params.data.index"
|
|
||||||
></ag-grid-vue>
|
></ag-grid-vue>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -19,12 +20,26 @@ import { AgGridVue } from "ag-grid-vue3";
|
|||||||
import "ag-grid-community/styles//ag-grid.css";
|
import "ag-grid-community/styles//ag-grid.css";
|
||||||
import "ag-grid-community/styles//ag-theme-alpine.css";
|
import "ag-grid-community/styles//ag-theme-alpine.css";
|
||||||
import ScreenshotCell from "./ScreenshotCell.js";
|
import ScreenshotCell from "./ScreenshotCell.js";
|
||||||
import {watchEffect} from "vue";
|
import ComboboxFilter from './ComboboxFilter.js';
|
||||||
|
|
||||||
|
const comboBoxDefinition = () => {
|
||||||
|
return {
|
||||||
|
filter: true,
|
||||||
|
floatingFilter: true,
|
||||||
|
suppressMenu: true,
|
||||||
|
floatingFilterComponent: 'ComboboxFilter',
|
||||||
|
floatingFilterComponentParams: {
|
||||||
|
suppressFilterButton: true,
|
||||||
|
options: []
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
AgGridVue,
|
AgGridVue,
|
||||||
ScreenshotCell: ScreenshotCell,
|
ScreenshotCell: ScreenshotCell,
|
||||||
|
ComboboxFilter
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -34,9 +49,8 @@ export default {
|
|||||||
defaultColDef: {
|
defaultColDef: {
|
||||||
width: 50,
|
width: 50,
|
||||||
initialPinned: true,
|
initialPinned: true,
|
||||||
filter: true,
|
|
||||||
floatingFilter: true,
|
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
editable: true
|
||||||
},
|
},
|
||||||
currentRowCount: 0,
|
currentRowCount: 0,
|
||||||
viewRowCount: 20,
|
viewRowCount: 20,
|
||||||
@ -48,6 +62,7 @@ export default {
|
|||||||
{
|
{
|
||||||
field: 'kubernetes.namespace',
|
field: 'kubernetes.namespace',
|
||||||
headerName: 'namespace',
|
headerName: 'namespace',
|
||||||
|
...comboBoxDefinition(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'kubernetes.pod.name',
|
field: 'kubernetes.pod.name',
|
||||||
@ -101,19 +116,15 @@ export default {
|
|||||||
this.gridApi = params.api;
|
this.gridApi = params.api;
|
||||||
this.gridColumnApi = params.columnApi;
|
this.gridColumnApi = params.columnApi;
|
||||||
const timer = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
this.refreshRowData();
|
this.getComboBoxOptions();
|
||||||
}, 1000);
|
}, 3000);
|
||||||
},
|
},
|
||||||
handleReceiveMessage (event) {
|
handleReceiveMessage (event) {
|
||||||
const eventData = this.parseEventData(event.data);
|
const eventData = this.parseEventData(event.data);
|
||||||
eventData.index = this.currentRowCount
|
this.rowData.push(eventData)
|
||||||
// this.rowData.unshift(eventData)
|
|
||||||
if (this.currentRowCount < this.viewRowCount) {
|
|
||||||
this.gridApi.setRowData(this.rowData)
|
this.gridApi.setRowData(this.rowData)
|
||||||
this.currentRowCount = this.currentRowCount + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
this.gridApi.sizeColumnsToFit()
|
this.gridApi.sizeColumnsToFit()
|
||||||
|
this.getComboBoxOptions()
|
||||||
},
|
},
|
||||||
refreshRowData () {
|
refreshRowData () {
|
||||||
const itemsToUpdate = [];
|
const itemsToUpdate = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user