Browse Source

[192-webreport] Added models of Overview and Comparison, with factories to create them

Evgeni 4 years ago
parent
commit
18edb7dbed

+ 1 - 2
report-viewer/src/components/CodePanel.vue

@@ -22,9 +22,8 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import {ref, defineComponent, watchEffect} from "vue";
+import {ref, defineComponent} from "vue";
 import LineOfCode from "./LineOfCode";
 import LineOfCode from "./LineOfCode";
-import {generateLineCodeLink} from "@/utils/Utils";
 
 
 export default defineComponent({
 export default defineComponent({
   name: "CodePanel",
   name: "CodePanel",

+ 10 - 9
report-viewer/src/components/ComparisonsTable.vue

@@ -8,16 +8,16 @@
     <th>Match %</th>
     <th>Match %</th>
   </tr>
   </tr>
   <tr v-for="(comparison, index) in topComparisons"
   <tr v-for="(comparison, index) in topComparisons"
-      :key="comparison.first_submission
-            + comparison.second_submission
-            + comparison.match_percentage"
-      :class="{'even-row' : index % 2 === 0, 'odd-row' : index % 2 !== 0}"
-      @click="navigateToComparisonView(comparison.first_submission, comparison.second_submission)">
+      :key="comparison.firstSubmissionId
+            + comparison.secondSubmissionId
+            + comparison.matchPercentage"
+      :class="{ 'even-row' : index % 2 === 0, 'odd-row' : index % 2 !== 0 }"
+      @click="navigateToComparisonView(comparison.firstSubmissionId, comparison.secondSubmissionId)">
     <td>{{ index + 1 }}.</td>
     <td>{{ index + 1 }}.</td>
-    <td>{{ comparison.first_submission }}</td>
+    <td>{{ comparison.firstSubmissionId }}</td>
     <td><img src="@/assets/double_arrow_black_18dp.svg" alt=">>"/></td>
     <td><img src="@/assets/double_arrow_black_18dp.svg" alt=">>"/></td>
-    <td>{{ comparison.second_submission }}</td>
-    <td>{{ formattedMatchPercentage(comparison.match_percentage) }}</td>
+    <td>{{ comparison.secondSubmissionId }}</td>
+    <td>{{ formattedMatchPercentage(comparison.matchPercentage) }}</td>
   </tr>
   </tr>
 </table>
 </table>
 </template>
 </template>
@@ -30,7 +30,8 @@ export default defineComponent({
   name: "ComparisonsTable",
   name: "ComparisonsTable",
   props: {
   props: {
    topComparisons : {
    topComparisons : {
-      required: true
+     type: Array,
+     required: true
    }
    }
   },
   },
   setup() {
   setup() {

+ 2 - 4
report-viewer/src/components/LineOfCode.vue

@@ -34,10 +34,8 @@ export default defineComponent({
       type: Boolean,
       type: Boolean,
     }
     }
   },
   },
-  setup(props) {
-    console.log(props.color)
-    return {
-    }
+  setup() {
+    return {}
   }
   }
 })
 })
 </script>
 </script>

+ 7 - 6
report-viewer/src/components/MatchTable.vue

@@ -10,19 +10,19 @@
       <th>File 2</th>
       <th>File 2</th>
       <th>Tokens</th>
       <th>Tokens</th>
     </tr>
     </tr>
-    <tr v-for="( match, index ) in matches" :key="String(index).concat(match.start_in_first).concat(match.start_in_second)"
+    <tr v-for="( match, index ) in matches" :key="String(index).concat(match.startInFirst).concat(match.startInSecond)"
         @click="$emit('matchSelected', $event, match)"
         @click="$emit('matchSelected', $event, match)"
         :style="{ background : match.color }">
         :style="{ background : match.color }">
       <td>
       <td>
         <div class="td-content">
         <div class="td-content">
-          <p>{{ match.first_file_name }}</p>
-          <p>({{ match.start_in_first }} - {{ match.end_in_first }})</p>
+          <p>{{ match.firstFile }}</p>
+          <p>({{ match.startInFirst }} - {{ match.endInFirst }})</p>
         </div>
         </div>
       </td>
       </td>
       <td>
       <td>
         <div class="td-content">
         <div class="td-content">
-          <p>{{ match.second_file_name }}</p>
-          <p>({{ match.start_in_second }} - {{ match.start_in_second }})</p>
+          <p>{{ match.secondFile }}</p>
+          <p>({{ match.startInSecond }} - {{ match.endInSecond }})</p>
         </div>
         </div>
       </td>
       </td>
       <td>TODO</td>
       <td>TODO</td>
@@ -47,7 +47,8 @@ export default defineComponent({
       type: String
       type: String
     }
     }
   },
   },
