[ZBXNEXT-2357] Introduce basic page controllers (mvc) Created: 2014 Jun 26 Updated: 2024 Apr 10 Resolved: 2017 Feb 16 |
|
Status: | Closed |
Project: | ZABBIX FEATURE REQUESTS |
Component/s: | Frontend (F) |
Affects Version/s: | None |
Fix Version/s: | 2.5.0 |
Type: | Change Request | Priority: | Major |
Reporter: | Alexei Vladishev | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 3 |
Labels: | codequality, mvc | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Issue Links: |
|
||||||||
Team: | Team A | ||||||||
Team: | Team A | ||||||||
Sprint: | Sprint 1 |
Description |
There are number of goals for the initial step of MVC code refactoring:
Next step might be refactoring of page_header,php and page_footer.php as well as creation of a single front-controller. |
Comments |
Comment by Andrejs Čirkovs (Inactive) [ 2014 Jun 26 ] |
Three more points that are needed: 1) Request / Response stack. We need to refactor out current code:
do_something($_GET);
echo "some string";
die();
to something like: $request = Request::createFromGlobals(); $response = ZabbixKernel::processRequest($request, $debug = false, $environment = 'production'); $response->send(); so we can use the same approach in tests like public function testZabbixPageHasZabbixString() { $request = Request::create('/dashboard', $debug = true, $environment = 'test'); $response = ZabbixKernel::processRequest($request); $this->assertContains('Zabbix', $response->getBody()); $this->assertEquals(200, $response->getStateus()); } 2) as stated above, we need to refactor/enhance ZBase, turning it into real HTTP Kernel, that can be instantiated many times, incapsulate request / response logic and most important, to be used in TESTS!! as shown above. 3) We need a very basic event engine for audit code. |
Comment by Andrejs Čirkovs (Inactive) [ 2014 Jun 26 ] |
more info / best practices on https://github.com/symfony/HttpFoundation |
Comment by Andrejs Čirkovs (Inactive) [ 2014 Jun 27 ] |
1a) One more idea why we need separate Request/Response classes is to check for redirections like: public function testZabbixPageHasZabbixString() { $request = Request::create('/dashboard', $debug = true, $environment = 'test'); $response = ZabbixKernel::processRequest($request); $this->assertTrue($response instanceof RedirectResponse); $this->assertEquals('/login', $response->getTarget()); } |
Comment by Andrejs Čirkovs (Inactive) [ 2014 Jun 27 ] |
4) Morover, we should need a routing. A lightweight routing who's primary reason would be not to have pretty urls but to validate url on generation - currently, we can put virtually any URI in html source; by introducing a routing, a uri validation would happen on generation process. |
Comment by Andrejs Čirkovs (Inactive) [ 2014 Jun 27 ] |
5) Lastly, we should consider changing our template engine, since the current one is not supported at all (except internally) and is a burden of loosely-coupled objects. To prevent developers for shouting themselves in the leg we should use HTML-less template engine, such as Jade or Haml (which is, in fact, my favorite and has native php port: http://haml.info/tutorial.html it basically renders:
#content
.left.column
%h2 Welcome to our site!
%p= print_information
.right.column
= render :partial => "sidebar"
into: <div id='content'> <div class='left column'> <h2>Welcome to our site!</h2> <p><%= print_information %></p> </div> <div class="right column"> <%= render :partial => "sidebar" %> </div> </div> native PHP port is here: https://github.com/arnaud-lb/MtHaml |
Comment by Vadim Nesterov [ 2015 Jan 07 ] |
Why don't you want to use modern js frameworks? |
Comment by richlv [ 2015 Jan 27 ] |
(1) it has been mentioned that |
Comment by Alexei Vladishev [ 2015 Feb 09 ] |
Vadim, the transformation cannot be done in one go. The work also depends on the API, which is going to be moved to the server side. Think about MVC as a first phase of broader redesign. |
Comment by richlv [ 2015 Feb 13 ] |
(2) changed translation strings ? New strings
Deleted strings
sasha Fixed typo in r53346. RESOLVED <richlv> the list seems to match, thanks
martins-v I agree to the first suggestion. As for the second I have often seen "Something went wrong" messages in similar contexts, which seems slightly better. <richlv> as discussed, style of the first message has been improved and second made the same as the first one directly in trunk r53495. <richlv> the above is relevant for trunk up to r53496. unfortunately, since then, there have been more unverified changes merged, and translations in trunk can't be synced at this time. see subissue (9) for continuation on this. |
Comment by richlv [ 2015 Feb 18 ] |
(3) looks like db patches for user profile "url" field are missing. as discussed, probably the best action is to do a simple substring replacement sasha the list of URLs which must be replaced: dashboard.php => zabbix.php?action=dashboard.view discovery.php => zabbix.php?action=discovery.view maps.php => zabbix.php?action=map.view httpmon.php => zabbix.php?action=web.view media_types.php => zabbix.php?action=mediatype.list proxies.php => zabbix.php?action=proxy.list scripts.php => zabbix.php?action=script.list report3.php => zabbix.php?action=report.services report1.php => zabbix.php?action=report.status wiper Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-2357-db
REOPENED Take a look at my changes in r57507. wiper Thanks. RESOLVED in r57509 sasha Successfully TESTED! Take a look at my changes in r57510, r57511, r57512. wiper Thanks, CLOSED |
Comment by richlv [ 2015 Feb 18 ] |
(4) documentation
|
Comment by Oleg Egorov (Inactive) [ 2015 Mar 24 ] |
(5) White page |
Comment by Alexander Vladishev [ 2015 Apr 09 ] |
(6) Broken permission check. "guest" user can open any pages (configuration and administration) sasha RESOLVED in trunk r53032. alexei CLOSED |
Comment by Alexander Vladishev [ 2015 Apr 29 ] |
(7) Broken browserwarning.php PHP Warning: require_once(include/classes/core/CView.php): failed to open stream: No such file or directory in browserwarning.php on line 25 PHP Stack trace: PHP 1. {main}() browserwarning.php:0 PHP Fatal error: require_once(): Failed opening required 'include/classes/core/CView.php' (include_path='.:/usr/share/php:/usr/share/pear') in browserwarning.php on line 25 PHP Stack trace: PHP 1. {main}() browserwarning.php:0 sasha RESOLVED directly in trunk in r53407. |
Comment by Alexander Vladishev [ 2015 May 05 ] |
(8) No server name in the new pages <richlv> for the record this is about upper right corner and the page title. also includes the "fatal error" page. |
Comment by richlv [ 2015 May 12 ] |
(9) changed strings take 2. since r53496, there have been more unverified string changes. splitting out as a separate subissue. |
Comment by Oleg Egorov (Inactive) [ 2015 Jun 03 ] |
(10) CheckBox issues This happens because unchecked checkbox don't send any value. Most popular solution is <input type="hidden" ...> with same name as checkbox. Hidden fields use all most popular Web frameworks. |
Comment by Ivo Kurzemnieks [ 2015 Sep 21 ] |
(11) Impossible to debug fatal error problems. All we get is "Fatal error, please report to the Zabbix team" and controller + action. Framework should specify full paths,passed POST and GET parameters, all data, expected results and what we got in the end. For example missing files, views etc. Maybe the validation in checkInput() was wrong due to FALSE from validateInput(), but we are looking for problem in doAction() which is actually incorrect. We should specify field that did not pass the validation and why it didn't. Also redirection to /frontends/php/zabbix.php?action=system.warning is annyoing. I order to retry submitting a larger form with a lot of data, user needs to find that form again and everything has to be re-entered again. |
Comment by Ivo Kurzemnieks [ 2015 Oct 07 ] |
(12) API calls should be handled on controller side, not in views. For example: monitoring.widget.hosts.view.php, monitoring.widget.web.view, monitoring.widget.discovery.view. |
Comment by Alexander Vladishev [ 2015 Nov 27 ] |
(14) The new MVC pages: Monitoring -> Web and Monitoring -> IT Services -> Service report alexei RESOLVED in r55907 sasha TESTED. Take a look at my changes in r56893 - r56906. sasha Released in pre-3.0.0alpha5 r56976 CLOSED |
Comment by Alexander Vladishev [ 2015 Nov 27 ] |
(15) changed translation strings Deleted strings:
alexei CLOSED |
Comment by Gunars Pujats (Inactive) [ 2016 Jan 04 ] |
(16) Dashboard widgets should load in parallel. Now widgets load sequentially because each widget locks session data during execution time. gunarspujats RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-2357
REOPENED
sasha Successfully TESTED! |
Comment by Andris Zeila [ 2016 Jan 11 ] |
Database patch to convert user URLs to the new format (3) is available in:
|
Comment by Alexander Vladishev [ 2017 Feb 16 ] |
It is decided to close this problem as is. Opened sub-issues can be opened as separate ZBX or ZBXNEXT projects. |