Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mariuxdeangelo <[email protected]>
  • Loading branch information
Mariuxdeangelo committed Sep 9, 2024
1 parent 6b3d380 commit 553b396
Show file tree
Hide file tree
Showing 36 changed files with 125 additions and 59 deletions.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/a-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/b-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/c-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/d-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/e-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/f-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/g-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/h-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/i-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/j-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/k-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/l-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/m-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/n-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/o-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/p-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/q-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/r-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions SBOM-Catalog/public/logos/s-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/t-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/u-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/v-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/w-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/x-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/y-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SBOM-Catalog/public/logos/z-solid.svg
61 changes: 34 additions & 27 deletions SBOM-Catalog/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
<script lang="ts" setup>
import {onBeforeMount, reactive, Ref, ref, watch} from "vue";
import {onBeforeMount, onMounted, reactive, Ref, ref, watch} from "vue";

Check warning on line 2 in SBOM-Catalog/src/App.vue

View workflow job for this annotation

GitHub Actions / build-catalog

'onMounted' is defined but never used
import axios from "axios";
import { load } from "js-yaml";
import {load} from "js-yaml";
import draggable from 'vuedraggable'
import {aggregateList, deepClone, generateTreeObject, normaliseList} from "./global/global.ts";
import TreePlot from "./components/plots/tree-plot.vue";
import ListPlot from "./components/plots/list-plot.vue";
import MarkdownParser from "./components/markdownParser.vue";
import CirclePlot from "./components/plots/circle-plot.vue";
import DetailEnumeration from "./components/detail-enumeration.vue";
import type { Tool } from "./types/tool";
import type { Filter } from "./types/filter";
import type {Tool} from "./types/tool";
import type {Filter} from "./types/filter";
import {AggregationModes, ViewMode} from "./types/view.d.ts";
import {useRoute, useRouter} from "vue-router";
enum AggregationModes {
Normalize,
Aggregate
}
enum ViewMode {
Circle,
Tree,
List
}
const route = useRoute();
const router = useRouter();
const activeViewMode: Ref<ViewMode> = ref(ViewMode.Circle)
const activeViewMode: Ref<ViewMode> = ref(ViewMode.Circle);
const activeAggregationMode: Ref<AggregationModes> = ref(AggregationModes.Normalize)
const rawdata: Ref<Tool[]> = ref([])
Expand All @@ -32,8 +26,6 @@ const filters = reactive<Filter[]>([]);
const formattedData: Ref<Tool[]> = ref([])
const filteredTreeData = ref()
const selectedItem: Ref<string> = ref('HowTo')
onBeforeMount(() => {
axios.get('filters.yaml').then(x => {
let filterList: Filter[] = load(x.data) as Filter[]
Expand All @@ -45,12 +37,12 @@ onBeforeMount(() => {
})
function onViewChange(view: ViewMode) {
activeViewMode.value = view
router.push({params: {view: view}})
}
function onAggregationModeChange(mode: AggregationModes) {
activeAggregationMode.value = mode
recalculateAllData(filters, rawdata.value)
router.push({params: {aggregation: mode}})
}
const updateFilters = (event: any) => {
Expand All @@ -67,6 +59,21 @@ function recalculateAllData(currentFilters: Filter[], currentRawData: Tool[]) {
filteredTreeData.value = generateTreeObject(currentFilters, formattedData.value)
}
watch(() => route.params.view, (newView) => {
if (newView) {
activeViewMode.value = ViewMode[newView as keyof typeof ViewMode];
recalculateAllData(filters, rawdata.value)
}
});
watch(() => route.params.aggregation, (newAggregation) => {
if (newAggregation) {
activeAggregationMode.value = AggregationModes[newAggregation as keyof typeof AggregationModes];
recalculateAllData(filters, rawdata.value)
}
});
watch(rawdata, (newRawData) => {
recalculateAllData(filters, newRawData)
})
Expand Down Expand Up @@ -126,24 +133,24 @@ watch(filters, (newFilters) => {
</div>
<div id="workbench" class="flex-grow-1 flex col full-vue-heigth">
<div v-if="filteredTreeData" class="flex-grow-1 flex col full-vue-heigth">
<circle-plot v-if="activeViewMode === ViewMode.Circle" v-model:selected-item="selectedItem" :dataList="filteredTreeData"/>
<tree-plot v-else-if="activeViewMode === ViewMode.Tree" v-model:selected-item="selectedItem" :dataList="filteredTreeData"/>
<list-plot v-else-if="activeViewMode === ViewMode.List" v-model:selected-item="selectedItem" :dataList="rawdata" :filterList="filters"/>
<circle-plot v-if="activeViewMode === ViewMode.Circle" :dataList="filteredTreeData"/>

Check warning on line 136 in SBOM-Catalog/src/App.vue

View workflow job for this annotation

GitHub Actions / build-catalog

Attribute ':dataList' must be hyphenated
<tree-plot v-else-if="activeViewMode === ViewMode.Tree" :dataList="filteredTreeData"/>

Check warning on line 137 in SBOM-Catalog/src/App.vue

View workflow job for this annotation

GitHub Actions / build-catalog

Attribute ':dataList' must be hyphenated
<list-plot v-else-if="activeViewMode === ViewMode.List" :dataList="rawdata" :filterList="filters"/>

Check warning on line 138 in SBOM-Catalog/src/App.vue

View workflow job for this annotation

GitHub Actions / build-catalog

Attribute ':dataList' must be hyphenated

Check warning on line 138 in SBOM-Catalog/src/App.vue

View workflow job for this annotation

GitHub Actions / build-catalog

Attribute ':filterList' must be hyphenated
</div>
</div>

<div class="flex flex-column surface-50 col-2 full-vue-heigth shadow-left">
<div class="flex justify-content-between align-items-center m-2">
<h2 class="m-0">{{ selectedItem }}</h2>
<h2 class="m-0">{{ $route.params.selection }}</h2>
<img
:src="'logos/' + selectedItem + '.png'" style="display: none"
:src="'logos/' + $route.params.selection + '.png'" style="display: none"
alt=""
class="responsive-image p-1 block"/>
</div>
<PDivider class="mt-2"/>
<div class="scrollable-div">
<detail-enumeration :selected="selectedItem" :rawdata="rawdata"/>
<markdown-parser :selected="selectedItem"/>
<detail-enumeration :rawdata="rawdata"/>
<markdown-parser/>
</div>
</div>
</div>
Expand Down
8 changes: 6 additions & 2 deletions SBOM-Catalog/src/components/detail-enumeration.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<script lang="ts" setup>
import {ref, watch} from "vue";
import {useRoute} from "vue-router";
const props = defineProps(['selected', 'rawdata'])
const props = defineProps(['rawdata'])

Check warning on line 5 in SBOM-Catalog/src/components/detail-enumeration.vue

View workflow job for this annotation

GitHub Actions / build-catalog

Prop "rawdata" should define at least its type
const route = useRoute();
const selectedObject = ref(null)
watch(() => props.selected, (newVal) => {
watch(() => route.params.selection, (newVal) => {
selectedObject.value = null
selectedObject.value = props.rawdata.find(x => x.Name === newVal)
})
Expand Down Expand Up @@ -46,5 +49,6 @@ watch(() => props.selected, (newVal) => {
.flex-container {
display: flex;
flex-wrap: wrap;
color: #478566;
}
</style>
9 changes: 3 additions & 6 deletions SBOM-Catalog/src/components/markdownParser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ import axios from 'axios';
import {Marked} from "marked";
import {markedHighlight} from "marked-highlight";
import hljs from 'highlight.js';
import {useRoute} from "vue-router";
const props = defineProps(['selected'])
const route = useRoute();
const mdres = ref()
onMounted(() => {
loadMarkdown(props.selected)
})
watch(() => props.selected, (newSelected) => {
watch(() => route.params.selection, (newSelected) => {
loadMarkdown(newSelected)
})
Expand Down
Loading

0 comments on commit 553b396

Please sign in to comment.