-  setup() {
+  setup(props) {
+    console.log(props.matches)
     return {}
     return {}
   }
   }
 })
 })

+ 89 - 0
report-viewer/src/model/Comparison.ts

@@ -0,0 +1,89 @@
+import {Match} from "./Match";
+import {SubmissionFile} from "./SubmissionFile"
+import {MatchInSingleFile} from "./MatchInSingleFile";
+
+export class Comparison {
+    private readonly _firstSubmissionId: string
+    private readonly _secondSubmissionId: string
+    private readonly _match_percentage: number
+    private _filesOfFirstSubmission: Record<string, SubmissionFile>
+    private _filesOfSecondSubmission: Record<string, SubmissionFile>
+    private _colors: Array<string>
+    private _allMatches: Array<Match>
+    private _matchesInFirstSubmission: Record<string, Array<MatchInSingleFile>>
+    private _matchesInSecondSubmissions: Record<string, Array<MatchInSingleFile>>
+
+
+    constructor(firstSubmissionId: string, secondSubmissionId: string, match_percentage: number) {
+        this._firstSubmissionId = firstSubmissionId;
+        this._secondSubmissionId = secondSubmissionId;
+        this._match_percentage = match_percentage;
+        this._filesOfFirstSubmission = {}
+        this._filesOfSecondSubmission = {}
+        this._colors = []
+        this._allMatches = []
+        this._matchesInFirstSubmission = {}
+        this._matchesInSecondSubmissions = {}
+    }
+
+
+    get firstSubmissionId(): string {
+        return this._firstSubmissionId;
+    }
+
+    get secondSubmissionId(): string {
+        return this._secondSubmissionId;
+    }
+
+    get match_percentage(): number {
+        return this._match_percentage;
+    }
+
+    get filesOfFirstSubmission(): Record<string, SubmissionFile> {
+        return this._filesOfFirstSubmission;
+    }
+
+    set filesOfFirstSubmission(value: Record<string, SubmissionFile>) {
+        this._filesOfFirstSubmission = value;
+    }
+
+    get filesOfSecondSubmission(): Record<string, SubmissionFile> {
+        return this._filesOfSecondSubmission;
+    }
+
+    set filesOfSecondSubmission(value: Record<string, SubmissionFile>) {
+        this._filesOfSecondSubmission = value;
+    }
+
+    get colors(): Array<string> {
+        return this._colors;
+    }
+
+    set colors(value: Array<string>) {
+        this._colors = value;
+    }
+
+    get allMatches(): Array<Match> {
+        return this._allMatches;
+    }
+
+    set allMatches(value: Array<Match>) {
+        this._allMatches = value;
+    }
+
+    get matchesInFirstSubmission(): Record<string, Array<MatchInSingleFile>> {
+        return this._matchesInFirstSubmission;
+    }
+
+    set matchesInFirstSubmission(value: Record<string, Array<MatchInSingleFile>>) {
+        this._matchesInFirstSubmission = value;
+    }
+
+    get matchesInSecondSubmissions(): Record<string, Array<MatchInSingleFile>> {
+        return this._matchesInSecondSubmissions;
+    }
+
+    set matchesInSecondSubmissions(value: Record<string, Array<MatchInSingleFile>>) {
+        this._matchesInSecondSubmissions = value;
+    }
+}

+ 5 - 0
report-viewer/src/model/ComparisonListElement.ts

@@ -0,0 +1,5 @@
+export type ComparisonListElement = {
+    firstSubmissionId: string,
+    secondSubmissionId: string,
+    matchPercentage: number
+}

+ 9 - 0
report-viewer/src/model/Match.ts

