Custom Maps configurable new map defaults (#16212)

This commit is contained in:
Tony Murray
2024-07-17 16:05:44 -05:00
committed by GitHub
parent 1cceafb887
commit cf7b025fb1
9 changed files with 409 additions and 24 deletions

View File

@@ -0,0 +1,48 @@
<!--
- SettingColor.vue
-
- Description-
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-
- @package LibreNMS
- @link https://www.librenms.org
- @copyright 2019 Tony Murray
- @author Tony Murray <murraytony@gmail.com>
-->
<template>
<input type="color" class="form-control"
:name="name"
:value="value"
@input="$emit('input', $event.target.value)"
:required="required"
:disabled="disabled"
>
</template>
<script>
import BaseSetting from "./BaseSetting";
export default {
name: "SettingColor",
mixins: [BaseSetting],
}
</script>
<style scoped>
.form-control {
padding-right: 12px;
}
</style>

View File

@@ -67,11 +67,11 @@
error: '',
resetBackground() {
this.type = this.initial_type;
this.color = 'color' in this.initial_data ? this.initial_data.color : '#badaee';
this.lat = 'lat' in this.initial_data ? this.initial_data.lat : 40;
this.lng = 'lng' in this.initial_data ? this.initial_data.lng : -20;
this.zoom = 'zoom' in this.initial_data ? this.initial_data.zoom : 3;
this.layer = 'layer' in this.initial_data ? this.initial_data.layer : null;
this.color = 'color' in this.initial_data ? this.initial_data.color : '{{ Config::get('custom_map.background_data.color') }}';
this.lat = 'lat' in this.initial_data ? this.initial_data.lat : {{ (float) Config::get('custom_map.background_data.lat') }};
this.lng = 'lng' in this.initial_data ? this.initial_data.lng : {{ (float) Config::get('custom_map.background_data.lng') }};
this.zoom = 'zoom' in this.initial_data ? this.initial_data.zoom : {{ (int) Config::get('custom_map.background_data.zoom') }};
this.layer = 'layer' in this.initial_data ? this.initial_data.layer : {{ Js::from(Config::get('custom_map.background_data.layer')) }};
this.image = this.initial_data['original_filename'];
this.image_content = null;
this.show_image_export = (! 'engine' in this.initial_data) || ! ['google', 'bing'].includes(this.initial_data['engine']);