mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
[CodeFactor] Apply fixes to commit bdc21d1
This commit is contained in:
parent
bdc21d1c53
commit
30710fbb7e
2 changed files with 56 additions and 60 deletions
|
@ -51,7 +51,8 @@ const gridWidgets = [
|
||||||
{ x: 0, y: 0, w: 16, h: 40 },
|
{ x: 0, y: 0, w: 16, h: 40 },
|
||||||
"Detailed heard stations list",
|
"Detailed heard stations list",
|
||||||
true,
|
true,
|
||||||
true,"Activity"
|
true,
|
||||||
|
"Activity",
|
||||||
),
|
),
|
||||||
new gridWidget(
|
new gridWidget(
|
||||||
active_stats,
|
active_stats,
|
||||||
|
@ -59,7 +60,7 @@ const gridWidgets = [
|
||||||
"Stats (waterfall, etc)",
|
"Stats (waterfall, etc)",
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
"Stats"
|
"Stats",
|
||||||
),
|
),
|
||||||
new gridWidget(
|
new gridWidget(
|
||||||
active_audio_level,
|
active_audio_level,
|
||||||
|
@ -75,7 +76,7 @@ const gridWidgets = [
|
||||||
"Rig control main",
|
"Rig control main",
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
"Rig"
|
"Rig",
|
||||||
),
|
),
|
||||||
new gridWidget(
|
new gridWidget(
|
||||||
active_broadcats,
|
active_broadcats,
|
||||||
|
@ -83,7 +84,7 @@ const gridWidgets = [
|
||||||
"Broadcats main",
|
"Broadcats main",
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
"Broadcasts"
|
"Broadcasts",
|
||||||
),
|
),
|
||||||
new gridWidget(
|
new gridWidget(
|
||||||
mini_heard_stations,
|
mini_heard_stations,
|
||||||
|
@ -91,16 +92,23 @@ const gridWidgets = [
|
||||||
"Mini heard stations list",
|
"Mini heard stations list",
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
"Activity"
|
"Activity",
|
||||||
|
),
|
||||||
|
new gridWidget(
|
||||||
|
s_meter,
|
||||||
|
{ x: 1, y: 1, w: 4, h: 8 },
|
||||||
|
"S-Meter",
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
"Rig",
|
||||||
),
|
),
|
||||||
new gridWidget(s_meter, { x: 1, y: 1, w: 4, h: 8 }, "S-Meter", false, true, "Rig"),
|
|
||||||
new gridWidget(
|
new gridWidget(
|
||||||
dbfs_meter,
|
dbfs_meter,
|
||||||
{ x: 1, y: 1, w: 4, h: 8 },
|
{ x: 1, y: 1, w: 4, h: 8 },
|
||||||
"Dbfs Meter",
|
"Dbfs Meter",
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
"Audio"
|
"Audio",
|
||||||
),
|
),
|
||||||
new gridWidget(
|
new gridWidget(
|
||||||
grid_activities,
|
grid_activities,
|
||||||
|
@ -110,7 +118,6 @@ const gridWidgets = [
|
||||||
true,
|
true,
|
||||||
"Activity",
|
"Activity",
|
||||||
),
|
),
|
||||||
|
|
||||||
];
|
];
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
grid = GridStack.init({
|
grid = GridStack.init({
|
||||||
|
@ -137,23 +144,23 @@ onMounted(() => {
|
||||||
|
|
||||||
grid.on("change", onChange);
|
grid.on("change", onChange);
|
||||||
|
|
||||||
gridWidgets.forEach((gw) =>{
|
gridWidgets.forEach((gw) => {
|
||||||
//Dynamically add widgets to widget menu
|
//Dynamically add widgets to widget menu
|
||||||
let dom = document.getElementById("otherBod");
|
let dom = document.getElementById("otherBod");
|
||||||
switch (gw.category) {
|
switch (gw.category) {
|
||||||
case "Activity":
|
case "Activity":
|
||||||
dom = document.getElementById("actBody");
|
dom = document.getElementById("actBody");
|
||||||
break;
|
break;
|
||||||
case "Stats":
|
case "Stats":
|
||||||
dom = document.getElementById("statsBody");
|
dom = document.getElementById("statsBody");
|
||||||
break;
|
break;
|
||||||
case "Audio":
|
case "Audio":
|
||||||
dom = document.getElementById("audioBody");
|
dom = document.getElementById("audioBody");
|
||||||
break;
|
break;
|
||||||
case "Rig":
|
case "Rig":
|
||||||
dom = document.getElementById("rigBody");
|
dom = document.getElementById("rigBody");
|
||||||
break;
|
break;
|
||||||
case "Broadcasts":
|
case "Broadcasts":
|
||||||
dom = document.getElementById("bcBody");
|
dom = document.getElementById("bcBody");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -161,19 +168,19 @@ onMounted(() => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
var index = gridWidgets.findIndex((w) => gw.text == w.text);
|
var index = gridWidgets.findIndex((w) => gw.text == w.text);
|
||||||
dom.insertAdjacentHTML("beforeend",`<div id="gridbtn-${index}""></div>`);
|
dom.insertAdjacentHTML("beforeend", `<div id="gridbtn-${index}""></div>`);
|
||||||
let dom2 = document.getElementById(`gridbtn-${index}`);
|
let dom2 = document.getElementById(`gridbtn-${index}`);
|
||||||
let vueComponent = h(grid_button,{btnText: gw.text,btnID:index});
|
let vueComponent = h(grid_button, { btnText: gw.text, btnID: index });
|
||||||
render(vueComponent,dom2);
|
render(vueComponent, dom2);
|
||||||
})
|
});
|
||||||
window.addEventListener(
|
window.addEventListener(
|
||||||
"add-widget",
|
"add-widget",
|
||||||
function (eventdata) {
|
function (eventdata) {
|
||||||
let data = eventdata.detail;
|
let data = eventdata.detail;
|
||||||
addNewWidget2(gridWidgets[data]);
|
addNewWidget2(gridWidgets[data]);
|
||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
function onChange(event, changeItems) {
|
function onChange(event, changeItems) {
|
||||||
// update item position
|
// update item position
|
||||||
|
@ -273,7 +280,7 @@ function quickfill() {
|
||||||
<h5 class="offcanvas-title" id="offcanvasGridItemsLabel">
|
<h5 class="offcanvas-title" id="offcanvasGridItemsLabel">
|
||||||
Manage grid widgets
|
Manage grid widgets
|
||||||
</h5>
|
</h5>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn-close"
|
class="btn-close"
|
||||||
|
@ -282,8 +289,10 @@ function quickfill() {
|
||||||
></button>
|
></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="offcanvas-body">
|
<div class="offcanvas-body">
|
||||||
<p>Grid widgets allow you to customize the display for your own usage. Here you may add additional widgets to fit your needs.
|
<p>
|
||||||
You can move and resize the individual widgets!
|
Grid widgets allow you to customize the display for your own usage. Here
|
||||||
|
you may add additional widgets to fit your needs. You can move and
|
||||||
|
resize the individual widgets!
|
||||||
</p>
|
</p>
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
|
@ -293,10 +302,8 @@ function quickfill() {
|
||||||
>
|
>
|
||||||
Fill grid with common widgets
|
Fill grid with common widgets
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr />
|
||||||
<!-- Begin widget selector -->
|
<!-- Begin widget selector -->
|
||||||
<div class="accordion" id="accordionExample">
|
<div class="accordion" id="accordionExample">
|
||||||
<!-- Heard Stations -->
|
<!-- Heard Stations -->
|
||||||
|
@ -319,9 +326,7 @@ function quickfill() {
|
||||||
aria-labelledby="headingHeardStations"
|
aria-labelledby="headingHeardStations"
|
||||||
data-bs-parent="#accordionExample"
|
data-bs-parent="#accordionExample"
|
||||||
>
|
>
|
||||||
<div class="accordion-body" id="actBody">
|
<div class="accordion-body" id="actBody"></div>
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -345,9 +350,7 @@ function quickfill() {
|
||||||
aria-labelledby="headingActivities"
|
aria-labelledby="headingActivities"
|
||||||
data-bs-parent="#accordionExample"
|
data-bs-parent="#accordionExample"
|
||||||
>
|
>
|
||||||
<div class="accordion-body" id="audioBody">
|
<div class="accordion-body" id="audioBody"></div>
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Broadcasts -->
|
<!-- Broadcasts -->
|
||||||
|
@ -370,9 +373,7 @@ function quickfill() {
|
||||||
aria-labelledby="headingBroadcasts"
|
aria-labelledby="headingBroadcasts"
|
||||||
data-bs-parent="#accordionExample"
|
data-bs-parent="#accordionExample"
|
||||||
>
|
>
|
||||||
<div class="accordion-body" id="bcBody">
|
<div class="accordion-body" id="bcBody"></div>
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Radio Control -->
|
<!-- Radio Control -->
|
||||||
|
@ -395,9 +396,7 @@ function quickfill() {
|
||||||
aria-labelledby="headingRadioControl"
|
aria-labelledby="headingRadioControl"
|
||||||
data-bs-parent="#accordionExample"
|
data-bs-parent="#accordionExample"
|
||||||
>
|
>
|
||||||
<div class="accordion-body" id="rigBody">
|
<div class="accordion-body" id="rigBody"></div>
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -421,9 +420,7 @@ function quickfill() {
|
||||||
aria-labelledby="headingAudioControl"
|
aria-labelledby="headingAudioControl"
|
||||||
data-bs-parent="#accordionExample"
|
data-bs-parent="#accordionExample"
|
||||||
>
|
>
|
||||||
<div class="accordion-body" id="statsBody">
|
<div class="accordion-body" id="statsBody"></div>
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -447,20 +444,18 @@ function quickfill() {
|
||||||
aria-labelledby="headingStatistics"
|
aria-labelledby="headingStatistics"
|
||||||
data-bs-parent="#accordionExample"
|
data-bs-parent="#accordionExample"
|
||||||
>
|
>
|
||||||
<div class="accordion-body" id="otherBod">
|
<div class="accordion-body" id="otherBod"></div>
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr />
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-outline-warning"
|
class="btn btn-sm btn-outline-warning"
|
||||||
type="button"
|
type="button"
|
||||||
@click="clearAllItems"
|
@click="clearAllItems"
|
||||||
>
|
>
|
||||||
Clear grid
|
Clear grid
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineProps } from 'vue';
|
import { defineProps } from "vue";
|
||||||
const props = defineProps(['btnText','btnID']);
|
const props = defineProps(["btnText", "btnID"]);
|
||||||
|
|
||||||
function emitClick() {
|
function emitClick() {
|
||||||
window.dispatchEvent(new CustomEvent("add-widget", { detail: props.btnID }));
|
window.dispatchEvent(new CustomEvent("add-widget", { detail: props.btnID }));
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<button class="btn btn-small btn-outline-secondary" v-on:click="emitClick">{{ btnText}}</button>
|
<button class="btn btn-small btn-outline-secondary" v-on:click="emitClick">
|
||||||
|
{{ btnText }}
|
||||||
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in a new issue