@@ -0,0 +1,9 @@
+export type Match = {
+    firstFile: string,
+    secondFile: string,
+    startInFirst: number,
+    endInFirst: number,
+    startInSecond: number,
+    endInSecond: number,
+    color: string
+}

+ 8 - 0
report-viewer/src/model/MatchInSingleFile.ts

@@ -0,0 +1,8 @@
+export type MatchInSingleFile = {
+    start: number,
+    end: number,
+    linked_panel: number,
+    linked_file: string,
+    linked_line: number,
+    color: string
+}

+ 8 - 0
report-viewer/src/model/Metric.ts

@@ -0,0 +1,8 @@
+import {ComparisonListElement} from "./ComparisonListElement";
+
+export type Metric = {
+    metricName : string,
+    metricThreshold : number,
+    distribution : Array<number>,
+    comparisons : Array<ComparisonListElement>
+}

+ 63 - 0
report-viewer/src/model/Overview.ts

@@ -0,0 +1,63 @@
+import {Metric} from "./Metric";
+
+export class Overview {
+    private readonly _submissionFolderPath: string
+    private readonly _baseCodeFolderPath: string
+    private readonly _language: string
+    private readonly _fileExtensions: Array<string>
+    private readonly _matchSensitivity: number
+    private readonly _submissionIds: Array<string>
+    private readonly _dateOfExecution: string
+    private readonly _durationOfExecution: number
+    private readonly _metrics: Array<Metric>
+
+
+    constructor(submissionFolderPath: string, baseCodeFolderPath: string, language: string, fileExtensions: Array<string>,matchSensitivity: number, submissionIds: Array<string>, dateOfExecution: string, durationOfExecution: number, metrics: Array<Metric>) {
+        this._submissionFolderPath = submissionFolderPath;
+        this._baseCodeFolderPath = baseCodeFolderPath;
+        this._language = language;
+        this._fileExtensions = fileExtensions
+        this._matchSensitivity = matchSensitivity;
+        this._submissionIds = submissionIds;
+        this._dateOfExecution = dateOfExecution;
+        this._durationOfExecution = durationOfExecution;
+        this._metrics = metrics;
+    }
+
+
+    get submissionFolderPath(): string {
+        return this._submissionFolderPath;
+    }
+
+    get baseCodeFolderPath(): string {
+        return this._baseCodeFolderPath;
+    }
+
+    get language(): string {
+        return this._language;
+    }
+
+    get fileExtensions(): Array<string> {
+        return this._fileExtensions
+    }
+
+    get matchSensitivity(): number {
+        return this._matchSensitivity;
+    }
+
+    get submissionIds(): Array<string> {
+        return this._submissionIds;
+    }
+
+    get dateOfExecution(): string {
+        return this._dateOfExecution;
+    }
+
+    get durationOfExecution(): number {
+        return this._durationOfExecution;
+    }
+
+    get metrics(): Array<Metric> {
+        return this._metrics;
+    }
+}

+ 4 - 0
report-viewer/src/model/SubmissionFile.ts

@@ -0,0 +1,4 @@
+export type SubmissionFile = {
+    lines: Array<string>;
+    collapsed: boolean;
+}

+ 105 - 0
report-viewer/src/model/factories/ComparisonFactory.ts

