don't try to get live stats for items that haven't been configured

This commit is contained in:
KodeStar 2018-02-08 20:58:07 +00:00
parent 912c6512fb
commit b2dd3f803e
4 changed files with 39 additions and 6 deletions

View file

@ -4,9 +4,12 @@
### Added
- guzzlehttp/guzzle as a dependency
- Variable polling, so interval is increased when an app is idle and decreased when it's active
- Turkish language translation
### Changed
- Updated composer dependencies
- Added live stats to Nzbget supported application
### Fixed
@ -17,6 +20,19 @@
### Added
- Translation support
- Initial "Supported" application support
- Finnish translation
- Swedish translation
- German translation
- French translation
- Spanish translation
- Duplicati supported application
- Emby supported application
- Nzbget supported application
- Pfsense supported application
- Pihole supported application
- Plex supported application
- Portainer supported application
- Unifi supported application
### Changed
- button layout and behaviour

View file

@ -139,8 +139,7 @@ class ItemController extends Controller
]);
}
$config = $request->input('config');
$config = (!empty($config)) ? json_encode($config) : null;
$config = Item::checkConfig($request->input('config'));
$request->merge([
'description' => $config
]);
@ -201,13 +200,11 @@ class ItemController extends Controller
]);
}
$config = $request->input('config');
$config = (!empty($config)) ? json_encode($config) : null;
$config = Item::checkConfig($request->input('config'));
$request->merge([
'description' => $config
]);
Item::find($id)->update($request->all());
return redirect()->route('dash')

View file

@ -67,4 +67,24 @@ class Item extends Model
}
return (object)$output;
}
public static function checkConfig($config)
{
if(empty($config)) {
$config = null;
} else {
$store = false;
foreach($config as $key => $check) {
if($key == 'type') continue;
if(!empty($check)) {
$store = true;
break;
}
}
$config['enabled'] = ($store) ? true : false;
$config = json_encode($config);
}
return $config;
}
}

View file

@ -7,7 +7,7 @@
@endif
<div class="details">
<div class="title">{{ $app->title }}</div>
@if(isset($app->description) && !empty($app->description))
@if(isset($app->config->enabled) && ((bool)$app->config->enabled === true))
<div data-id="{{ $app->id }}" class="livestats-container"></div>
@endif
</div>