Browse Source

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

pull/21/head
KodeStar 7 years ago
parent
commit
b2dd3f803e
  1. 16
      CHANGELOG.md
  2. 7
      app/Http/Controllers/ItemController.php
  3. 20
      app/Item.php
  4. 2
      resources/views/item.blade.php

16
CHANGELOG.md

@ -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

7
app/Http/Controllers/ItemController.php

@ -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,12 +200,10 @@ 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());

20
app/Item.php

@ -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;
}
}

2
resources/views/item.blade.php

@ -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>

Loading…
Cancel
Save