Commit 62204919 authored by Roman Ondráček's avatar Roman Ondráček

Config: fix datagrids - fix CSS overflow, fix AJAX snippet

Signed-off-by: Roman Ondráček's avatarRoman Ondráček <ondracek.roman@centrum.cz>
parent 5d2e84ce
Pipeline #2116 passed with stages
in 13 minutes and 35 seconds
......@@ -80,19 +80,26 @@ class ComponentsDataGridFactory {
$grid->addColumnText('libraryPath', 'config.components.form.libraryPath');
$grid->addColumnText('libraryName', 'config.components.form.libraryName');
$grid->addColumnStatus('enabled', 'config.components.form.enabled')
->addOption(true, 'config.components.form.enabled')->setIcon('ok')->endOption()
->addOption(false, 'config.components.form.disabled')->setIcon('remove')
->setClass('btn btn-xs btn-danger')->endOption()
->addOption(true, 'config.components.form.enabled')
->setIcon('ok')
->endOption()
->addOption(false, 'config.components.form.disabled')
->setIcon('remove')
->setClass('btn btn-xs btn-danger')
->endOption()
->onChange[] = [$this, 'changeStatus'];
$grid->addAction('edit', 'config.actions.Edit')->setIcon('pencil')
$grid->addAction('edit', 'config.actions.Edit')
->setIcon('pencil')
->setClass('btn btn-xs btn-info');
$grid->addAction('delete', 'config.actions.Remove')->setIcon('remove')
$grid->addAction('delete', 'config.actions.Remove')
->setIcon('remove')
->setClass('btn btn-xs btn-danger ajax')
->setConfirmation(new StringConfirmation('config.components.form.messages.confirmDelete', 'name'));
$grid->allowRowsAction('delete', function (): bool {
return $this->presenter->user->isInRole('power');
return $this->presenter->getUser()->isInRole('power');
});
$grid->addToolbarButton('add', 'config.actions.Add')
->setIcon('plus')
->setClass('btn btn-xs btn-success');
return $grid;
}
......@@ -103,7 +110,7 @@ class ComponentsDataGridFactory {
* @throws JsonException
*/
private function load(): array {
if ($this->presenter->user->isInRole('power')) {
if ($this->presenter->getUser()->isInRole('power')) {
return $this->configManager->list();
}
$visible = ['iqrf::IqrfCdc', 'iqrf::IqrfSpi', 'iqrf::IqrfUart'];
......@@ -134,10 +141,9 @@ class ComponentsDataGridFactory {
$this->presenter->flashError('config.messages.writeFailures.nonExistingJsonSchema');
} finally {
if ($this->presenter->isAjax()) {
$this->presenter->redrawControl('flashes');
$dataGrid = $this->presenter['configComponentsDataGrid'];
$dataGrid->setDataSource($this->load());
$dataGrid->redrawItem($id);
$dataGrid->reloadTheWholeGrid();
}
}
}
......
......@@ -80,17 +80,24 @@ class MonitorDataGridFactory {
$grid->addColumnNumber('reportPeriod', 'config.monitor.form.reportPeriod');
$grid->addColumnNumber('port', 'config.monitor.form.WebsocketPort');
$grid->addColumnStatus('acceptOnlyLocalhost', 'config.websocket.form.acceptOnlyLocalhost')
->addOption(true, 'config.components.form.enabled')->setIcon('ok')->endOption()
->addOption(true, 'config.components.form.enabled')
->setIcon('ok')
->endOption()
->addOption(false, 'config.components.form.disabled')
->setIcon('remove')->setClass('btn btn-xs btn-danger')->endOption()
->setIcon('remove')
->setClass('btn btn-xs btn-danger')
->endOption()
->onChange[] = [$this, 'changeOnlyLocalhost'];
$grid->addAction('edit', 'config.actions.Edit')->setIcon('pencil')
$grid->addAction('edit', 'config.actions.Edit')
->setIcon('pencil')
->setClass('btn btn-xs btn-info');
$grid->addAction('delete', 'config.actions.Remove')->setIcon('remove')
$grid->addAction('delete', 'config.actions.Remove')
->setIcon('remove')
->setClass('btn btn-xs btn-danger ajax')
->setConfirmation(new StringConfirmation('config.monitor.messages.confirmDelete', 'monitorInstance'));
$grid->addToolbarButton('add', 'config.actions.Add')
->setClass('btn btn-xs btn-success');
->setClass('btn btn-xs btn-success')
->setIcon('plus');
return $grid;
}
......@@ -116,7 +123,7 @@ class MonitorDataGridFactory {
$this->presenter->redrawControl('flashes');
$dataGrid = $this->presenter['configMonitorDataGrid'];
$dataGrid->setDataSource($this->manager->list());
$dataGrid->redrawItem($id);
$dataGrid->reloadTheWholeGrid();
}
}
}
......
......@@ -82,17 +82,24 @@ class MqMessagingDataGridFactory {
$grid->addColumnText('LocalMqName', 'config.mq.form.LocalMqName');
$grid->addColumnText('RemoteMqName', 'config.mq.form.RemoteMqName');
$grid->addColumnStatus('acceptAsyncMsg', 'config.mq.form.acceptAsyncMsg')
->addOption(true, 'config.components.form.enabled')->setIcon('ok')->endOption()
->addOption(true, 'config.components.form.enabled')
->setIcon('ok')
->endOption()
->addOption(false, 'config.components.form.disabled')
->setIcon('remove')->setClass('btn btn-xs btn-danger')->endOption()
->setIcon('remove')
->setClass('btn btn-xs btn-danger')
->endOption()
->onChange[] = [$this, 'changeAsyncMsg'];
$grid->addAction('edit', 'config.actions.Edit')->setIcon('pencil')
$grid->addAction('edit', 'config.actions.Edit')
->setIcon('pencil')
->setClass('btn btn-xs btn-info');
$grid->addAction('delete', 'config.actions.Remove')->setIcon('remove')
$grid->addAction('delete', 'config.actions.Remove')
->setIcon('remove')
->setClass('btn btn-xs btn-danger ajax')
->setConfirmation(new StringConfirmation('config.mq.form.messages.confirmDelete', 'instance'));
$grid->addToolbarButton('add', 'config.actions.Add')
->setClass('btn btn-xs btn-success');
->setClass('btn btn-xs btn-success')
->setIcon('plus');
return $grid;
}
......@@ -114,10 +121,9 @@ class MqMessagingDataGridFactory {
$this->presenter->flashError('config.messages.writeFailures.nonExistingJsonSchema');
} finally {
if ($this->presenter->isAjax()) {
$this->presenter->redrawControl('flashes');
$dataGrid = $this->presenter['configMqDataGrid'];
$dataGrid->setDataSource($this->configManager->list());
$dataGrid->redrawItem($id);
$dataGrid->reloadTheWholeGrid();
}
}
}
......
......@@ -84,22 +84,33 @@ class MqttMessagingDataGridFactory {
$grid->addColumnText('TopicRequest', 'config.mqtt.form.TopicRequest');
$grid->addColumnText('TopicResponse', 'config.mqtt.form.TopicResponse');
$grid->addColumnStatus('EnabledSSL', 'config.mqtt.form.EnabledSSL')
->addOption(true, 'config.components.form.enabled')->setIcon('ok')->endOption()
->addOption(true, 'config.components.form.enabled')
->setIcon('ok')
->endOption()
->addOption(false, 'config.components.form.disabled')
->setIcon('remove')->setClass('btn btn-xs btn-danger')->endOption()
->setIcon('remove')
->setClass('btn btn-xs btn-danger')
->endOption()
->onChange[] = [$this, 'changeTls'];
$grid->addColumnStatus('acceptAsyncMsg', 'config.mqtt.asyncMessages')
->addOption(true, 'config.components.form.enabled')->setIcon('ok')->endOption()
->addOption(true, 'config.components.form.enabled')
->setIcon('ok')
->endOption()
->addOption(false, 'config.components.form.disabled')
->setIcon('remove')->setClass('btn btn-xs btn-danger')->endOption()
->setIcon('remove')
->setClass('btn btn-xs btn-danger')
->endOption()
->onChange[] = [$this, 'changeAsyncMsg'];
$grid->addAction('edit', 'config.actions.Edit')->setIcon('pencil')
$grid->addAction('edit', 'config.actions.Edit')
->setIcon('pencil')
->setClass('btn btn-xs btn-info');
$grid->addAction('delete', 'config.actions.Remove')->setIcon('remove')
$grid->addAction('delete', 'config.actions.Remove')
->setIcon('remove')
->setClass('btn btn-xs btn-danger ajax')
->setConfirmation(new StringConfirmation('config.mqtt.form.messages.confirmDelete', 'instance'));
$grid->addToolbarButton('add', 'config.actions.Add')
->setClass('btn btn-xs btn-success');
->setClass('btn btn-xs btn-success')
->setIcon('plus');
return $grid;
}
......@@ -135,7 +146,7 @@ class MqttMessagingDataGridFactory {
$this->presenter->redrawControl('flashes');
$dataGrid = $this->presenter['configMqttDataGrid'];
$dataGrid->setDataSource($this->configManager->list());
$dataGrid->redrawItem($id);
$dataGrid->reloadTheWholeGrid();
}
}
}
......
......@@ -71,9 +71,11 @@ class SchedulerDataGridFactory {
$grid->addColumnText('time', 'config.scheduler.form.time');
$grid->addColumnText('service', 'config.scheduler.form.service');
$grid->addColumnText('mType', 'config.scheduler.form.mType');
$grid->addAction('edit', 'config.actions.Edit')->setIcon('pencil')
$grid->addAction('edit', 'config.actions.Edit')
->setIcon('pencil')
->setClass('btn btn-xs btn-info');
$grid->addAction('delete', 'config.actions.Remove')->setIcon('remove')
$grid->addAction('delete', 'config.actions.Remove')
->setIcon('remove')
->setClass('btn btn-xs btn-danger ajax')
->setConfirmation(new StringConfirmation('config.scheduler.form.messages.confirmDelete', 'id'));
$grid->addToolbarButton('add', 'config.actions.Add')
......
......@@ -71,13 +71,16 @@ class TraceFileDataGridFactory {
$grid->addColumnText('instance', 'config.tracer.form.instance');
$grid->addColumnText('path', 'config.tracer.form.path');
$grid->addColumnText('filename', 'config.tracer.form.filename');
$grid->addAction('edit', 'config.actions.Edit')->setIcon('pencil')
$grid->addAction('edit', 'config.actions.Edit')
->setIcon('pencil')
->setClass('btn btn-xs btn-info');
$grid->addAction('delete', 'config.actions.Remove')->setIcon('remove')
$grid->addAction('delete', 'config.actions.Remove')
->setIcon('remove')
->setClass('btn btn-xs btn-danger ajax')
->setConfirmation(new StringConfirmation('config.tracer.form.messages.confirmDelete', 'instance'));
$grid->addToolbarButton('add', 'config.actions.Add')
->setClass('btn btn-xs btn-success');
->setClass('btn btn-xs btn-success')
->setIcon('plus');
return $grid;
}
......
......@@ -71,13 +71,16 @@ class UdpMessagingDataGridFactory {
$grid->addColumnText('instance', 'config.udp.form.instance');
$grid->addColumnNumber('RemotePort', 'config.udp.form.RemotePort');
$grid->addColumnNumber('LocalPort', 'config.udp.form.LocalPort');
$grid->addAction('edit', 'config.actions.Edit')->setIcon('pencil')
$grid->addAction('edit', 'config.actions.Edit')
->setIcon('pencil')
->setClass('btn btn-xs btn-info');
$grid->addAction('delete', 'config.actions.Remove')->setIcon('remove')
$grid->addAction('delete', 'config.actions.Remove')
->setIcon('remove')
->setClass('btn btn-xs btn-danger ajax')
->setConfirmation(new StringConfirmation('config.udp.form.messages.confirmDelete', 'instance'));
$grid->addToolbarButton('add', 'config.actions.Add')
->setClass('btn btn-xs btn-success');
->setClass('btn btn-xs btn-success')
->setIcon('plus');
return $grid;
}
......
......@@ -80,22 +80,33 @@ class WebSocketDataGridFactory {
$grid->addColumnText('messagingInstance', 'config.websocket.form.instance');
$grid->addColumnNumber('port', 'config.websocket.form.WebsocketPort');
$grid->addColumnStatus('acceptAsyncMsg', 'config.websocket.form.acceptAsyncMsg')
->addOption(true, 'config.components.form.enabled')->setIcon('ok')->endOption()
->addOption(true, 'config.components.form.enabled')
->setIcon('ok')
->endOption()
->addOption(false, 'config.components.form.disabled')
->setIcon('remove')->setClass('btn btn-xs btn-danger')->endOption()
->setIcon('remove')
->setClass('btn btn-xs btn-danger')
->endOption()
->onChange[] = [$this, 'changeAsyncMsg'];
$grid->addColumnStatus('acceptOnlyLocalhost', 'config.websocket.form.acceptOnlyLocalhost')
->addOption(true, 'config.components.form.enabled')->setIcon('ok')->endOption()
->addOption(true, 'config.components.form.enabled')
->setIcon('ok')
->endOption()
->addOption(false, 'config.components.form.disabled')
->setIcon('remove')->setClass('btn btn-xs btn-danger')->endOption()
->setIcon('remove')
->setClass('btn btn-xs btn-danger')
->endOption()
->onChange[] = [$this, 'changeOnlyLocalhost'];
$grid->addAction('edit', 'config.actions.Edit')->setIcon('pencil')
$grid->addAction('edit', 'config.actions.Edit')
->setIcon('pencil')
->setClass('btn btn-xs btn-info');
$grid->addAction('delete', 'config.actions.Remove')->setIcon('remove')
$grid->addAction('delete', 'config.actions.Remove')
->setIcon('remove')
->setClass('btn btn-xs btn-danger ajax')
->setConfirmation(new StringConfirmation('config.websocket.interface.messages.confirmDelete', 'messagingInstance'));
$grid->addToolbarButton('add', 'config.actions.Add')
->setClass('btn btn-xs btn-success');
->setClass('btn btn-xs btn-success')
->setIcon('plus');
return $grid;
}
......@@ -128,10 +139,9 @@ class WebSocketDataGridFactory {
$this->presenter->flashError('config.messages.writeFailures.nonExistingJsonSchema');
} finally {
if ($this->presenter->isAjax()) {
$this->presenter->redrawControl('flashes');
$dataGrid = $this->presenter['configWebSocketDataGrid'];
$dataGrid->setDataSource($this->configManager->list());
$dataGrid->redrawItem($id);
$dataGrid->reloadTheWholeGrid();
}
}
}
......
......@@ -79,18 +79,25 @@ class WebSocketMessagingDataGridFactory {
$grid->setDataSource($this->getData());
$grid->addColumnText('instance', 'config.websocket.form.instance');
$grid->addColumnStatus('acceptAsyncMsg', 'config.websocket.form.acceptAsyncMsg')
->addOption(true, 'config.components.form.enabled')->setIcon('ok')->endOption()
->addOption(true, 'config.components.form.enabled')
->setIcon('ok')
->endOption()
->addOption(false, 'config.components.form.disabled')
->setIcon('remove')->setClass('btn btn-xs btn-danger')->endOption()
->setIcon('remove')
->setClass('btn btn-xs btn-danger')
->endOption()
->onChange[] = [$this, 'changeAsyncMsg'];
$grid->addColumnText('requiredInterfaces', 'config.websocket.form.requiredInterface.instance');
$grid->addAction('edit-messaging', 'config.actions.Edit')->setIcon('pencil')
$grid->addAction('edit-messaging', 'config.actions.Edit')
->setIcon('pencil')
->setClass('btn btn-xs btn-info');
$grid->addAction('delete-messaging', 'config.actions.Remove')->setIcon('remove')
$grid->addAction('delete-messaging', 'config.actions.Remove')
->setIcon('remove')
->setClass('btn btn-xs btn-danger ajax')
->setConfirmation(new StringConfirmation('config.websocket.messaging.messages.confirmDelete', 'instance'));
$grid->addToolbarButton('add-messaging', 'config.actions.Add')
->setClass('btn btn-xs btn-success');
->setClass('btn btn-xs btn-success')
->setIcon('plus');
return $grid;
}
......@@ -133,7 +140,7 @@ class WebSocketMessagingDataGridFactory {
$this->presenter->redrawControl('flashes');
$dataGrid = $this->presenter['configWebSocketMessagingDataGrid'];
$dataGrid->setDataSource($this->getData());
$dataGrid->redrawItem($id);
$dataGrid->reloadTheWholeGrid();
}
}
}
......
......@@ -81,17 +81,24 @@ class WebSocketServiceDataGridFactory {
$grid->addColumnText('instance', 'config.websocket.form.instance');
$grid->addColumnNumber('WebsocketPort', 'config.websocket.form.WebsocketPort');
$grid->addColumnStatus('acceptOnlyLocalhost', 'config.websocket.form.acceptOnlyLocalhost')
->addOption(true, 'config.components.form.enabled')->setIcon('ok')->endOption()
->addOption(true, 'config.components.form.enabled')
->setIcon('ok')
->endOption()
->addOption(false, 'config.components.form.disabled')
->setIcon('remove')->setClass('btn btn-xs btn-danger')->endOption()
->setIcon('remove')
->setClass('btn btn-xs btn-danger')
->endOption()
->onChange[] = [$this, 'changeOnlyLocalhost'];
$grid->addAction('edit-service', 'config.actions.Edit')->setIcon('pencil')
$grid->addAction('edit-service', 'config.actions.Edit')
->setIcon('pencil')
->setClass('btn btn-xs btn-info');
$grid->addAction('delete-service', 'config.actions.Remove')->setIcon('remove')
$grid->addAction('delete-service', 'config.actions.Remove')
->setIcon('remove')
->setClass('btn btn-xs btn-danger ajax')
->setConfirmation(new StringConfirmation('config.websocket.service.messages.confirmDelete', 'instance'));
$grid->addToolbarButton('add-service', 'config.actions.Add')
->setClass('btn btn-xs btn-success');
->setClass('btn btn-xs btn-success')
->setIcon('plus');
return $grid;
}
......@@ -116,7 +123,7 @@ class WebSocketServiceDataGridFactory {
$this->presenter->redrawControl('flashes');
$dataGrid = $this->presenter['configWebSocketServiceDataGrid'];
$dataGrid->setDataSource($this->configManager->list());
$dataGrid->redrawItem($id);
$dataGrid->reloadTheWholeGrid();
}
}
}
......
......@@ -20,7 +20,6 @@ declare(strict_types = 1);
namespace App\ConfigModule\Forms;
use App\ConfigModule\Presenters\IqrfInfoPresenter;
use Nette\Application\UI\Form;
use Nette\SmartObject;
......@@ -55,4 +54,5 @@ class IqrfInfoFormFactory extends GenericConfigFormFactory {
$form->onSuccess[] = [$this, 'save'];
return $form;
}
}
......@@ -20,7 +20,6 @@ declare(strict_types = 1);
namespace App\ConfigModule\Presenters;
use App\ConfigModule\Forms\IqrfInfoFormFactory;
use App\ConfigModule\Models\GenericManager;
use Nette\Application\UI\Form;
......
......@@ -141,7 +141,7 @@ class UserDataGridFactory {
if ($this->presenter->isAjax()) {
$dataGrid = $this->presenter['userGrid'];
$dataGrid->setDataSource($this->manager->getUsers());
$dataGrid->redrawItem($id);
$dataGrid->reloadTheWholeGrid();
}
}
}
......
......@@ -22,7 +22,7 @@
.datagrid {
padding: 0;
overflow-x: auto;
overflow-x: visible;
}
.icon {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment