parent
bab0ebc6c1
commit
fb72a6e293
|
@ -13,6 +13,10 @@ before switching to a new version.
|
|||
### Permissions and Restrictions
|
||||
* FEATURE: Showing the executed SQL query now requires the `showsql` permission
|
||||
|
||||
### UI features
|
||||
* Admins have now access to JSON download links in many places
|
||||
* Users equipped with related permissions can toggle "Show SQL" in the GUI
|
||||
|
||||
1.4.1
|
||||
-----
|
||||
### Fixed issues
|
||||
|
|
|
@ -78,7 +78,18 @@ abstract class ObjectsController extends ActionController
|
|||
$this->apiRequestHandler()->dispatch();
|
||||
return;
|
||||
}
|
||||
|
||||
$type = $this->getType();
|
||||
if ($this->params->get('format') === 'json') {
|
||||
$filename = sprintf(
|
||||
"director-${type}_%s.json",
|
||||
date('YmdHis')
|
||||
);
|
||||
$this->getResponse()->setHeader('Content-disposition', "attachment; filename=$filename", true);
|
||||
$this->apiRequestHandler()->dispatch();
|
||||
return;
|
||||
}
|
||||
|
||||
$this
|
||||
->addObjectsTabs()
|
||||
->setAutorefreshInterval(10)
|
||||
|
|
|
@ -28,6 +28,9 @@ class AdditionalTableActions
|
|||
public function appendTo(Html $parent)
|
||||
{
|
||||
$links = [];
|
||||
if ($this->hasPermission('director/admin')) {
|
||||
$links[] = $this->createDownloadJsonLink();
|
||||
}
|
||||
if ($this->hasPermission('director/showsql')) {
|
||||
$links[] = $this->createShowSqlToggle();
|
||||
}
|
||||
|
@ -39,6 +42,16 @@ class AdditionalTableActions
|
|||
return $this;
|
||||
}
|
||||
|
||||
protected function createDownloadJsonLink()
|
||||
{
|
||||
return Link::create(
|
||||
$this->translate('Download as JSON'),
|
||||
$this->url->with('format', 'json'),
|
||||
null,
|
||||
['target' => '_blank']
|
||||
);
|
||||
}
|
||||
|
||||
protected function createShowSqlToggle()
|
||||
{
|
||||
if ($this->url->getParam('format') === 'sql') {
|
||||
|
|
Loading…
Reference in New Issue