mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-11-04 00:10:57 +00:00 
			
		
		
		
	
						commit
						d07b508990
					
				@ -14,6 +14,7 @@ const components = {
 | 
				
			|||||||
  docker: dynamic(() => import("./docker/component")),
 | 
					  docker: dynamic(() => import("./docker/component")),
 | 
				
			||||||
  kubernetes: dynamic(() => import("./kubernetes/component")),
 | 
					  kubernetes: dynamic(() => import("./kubernetes/component")),
 | 
				
			||||||
  emby: dynamic(() => import("./emby/component")),
 | 
					  emby: dynamic(() => import("./emby/component")),
 | 
				
			||||||
 | 
					  fileflows: dynamic(() => import("./fileflows/component")),
 | 
				
			||||||
  flood: dynamic(() => import("./flood/component")),
 | 
					  flood: dynamic(() => import("./flood/component")),
 | 
				
			||||||
  gluetun: dynamic(() => import("./gluetun/component")),
 | 
					  gluetun: dynamic(() => import("./gluetun/component")),
 | 
				
			||||||
  gotify: dynamic(() => import("./gotify/component")),
 | 
					  gotify: dynamic(() => import("./gotify/component")),
 | 
				
			||||||
@ -70,4 +71,4 @@ const components = {
 | 
				
			|||||||
  uptimekuma: dynamic(() => import("./uptimekuma/component")),
 | 
					  uptimekuma: dynamic(() => import("./uptimekuma/component")),
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default components;
 | 
					export default components;
 | 
				
			||||||
							
								
								
									
										37
									
								
								src/widgets/fileflows/component.jsx
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										37
									
								
								src/widgets/fileflows/component.jsx
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					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: fileflowsData, error: fileflowsError } = useWidgetAPI(widget, "status");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (fileflowsError) {
 | 
				
			||||||
 | 
					    return <Container error={fileflowsError} />;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!fileflowsData) {
 | 
				
			||||||
 | 
					    return (
 | 
				
			||||||
 | 
					      <Container service={service}>
 | 
				
			||||||
 | 
					        <Block label="fileflows.queue" />
 | 
				
			||||||
 | 
					        <Block label="fileflows.processing" />
 | 
				
			||||||
 | 
					        <Block label="fileflows.processed" />
 | 
				
			||||||
 | 
					        <Block label="fileflows.time" />
 | 
				
			||||||
 | 
					      </Container>
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
						  
 | 
				
			||||||
 | 
					  return (
 | 
				
			||||||
 | 
					    <Container service={service}>
 | 
				
			||||||
 | 
					      <Block label="queue" value={t("common.number", { value: fileflowsData.queue })} />
 | 
				
			||||||
 | 
					      <Block label="processing" value={t("common.number", { value: fileflowsData.processing })} />
 | 
				
			||||||
 | 
					      <Block label="processed" value={t("common.number", { value: fileflowsData.processed })} />
 | 
				
			||||||
 | 
					      <Block label="time" value={fileflowsData.time?.length ? fileflowsData.time : "0:00"} />
 | 
				
			||||||
 | 
					    </Container>
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										14
									
								
								src/widgets/fileflows/widget.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								src/widgets/fileflows/widget.js
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					import genericProxyHandler from "utils/proxy/handlers/generic";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const widget = {
 | 
				
			||||||
 | 
					  api: "{url}/api/{endpoint}",
 | 
				
			||||||
 | 
					  proxyHandler: genericProxyHandler,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  mappings: {
 | 
				
			||||||
 | 
					    "status": {
 | 
				
			||||||
 | 
					      endpoint: "status",
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default widget;
 | 
				
			||||||
@ -9,6 +9,7 @@ import deluge from "./deluge/widget";
 | 
				
			|||||||
import diskstation from "./diskstation/widget";
 | 
					import diskstation from "./diskstation/widget";
 | 
				
			||||||
import downloadstation from "./downloadstation/widget";
 | 
					import downloadstation from "./downloadstation/widget";
 | 
				
			||||||
import emby from "./emby/widget";
 | 
					import emby from "./emby/widget";
 | 
				
			||||||
 | 
					import fileflows from "./fileflows/widget";
 | 
				
			||||||
import flood from "./flood/widget";
 | 
					import flood from "./flood/widget";
 | 
				
			||||||
import gluetun from "./gluetun/widget";
 | 
					import gluetun from "./gluetun/widget";
 | 
				
			||||||
import gotify from "./gotify/widget";
 | 
					import gotify from "./gotify/widget";
 | 
				
			||||||
@ -75,6 +76,7 @@ const widgets = {
 | 
				
			|||||||
  diskstation,
 | 
					  diskstation,
 | 
				
			||||||
  downloadstation,
 | 
					  downloadstation,
 | 
				
			||||||
  emby,
 | 
					  emby,
 | 
				
			||||||
 | 
					  fileflows,
 | 
				
			||||||
  flood,
 | 
					  flood,
 | 
				
			||||||
  gluetun,
 | 
					  gluetun,
 | 
				
			||||||
  gotify,
 | 
					  gotify,
 | 
				
			||||||
@ -132,4 +134,4 @@ const widgets = {
 | 
				
			|||||||
  uptimekuma,
 | 
					  uptimekuma,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default widgets;
 | 
					export default widgets;
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user