-
Notifications
You must be signed in to change notification settings - Fork 1
Optional datastore toggle #323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4d9ea94
ddbbdac
8a9c93f
f627b43
d43f7d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,8 +40,8 @@ const props = defineProps({ | |
| type: Boolean, | ||
| required: true, | ||
| }, | ||
| nodeType: { | ||
| type: String, | ||
| requireDatastore: { | ||
| type: Boolean, | ||
| required: true, | ||
| }, | ||
|
Comment on lines
+43
to
46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: rg -n --type=vue "<AnalysisControlButtons" -C3Repository: PrivateAIM/node-ui Length of output: 89 🏁 Script executed: fd -e vue -x grep -l "AnalysisControlButtons" {} + | head -20Repository: PrivateAIM/node-ui Length of output: 1413 🏁 Script executed: rg -n "AnalysisControlButtons" --type-list | head -5Repository: PrivateAIM/node-ui Length of output: 451 🏁 Script executed: rg -n "AnalysisControlButtons" -C3 --no-heading | head -100Repository: PrivateAIM/node-ui Length of output: 5034 🏁 Script executed: sed -n '735,755p' components/analysis/AnalysesTable.vueRepository: PrivateAIM/node-ui Length of output: 964 🏁 Script executed: grep -n "requireDatastore" components/analysis/AnalysesTable.vueRepository: PrivateAIM/node-ui Length of output: 122 🏁 Script executed: grep -n "requireDatastore" test/components/analysis/AnalysisControlButtons.spec.ts | head -20Repository: PrivateAIM/node-ui Length of output: 44 🏁 Script executed: sed -n '53,64p' test/components/analysis/AnalysisControlButtons.spec.tsRepository: PrivateAIM/node-ui Length of output: 514 🏁 Script executed: sed -n '277,288p' test/components/analysis/AnalysisControlButtons.spec.tsRepository: PrivateAIM/node-ui Length of output: 506 Update test mount calls to include the required The production usage in 🤖 Prompt for AI Agents |
||
| }); | ||
|
|
@@ -274,7 +274,7 @@ async function onDeleteAnalysis() { | |
| :disabled=" | ||
| !buttonStatuses.playActive || | ||
| !(props.analysisBuildStatus === AnalysisBuildStatus.Finished) || | ||
| (!props.datastore && props.nodeType != 'aggregator') | ||
| (!props.datastore && props.requireDatastore) | ||
| " | ||
| :loading="loading" | ||
| aria-label="Start" | ||
|
|
@@ -289,7 +289,7 @@ async function onDeleteAnalysis() { | |
| :disabled=" | ||
| !buttonStatuses.rerunActive || | ||
| !(props.analysisBuildStatus === AnalysisBuildStatus.Finished) || | ||
| (!props.datastore && props.nodeType != 'aggregator') | ||
| (!props.datastore && props.requireDatastore) | ||
| " | ||
| :loading="loading" | ||
| aria-label="Rerun" | ||
|
|
@@ -303,7 +303,7 @@ async function onDeleteAnalysis() { | |
| :disabled=" | ||
| !buttonStatuses.stopActive || | ||
| !(props.analysisBuildStatus === AnalysisBuildStatus.Finished) || | ||
| (!props.datastore && props.nodeType != 'aggregator') | ||
| (!props.datastore && props.requireDatastore) | ||
| " | ||
| :loading="loading" | ||
| aria-label="Stop" | ||
|
|
@@ -317,7 +317,7 @@ async function onDeleteAnalysis() { | |
| :disabled=" | ||
| !buttonStatuses.deleteActive || | ||
| !(props.analysisBuildStatus === AnalysisBuildStatus.Finished) || | ||
| (!props.datastore && props.nodeType != 'aggregator') | ||
| (!props.datastore && props.requireDatastore) | ||
| " | ||
| :loading="loading" | ||
| aria-label="Delete" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ import type { | |
| ListConsumers, | ||
| ListRoutes, | ||
| ListServices, | ||
| NodeSettings, | ||
| Project, | ||
| ProjectNode, | ||
| Service, | ||
|
|
@@ -32,6 +33,14 @@ export function getEvents(opts?) { | |
| }); | ||
| } | ||
|
|
||
| // Node endpoints | ||
| export function getNodeConfiguration(opts?) { | ||
| return useAPIFetch<NodeSettings>("/node/settings", { | ||
| ...opts, | ||
| method: "GET", | ||
| }); | ||
| } | ||
|
Comment on lines
+36
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: rg -n 'getNodeConfiguration' --type=ts --type=vueRepository: PrivateAIM/node-ui Length of output: 89 🏁 Script executed: rg -n 'getNodeConfiguration' --type tsRepository: PrivateAIM/node-ui Length of output: 137 🏁 Script executed: rg -n 'useDatastoreRequirement' --type ts | head -20Repository: PrivateAIM/node-ui Length of output: 1005 🏁 Script executed: cat composables/useDatastoreRequirement.tsRepository: PrivateAIM/node-ui Length of output: 1724 Remove
🤖 Prompt for AI Agents |
||
|
|
||
| // Hub endpoints | ||
| export function getProjectNodes(opts?) { | ||
| return useAPIFetch<ProjectNode[]>("/project-nodes", { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,58 @@ | ||||||||||||||||||||||||||||||||||
| import { type NodeTypeResponse } from "~/services/Api"; | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing
🐛 Proposed fix-import { type NodeTypeResponse } from "~/services/Api";
+import { type NodeSettings, type NodeTypeResponse } from "~/services/Api";📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| import { useNuxtApp, useState } from "#app"; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| interface DatastoreState { | ||||||||||||||||||||||||||||||||||
| datastoreRequired: boolean | null; | ||||||||||||||||||||||||||||||||||
| nodeType: string | null; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| export async function useDatastoreRequirement() { | ||||||||||||||||||||||||||||||||||
| const datastoreState = useState<DatastoreState>("datastoreRequired", () => ({ | ||||||||||||||||||||||||||||||||||
| datastoreRequired: null, | ||||||||||||||||||||||||||||||||||
| nodeType: null, | ||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| let dataRequired: boolean = true; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Get node configuration settings | ||||||||||||||||||||||||||||||||||
| if (!datastoreState.value.datastoreRequired) { | ||||||||||||||||||||||||||||||||||
| const nodeConfigResp = (await useNuxtApp() | ||||||||||||||||||||||||||||||||||
| .$hubApi("/node/settings", { method: "GET" }) | ||||||||||||||||||||||||||||||||||
| .catch(() => null)) as NodeSettings; | ||||||||||||||||||||||||||||||||||
| if (nodeConfigResp) { | ||||||||||||||||||||||||||||||||||
| dataRequired = Boolean(nodeConfigResp.data_required); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+18
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Falsy check causes re-fetching when
The same issue exists on line 27 with 🐛 Proposed fix — use strict null checks- if (!datastoreState.value.datastoreRequired) {
+ if (datastoreState.value.datastoreRequired === null) {- if (!datastoreState.value.nodeType) {
+ if (datastoreState.value.nodeType === null) {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (!datastoreState.value.nodeType) { | ||||||||||||||||||||||||||||||||||
| // Re-fetch if node type couldn't be obtained previously | ||||||||||||||||||||||||||||||||||
| const nodeResp = (await useNuxtApp() | ||||||||||||||||||||||||||||||||||
| .$hubApi("/node-type", { method: "GET" }) | ||||||||||||||||||||||||||||||||||
| .catch(() => null)) as NodeTypeResponse; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (nodeResp) { | ||||||||||||||||||||||||||||||||||
| datastoreState.value = { | ||||||||||||||||||||||||||||||||||
| nodeType: nodeResp.type, | ||||||||||||||||||||||||||||||||||
| datastoreRequired: nodeResp.type !== "aggregator" && dataRequired, | ||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| async function setDatastoreRequired(updatedRequirement: boolean) { | ||||||||||||||||||||||||||||||||||
| const nodeConfigResp = (await useNuxtApp() | ||||||||||||||||||||||||||||||||||
| .$hubApi("/node/settings", { | ||||||||||||||||||||||||||||||||||
| method: "POST", | ||||||||||||||||||||||||||||||||||
| body: { data_required: updatedRequirement }, | ||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||
| .catch(() => null)) as NodeSettings; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (nodeConfigResp) { | ||||||||||||||||||||||||||||||||||
| datastoreState.value = { | ||||||||||||||||||||||||||||||||||
| ...datastoreState.value, | ||||||||||||||||||||||||||||||||||
| datastoreRequired: nodeConfigResp.data_required, | ||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+41
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The initial fetch on line 36 applies 🐛 Proposed fix if (nodeConfigResp) {
datastoreState.value = {
...datastoreState.value,
- datastoreRequired: nodeConfigResp.data_required,
+ datastoreRequired:
+ datastoreState.value.nodeType !== "aggregator" &&
+ Boolean(nodeConfigResp.data_required),
};
}🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| return { datastoreState, setDatastoreRequired }; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle unknown
datastoreRequiredexplicitly.If
useDatastoreRequirementyieldsnull(e.g., failed fetch), the current logic treats it asfalse, enabling controls and showing the “not required” tooltip. Consider defaulting to a safe value or surfacing an “unknown” state, and remove the non-null assertion when passing the prop.🛡️ Safer fallback example
Also applies to: 659-664, 745-746
🤖 Prompt for AI Agents