8000 323 vue3 topology display by amarkensteijn · Pull Request #359 · Deltares/fews-web-oc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

323 vue3 topology display #359

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

Merged
merged 11 commits into from
Oct 25, 2023
Merged

323 vue3 topology display #359

merged 11 commits into from
Oct 25, 2023

Conversation

amarkensteijn
Copy link
Collaborator

No description provided.

@amarkensteijn amarkensteijn self-assigned this Oct 24, 2023
@amarkensteijn amarkensteijn added the next Vue3 migration label Oct 24, 2023
Copy link
Collaborator
@ceesvoesenek ceesvoesenek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Topology display looks good, also some nice other improvements.

Just some comments about small things

* @param {TopologyNode[] | undefined} nodes - An array of TopologyNode objects or undefined.
* @param {Map<string, TopologyNode>} topologyMap - A Map used to store the topology nodes.
*/
export function createTopologyMap(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make this a function that returns the Map? The recursion can then be achieved with an internal function, so the caller does not need to know about it.

*/
export function useTopologyNodes(
export function useDisplayConfig(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This directory should probably be renamed to useDisplayConfig

}

function loadTimes(): void {
let valueDates: Date[]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there's a few cases where [] is assigned to valueDates that can be removed if you just initialise valueDates to an empty array here?

capabilities.layers[0]
}
} catch (error) {
console.log(error)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need better error handling than this? I would suggest using at least console.error instead of console.log

)

const plotIds = computed(() => {
if (displays.value?.length) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of implicit boolean conversion of numbers... maybe displays.value && displays.value.length > 0?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to ignore this (but fix it if you like ;)), just noticed it's code that was moved around...

const plotIds = computed(() => {
if (displays.value?.length) {
const ids = displays.value.map((d) => {
return d.title
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Braces and return are not necessary, also you can return the result of the map directly instead of using an intermediate variable.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to ignore this (but fix it if you like ;)), just noticed it's code that was moved around...

createTopologyMap(nodes.value, topologyMap.value)
})

function anyChildNodeIsVisible(nodes: TopologyNode[] | undefined): boolean {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should checking for undefined not be the caller's responsibility?

const topologyMap = ref(new Map<string, TopologyNode>())
getTopologyNodes().then((response) => {
nodes.value = response
createTopologyMap(nodes.value, topologyMap.value)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we never need to update the topology?


function anyChildNodeIsVisible(nodes: TopologyNode[] | undefined): boolean {
if (nodes === undefined) return false
for (const node of nodes) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function can be simplified as return nodes.some(topologyNodeIsVisible)


watch(nodes, updateItems)

watchEffect(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if this had a comment with a brief description on what it is watching for and what it will update

@amarkensteijn amarkensteijn force-pushed the 323-vue3-topology-display branch from 7fdd5fe to 593fc4f Compare October 25, 2023 12:31
@amarkensteijn amarkensteijn merged commit ccdca63 into next Oct 25, 2023
@amarkensteijn amarkensteijn deleted the 323-vue3-topology-display branch October 25, 2023 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next Vue3 migration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0