-
Notifications
You must be signed in to change notification settings - Fork 8
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
refactor: replaced layout context to zustand layout store #38
Conversation
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.
It LGTM, I'll clone and run to test it out in a minute. Then I'll approve.
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.
There's probably a simple bug there to solve. All the other features works smoothly!
Btw, thanks for the contribution.
src/lib/menu-list.ts
Outdated
const keyspaces = useLayout((state) => state.keyspaces); | ||
const connections = useLayout((state) => state.connections); | ||
const setSelectedConnection = useLayout( | ||
(state) => state.setSelectedConnection, | ||
); | ||
const selectedConnection = useLayout((state) => state.selectedConnection); |
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.
Somehow this feature isn't working for me.
I took a look on the CQL Editor and how it's currently being used and I saw that maybe your implementation didn't fulfilled the feature needs.
At the Result Filters (result-filters.tsx
), you can fetch all the data and pass it to the Select Input
but the same isn't true for Connections Menu List.
const fetchConnectionsAction = useAction(fetchConnections, {
onSuccess: ({ data }) => {
setAvailableConnections(data ?? []);
setCurrentConnection(data?.[0] ?? null);
},
onError: ({ error }) => {
console.error("[ResultFilters.fetchConnectionsAction]", error);
},
});
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.
Looking forward to actively contribute. Actually I do not have clear idea about the web app or our scylla studio yet.
I'll try to figure out what's going wrong 👀
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.
@DanielHe4rt, continuing to the expected behaviour basically it should show list of all connection in menu select ?
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.
Just like that!
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.
can you confirm this feature is working after adding connection followed by page refresh?
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.
@Daniel-Boll could you please check it?
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.
I was in high demands. I will try to give it a look tomorrow guys.
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.
I'll give it a look now.
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.
Sorry by the delay on the feedback. So:
Now that you probably have a ScyllaDB Database running in your local environment, would be a good thing if you check-out and see the default behavior.
What we expect is that the connection selected triggers the Database SubMenus loading, not pop the update modal.
Hey, can we update the docs for local setup via docker ? And at unable to access connection.db is it related to my local setup ? |
After pruning my Docker images and following the steps in the README again, I managed to run it successfully. What issues are you encountering? |
Just trying this command to run scylla studio via docker docker run --name scylla --network ws-scylla -p "9042:9042" -d scylladb/scylla:6.1.2 \
--overprovisioned 1 \
--smp 1 localhost:3000 shows |
Oh, no. This docker command is to run a local ScyllaDB instance (which you also need). The Scylla Studio docker command itself may be found a little bellow in the README.
|
Sorry, I was pasting the later one the command that you have shared but ended up pasting the above one (by mistake). |
Also I am on windows, also tried it on wsl but getting same res localhost refused to connect |
Try changing the command to something like this:
Directly connection to scylla's db may help, but you will have to add a connection based on the IP of the ws-scylla docker network to the container of scylladb.
find the scylla container and get it's ip e.g. 172.19.0.2 then you call add a connection to the DB using something like: This is a solution I think may work, but it's pretty much a workaround the default way as I cannot understand why it's not working in your case. |
Update : I mapped port manually in the command itself and now it is working fine!
If i only talk about localhost:3000 manually mapping port in existing command is working fine! Thanks a lot |
@Daniel-Boll thanks, this look cool |
@void-hr Did you pushed the latest changes? |
No, I was waiting for confirmation if on hard refresh it is showing all connection in menu lists, so no need to push latest changes since it is of no use. Actually menu list should update without hard refresh when adding connection but I am not able to figure out how we can achieve that. Used useEffect also with dependencies like connections and all but it is not working as expected. I am not sure but maybe we have to update the state on adding connection in const handleSave = (data: z.infer<typeof formSchema>) => {
startTransition(async () => {
await onSave(data);
setOpen(false);
});
}; |
@void-hr push a wip so we can help you with that. Maybe @Matozinho or @Daniel-Boll could help you with that. |
Sure! |
Hey @void-hr. I tested the code here and I found some issues.
problems_demo.mp4 |
src/contexts/layout.tsx
Outdated
useEffect(() => { | ||
if (selectedConnection) { | ||
queryKeyspace.execute({ | ||
fetchInitialConnections: async () => { | ||
try { | ||
const initialConnections = await fetchConnections(); | ||
if ( | ||
JSON.stringify(get().connections) !== JSON.stringify(initialConnections) | ||
) { | ||
startTransition(() => { | ||
set({ connections: initialConnections }); | ||
}); | ||
} | ||
} catch (error) { | ||
console.error("Error fetching connections:", error); | ||
toast.error("Failed to fetch connections."); | ||
} | ||
}, | ||
|
||
queryKeyspace: async (selectedConnection) => { | ||
try { | ||
const queryKeyspace = await queryKeyspaceAction({ | ||
host: selectedConnection.host, | ||
port: selectedConnection.port, | ||
password: selectedConnection.password, | ||
username: selectedConnection.username, | ||
}); | ||
return queryKeyspace; | ||
} catch (error) { | ||
console.error(error); | ||
toast.error("Failed to query keyspaces."); | ||
get().setSelectedConnection(undefined); | ||
throw error; | ||
} | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [queryKeyspace.execute, selectedConnection]); |
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.
The problem of removing the useEffect
is that the keyspaces are not fetched anymore. Neither the initial connections (the useEffect
above this one)
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.
Sure will let you know!
Noted! Work is in progress, trying to debug. Also can you please confirm that adding console log statements are working or not. |
They are, but depending on the file they will appear on the terminal, not the browser. |
@Matozinho can you take a look again? |
We will take a look on that today after our working hours. Thanks again for keep the contributions! Btw, we added an Discord Channel recently. If you have any interest, feel free to join us: https://discord.gg/ShwwggRU |
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.
I just fully tested it and seems to work flawlessly! Thanks @void-hr for the contribution.
In order to merge, I'll need a code review from one of the FE devs to make sure that has nothing missing.
Code-wise is looking good, as @DanielHe4rt already tested it LGTM to be merged |
Thank you for your contribution @void-hr, I'm sorry for the time it took and the lack of support by my part which was the responsible for the issue. I'd like to extend my gratitude for the team @Matozinho @gvieira18 @DanielHe4rt @diegoreis42 for taking care of the issue and being able to help everyone, thanks guys. |
@Daniel-Boll it was a nice experience, main reason was different timezone i guess. I thankyou all of you (@Matozinho @gvieira18 @DanielHe4rt @diegoreis42 @Daniel-Boll ) to guide me through! |
This PR resolves issue #31
Let me know, if this will work or I'll ammend changes as mentioned