mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 01:54:49 +00:00
Firmware - minor bugfix to map Subscription on page load and add initial migration so BE users stick to their version.
This commit is contained in:
parent
31aa007c74
commit
eb1f41f449
39
src/opnsense/mvc/app/models/OPNsense/Core/Firmware.php
Normal file
39
src/opnsense/mvc/app/models/OPNsense/Core/Firmware.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2021 Deciso B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OPNsense\Core;
|
||||
|
||||
use OPNsense\Base\BaseModel;
|
||||
|
||||
/**
|
||||
* Class Firmware
|
||||
* @package OPNsense\Core
|
||||
*/
|
||||
class Firmware extends BaseModel
|
||||
{
|
||||
}
|
||||
25
src/opnsense/mvc/app/models/OPNsense/Core/Firmware.xml
Normal file
25
src/opnsense/mvc/app/models/OPNsense/Core/Firmware.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<model>
|
||||
<mount>//system/firmware</mount>
|
||||
<version>1.0.0</version>
|
||||
<description>
|
||||
OPNsense Firmware settings
|
||||
</description>
|
||||
<items>
|
||||
<mirror type="TextField">
|
||||
<Required>N</Required>
|
||||
<default></default>
|
||||
</mirror>
|
||||
<flavour type="TextField">
|
||||
<Required>N</Required>
|
||||
<default></default>
|
||||
</flavour>
|
||||
<plugins type="TextField">
|
||||
<Required>N</Required>
|
||||
<default></default>
|
||||
</plugins>
|
||||
<type type="TextField">
|
||||
<Required>N</Required>
|
||||
<default></default>
|
||||
</type>
|
||||
</items>
|
||||
</model>
|
||||
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2021 Deciso B.V.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OPNsense\Core\Migrations;
|
||||
|
||||
use OPNsense\Base\BaseModelMigration;
|
||||
|
||||
class M1_0_0 extends BaseModelMigration
|
||||
{
|
||||
/**
|
||||
* Migrate BE release type
|
||||
* @param $model
|
||||
*/
|
||||
public function run($model)
|
||||
{
|
||||
|
||||
if ((empty((string)$model->type) || (string)$model->type == "devel") && !empty((string)$model->mirror) ) {
|
||||
$is_business = stripos((string)$model->mirror, "opnsense-update.deciso.com") > 1;
|
||||
if ($is_business) {
|
||||
$model->type = "business";
|
||||
$model->flavour = "latest";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -622,6 +622,7 @@
|
||||
$("#firmware_mirror").append($("<option/>")
|
||||
.attr("value",key)
|
||||
.text(value)
|
||||
.data("has_subscription", firmwareoptions['families_has_subscription'].length > 0)
|
||||
.prop('selected', selected)
|
||||
);
|
||||
});
|
||||
@ -634,6 +635,12 @@
|
||||
);
|
||||
}
|
||||
|
||||
if ($("#firmware_mirror option:selected").data("has_subscription") == true) {
|
||||
$("#firmware_mirror_subscription").val(firmwareconfig['mirror'].substr($("#firmware_mirror").val().length+1));
|
||||
} else {
|
||||
$("#firmware_mirror_subscription").val("");
|
||||
}
|
||||
|
||||
$("#firmware_mirror").selectpicker('refresh');
|
||||
$("#firmware_mirror").change();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user