From 010477652983a18be4ec17a8fa5a7831c0737470 Mon Sep 17 00:00:00 2001 From: "Peter.Morton" Date: Mon, 10 Jul 2023 04:23:44 +0100 Subject: [PATCH] formatting --- src/views/InteractionsFlowView.vue | 35 +++++++++++++++++------------ src/views/SearchByReferenceView.vue | 6 ++--- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/views/InteractionsFlowView.vue b/src/views/InteractionsFlowView.vue index de76c8d..ee60790 100644 --- a/src/views/InteractionsFlowView.vue +++ b/src/views/InteractionsFlowView.vue @@ -6,16 +6,16 @@ import * as align from "d3-sankey"; import { sankey, sankeyLinkHorizontal } from "d3-sankey"; import { v4 as uuidv4 } from "uuid"; -const filterOptions = ['Channel', 'SubChannel', 'Queue', 'Outcome'] -const multiSelected = ref(filterOptions) +const filterOptions = ["Channel", "SubChannel", "Queue", "Outcome"]; +const multiSelected = ref(filterOptions); -const alignOptions = ['Left', 'Center', 'Right', 'Justify'] -const alignSelected = ref('Left') +const alignOptions = ["Left", "Center", "Right", "Justify"]; +const alignSelected = ref("Left"); const errorMessage = ref(null); onMounted(() => { - fetchData() + fetchData(); }); function fetchData() { @@ -23,7 +23,9 @@ function fetchData() { errorMessage.value = null; fetch( - `${import.meta.env.VITE_EO_SERVICES_URL}/api/interactions-flow?filter=${multiSelected.value}`, + `${import.meta.env.VITE_EO_SERVICES_URL}/api/interactions-flow?filter=${ + multiSelected.value + }`, { credentials: "include", // fetch won't send cookies unless you set credentials } @@ -46,7 +48,6 @@ function fetchData() { } function generateSankey(data) { - // filter data // const filteredData @@ -63,7 +64,7 @@ function generateSankey(data) { // ["target", "target"] // clear the old svg - d3.select("#chart").select("svg").remove() + d3.select("#chart").select("svg").remove(); // Create a SVG container. const svg = d3 @@ -77,7 +78,13 @@ function generateSankey(data) { // Constructs and configures a Sankey generator. const sankeyGen = sankey() .nodeId((d) => d.name) - .nodeAlign(align[`sankey${alignSelected.value[0].toUpperCase()}${alignSelected.value.slice(1)}`]) // d3.sankeyLeft, etc. + .nodeAlign( + align[ + `sankey${alignSelected.value[0].toUpperCase()}${alignSelected.value.slice( + 1 + )}` + ] + ) // d3.sankeyLeft, etc. .nodeWidth(15) .nodePadding(10) .extent([ @@ -147,10 +154,10 @@ function generateSankey(data) { linkColor === "source-target" ? (d) => `url(#${d.uid})` : linkColor === "source" - ? (d) => color(d.source.category) - : linkColor === "target" - ? (d) => color(d.target.category) - : linkColor + ? (d) => color(d.source.category) + : linkColor === "target" + ? (d) => color(d.target.category) + : linkColor ) .attr("stroke-width", (d) => Math.max(1, d.width)); @@ -178,7 +185,7 @@ function generateSankey(data) { - diff --git a/src/views/SearchByReferenceView.vue b/src/views/SearchByReferenceView.vue index 7547459..04a5504 100644 --- a/src/views/SearchByReferenceView.vue +++ b/src/views/SearchByReferenceView.vue @@ -18,9 +18,9 @@ function fetchData() { errorMessage.value = null; contactData.value = null; fetch( - `${import.meta.env.VITE_EO_SERVICES_URL}/api/unified-data-gateway?referenceId=${ - referenceId.value - }`, + `${ + import.meta.env.VITE_EO_SERVICES_URL + }/api/unified-data-gateway?referenceId=${referenceId.value}`, { credentials: "include", // fetch won't send cookies unless you set credentials }