Initial commit
This commit is contained in:
commit
a22fe38f7d
36
src/widgets/lyrics/component.jsx
Normal file
36
src/widgets/lyrics/component.jsx
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import { useTranslation } from "next-i18next";
|
||||||
|
|
||||||
|
import Container from "components/services/widget/container";
|
||||||
|
import Block from "components/services/widget/block";
|
||||||
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||||
|
|
||||||
|
export default function Component({ service }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { widget } = service;
|
||||||
|
const { data, error } = useWidgetAPI(widget, "widget", {
|
||||||
|
refreshInterval: 5000,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return <Container service={service} error={error} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="Cache" />
|
||||||
|
<Block label="LRCLib" />
|
||||||
|
<Block label="Genius" />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="Cache" value={t("common.number", { value: data.cache })} />
|
||||||
|
<Block label="LRCLib" value={t("common.number", { value: data.lrclib })} />
|
||||||
|
<Block label="Genius" value={t("common.number", { value: data.genius })} />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
19
src/widgets/lyrics/widget.js
Normal file
19
src/widgets/lyrics/widget.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||||
|
|
||||||
|
const widget = {
|
||||||
|
api: "{url}/{endpoint}" ,
|
||||||
|
proxyHandler: genericProxyHandler ,
|
||||||
|
|
||||||
|
mappings: {
|
||||||
|
"widget": {
|
||||||
|
endpoint: "widget/lyrics/",
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Accept": "application/json",
|
||||||
|
"Accept-Content": "application/json",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default widget;
|
33
src/widgets/radio/component.jsx
Normal file
33
src/widgets/radio/component.jsx
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import { useTranslation } from "next-i18next";
|
||||||
|
|
||||||
|
import Container from "components/services/widget/container";
|
||||||
|
import Block from "components/services/widget/block";
|
||||||
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||||
|
|
||||||
|
export default function Component({ service }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { widget } = service;
|
||||||
|
const { data, error } = useWidgetAPI(widget, "widget", {
|
||||||
|
refreshInterval: 5000,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return <Container service={service} error={error} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="Now Playing" />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<img src={`https://codey.lol/images/radio_art.jpg?${Date.now()}`} height={85} width={85}></img>
|
||||||
|
<Block label="Now Playing" value={ data.now_playing } />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
19
src/widgets/radio/widget.js
Normal file
19
src/widgets/radio/widget.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||||
|
|
||||||
|
const widget = {
|
||||||
|
api: "{url}/{endpoint}" ,
|
||||||
|
proxyHandler: genericProxyHandler ,
|
||||||
|
|
||||||
|
mappings: {
|
||||||
|
"widget": {
|
||||||
|
endpoint: "widget/radio/",
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Accept": "application/json",
|
||||||
|
"Accept-Content": "application/json",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default widget;
|
38
src/widgets/redis/component.jsx
Normal file
38
src/widgets/redis/component.jsx
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import { useTranslation } from "next-i18next";
|
||||||
|
|
||||||
|
import Container from "components/services/widget/container";
|
||||||
|
import Block from "components/services/widget/block";
|
||||||
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||||
|
|
||||||
|
export default function Component({ service }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { widget } = service;
|
||||||
|
const { data, error } = useWidgetAPI(widget, "widget", {
|
||||||
|
refreshInterval: 5000,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return <Container service={service} error={error} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="Response Time" />
|
||||||
|
<Block label="Stored Keys" />
|
||||||
|
<Block label="Indexed Lyrics" />
|
||||||
|
<Block label="Stored Sessions" />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="Response Time" value={`${data.responseTime}s` } />
|
||||||
|
<Block label="Stored Keys" value={t("common.number", { value: data.storedKeys })} />
|
||||||
|
<Block label="Indexed Lyrics" value={t("common.number", { value: data.indexedLyrics })} />
|
||||||
|
<Block label="Stored Sessions" value={t("common.number", { value: data.sessions })} />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
19
src/widgets/redis/widget.js
Normal file
19
src/widgets/redis/widget.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||||
|
|
||||||
|
const widget = {
|
||||||
|
api: "{url}/{endpoint}" ,
|
||||||
|
proxyHandler: genericProxyHandler ,
|
||||||
|
|
||||||
|
mappings: {
|
||||||
|
"widget": {
|
||||||
|
endpoint: "widget/redis/",
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Accept": "application/json",
|
||||||
|
"Accept-Content": "application/json",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default widget;
|
36
src/widgets/sqlite/component.jsx
Normal file
36
src/widgets/sqlite/component.jsx
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import { useTranslation } from "next-i18next";
|
||||||
|
|
||||||
|
import Container from "components/services/widget/container";
|
||||||
|
import Block from "components/services/widget/block";
|
||||||
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||||
|
|
||||||
|
export default function Component({ service }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { widget } = service;
|
||||||
|
const { data, error } = useWidgetAPI(widget, "widget", {
|
||||||
|
refreshInterval: 5000,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return <Container service={service} error={error} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="Stored Tracks" />
|
||||||
|
<Block label="Distinct Artists" />
|
||||||
|
<Block label="Total Lyrics Length" />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="Stored Tracks" value={t("common.number", { value: data.storedRows })} />
|
||||||
|
<Block label="Distinct Artists" value={t("common.number", { value: data.distinctArtists })} />
|
||||||
|
<Block label="Total Lyrics Length" value={t("common.number", { value: data.lyricsLength })} />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
19
src/widgets/sqlite/widget.js
Normal file
19
src/widgets/sqlite/widget.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||||
|
|
||||||
|
const widget = {
|
||||||
|
api: "{url}/{endpoint}" ,
|
||||||
|
proxyHandler: genericProxyHandler ,
|
||||||
|
|
||||||
|
mappings: {
|
||||||
|
"widget": {
|
||||||
|
endpoint: "widget/sqlite/",
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Accept": "application/json",
|
||||||
|
"Accept-Content": "application/json",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default widget;
|
Loading…
x
Reference in New Issue
Block a user