@@ -0,0 +1,105 @@
+import {Comparison} from "../Comparison";
+import {Match} from "../Match";
+import {SubmissionFile} from "../SubmissionFile";
+import {MatchInSingleFile} from "../MatchInSingleFile";
+
+export class ComparisonFactory {
+
+    static getComparison(json: Record<string, unknown>): Comparison {
+        const filesOfFirst = this.convertToFilesByName(json.files_of_first_submission as Array<Record<string, unknown>>)
+        const filesOfSecond = this.convertToFilesByName(json.files_of_second_submission as Array<Record<string, unknown>>)
+
+        const matches = json.matches as Array<Record<string, unknown>>
+        const colors = this.generateColorsForMatches(matches.length)
+        const coloredMatches = matches.map( (match, index) => this.mapMatch(match, colors[index]) )
+
+        const matchesInFirst = this.groupMatchesByFileName(coloredMatches, 1)
+        const matchesInSecond = this.groupMatchesByFileName(coloredMatches, 2)
+
+        const comparison = new Comparison(
+            json.first_submission_id as string,
+            json.second_submission_id as string,
+            json.match_percentage as number
+        )
+        comparison.filesOfFirstSubmission = filesOfFirst
+        comparison.filesOfSecondSubmission = filesOfSecond
+        comparison.colors = colors
+        comparison.allMatches = coloredMatches
+        comparison.matchesInFirstSubmission = matchesInFirst
+        comparison.matchesInSecondSubmissions = matchesInSecond
+
+        return comparison
+    }
+
+    private static convertToFilesByName(files: Array<Record<string, unknown>>): Record<string, SubmissionFile> {
+        return files.reduce( (acc: Record<string, SubmissionFile>, val: Record<string, unknown>) => {
+            if(!acc[val.file_name as string]) {
+                acc[val.file_name as string] = {
+                    lines : [],
+                    collapsed: false
+                }
+            }
+            acc[val.file_name as string] = {
+                lines: val.lines as Array<string>,
+                collapsed: false
+            }
+            return acc;
+        }, {})
+    }
+
+    private static groupMatchesByFileName(matches: Array<Match>, index: number): Record<string, Array<MatchInSingleFile>> {
+        return matches.reduce( (acc: Record<string, Array<MatchInSingleFile>>, val: Match ) => {
+            const name = index === 1 ? val.firstFile as string : val.secondFile as string
+            if(!acc[name]) {
+                acc[name] = []
+            }
+            if( index === 1 ) {
+                const newVal: MatchInSingleFile = {
+                    start : val.startInFirst as number,
+                    end: val.endInFirst as number,
+                    linked_panel: 2,
+                    linked_file: val.secondFile as string,
+                    linked_line: val.startInSecond as number,
+                    color: val.color as string
+                }
+                acc[name].push(newVal)
+            } else {
+                const newVal: MatchInSingleFile = {
+                    start : val.startInSecond as number,
+                    end: val.endInSecond as number,
+                    linked_panel: 1,
+                    linked_file: val.firstFile as string,
+                    linked_line: val.startInFirst as number,
+                    color: val.color as string
+                }
+                acc[name].push(newVal)
+            }
+            return acc;
+        }, {})
+    }
+
+    private static generateColorsForMatches( num : number ): Array<string> {
+        const colors = []
+        const hueDelta = Math.trunc(360 / (num) )
+
+        for( let i = 0; i < num; i++ ) {
+            const hue = i * hueDelta
+
+            colors.push(`hsla(${hue}, 80%, 50%, 0.5)`)
+        }
+        return colors
+    }
+
+    private static mapMatch(match: Record<string, unknown>, color: string): Match {
+        return {
+            firstFile: match.first_file_name as string,
+            secondFile: match.second_file_name as string,
+            startInFirst: match.start_in_first as number,
+            endInFirst: match.end_in_first as number,
+            startInSecond: match.start_in_second as number,
+            endInSecond: match.end_in_second as number,
+            color: color
+        };
+    }
+
+}

+ 51 - 0
report-viewer/src/model/factories/OverviewFactory.ts

@@ -0,0 +1,51 @@
+import {Overview} from "../Overview";
+import {Metric} from "../Metric";
+import {ComparisonListElement} from "../ComparisonListElement";
+
+export class OverviewFactory {
+
+    static getOverview(json: Record<string, unknown>): Overview {
+        const submissionFolder = json.submission_folder_path as string
+        const baseCodeFolder = ""
+        const language = json.language as string
+        const fileExtensions = json.file_extensions as Array<string>
+        const matchSensitivity = json.match_sensitivity as number
+        const submissions = json.submission_ids as Array<string>
+        const dateOfExecution = json.date_of_execution as string
+        const duration = json.execution_time as number as number
+        const metrics = [] as Array<Metric>
+        (json.metrics as Array<unknown>).forEach( (m) => {
+            const metric = m as Record<string, unknown>
+            const comparisons = [] as Array<ComparisonListElement>
+
+            (metric.topComparisons as Array<Record<string, unknown>>).forEach( c => {
+                const comparison: ComparisonListElement = {
+                    firstSubmissionId : c.first_submission as string,
+                    secondSubmissionId : c.second_submission as string,
+                    matchPercentage : c.match_percentage as number
+                }
+                comparisons.push(comparison)
+            })
+
+            const newMetric : Metric = {
+                metricName : metric.name as string,
+                metricThreshold : metric.threshold as number,
+                distribution : metric.distribution as Array<number>,
+                comparisons : comparisons
+            }
+            metrics.push(newMetric)
+        })
+
+        return new Overview(
+            submissionFolder,
+            baseCodeFolder,
+            language,
+            fileExtensions,
+            matchSensitivity,
+            submissions,
+            dateOfExecution,
+            duration,
+            metrics
+        )
+    }
+}

