1616// under the License.
1717
1818<template >
19- <a-card class =" instances-card" >
20- <template #title >
21- Import VM Tasks
22- <a-tooltip :title =" 'Running Import VM Tasks'" >
23- <info-circle-outlined />
24- </a-tooltip >
25- <a-button
26- style =" margin-left : 12px ; margin-top : 4px "
27- :loading =" loading"
28- size =" small"
29- shape =" round"
30- @click =" fetchData()" >
31- <template #icon ><reload-outlined /></template >
32- </a-button >
33- <a-select
34- :placeholder =" $t('label.filterby')"
35- :value =" importVmTasksFilterValue"
36- style =" min-width : 100px ; margin-left : 10px ; margin-bottom : 5px "
37- size =small
38- @change =" onFilterChange"
39- showSearch
40- optionFilterProp =" label"
41- :filterOption =" (input, option) => {
42- return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
43- }"
44- >
45- <template #suffixIcon ><filter-outlined class =" ant-select-suffix" /></template >
46- <a-select-option
47- v-for =" filter in filters"
48- :key =" filter"
49- :label =" $t('label.' + filter)"
50- >
51- {{ $t('label.' + filter) }}
52- </a-select-option >
53- </a-select >
54- </template >
55- <a-table
56- :data-source =" tasks"
57- :columns =" columns" >
58- <template #bodyCell =" { column , record } " >
59- <template v-if =" column .key === ' convertinstancehostid' " >
60- <router-link :to =" { path: '/host/' + record.convertinstancehostid }" >{{ record.convertinstancehostname }}</router-link >
61- </template >
62- <template v-else-if =" column .key === ' displayname' " >
63- <router-link v-if =" record.virtualmachineid" :to =" { path: '/vm/' + record.virtualmachineid }" >{{ record.displayname }}</router-link >
64- <span v-else >{{ record.displayname }}</span >
65- </template >
19+ <a-row :gutter =" 12" >
20+ <a-col :md =" 24" :lg =" 24" >
21+ <a-card class =" instances-card" >
22+ <template #title >
23+ {{ $t('label.import.vm.tasks') }}
24+ <a-tooltip :title =" $t('message.import.vm.tasks')" >
25+ <info-circle-outlined />
26+ </a-tooltip >
27+ <a-button
28+ style =" margin-left : 12px ; margin-top : 4px "
29+ :loading =" loading"
30+ size =" small"
31+ shape =" round"
32+ @click =" this.$emit('fetch-import-vm-tasks')" >
33+ <template #icon ><reload-outlined /></template >
34+ </a-button >
35+ <span style =" float : right ; width : 50% " >
36+ <a-select
37+ :placeholder =" $t('label.filterby')"
38+ :value =" filter"
39+ style =" min-width : 100px ; margin-left : 10px ; margin-bottom : 5px "
40+ size =small
41+ @change =" onFilterChange"
42+ showSearch
43+ optionFilterProp =" label"
44+ :filterOption =" (input, option) => {
45+ return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
46+ }"
47+ >
48+ <template #suffixIcon ><filter-outlined class =" ant-select-suffix" /></template >
49+ <a-select-option
50+ v-for =" filter in filters"
51+ :key =" filter"
52+ :label =" $t('label.' + filter)"
53+ >
54+ {{ $t('label.' + filter) }}
55+ </a-select-option >
56+ </a-select >
57+ </span >
6658 </template >
67- </a-table >
68- </a-card >
59+ <a-table
60+ :data-source =" tasks"
61+ class =" instances-card-table"
62+ size =" middle"
63+ :pagination =" false"
64+ :columns =" columns" >
65+ <template #bodyCell =" { column , record } " >
66+ <template v-if =" column .key === ' convertinstancehostid' " >
67+ <router-link :to =" { path: '/host/' + record.convertinstancehostid }" >{{ record.convertinstancehostname }}</router-link >
68+ </template >
69+ <template v-else-if =" column .key === ' displayname' " >
70+ <router-link v-if =" record.virtualmachineid" :to =" { path: '/vm/' + record.virtualmachineid }" >{{ record.displayname }}</router-link >
71+ <span v-else >{{ record.displayname }}</span >
72+ </template >
73+ </template >
74+ </a-table >
75+ <div class =" instances-card-footer" >
76+ <a-pagination
77+ class =" row-element"
78+ size =" small"
79+ :current =" page"
80+ :pageSize =" pageSize"
81+ :total =" total"
82+ :showTotal =" total => `${$t('label.showing')} ${Math.min(total, 1+((page-1)*pageSize))}-${Math.min(page*pageSize, total)} ${$t('label.of')} ${total} ${$t('label.items')}`"
83+ @change =" onPaginationChange"
84+ showQuickJumper >
85+ <template #buildOptionText =" props " >
86+ <span >{{ props.value }} / {{ $t('label.page') }}</span >
87+ </template >
88+ </a-pagination >
89+ </div >
90+ </a-card >
91+ </a-col >
92+ </a-row >
6993</template >
7094
7195<script >
@@ -81,6 +105,22 @@ export default {
81105 loading: {
82106 type: Boolean ,
83107 required: false
108+ },
109+ filter: {
110+ type: String ,
111+ required: false
112+ },
113+ total: {
114+ type: Number ,
115+ required: true
116+ },
117+ page: {
118+ type: Number ,
119+ required: true
120+ },
121+ pageSize: {
122+ type: Number ,
123+ required: true
84124 }
85125 },
86126 data () {
@@ -139,11 +179,13 @@ export default {
139179 },
140180 methods: {
141181 fetchData () {
142- this .$emit (' fetch-import-vm-tasks' , this . filterValue )
182+ this .$emit (' fetch-import-vm-tasks' )
143183 },
144184 onFilterChange (e ) {
145- this .filterValue = e
146- this .fetchData ()
185+ this .$emit (' change-filter' , e)
186+ },
187+ onPaginationChange (page , size ) {
188+ this .$emit (' change-pagination' , page, size)
147189 }
148190 }
149191}
0 commit comments