components have their own icons (?)
This commit is contained in:
parent
60baed5e22
commit
08f1b12143
2 changed files with 35 additions and 35 deletions
|
@ -35,16 +35,10 @@
|
||||||
import UpLink from "@/components/UpLink.vue";
|
import UpLink from "@/components/UpLink.vue";
|
||||||
import Compass from "@/components/widgets/Compass.vue";
|
import Compass from "@/components/widgets/Compass.vue";
|
||||||
import Table from "@/components/widgets/Table.vue";
|
import Table from "@/components/widgets/Table.vue";
|
||||||
import { UpType } from "@/lib/types";
|
import { UpType, Widget } from "@/lib/types";
|
||||||
import { AttributeChange, IEntry } from "@/types/base";
|
import { AttributeChange, IEntry } from "@/types/base";
|
||||||
import { ComponentOptions, defineComponent, PropType } from "vue";
|
import { ComponentOptions, defineComponent, PropType } from "vue";
|
||||||
|
|
||||||
interface Widget {
|
|
||||||
name: string;
|
|
||||||
icon?: string;
|
|
||||||
components: ComponentOptions[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "AttributeView",
|
name: "AttributeView",
|
||||||
components: {
|
components: {
|
||||||
|
@ -88,11 +82,7 @@ export default defineComponent({
|
||||||
const result = [] as Widget[];
|
const result = [] as Widget[];
|
||||||
|
|
||||||
if (this.type?.widgetInfo) {
|
if (this.type?.widgetInfo) {
|
||||||
result.push({
|
result.push(this.type.widgetInfo);
|
||||||
name: this.type.name || this.type.address,
|
|
||||||
icon: this.type.icon,
|
|
||||||
components: this.type.widgetInfo,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result.push({
|
result.push({
|
||||||
|
|
|
@ -13,19 +13,28 @@ export class UpType {
|
||||||
return this.name ? TYPE_ICONS[this.name] : undefined;
|
return this.name ? TYPE_ICONS[this.name] : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get widgetInfo(): ComponentOptions[] | undefined {
|
public get widgetInfo(): Widget | undefined {
|
||||||
return this.name ? TYPE_WIDGETS[this.name] : undefined;
|
return this.name ? TYPE_WIDGETS[this.name] : undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Widget {
|
||||||
|
name: string;
|
||||||
|
icon?: string;
|
||||||
|
components: ComponentOptions[];
|
||||||
|
}
|
||||||
|
|
||||||
const TYPE_ICONS: { [key: string]: string } = {
|
const TYPE_ICONS: { [key: string]: string } = {
|
||||||
"BLOB": "box",
|
"BLOB": "box",
|
||||||
"FS_FILE": "file-earmark",
|
"FS_FILE": "file-earmark",
|
||||||
"FS_DIR": "folder"
|
"FS_DIR": "folder"
|
||||||
}
|
}
|
||||||
|
|
||||||
const TYPE_WIDGETS: { [key: string]: ComponentOptions[] } = {
|
const TYPE_WIDGETS: { [key: string]: Widget } = {
|
||||||
"KSX_TRACK_MOODS": [
|
"KSX_TRACK_MOODS": {
|
||||||
|
name: "ksx-track-compass",
|
||||||
|
icon: "plus-square",
|
||||||
|
components: [
|
||||||
{
|
{
|
||||||
name: "Compass",
|
name: "Compass",
|
||||||
id: "compass_tint_energy",
|
id: "compass_tint_energy",
|
||||||
|
@ -47,4 +56,5 @@ const TYPE_WIDGETS: { [key: string]: ComponentOptions[] } = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue