From 57b6d12d076cd33a2bb2757a3d2efbca9b92e151 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 17 Apr 2014 11:05:17 +0300 Subject: [PATCH] cron message --- application/Espo/Core/Cron/ScheduledJob.php | 6 +-- .../metadata/clientDefs/ScheduledJob.json | 5 +- .../res/templates/scheduled-job/cronjob.tpl | 4 ++ frontend/client/src/views/list.js | 14 +++-- .../client/src/views/scheduled-job/list.js | 52 +++++++++++++++++++ 5 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 frontend/client/res/templates/scheduled-job/cronjob.tpl create mode 100644 frontend/client/src/views/scheduled-job/list.js diff --git a/application/Espo/Core/Cron/ScheduledJob.php b/application/Espo/Core/Cron/ScheduledJob.php index 462f262ae7..22fa69ad81 100644 --- a/application/Espo/Core/Cron/ScheduledJob.php +++ b/application/Espo/Core/Cron/ScheduledJob.php @@ -171,15 +171,15 @@ class ScheduledJob $cronFile = Util::concatPath($this->getSystemUtil()->getRootDir(), $this->cronFile); $desc = $language->translate('cronSetup', 'options', 'ScheduledJob'); - $label = isset($desc[$OS]) ? $desc[$OS] : $desc['default']; + $message = isset($desc[$OS]) ? $desc[$OS] : $desc['default']; $command = isset($this->cronSetup[$OS]) ? $this->cronSetup[$OS] : $this->cronSetup['default']; $command = str_replace(array('{PHP-BIN-DIR}', '{CRON-FILE}'), array($phpBin, $cronFile), $command); return array( - 'label' => $label, + 'message' => $message, 'command' => $command, ); } -} \ No newline at end of file +} diff --git a/application/Espo/Resources/metadata/clientDefs/ScheduledJob.json b/application/Espo/Resources/metadata/clientDefs/ScheduledJob.json index dd040e9b19..f51d21776b 100644 --- a/application/Espo/Resources/metadata/clientDefs/ScheduledJob.json +++ b/application/Espo/Resources/metadata/clientDefs/ScheduledJob.json @@ -4,5 +4,8 @@ "log":{ "readOnly": true } - } + }, + "views": { + "list": "ScheduledJob.List" + } } diff --git a/frontend/client/res/templates/scheduled-job/cronjob.tpl b/frontend/client/res/templates/scheduled-job/cronjob.tpl new file mode 100644 index 0000000000..dbfb1f986c --- /dev/null +++ b/frontend/client/res/templates/scheduled-job/cronjob.tpl @@ -0,0 +1,4 @@ +
+
 
+
 
+
diff --git a/frontend/client/src/views/list.js b/frontend/client/src/views/list.js index 5641de323b..dc82129c06 100644 --- a/frontend/client/src/views/list.js +++ b/frontend/client/src/views/list.js @@ -37,13 +37,17 @@ Espo.define('Views.List', 'Views.Main', function (Dep) { view: 'Header' } }, + + searchPanel: true, setup: function () { - this.createView('search', 'Record.Search', { - collection: this.collection, - el: '#main > .search-container', - searchManager: this.options.searchManager, - }); + if (this.searchPanel) { + this.createView('search', 'Record.Search', { + collection: this.collection, + el: '#main > .search-container', + searchManager: this.options.searchManager, + }); + } this.menu.buttons.unshift({ link: '#' + this.scope + '/create', diff --git a/frontend/client/src/views/scheduled-job/list.js b/frontend/client/src/views/scheduled-job/list.js new file mode 100644 index 0000000000..72a30fdbe0 --- /dev/null +++ b/frontend/client/src/views/scheduled-job/list.js @@ -0,0 +1,52 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko + * Website: http://www.espocrm.com + * + * EspoCRM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EspoCRM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EspoCRM. If not, see http://www.gnu.org/licenses/. + ************************************************************************/ +Espo.define('Views.ScheduledJob.List', 'Views.List', function (Dep) { + + return Dep.extend({ + + searchPanel: false, + + setup: function () { + Dep.prototype.setup.call(this); + + this.createView('search', 'Base', { + el: '#main > .search-container', + template: 'scheduled-job.cronjob' + }); + }, + + afterRender: function () { + Dep.prototype.afterRender.call(this); + $.ajax({ + type: 'GET', + url: 'Admin/action/cronMessage', + error: function (x) { + }.bind(this) + }).done(function (data) { + console.log(data); + this.$el.find('.cronjob .message').html(data.message); + this.$el.find('.cronjob .command').html('' + data.command + ''); + }.bind(this)); + }, + + }); + +});