diff --git a/web/components/cloud-tab.js b/web/components/cloud-tab.js index 788dd52..30d3142 100644 --- a/web/components/cloud-tab.js +++ b/web/components/cloud-tab.js @@ -10,12 +10,10 @@ function cloudCrud(title, path) { type: 'crud', title: title, api: `\${base}${path}`, + ...crudCommonOptions(), interval: 2000, - syncLocation: false, - silentPolling: true, headerToolbar: ['reload'], loadDataOnce: true, - affixHeader: false, perPage: 100, columns: [ {name: 'name', label: '名称'}, diff --git a/web/components/common.js b/web/components/common.js index 0e79459..22b6e1b 100644 --- a/web/components/common.js +++ b/web/components/common.js @@ -1,3 +1,13 @@ +function crudCommonOptions() { + return { + affixHeader: false, + stopAutoRefreshWhenModalIsOpen: true, + resizable: false, + syncLocation: false, + silentPolling: true, + } +} + function timeAndFrom(field, fromNow, emptyText = '未停止', showSource = true) { let tpl = "${IF(" + field + " === 0, '(" + emptyText + ")', CONCATENATE(''," + fromNow + ",''))}" if (showSource) { diff --git a/web/components/queue-tab.js b/web/components/queue-tab.js index fe46de6..dbfee1f 100644 --- a/web/components/queue-tab.js +++ b/web/components/queue-tab.js @@ -3,14 +3,10 @@ function queueCrud(name) { type: 'crud', title: name, api: `\${base}/queue/all?name=${name}`, + ...crudCommonOptions(), interval: 10000, - syncLocation: false, - silentPolling: true, loadDataOnce: true, - affixHeader: false, perPage: 5, - stopAutoRefreshWhenModalIsOpen: true, - resizable: false, headerToolbar: [ "reload", 'filter-toggler', diff --git a/web/components/table-tab.js b/web/components/table-tab.js index 317d2ad..271a4b0 100644 --- a/web/components/table-tab.js +++ b/web/components/table-tab.js @@ -23,9 +23,8 @@ function tableTab() { filter_compaction_status: '${syncState\\.compactionStatus|default:undefined}' } }, - syncLocation: false, + ...crudCommonOptions(), // interval: 10000, - silentPolling: true, filter: { mode: 'inline', title: '表筛选', @@ -66,8 +65,6 @@ function tableTab() { }, filterTogglable: true, filterDefaultVisible: true, - stopAutoRefreshWhenModalIsOpen: true, - resizable: false, perPage: 20, headerToolbar: [ "reload", diff --git a/web/components/version-tab.js b/web/components/version-tab.js index 0beb235..2634949 100644 --- a/web/components/version-tab.js +++ b/web/components/version-tab.js @@ -21,12 +21,8 @@ function versionTab() { data: { now: "${DATETOSTR(DATEMODIFY(NOW(), -1, 'days'), 'YYYYMMDD')}" }, - defaultParams: { - // version: "${DATETOSTR(NOW(), 'YYYYMMDD')}" - }, - syncLocation: false, + ...crudCommonOptions(), interval: 10000, - silentPolling: true, filter: { mode: 'inline', title: '表筛选', @@ -78,8 +74,6 @@ function versionTab() { }, filterTogglable: true, filterDefaultVisible: true, - stopAutoRefreshWhenModalIsOpen: true, - resizable: false, perPage: 20, headerToolbar: [ "reload", diff --git a/web/components/yarn-tab.js b/web/components/yarn-tab.js index 4edf307..c594e78 100644 --- a/web/components/yarn-tab.js +++ b/web/components/yarn-tab.js @@ -37,10 +37,8 @@ function yarnTab(cluster, title, queueNames = 'root', searchName = undefined) { defaultParams: { name: searchName }, + ...crudCommonOptions(), interval: 10000, - affixHeader: false, - syncLocation: false, - silentPolling: true, filter: { mode: 'inline', title: '任务筛选', @@ -81,8 +79,6 @@ function yarnTab(cluster, title, queueNames = 'root', searchName = undefined) { }, filterTogglable: true, filterDefaultVisible: false, - stopAutoRefreshWhenModalIsOpen: true, - resizable: false, perPage: 20, headerToolbar: [ "reload",