website-builder-backend / frontend /hooks /useKubernetes.js
David Prince
fix: add all missing local module stubs (remote_mcp_registry, mcp_auth, mcp_transport, etc)
cce8120
Raw
History Blame Contribute Delete
765 Bytes
"use client";
import {useState} from "react";
import * as kube from "../services/kubernetes/client";
export default function useKubernetes(){
const [loading,setLoading]=useState(false);
async function execute(fn,...args){
setLoading(true);
try{
return await fn(...args);
}finally{
setLoading(false);
}
}
return{
loading,
clusters:(...a)=>execute(kube.clusters,...a),
namespaces:(...a)=>execute(kube.namespaces,...a),
pods:(...a)=>execute(kube.pods,...a),
deployments:(...a)=>execute(kube.deployments,...a),
services:(...a)=>execute(kube.services,...a),
logs:(...a)=>execute(kube.logs,...a),
scale:(...a)=>execute(kube.scale,...a),
rollout:(...a)=>execute(kube.rollout,...a),
deletePod:(...a)=>execute(kube.deletePod,...a)
};
}