|
|
@ -4,16 +4,17 @@ define(
|
|
|
|
'app',
|
|
|
|
'app',
|
|
|
|
'marionette',
|
|
|
|
'marionette',
|
|
|
|
'backgrid',
|
|
|
|
'backgrid',
|
|
|
|
'Logs/Files/FilenameCell',
|
|
|
|
'System/Logs/Files/FilenameCell',
|
|
|
|
'Cells/RelativeDateCell',
|
|
|
|
'Cells/RelativeDateCell',
|
|
|
|
'Logs/Files/Collection',
|
|
|
|
'System/Logs/Files/LogFileCollection',
|
|
|
|
'Logs/Files/Row',
|
|
|
|
'System/Logs/Files/Row',
|
|
|
|
'Logs/Files/ContentsView',
|
|
|
|
'System/Logs/Files/ContentsView',
|
|
|
|
'Logs/Files/ContentsModel',
|
|
|
|
'System/Logs/Files/ContentsModel',
|
|
|
|
'Shared/Toolbar/ToolbarLayout'
|
|
|
|
'Shared/Toolbar/ToolbarLayout',
|
|
|
|
], function (App, Marionette, Backgrid, FilenameCell, RelativeDateCell, LogFileCollection, LogFileRow, ContentsView, ContentsModel, ToolbarLayout) {
|
|
|
|
'Shared/LoadingView'
|
|
|
|
|
|
|
|
], function (App, Marionette, Backgrid, FilenameCell, RelativeDateCell, LogFileCollection, LogFileRow, ContentsView, ContentsModel, ToolbarLayout, LoadingView) {
|
|
|
|
return Marionette.Layout.extend({
|
|
|
|
return Marionette.Layout.extend({
|
|
|
|
template: 'Logs/Files/LayoutTemplate',
|
|
|
|
template: 'System/Logs/Files/LogFileLayoutTemplate',
|
|
|
|
|
|
|
|
|
|
|
|
regions: {
|
|
|
|
regions: {
|
|
|
|
toolbar : '#x-toolbar',
|
|
|
|
toolbar : '#x-toolbar',
|
|
|
@ -38,8 +39,8 @@ define(
|
|
|
|
initialize: function () {
|
|
|
|
initialize: function () {
|
|
|
|
this.collection = new LogFileCollection();
|
|
|
|
this.collection = new LogFileCollection();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
App.vent.on(App.Commands.ShowLogFile, this._showLogFile, this);
|
|
|
|
App.vent.on(App.Commands.ShowLogFile, this._showLogFile, this);
|
|
|
|
|
|
|
|
App.vent.on(App.Events.CommandComplete, this._commandComplete, this);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
onShow: function () {
|
|
|
|
onShow: function () {
|
|
|
@ -51,15 +52,19 @@ define(
|
|
|
|
_fetchAndShow: function () {
|
|
|
|
_fetchAndShow: function () {
|
|
|
|
var self = this;
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.contents.close();
|
|
|
|
|
|
|
|
|
|
|
|
var promise = this.collection.fetch();
|
|
|
|
var promise = this.collection.fetch();
|
|
|
|
promise.done(function () {
|
|
|
|
promise.done(function () {
|
|
|
|
self._showLogFile({ model: self.collection.first() });
|
|
|
|
if (self.collection.length > 0) {
|
|
|
|
|
|
|
|
self._showLogFile({ model: self.collection.first() });
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
_showToolbar: function () {
|
|
|
|
_showToolbar: function () {
|
|
|
|
|
|
|
|
|
|
|
|
var leftSideButtons = {
|
|
|
|
var rightSideButtons = {
|
|
|
|
type : 'default',
|
|
|
|
type : 'default',
|
|
|
|
storeState: false,
|
|
|
|
storeState: false,
|
|
|
|
items :
|
|
|
|
items :
|
|
|
@ -76,17 +81,15 @@ define(
|
|
|
|
icon : 'icon-trash',
|
|
|
|
icon : 'icon-trash',
|
|
|
|
command : 'deleteLogFiles',
|
|
|
|
command : 'deleteLogFiles',
|
|
|
|
successMessage : 'Log files have been deleted',
|
|
|
|
successMessage : 'Log files have been deleted',
|
|
|
|
errorMessage : 'Failed to delete log files',
|
|
|
|
errorMessage : 'Failed to delete log files'
|
|
|
|
ownerContext : this,
|
|
|
|
|
|
|
|
onSuccess: this._refreshLogs
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.toolbar.show(new ToolbarLayout({
|
|
|
|
this.toolbar.show(new ToolbarLayout({
|
|
|
|
left :
|
|
|
|
right :
|
|
|
|
[
|
|
|
|
[
|
|
|
|
leftSideButtons
|
|
|
|
rightSideButtons
|
|
|
|
],
|
|
|
|
],
|
|
|
|
context: this
|
|
|
|
context: this
|
|
|
|
}));
|
|
|
|
}));
|
|
|
@ -102,8 +105,7 @@ define(
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
_showLogFile: function (options) {
|
|
|
|
_showLogFile: function (options) {
|
|
|
|
|
|
|
|
this.contents.show(new LoadingView());
|
|
|
|
this.contents.close();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!options.model) {
|
|
|
|
if (!options.model) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -127,6 +129,12 @@ define(
|
|
|
|
|
|
|
|
|
|
|
|
_refreshLogs: function () {
|
|
|
|
_refreshLogs: function () {
|
|
|
|
this._fetchAndShow();
|
|
|
|
this._fetchAndShow();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_commandComplete: function (options) {
|
|
|
|
|
|
|
|
if (options.command.get('name') === 'deletelogfiles') {
|
|
|
|
|
|
|
|
this._refreshLogs();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|