feat: show warning if api is not configured

pull/36/head
sualko 2020-05-17 12:29:44 +02:00
parent 6587b53246
commit e147019dbe
4 changed files with 42 additions and 5 deletions

View File

@ -8,7 +8,7 @@ use OCP\Settings\ISettings;
class Admin implements ISettings
{
/** @var IConfig */
/** @var IConfig */
private $config;
/**

View File

@ -4,15 +4,40 @@ namespace OCA\BigBlueButton\Settings;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Settings\ISettings;
use OCP\IConfig;
use \OCP\IL10N;
class Personal implements ISettings
{
/** @var IConfig */
private $config;
/** @var IL10N */
private $l;
/**
* Admin constructor.
*
* @param IConfig $config
*/
public function __construct(IConfig $config, IL10N $l)
{
$this->config = $config;
$this->l = $l;
}
/**
* @return TemplateResponse
*/
public function getForm()
{
return new TemplateResponse('bbb', 'manager');
$warning = '';
if (empty($this->config->getAppValue('bbb', 'api.url')) || empty($this->config->getAppValue('bbb', 'api.secret'))) {
$warning = $this->l->t('API url or secret not configured. Please contact your administrator.');
}
return new TemplateResponse('bbb', 'manager', ['warning' => $warning]);
}
/**

View File

@ -3,3 +3,9 @@ script('bbb', 'manager');
?>
<div id="bbb-root"></div>
<?php if(!empty($_['warning'])): ?>
<div id="bbb-warning">
<span class="icon icon-error-color icon-visible"></span> <?php p($_['warning']); ?>
</div>
<?php endif; ?>

View File

@ -1,6 +1,12 @@
#bbb-react-root, #bbb-root {
height: 100%;
min-height: calc(100vh - 50px);
#bbb-warning {
margin: 3em;
padding: 1em;
background-color: rgb(255, 255, 123);
display: inline-block;
.icon {
display: inline-block;
}
}
#bbb-react-root {