-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #789 from intuitem/748_folders_overview_viz
First part of the inspect mode
- Loading branch information
Showing
9 changed files
with
160 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<script lang="ts"> | ||
import { onMount } from 'svelte'; | ||
export let s_label = ''; | ||
export let width = 'w-auto'; | ||
export let height = 'h-full'; | ||
export let classesContainer = ''; | ||
export let title = ''; | ||
export let name = ''; | ||
interface treeType { | ||
name: string; | ||
children: treeType[]; | ||
} | ||
export let tree: treeType[]; | ||
const chart_id = `${name}_div`; | ||
onMount(async () => { | ||
const echarts = await import('echarts'); | ||
let chart_t = echarts.init(document.getElementById(chart_id), null, { renderer: 'svg' }); | ||
// specify chart configuration item and data | ||
var option = { | ||
tooltip: { | ||
trigger: 'item', | ||
triggerOn: 'mousemove' | ||
}, | ||
title: { text: title }, | ||
series: [ | ||
{ | ||
type: 'tree', | ||
data: [tree], | ||
symbol: 'emptyCircle', | ||
symbolSize: 10, | ||
label: { | ||
position: 'left', | ||
verticalAlign: 'middle', | ||
align: 'right', | ||
fontSize: 10 | ||
}, | ||
leaves: { | ||
label: { | ||
position: 'right', | ||
verticalAlign: 'middle', | ||
align: 'left' | ||
} | ||
}, | ||
emphasis: { | ||
focus: 'descendant' | ||
}, | ||
expandAndCollapse: true, | ||
animationDuration: 550, | ||
animationDurationUpdate: 750 | ||
} | ||
] | ||
}; | ||
// console.debug(option); | ||
// use configuration item and data specified to show chart | ||
chart_t.setOption(option); | ||
window.addEventListener('resize', function () { | ||
chart_t.resize(); | ||
}); | ||
}); | ||
</script> | ||
|
||
{#if tree.length === 0} | ||
<div class="flex flex-col justify-center items-center h-full"> | ||
<span class="text-center text-gray-600" | ||
>Not enough data yet. Refresh when more content is available.</span | ||
> | ||
</div> | ||
{:else} | ||
<div id={chart_id} class="{height} {width} {classesContainer}" /> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="card bg-white shadow-lg"> | ||
<slot /> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { BASE_API_URL } from '$lib/utils/constants'; | ||
|
||
import type { PageServerLoad } from './$types'; | ||
|
||
export const load = (async ({ fetch }) => { | ||
const endpoint = `${BASE_API_URL}/folders/org_tree/`; | ||
|
||
const res = await fetch(endpoint); | ||
const data = await res.json(); | ||
|
||
return { data }; | ||
}) satisfies PageServerLoad; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script lang="ts"> | ||
import type { PageData } from './$types'; | ||
export let data: PageData; | ||
import TreeChart from '$lib/components/Chart/TreeChart.svelte'; | ||
</script> | ||
|
||
<div class="bg-white p-6 shadow flex overflow-x-auto"> | ||
<div class="w-full h-96"> | ||
<TreeChart title="Organisation overview" tree={data.data} name="org_tree" /> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters