Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,28 @@ export default function BaseQueryParams({ formRef }) {
formRef.current.attention_correlation = Number(e.target.value)
}}
/>
<Box sx={{ gridColumn: "1 / -1" }}>
<Box sx={{ display: "flex", justifyContent: "space-between", mb: 0.5 }}>
<Typography sx={{ fontSize: 13, color: palette.textSecondary }}>
<Box sx={{ gridColumn: "1 / -1", maxWidth: "50%" }}>
<Box
sx={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
gap: 1,
mb: 0.5,
}}
>
<Typography sx={{ fontSize: 13, color: palette.textSecondary, minWidth: 0 }}>
Attention Focus Strictness
</Typography>
<Typography sx={{ fontSize: 13, fontWeight: 600, color: palette.textPrimary }}>
<Typography
sx={{
fontSize: 13,
fontWeight: 600,
color: palette.textPrimary,
flexShrink: 0,
fontVariantNumeric: "tabular-nums",
}}
>
{focusStrictness.toFixed(1)}
</Typography>
</Box>
Expand All @@ -71,13 +87,14 @@ export default function BaseQueryParams({ formRef }) {
min={0}
max={1}
step={0.1}
valueLabelDisplay="auto"
onChange={(_, value) => {
setFocusStrictness(value)
formRef.current.attention_focus_strictness = value
}}
sx={{
color: palette.accent,
"& .MuiSlider-rail": { opacity: 0.35 }
"& .MuiSlider-rail": { opacity: 0.35 },
}}
/>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,13 @@ export function ArchitectureActionControl({
return;
}

const serviceLabels = selectedServices
.map((id) => ALL_SERVICES.find((service) => service.id === id)?.label)
.filter(Boolean);

showConfirm({
title: "Start Architecture",
message: `Start ${selectedServices.length} selected service(s)?`,
message: `The following services will be started:\n\n${serviceLabels.map((label) => `• ${label}`).join("\n")}`,
Comment thread
levisingularity marked this conversation as resolved.
onConfirm: () =>
executeAsyncAction(
"start-architecture",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@ import { useDashboardContext } from "../../../global_providers/DashboardContextP
import { useToast } from "../../../global_providers/ToastProvider";
import { useDialog } from "../../../global_providers/DialogProvider";
import { startDatabases, stopDatabases } from "../../../../api/ServicesAPI";
import { getConfigDefaults } from "../../../../api/ConfigAPI";
import { extractErrorDetails } from "../../../../api/APIUtils";

const LOADING_KEYS = ["start-database", "stop-database"];

const ATOMDB_TYPE_LABELS = {
redismongodb: "Redis + MongoDB",
morkdb: "Mork + MongoDB",
inmemorydb: "In-Memory",
remotedb: "RemoteDB",
adapterdb: "AdapterDB",
};

export function AtomDBActionControl({
atomDbOnline,
isServerOffline,
Expand All @@ -20,7 +29,7 @@ export function AtomDBActionControl({
}) {
const [loadingAction, setLoadingAction] = useState(null);

const { currentMachine } = useDashboardContext();
const { currentMachine, machines } = useDashboardContext();
const { showToast } = useToast();
const { showConfirm } = useDialog();

Expand Down Expand Up @@ -50,11 +59,11 @@ export function AtomDBActionControl({
}
};

const handleDatabaseAction = () => {
const handleDatabaseAction = async () => {
if (atomDbOnline) {
showConfirm({
title: "Stop AtomDB",
message: "Are you sure you want to stop AtomDB?\n\nAll in-memory data may be lost.",
message: "Are you sure you want to stop the AtomDB?\n\nAll components will be stopped, so any data they may be carrying will be lost.",
onConfirm: () => executeAsyncAction(
"stop-database",
() => stopDatabases(currentHost),
Expand All @@ -65,9 +74,34 @@ export function AtomDBActionControl({
return;
}

let atomdbType;
try {
const defaults = await getConfigDefaults();
atomdbType = defaults?.content?.atomdb?.atomdb_type;
} catch (error) {
console.error("Failed to load AtomDB type for confirmation:", error);
}

const typeLabel = ATOMDB_TYPE_LABELS[atomdbType] ?? atomdbType ?? "AtomDB";
const endpoints = [
...new Set(
machines.flatMap((machine) =>
(machine.expectedServices ?? [])
.filter((service) => service.type === "atomdb" && service.host)
.map((service) =>
service.port ? `${service.host}:${service.port}` : service.host
)
)
),
].sort();
const serversList = endpoints.length ? endpoints.join(", ") : "configured servers";

showConfirm({
title: "Start AtomDB",
message: "Do you want to start AtomDB?",
message:
`An ${typeLabel} AtomDB will be started in the servers: ${serversList}. ` +
"Any AtomDB component running on these machines will be re-started " +
"so any data they may be carrying will be lost.",
onConfirm: () => executeAsyncAction(
"start-database",
() => startDatabases(currentHost),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,13 @@ export function SideBar() {
<SectionLabel>Actions</SectionLabel>

<List disablePadding>
<MettaLoadActionControl

<AtomDBActionControl
atomDbOnline={atomDbOnline}
isServerOffline={isServerOffline}
disabled={isAnyActionLoading && !busyActions.metta}
onBusyChange={(busy) => setActionBusy("metta", busy)}
disabled={isAnyActionLoading && !busyActions.atomdb}
onBusyChange={(busy) => setActionBusy("atomdb", busy)}
onActionComplete={loadInfraStatus}
Comment thread
levisingularity marked this conversation as resolved.
/>

<ArchitectureActionControl
Expand All @@ -119,13 +122,12 @@ export function SideBar() {
onActionComplete={loadInfraStatus}
/>

<AtomDBActionControl
atomDbOnline={atomDbOnline}
<MettaLoadActionControl
isServerOffline={isServerOffline}
disabled={isAnyActionLoading && !busyActions.atomdb}
onBusyChange={(busy) => setActionBusy("atomdb", busy)}
onActionComplete={loadInfraStatus}
disabled={isAnyActionLoading && !busyActions.metta}
onBusyChange={(busy) => setActionBusy("metta", busy)}
/>

</List>
</StyledList>
</SidebarListContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function DialogProvider({ children }) {
</DialogTitle>

<DialogContent>
<DialogContentText>
<DialogContentText sx={{ whiteSpace: "pre-line" }}>
{dialog.message}
</DialogContentText>
</DialogContent>
Expand Down
Loading