A focused Docker Compose management web application.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: add jsdoc and rustdoc

Brooke 1a65e77f 651ef819

+12 -5
+3
packages/node/src/core/state.rs
··· 26 26 const COMPOSE_SERVICE_LABEL: &str = "com.docker.compose.service"; 27 27 28 28 impl LuminaryEngine { 29 + /// Retrieves a [LuminaryProject] by its name from the current state. 29 30 pub async fn get_project(&self, name: &String) -> Result<LuminaryProject> { 30 31 return Ok(self 31 32 .state ··· 37 38 .wrap_err("Failed to fetch project")?); 38 39 } 39 40 41 + /// Returns a stream of state updates, initialising the stream with the current state. 40 42 pub async fn state_subscribe<'a>(&'_ self) -> BoxStream<'a, LuminaryStateList> { 41 43 let mut reciever = self.state_channel.subscribe(); 42 44 let initial = self.state.read().await.clone(); ··· 57 59 .boxed(); 58 60 } 59 61 62 + /// Spawn a background task that listens to Docker events and updates the state accordingly. 60 63 pub(super) async fn spawn_state_worker(&self) { 61 64 let this = self.clone(); 62 65 let mut filters = HashMap::new();
+5 -1
packages/panel/src/lib/api/realtime.svelte.ts
··· 18 18 * A getter for the current project list. 19 19 * @returns A reactive store containing the current state list. 20 20 */ 21 - export const getList = () => list; 21 + export const getProjects = () => list; 22 22 23 + /** 24 + * Updates the project list with the given project. 25 + * @param project The project to insert into the list. 26 + */ 23 27 export const putProject = (project: LuminaryProject) => (list = { ...list, [project.name]: project }); 24 28 25 29 /**
+2 -2
packages/panel/src/routes/(authenticated)/projects/+page.svelte
··· 2 2 import StatusIcon, { type LuminaryStatus } from "$lib/component/StatusIcon.svelte"; 3 3 import { faMagnifyingGlass, faMinus, faPlus } from "@fortawesome/free-solid-svg-icons"; 4 4 import { Accordion } from "melt/builders"; 5 - import { getList } from "$lib/api"; 5 + import { getProjects } from "$lib/api"; 6 6 import { Debounced } from "runed"; 7 7 import Fa from "svelte-fa"; 8 8 ··· 16 16 let groups = $derived( 17 17 Object.entries( 18 18 Object.groupBy( 19 - Object.values(getList()) 19 + Object.values(getProjects()) 20 20 .filter((p) => p.name.includes(debounced.current)) 21 21 .toSorted((a, b) => a.name.localeCompare(b.name)), 22 22 (project) => project.status,
+2 -2
packages/panel/src/routes/(authenticated)/projects/[project]/+page.svelte
··· 4 4 import StatusIcon from "$lib/component/StatusIcon.svelte"; 5 5 import Tabs from "$lib/component/Tabs.svelte"; 6 6 import StatusTab from "./ProjectStatus.svelte"; 7 - import { getList } from "$lib/api"; 7 + import { getProjects } from "$lib/api"; 8 8 import { page } from "$app/state"; 9 9 import Fa from "svelte-fa"; 10 10 11 - let project = $derived(getList()[page.params.project!]); 11 + let project = $derived(getProjects()[page.params.project!]); 12 12 let { data } = $props(); 13 13 </script> 14 14