mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-11-10 09:52:42 +09:00
Merge pull request #1476 from KodeStar/2.x
Load in configs values if class has been lost
This commit is contained in:
@@ -194,6 +194,7 @@ class ItemController extends Controller
|
|||||||
public function create(): View
|
public function create(): View
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
$data['item'] = new \App\Item();
|
||||||
$data['tags'] = Item::ofType('tag')->orderBy('title', 'asc')->pluck('title', 'id');
|
$data['tags'] = Item::ofType('tag')->orderBy('title', 'asc')->pluck('title', 'id');
|
||||||
$data['tags']->prepend(__('app.dashboard'), 0);
|
$data['tags']->prepend(__('app.dashboard'), 0);
|
||||||
$data['current_tags'] = '0';
|
$data['current_tags'] = '0';
|
||||||
@@ -422,6 +423,7 @@ class ItemController extends Controller
|
|||||||
{
|
{
|
||||||
$output = [];
|
$output = [];
|
||||||
$appid = $request->input('app');
|
$appid = $request->input('app');
|
||||||
|
$itemId = $request->input('item_id');
|
||||||
|
|
||||||
if ($appid === 'null') {
|
if ($appid === 'null') {
|
||||||
return null;
|
return null;
|
||||||
@@ -436,8 +438,10 @@ class ItemController extends Controller
|
|||||||
$appdetails = Application::getApp($appid);
|
$appdetails = Application::getApp($appid);
|
||||||
|
|
||||||
if ((bool)$app->enhanced === true) {
|
if ((bool)$app->enhanced === true) {
|
||||||
|
$item = $itemId ? Item::find($itemId) : Item::where('appid', $appid)->first();
|
||||||
// if(!isset($app->config)) { // class based config
|
// if(!isset($app->config)) { // class based config
|
||||||
$output['custom'] = className($appdetails->name) . '.config';
|
$output['custom'] = className($appdetails->name) . '.config';
|
||||||
|
$output['appvalue'] = $item->description;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Facade;
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'version' => '2.7.1',
|
'version' => '2.7.2',
|
||||||
|
|
||||||
'appsource' => env('APP_SOURCE', 'https://appslist.heimdall.site/'),
|
'appsource' => env('APP_SOURCE', 'https://appslist.heimdall.site/'),
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<section class="module-container">
|
<section class="module-container">
|
||||||
@if($enable_auth_admin_controls)
|
@if($enable_auth_admin_controls)
|
||||||
<header>
|
<header>
|
||||||
|
{{ html()->hidden('app_id', $item->id) }}
|
||||||
<div class="section-title">{{ __('app.apps.preview') }}</div>
|
<div class="section-title">{{ __('app.apps.preview') }}</div>
|
||||||
<div class="module-actions">
|
<div class="module-actions">
|
||||||
<div class="toggleinput">
|
<div class="toggleinput">
|
||||||
@@ -120,7 +121,7 @@
|
|||||||
@if(isset($item) && $item->enhanced())
|
@if(isset($item) && $item->enhanced())
|
||||||
|
|
||||||
<div id="sapconfig" style="display: block;">
|
<div id="sapconfig" style="display: block;">
|
||||||
@if(isset($item))
|
@if(isset($item) && $item->class)
|
||||||
@include('SupportedApps::'.App\Item::nameFromClass($item->class).'.config')
|
@include('SupportedApps::'.App\Item::nameFromClass($item->class).'.config')
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -171,13 +171,14 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
function appload(appvalue) {
|
function appload(appvalue) {
|
||||||
|
const itemId = $('input[name="item_id"]').val();
|
||||||
if(appvalue == 'null') {
|
if(appvalue == 'null') {
|
||||||
$('#sapconfig').html('').hide();
|
$('#sapconfig').html('').hide();
|
||||||
$('#tile-preview .app-icon').attr('src', '/img/heimdall-icon-small.png');
|
$('#tile-preview .app-icon').attr('src', '/img/heimdall-icon-small.png');
|
||||||
$('#appimage').html("<img src='/img/heimdall-icon-small.png' />");
|
$('#appimage').html("<img src='/img/heimdall-icon-small.png' />");
|
||||||
$('#sapconfig').html('').hide();
|
$('#sapconfig').html('').hide();
|
||||||
} else {
|
} else {
|
||||||
$.post('{{ route('appload') }}', { app: appvalue }, function(data) {
|
$.post('{{ route('appload') }}', { app: appvalue, item_id: itemId }, function(data) {
|
||||||
// Main details
|
// Main details
|
||||||
$('#appimage').html("<img src='"+data.iconview+"' /><input type='hidden' name='icon' value='"+data.iconview+"' />");
|
$('#appimage').html("<img src='"+data.iconview+"' /><input type='hidden' name='icon' value='"+data.iconview+"' />");
|
||||||
$('input[name=colour]').val(data.colour);
|
$('input[name=colour]').val(data.colour);
|
||||||
@@ -194,6 +195,21 @@
|
|||||||
if(data.custom != null) {
|
if(data.custom != null) {
|
||||||
$.get(base+'view/'+data.custom, function(getdata) {
|
$.get(base+'view/'+data.custom, function(getdata) {
|
||||||
$('#sapconfig').html(getdata).show();
|
$('#sapconfig').html(getdata).show();
|
||||||
|
// Populate fields in the loaded form with description data
|
||||||
|
if (data.description) {
|
||||||
|
const description = JSON.parse(data.appvalue);
|
||||||
|
Object.keys(description).forEach(function(key) {
|
||||||
|
const value = description[key];
|
||||||
|
const field = $(`#sapconfig [name="config[${key}]"]`);
|
||||||
|
if (field.length) {
|
||||||
|
if (field.is(':checkbox')) {
|
||||||
|
field.prop('checked', value);
|
||||||
|
} else {
|
||||||
|
field.val(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$('#sapconfig').html('').hide();
|
$('#sapconfig').html('').hide();
|
||||||
|
|||||||
Reference in New Issue
Block a user