+ 12 - 18
report-viewer/src/views/ComparisonView.vue

@@ -11,8 +11,8 @@
       </div>
       </div>
       <TextInformation label="Submission 1" :value="id1" :has-additional-info="false"/>
       <TextInformation label="Submission 1" :value="id1" :has-additional-info="false"/>
       <TextInformation label="Submission 2" :value="id2" :has-additional-info="false"/>
       <TextInformation label="Submission 2" :value="id2" :has-additional-info="false"/>
-      <TextInformation label="Match %" :value="json.match_percentage" :has-additional-info="false"/>
-      <MatchTable :matches="coloredMatches" :id1="id1" :id2="id2" @match-selected="showMatch" />
+      <TextInformation label="Match %" :value="comparison.match_percentage" :has-additional-info="false"/>
+      <MatchTable :matches="comparison.allMatches" :id1="id1" :id2="id2" @match-selected="showMatch" />
     </div>
     </div>
     <div class="files-container" id="files1">
     <div class="files-container" id="files1">
       <h1>Files of {{ id1 }}</h1>
       <h1>Files of {{ id1 }}</h1>
@@ -21,7 +21,7 @@
                  :lines="filesOfFirst[file].lines"
                  :lines="filesOfFirst[file].lines"
                  :title="file"
                  :title="file"
                  :file-index="index"
                  :file-index="index"
-                 :matches="!matchesInFirst[file] ? [] : matchesInFirst[file]"
+                 :matches="!comparison.matchesInFirstSubmission[file] ? [] : comparison.matchesInFirstSubmission[file]"
                  :key="file.concat(index)"
                  :key="file.concat(index)"
                  :collapse="filesOfFirst[file].collapsed"
                  :collapse="filesOfFirst[file].collapsed"
                  @toggle-collapse="toggleCollapseFirst(file)"
                  @toggle-collapse="toggleCollapseFirst(file)"
@@ -37,7 +37,7 @@
                    :lines="filesOfSecond[file].lines"
                    :lines="filesOfSecond[file].lines"
                    :title="file"
                    :title="file"
                    :file-index="index"
                    :file-index="index"
-                   :matches="!matchesInSecond[file] ? [] : matchesInSecond[file]"
+                   :matches="!comparison.matchesInSecondSubmissions[file] ? [] : comparison.matchesInSecondSubmissions[file]"
                    :key="file.concat(index)"
                    :key="file.concat(index)"
                    :collapse="filesOfSecond[file].collapsed"
                    :collapse="filesOfSecond[file].collapsed"
                    @toggle-collapse="toggleCollapseSecond(file)"
                    @toggle-collapse="toggleCollapseSecond(file)"
@@ -51,11 +51,12 @@
 
 
 <script>
 <script>
 import { defineComponent, ref } from "vue";
 import { defineComponent, ref } from "vue";
-import {convertToFilesByName, generateColorsForMatches,generateLineCodeLink, groupMatchesByFileName} from "@/utils/Utils";
+import {generateLineCodeLink} from "@/utils/Utils";
 import { VueDraggableNext } from 'vue-draggable-next'
 import { VueDraggableNext } from 'vue-draggable-next'
 import CodePanel from "@/components/CodePanel";
 import CodePanel from "@/components/CodePanel";
 import TextInformation from "@/components/TextInformation";
 import TextInformation from "@/components/TextInformation";
 import MatchTable from "@/components/MatchTable";
 import MatchTable from "@/components/MatchTable";
