ui: TaskSummary: move state/types/titles out of the controller
it seems that under certain circumstances, extjs does not initialize or remove the content from objects in controllers move it to the view, were they always exist Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
ab81bb13ad
commit
4623cd6497
|
@ -4,31 +4,32 @@ Ext.define('PBS.TaskSummary', {
|
||||||
|
|
||||||
title: gettext('Task Summary'),
|
title: gettext('Task Summary'),
|
||||||
|
|
||||||
|
states: [
|
||||||
|
"",
|
||||||
|
"error",
|
||||||
|
"warning",
|
||||||
|
"ok",
|
||||||
|
],
|
||||||
|
|
||||||
|
types: [
|
||||||
|
"backup",
|
||||||
|
"prune",
|
||||||
|
"garbage_collection",
|
||||||
|
"sync",
|
||||||
|
"verify",
|
||||||
|
],
|
||||||
|
|
||||||
|
titles: {
|
||||||
|
"backup": gettext('Backups'),
|
||||||
|
"prune": gettext('Prunes'),
|
||||||
|
"garbage_collection": gettext('Garbage collections'),
|
||||||
|
"sync": gettext('Syncs'),
|
||||||
|
"verify": gettext('Verify'),
|
||||||
|
},
|
||||||
|
|
||||||
controller: {
|
controller: {
|
||||||
xclass: 'Ext.app.ViewController',
|
xclass: 'Ext.app.ViewController',
|
||||||
|
|
||||||
states: [
|
|
||||||
"",
|
|
||||||
"error",
|
|
||||||
"warning",
|
|
||||||
"ok",
|
|
||||||
],
|
|
||||||
|
|
||||||
types: [
|
|
||||||
"backup",
|
|
||||||
"prune",
|
|
||||||
"garbage_collection",
|
|
||||||
"sync",
|
|
||||||
"verify",
|
|
||||||
],
|
|
||||||
|
|
||||||
titles: {
|
|
||||||
"backup": gettext('Backups'),
|
|
||||||
"prune": gettext('Prunes'),
|
|
||||||
"garbage_collection": gettext('Garbage collections'),
|
|
||||||
"sync": gettext('Syncs'),
|
|
||||||
"verify": gettext('Verify'),
|
|
||||||
},
|
|
||||||
|
|
||||||
openTaskList: function(grid, td, cellindex, record, tr, rowindex) {
|
openTaskList: function(grid, td, cellindex, record, tr, rowindex) {
|
||||||
let me = this;
|
let me = this;
|
||||||
|
@ -36,8 +37,8 @@ Ext.define('PBS.TaskSummary', {
|
||||||
|
|
||||||
if (cellindex > 0) {
|
if (cellindex > 0) {
|
||||||
let tasklist = view.tasklist;
|
let tasklist = view.tasklist;
|
||||||
let state = me.states[cellindex];
|
let state = view.states[cellindex];
|
||||||
let type = me.types[rowindex];
|
let type = view.types[rowindex];
|
||||||
let filterParam = {
|
let filterParam = {
|
||||||
limit: 0,
|
limit: 0,
|
||||||
'statusfilter': state,
|
'statusfilter': state,
|
||||||
|
@ -137,7 +138,7 @@ Ext.define('PBS.TaskSummary', {
|
||||||
tasklist.cidx = cellindex;
|
tasklist.cidx = cellindex;
|
||||||
tasklist.ridx = rowindex;
|
tasklist.ridx = rowindex;
|
||||||
|
|
||||||
let task = me.titles[type];
|
let task = view.titles[type];
|
||||||
let status = "";
|
let status = "";
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case 'ok': status = gettext("OK"); break;
|
case 'ok': status = gettext("OK"); break;
|
||||||
|
@ -182,7 +183,8 @@ Ext.define('PBS.TaskSummary', {
|
||||||
|
|
||||||
render_count: function(value, md, record, rowindex, colindex) {
|
render_count: function(value, md, record, rowindex, colindex) {
|
||||||
let me = this;
|
let me = this;
|
||||||
let icon = me.render_icon(me.states[colindex], value);
|
let view = me.getView();
|
||||||
|
let icon = me.render_icon(view.states[colindex], value);
|
||||||
return `${icon} ${value}`;
|
return `${icon} ${value}`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -191,8 +193,8 @@ Ext.define('PBS.TaskSummary', {
|
||||||
let me = this;
|
let me = this;
|
||||||
let controller = me.getController();
|
let controller = me.getController();
|
||||||
let data = [];
|
let data = [];
|
||||||
controller.types.forEach((type) => {
|
me.types.forEach((type) => {
|
||||||
source[type].type = controller.titles[type];
|
source[type].type = me.titles[type];
|
||||||
data.push(source[type]);
|
data.push(source[type]);
|
||||||
});
|
});
|
||||||
me.lookup('grid').getStore().setData(data);
|
me.lookup('grid').getStore().setData(data);
|
||||||
|
|
Loading…
Reference in New Issue