mirror of
https://github.com/Qortal/qapp-core.git
synced 2026-04-30 03:49:22 +00:00
24 lines
720 B
TypeScript
24 lines
720 B
TypeScript
import { usePublishStore } from '../state/publishes';
|
|
import { Service } from '../types/interfaces/resources';
|
|
|
|
export const useAllResourceStatus = () =>
|
|
usePublishStore((state) =>
|
|
Object.entries(state.resourceStatus)
|
|
.filter(([_, status]) => status !== null)
|
|
.map(([id, status]) => {
|
|
const parts = id.split('-');
|
|
const service = parts[0] as Service;
|
|
const name = parts[1] || '';
|
|
const identifier = parts.length > 2 ? parts.slice(2).join('-') : '';
|
|
const { path, filename, ...rest } = status!;
|
|
|
|
return {
|
|
id,
|
|
metadata: { service, name, identifier },
|
|
status: rest,
|
|
path,
|
|
filename,
|
|
};
|
|
})
|
|
);
|