+import {ComparisonFactory} from "@/model/factories/ComparisonFactory";
 
 
 export default defineComponent({
 export default defineComponent({
   name: "ComparisonView",
   name: "ComparisonView",
@@ -72,14 +73,10 @@ export default defineComponent({
     const fileName = props.id1.concat("-").concat(props.id2)
     const fileName = props.id1.concat("-").concat(props.id2)
     // eslint-disable-next-line @typescript-eslint/no-var-requires
     // eslint-disable-next-line @typescript-eslint/no-var-requires
     const json = require(`../files/${fileName}.json`)
     const json = require(`../files/${fileName}.json`)
+    const comparison = ComparisonFactory.getComparison(json)
 
 
-    const filesOfFirst = ref(convertToFilesByName(json.files_of_first_submission))
-    const filesOfSecond = ref(convertToFilesByName(json.files_of_second_submission))
-    const colors = generateColorsForMatches(json.matches.length)
-    const coloredMatches = json.matches.map( (m, index) => { return {...m, color : colors[index]} })
-
-    const matchesInFirst = groupMatchesByFileName(coloredMatches, 1)
-    const matchesInSecond = groupMatchesByFileName(coloredMatches, 2)
+    const filesOfFirst = ref(comparison.filesOfFirstSubmission)
+    const filesOfSecond = ref(comparison.filesOfSecondSubmission)
 
 
     const toggleCollapseFirst = (title) => { filesOfFirst.value[title].collapsed = !filesOfFirst.value[title].collapsed }
     const toggleCollapseFirst = (title) => { filesOfFirst.value[title].collapsed = !filesOfFirst.value[title].collapsed }
     const toggleCollapseSecond = (title) => { filesOfSecond.value[title].collapsed = !filesOfSecond.value[title].collapsed }
     const toggleCollapseSecond = (title) => { filesOfSecond.value[title].collapsed = !filesOfSecond.value[title].collapsed }
@@ -95,8 +92,8 @@ export default defineComponent({
     }
     }
 
 
     const showMatch = ( e, match ) => {
     const showMatch = ( e, match ) => {
-      showMatchInFirst(e, 1, match.first_file_name, match.start_in_first)
-      showMatchInSecond(e, 2, match.second_file_name, match.start_in_second)
+      showMatchInFirst(e, 1, match.firstFile, match.startInFirst)
+      showMatchInSecond(e, 2, match.secondFile, match.startInSecond)
     }
     }
 
 
 
 
@@ -106,12 +103,9 @@ export default defineComponent({
     }
     }
 
 
     return {
     return {
-      json,
+      comparison,
       filesOfFirst,
       filesOfFirst,
       filesOfSecond,
       filesOfSecond,
-      matchesInFirst,
-      matchesInSecond,
-      coloredMatches,
       hideLeftPanel,
       hideLeftPanel,
 
 
       toggleCollapseFirst,
       toggleCollapseFirst,

+ 19 - 23
report-viewer/src/views/Overview.vue

@@ -4,12 +4,12 @@
       <h1>JPlag Report</h1>
       <h1>JPlag Report</h1>
       <p class="section-title">Main Info:</p>
       <p class="section-title">Main Info:</p>
       <div id="basicInfo">
       <div id="basicInfo">
-        <TextInformation label="Directory path" :value="json.submission_folder_path" :has-additional-info="false"/>
-        <TextInformation label="Language" :value="json.language" :has-additional-info="true" :additional-info="json.file_extensions" additional-info-title="File extensions:"/>
-        <TextInformation :has-additional-info="false" :value="json.match_sensitivity" label="Match Sensitivity"/>
-        <TextInformation label="Submissions" :value="json.submission_ids.length" :has-additional-info="true" :additional-info="json.submission_ids" additional-info-title="Submission IDs:"/>
-        <TextInformation label="Date of execution" :value="json.date_of_execution" :has-additional-info="false"/>
-        <TextInformation label="Duration (in ms)" :value="json.execution_time" :has-additional-info="false"/>
+        <TextInformation label="Directory path" :value="overview.submissionFolderPath" :has-additional-info="false"/>
+        <TextInformation label="Language" :value="overview.language" :has-additional-info="true" :additional-info="overview.fileExtensions" additional-info-title="File extensions:"/>
+        <TextInformation :has-additional-info="false" :value="overview.matchSensitivity" label="Match Sensitivity"/>
+        <TextInformation label="Submissions" :value="overview.submissionIds.length" :has-additional-info="true" :additional-info="overview.submissionIds" additional-info-title="Submission IDs:"/>
+        <TextInformation label="Date of execution" :value="overview.dateOfExecution" :has-additional-info="false"/>
+        <TextInformation label="Duration (in ms)" :value="overview.durationOfExecution" :has-additional-info="false"/>
       </div>
       </div>
       <div id="logo-section">
       <div id="logo-section">
         <img id="logo" src="@/assets/logo-nobg.png" alt="JPlag">
         <img id="logo" src="@/assets/logo-nobg.png" alt="JPlag">
@@ -20,10 +20,10 @@
         <div id="metrics">
         <div id="metrics">
           <p class="section-title">Metric:</p>
           <p class="section-title">Metric:</p>
           <div id="metrics-list">
           <div id="metrics-list">
-            <MetricButton v-for="(metric, i) in json.metrics" :key="metric.name"
-                          :id="metric.name"
-                          :metric-threshold="metric.threshold"
-                          :metric-name="metric.name"
+            <MetricButton v-for="(metric, i) in overview.metrics" :key="metric.metricName"
+                          :id="metric.metricName"
+                          :metric-threshold="metric.metricThreshold"
+                          :metric-name="metric.metricName"
                           :is-selected="selectedMetric[i]"
                           :is-selected="selectedMetric[i]"
                           @click="selectMetric(i)"/>
                           @click="selectMetric(i)"/>
           </div>
           </div>
@@ -48,24 +48,19 @@ import DistributionDiagram from "@/components/DistributionDiagram";
 import MetricButton from "@/components/MetricButton";
 import MetricButton from "@/components/MetricButton";
 import Overview from "../files/overview.json"
 import Overview from "../files/overview.json"
 import ComparisonsTable from "@/components/ComparisonsTable";
 import ComparisonsTable from "@/components/ComparisonsTable";
+import {OverviewFactory} from "@/model/factories/OverviewFactory";
 
 
 export default defineComponent({
 export default defineComponent({
   name: "Overview",
   name: "Overview",
   components: {ComparisonsTable, DistributionDiagram, MetricButton, TextInformation },
   components: {ComparisonsTable, DistributionDiagram, MetricButton, TextInformation },
-  props: {
-    jsonString: {
-      type: String,
-    }
-  },
   setup() {
   setup() {
-    const json = Overview
+    const overview = OverviewFactory.getOverview(Overview)
 
 
     //Metrics
     //Metrics
-    let selectedMetric = ref(json.metrics.map( () => false ))
-    selectedMetric.value[0] = true;
-
+    let selectedMetric = ref(overview.metrics.map( () => false ))
     let selectedMetricIndex = ref(0)
     let selectedMetricIndex = ref(0)
-
+    selectedMetric.value[0] = true;
+    
     const selectMetric = (metric) => {
     const selectMetric = (metric) => {
       selectedMetric.value = selectedMetric.value.map( () => { return false })
       selectedMetric.value = selectedMetric.value.map( () => { return false })
       selectedMetric.value[metric] = true
       selectedMetric.value[metric] = true
@@ -73,13 +68,14 @@ export default defineComponent({
     }
     }
 
 
     //Distribution
     //Distribution
-    let distributions = ref(json.metrics.map( (m) =>  m.distribution ))
+    let distributions = ref(overview.metrics.map( (m) =>  m.distribution ))
+    console.log(overview.metrics[0])
 
 
     //Top Comparisons
     //Top Comparisons
-    let topComps = ref(json.metrics.map((m) => m.topComparisons))
+    let topComps = ref(overview.metrics.map((m) => m.comparisons ))
 
 
     return {
     return {
-      json,
+      overview,
       selectedMetricIndex,
       selectedMetricIndex,
       selectedMetric,
       selectedMetric,
       distributions,
       distributions,