Просмотр исходного кода

[192-webreport] Code and project cleanup

Evgeni 4 лет назад
Родитель
Сommit
f347c06616

+ 1 - 1
jplag/src/main/java/de/jplag/reportingV2/ReportingTest.java

@@ -11,7 +11,7 @@ import java.util.List;
 public class ReportingTest {
 public class ReportingTest {
 
 
 	public static void main(String[] args) throws ExitException {
 	public static void main(String[] args) throws ExitException {
-		JPlagOptions options = new JPlagOptions("C:\\Uni\\PISE\\jplag-try-out\\src\\submission", LanguageOption.JAVA_1_9);
+		JPlagOptions options = new JPlagOptions("C:\\Uni\\PISE\\JPlag\\jplag\\src\\test\\resources\\de\\jplag\\samples\\PartialPlagiarism", LanguageOption.JAVA_1_9);
 		JPlag jPlag = new JPlag(options);
 		JPlag jPlag = new JPlag(options);
 		JPlagResult result = jPlag.run();
 		JPlagResult result = jPlag.run();
 		Report reporting = new JsonReport();
 		Report reporting = new JsonReport();

+ 0 - 10
report-viewer/src/App.vue

@@ -4,16 +4,6 @@
 </template>
 </template>
 
 
 <style>
 <style>
-@font-face {
-  font-family: "Lobster";
-  src: url("./fonts/Lobster.ttf");
-}
-
-@font-face {
-  font-family: "League Spartan";
-  src: url("./fonts/LeagueSpartan.ttf");
-}
-
 @font-face {
 @font-face {
   font-family: "JetBrains Mono";
   font-family: "JetBrains Mono";
   src: url("./fonts/jetbrains-mono/JetBrainsMono-Light.ttf");
   src: url("./fonts/jetbrains-mono/JetBrainsMono-Light.ttf");

+ 0 - 90
report-viewer/src/components/ComparisonListElement.vue

@@ -1,90 +0,0 @@
-<template>
-  <div class="wrapper-list-element" @click="navigateToComparisonView()">
-      <p class="index">{{ index }}.</p>
-      <p class="submission-id">{{ submission1 }}</p>
-      <img src="@/assets/double_arrow_black_18dp.svg" alt=">>"/>
-      <p class="submission-id">{{ submission2 }}</p>
-      <p class="match-percentage">{{ formattedMatchPercentage }}%</p>
-  </div>
-</template>
-
-<script>
-import {defineComponent, ref } from "vue";
-import router from "@/router";
-
-export default defineComponent({
-  name: "ComparisonListElement",
-  props: {
-    index: {
-      type: Number,
-      required: true
-    },
-    submission1: {
-      type: String,
-      required: true
-    },
-    submission2: {
-      type: String,
-      required: true
-    },
-    matchPercentage: {
-      type: Number,
-      required: true
-    }
-  },
-  setup(props) {
-    let formattedMatchPercentage = props.matchPercentage.toFixed(2)
-
-    const navigateToComparisonView = () => {
-      router.push({
-        name: "ComparisonView",
-        params: {id1 : props.submission1, id2 : props.submission2}
-      })
-    }
-
-    return {
-      formattedMatchPercentage,
-      navigateToComparisonView
-    }
-  }
-})
-</script>
-
-<style scoped>
-.wrapper-list-element {
-  background: var(--quaternary-color);
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  justify-content: space-between;
-  padding: 2% 3%;
-  margin-bottom: 2%;
-  box-shadow: #777777 0 3px 3px;
-  border-radius: 40px;
-}
-
-.wrapper-list-element > * {
-  margin-top: 0;
-  margin-bottom: 0;
-}
-
-.wrapper-list-element:hover {
-  background: #FF5353;
-  cursor: pointer;
-}
-
-.wrapper-list-element:hover p {
-  color: white;
-}
-
-img {
-  flex-shrink: 2;
-}
-
-p {
-  font-weight: bold;
-  font-size: large;
-  text-align: center;
-  text-anchor: middle;
-}
-</style>

+ 0 - 60
report-viewer/src/components/ComparisonsLists.vue

@@ -1,60 +0,0 @@
-<template>
-  <div class="wrapper">
-    <ul id="list">
-      <li v-for="(comparison, index) in comparisons" :key="comparison.first_submission
-      + comparison.second_submission
-      + comparison.match_percentage">
-        <ComparisonListElement :index="index + 1"
-                               :submission1="comparison.first_submission"
-                               :submission2="comparison.second_submission"
-                               :match-percentage="comparison.match_percentage"/>
-      </li>
-    </ul>
-  </div>
-</template>
-
-<script>
-import { defineComponent, ref, watch} from "vue";
-import ComparisonListElement from "./ComparisonListElement";
-
-export default defineComponent({
-  name: "ComparisonsLists",
-  components: {ComparisonListElement},
-  props: {
-    comparisons: {
-      required: true
-    }
-  },
-  setup(props) {
-
-    watch( () => props.comparisons, (val, oldVal) => {
-      console.log("New val is: " + JSON.stringify(val))
-    })
-
-    return {
-
-    }
-  }
-})
-</script>
-
-<style scoped>
-.wrapper {
-  display: flex;
-  background: whitesmoke;
-  border-radius: 10px;
-  align-items: center;
-  box-shadow: #777777 2px 3px 3px;
-  height: 300px;
-}
-
-ul {
-  width: 100%;
-  height: 100%;
-  list-style-type: none;
-  padding: 2% 1% 0;
-  columns: 3;
-  -webkit-columns: 3;
-  -moz-columns: 3;
-}
-</style>

+ 3 - 3
report-viewer/src/components/ComparisonsTable.vue

@@ -23,7 +23,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { defineComponent, computed } from "vue";
+import { defineComponent } from "vue";
 import router from "@/router";
 import router from "@/router";
 
 
 export default defineComponent({
 export default defineComponent({
@@ -33,12 +33,12 @@ export default defineComponent({
       required: true
       required: true
    }
    }
   },
   },
-  setup(props) {
+  setup() {
     let formattedMatchPercentage = ( number ) => number.toFixed(2)
     let formattedMatchPercentage = ( number ) => number.toFixed(2)
 
 
     const navigateToComparisonView = (id1, id2) => {
     const navigateToComparisonView = (id1, id2) => {
       router.push({
       router.push({
-        name: "ComparisonView2",
+        name: "ComparisonView",
         params: { id1 : id1, id2 : id2 }
         params: { id1 : id1, id2 : id2 }
       })
       })
     }
     }

+ 1 - 1
report-viewer/src/components/DistributionDiagram.vue

@@ -68,7 +68,7 @@ export default defineComponent({
       }
       }
     })
     })
 
 
-    watch( () => props.distribution, (val, oldVal) => {
+    watch( () => props.distribution, (val) => {
       chartData.value = {
       chartData.value = {
         labels: ['0-10%', '11-20%', '21-30%', '31-40%', '41-50%', '51-60%', '61-70%', '71-80%', '81-90%', '91-100%'],
         labels: ['0-10%', '11-20%', '21-30%', '31-40%', '41-50%', '51-60%', '61-70%', '71-80%', '81-90%', '91-100%'],
         datasets: [{
         datasets: [{

+ 0 - 27
report-viewer/src/components/FilesSelection.vue

@@ -1,27 +0,0 @@
-<template>
-
-</template>
-
-<script>
-import { defineComponent} from "vue";
-
-export default defineComponent({
-  name: "FilesSelection",
-  props: {
-    matches: {
-      type: Object,
-      required: true
-    }
-  },
-  setup() {
-
-    return {
-
-    }
-  }
-})
-</script>
-
-<style scoped>
-
-</style>

+ 1 - 1
report-viewer/src/components/LineOfCode.vue

@@ -47,7 +47,7 @@ pre {
   margin: 0;
   margin: 0;
   padding: 0;
   padding: 0;
   float: left;
   float: left;
-  font-family: "JetBrains Mono";
+  font-family: "JetBrains Mono",serif;
   font-size: x-small;
   font-size: x-small;
 }
 }
 
 

+ 0 - 133
report-viewer/src/components/MatchList.vue

@@ -1,133 +0,0 @@
-<template>
-<div class="wrapper">
-  <select v-model="selected" @change="this.$emit('selectionChanged', $event, selected.split(SEPARATOR)[0], selected.split(SEPARATOR)[1])">
-    <option v-for="option in generatedSelectOptions" :value="option" :key="option">
-      {{ option }}
-    </option>
-  </select>
-  <table>
-    <tr>
-      <th>
-        <p>{{ submission1 }}</p>
-        <p>{{ selectedSplit[0] }}</p>
-      </th>
-      <th>
-        <p>{{ submission2 }}</p>
-        <p>{{ selectedSplit[1] }}</p>
-      </th>
-      <th>Tokens</th>
-    </tr>
-    <tr class="selectable-row" v-for="match in matches[selectedSplit[0]][selectedSplit[1]]"
-        :key="match.start_in_first + match.end_in_first"
-        @click="this.$emit('matchSelected', $event, match.start_in_first, match.end_in_first, match.start_in_second, match.end_in_second)"
-        :style="{background : match.color}"
-    >
-      <td>{{ match.start_in_first }} - {{ match.end_in_first }}</td>
-      <td>{{ match.start_in_second }} - {{ match.end_in_second }}</td>
-      <td>TODO</td>
-    </tr>
-  </table>
-</div>
-</template>
-
-<script>
-import { defineComponent, ref, watchEffect } from "vue";
-
-export default defineComponent({
-  name: "MatchList",
-  props: {
-    matches: {
-      type: Array,
-      required: true
-    },
-    submission1: {
-      type: String,
-      required: true
-    },
-    submission2: {
-      type: String,
-      required: true
-    }
-  },
-  setup(props) {
-    const SEPARATOR = " - "
-
-    const generatedSelectOptions = ref([])
-    Object.keys(props.matches).forEach( (key) => {
-      Object.keys(props.matches[key]).forEach( (subkey) => {
-        generatedSelectOptions.value.push(key + SEPARATOR + subkey)
-      })
-    })
-
-    let selected = ref(generatedSelectOptions.value[0]);
-    let selectedSplit = ref(selected.value.split(SEPARATOR))
-
-
-    watchEffect(() => {
-      selectedSplit.value = selected.value.split(SEPARATOR)
-    })
-
-    return {
-      selected,
-      selectedSplit,
-      generatedSelectOptions,
-      SEPARATOR
-    }
-  }
-})
-</script>
-
-<style scoped>
-.wrapper {
-  background: #ECECEC;
-  border-radius: 10px;
-  padding: 5%;
-  display: flex;
-  flex-direction: column;
-  overflow-x: hidden;
-  overflow-y: scroll;
-  -ms-overflow-style: none;
-}
-
-.wrapper::-webkit-scrollbar {
-  display: none;
-}
-
-select {
-  margin-bottom: 5%;
-  background: #ECECEC;
-  border: none;
-  border-bottom: solid rgba(119, 119, 119, 0.20);
-}
-
-option {
-  text-align: center;
-}
-
-table {
-  border-collapse: collapse;
-}
-
-th {
-  font-size: small;
-}
-
-th > p {
-  margin: 0
-}
-
-tr {
-  border-bottom: solid rgba(119, 119, 119, 0.20);
-  border-radius: 10px;
-}
-
-td {
-  padding: 2% 0;
-}
-
-.selectable-row:hover {
-  color: white;
-  cursor: pointer;
-}
-
-</style>

+ 2 - 5
report-viewer/src/components/MatchTable.vue

@@ -47,11 +47,8 @@ export default defineComponent({
       type: String
       type: String
     }
     }
   },
   },
-  setup(props) {
-
-    return {
-
-    }
+  setup() {
+    return {}
   }
   }
 })
 })
 </script>
 </script>

+ 1 - 3
report-viewer/src/components/MetricButton.vue

@@ -31,9 +31,7 @@ export default defineComponent({
     },
     },
   },
   },
   setup() {
   setup() {
-
-    return {
-    }
+    return {}
   }
   }
 })
 })
 </script>
 </script>

+ 1 - 6
report-viewer/src/components/TextInformation.vue

@@ -78,11 +78,6 @@ hr {
   overflow: hidden;
   overflow: hidden;
 }
 }
 
 
-.label {
-  display: flex;
-  justify-content: space-between;
-}
-
 .label-text {
 .label-text {
   color: var(--on-primary-color);
   color: var(--on-primary-color);
   text-align: left;
   text-align: left;
@@ -116,7 +111,7 @@ hr {
   margin: 3% 0;
   margin: 3% 0;
   box-shadow: inset var(--shadow-color) 0 0 3px;
   box-shadow: inset var(--shadow-color) 0 0 3px;
   border-radius: 10px;
   border-radius: 10px;
-  font-family: "JetBrains Mono";
+  font-family: "JetBrains Mono",serif;
   font-size: smaller;
   font-size: smaller;
 }
 }
 
 

BIN
report-viewer/src/fonts/LeagueSpartan.ttf


BIN
report-viewer/src/fonts/Lobster.ttf


+ 0 - 17
report-viewer/src/model/TopComparison.ts

@@ -1,17 +0,0 @@
-class TopComparison {
-    comparisonName: string;
-    submission1: string;
-    submission2: string
-    matchPercentage: string;
-
-    constructor(comparisonName: string, matchPercentage: number) {
-        this.comparisonName = comparisonName
-        const split: string[]  = comparisonName.split("-")
-        this.submission1 = split[0]
-        this.submission2 = split[1]
-        this.matchPercentage = matchPercentage.toFixed(2)
-    }
-
-}
-
-export default TopComparison;

+ 3 - 3
report-viewer/src/router/index.ts

@@ -1,7 +1,7 @@
 import {createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw} from "vue-router";
 import {createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw} from "vue-router";
 import Overview from "@/views/Overview.vue";
 import Overview from "@/views/Overview.vue";
 import FileUpload from "@/views/FileUpload.vue"
 import FileUpload from "@/views/FileUpload.vue"
-import ComparisonView2 from "@/views/ComparisonView2.vue"
+import ComparisonView from "@/views/ComparisonView.vue"
 
 
 const routes: Array<RouteRecordRaw> = [
 const routes: Array<RouteRecordRaw> = [
   {
   {
@@ -17,8 +17,8 @@ const routes: Array<RouteRecordRaw> = [
   },
   },
   {
   {
     path: "/comparison/:id1/:id2",
     path: "/comparison/:id1/:id2",
-    name: "ComparisonView2",
-    component: ComparisonView2,
+    name: "ComparisonView",
+    component: ComparisonView,
     props: true
     props: true
   },
   },
 ];
 ];

+ 134 - 107
report-viewer/src/views/ComparisonView.vue

@@ -1,44 +1,71 @@
 <template>
 <template>
-<div class="container">
-  <div id="leftPanel" v-bind:class="{hidden : hideLeftPanel}">
-    <div class="logo-section">
-      <img id="logo" src="@/assets/logo-nobg.png" alt="JPlag">
-      <button id="hide-button" @click="togglePanel" title="Hide sidebar"><img src="@/assets/double_arrow_white_24dp.svg" alt="hide"></button>
+  <div class="container">
+    <button id="show-button" :class="{hidden : !hideLeftPanel}" @click="togglePanel" title="Show sidebar">
+      <img src="@/assets/double_arrow_white_24dp.svg" alt="show">
+    </button>
+    <div id="sidebar" :class="{ hidden : hideLeftPanel }">
+      <div class="title-section">
+        <h1>JPlag Comparison</h1>
+        <button id="hide-button" @click="togglePanel" title="Hide sidebar">
+          <img src="@/assets/keyboard_double_arrow_left_white_24dp.svg" alt="hide"></button>
+      </div>
+      <TextInformation label="Submission 1" :value="id1" :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" />
+    </div>
+    <div class="files-container" id="files1">
+      <h1>Files of {{ id1 }}</h1>
+      <VueDraggableNext>
+      <CodePanel v-for="(file, index) in Object.keys(filesOfFirst)"
+                 :lines="filesOfFirst[file].lines"
+                 :title="file"
+                 :file-index="index"
+                 :matches="!matchesInFirst[file] ? [] : matchesInFirst[file]"
+                 :key="file.concat(index)"
+                 :collapse="filesOfFirst[file].collapsed"
+                 @toggle-collapse="toggleCollapseFirst(file)"
+                 @line-selected="showMatchInSecond"
+                 :panel-id="1"
+      />
+      </VueDraggableNext>
+    </div>
+    <div class="files-container" id="files2">
+      <h1>Files of {{ id2 }}</h1>
+      <VueDraggableNext>
+        <CodePanel v-for="(file, index) in Object.keys(filesOfSecond)"
+                   :lines="filesOfSecond[file].lines"
+                   :title="file"
+                   :file-index="index"
+                   :matches="!matchesInSecond[file] ? [] : matchesInSecond[file]"
+                   :key="file.concat(index)"
+                   :collapse="filesOfSecond[file].collapsed"
+                   @toggle-collapse="toggleCollapseSecond(file)"
+                   @line-selected="showMatchInFirst"
+                   :panel-id="2"
+                   />
+      </VueDraggableNext>
     </div>
     </div>
-    <TextInformation :has-additional-info="false" value="Matches Report" label=""/>
-    <TextInformation label="First Submission:" :value="json.first_submission_id" :has-additional-info="false"/>
-    <TextInformation label="Second Submission:" :value="json.second_submission_id" :has-additional-info="false"/>
-    <TextInformation label="Match percentage:" :value="json.match_percentage" :has-additional-info="false"/>
-    <MatchList :submission1="json.first_submission_id"
-               :submission2="json.second_submission_id"
-               :matches="groupedMatches"
-                @selection-changed="selectFiles"
-                @match-selected="selectMatch"/>
-  </div>
-  <div id="rightPanel" v-bind:class="{extended : hideLeftPanel}">
-    <button id="show-button" v-bind:class="{hidden : !hideLeftPanel}" @click="togglePanel" title="Show sidebar"><img src="@/assets/double_arrow_white_24dp.svg" alt="hide"></button>
-    <CodePanel id="codePanel1" :lines="filesOfFirst[selectedFileOfFirst]" :coloring="coloringFirst" panel-id="1"/>
-    <CodePanel :lines="filesOfSecond[selectedFileOfSecond]"  :coloring="coloringSecond" panel-id="2"/>
   </div>
   </div>
-</div>
 </template>
 </template>
 
 
 <script>
 <script>
-import { defineComponent, ref, onBeforeMount } from "vue";
-import TextInformation from "@/components/TextInformation";
-import MatchList from "@/components/MatchList";
+import { defineComponent, ref } from "vue";
+import {convertToFilesByName, generateColorsForMatches,generateLineCodeLink, groupMatchesByFileName} from "@/utils/Utils";
+import { VueDraggableNext } from 'vue-draggable-next'
 import CodePanel from "@/components/CodePanel";
 import CodePanel from "@/components/CodePanel";
-import {convertToFilesByName, generateColoringArray, generateColor} from "@/utils/Utils";
+import TextInformation from "@/components/TextInformation";
+import MatchTable from "@/components/MatchTable";
 
 
 export default defineComponent({
 export default defineComponent({
   name: "ComparisonView",
   name: "ComparisonView",
-  components: {CodePanel, MatchList, TextInformation},
+  components: {MatchTable, TextInformation, VueDraggableNext, CodePanel},
   props: {
   props: {
     id1: {
     id1: {
-      type: String
+      type: String,
     },
     },
     id2: {
     id2: {
-      type: String
+      type: String,
     }
     }
   },
   },
   setup(props) {
   setup(props) {
@@ -46,121 +73,124 @@ export default defineComponent({
     // 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 filesOfFirst = convertToFilesByName(json.files_of_first_submission)
-    const filesOfSecond = convertToFilesByName(json.files_of_second_submission)
-
-    const groupedMatches = ref(json.matches.reduce( (acc, val) => {
-            let name = val.first_file_name
-            let subname = val.second_file_name
-            if(!acc[name]) {
-              acc[name] = {}
-            }
-            if(!acc[name][subname]) {
-              acc[name][subname] = []
-            }
-            let newVal = {...val, color: generateColor()}
-            acc[name][subname].push(newVal)
-            return acc;
-          }, {})
-      )
-
-    const selectedFileOfFirst = ref(Object.keys(groupedMatches.value)[0])
-    const selectedFileOfSecond = ref(Object.keys(groupedMatches.value[selectedFileOfFirst.value])[0])
-
-      let coloringFirst = ref(generateColoringArray(groupedMatches.value[selectedFileOfFirst.value][selectedFileOfSecond.value], 1))
-      let coloringSecond = ref(generateColoringArray(groupedMatches.value[selectedFileOfFirst.value][selectedFileOfSecond.value], 2))
-
-      const selectFiles = (e , file1, file2) => {
-        selectedFileOfFirst.value = file1
-        selectedFileOfSecond.value = file2
-        coloringFirst.value = generateColoringArray(groupedMatches.value[selectedFileOfFirst.value][selectedFileOfSecond.value], 1)
-        coloringSecond.value = generateColoringArray(groupedMatches.value[selectedFileOfFirst.value][selectedFileOfSecond.value], 2)
-      }
-
-      const selectMatch = (e, s1, e1, s2, e2) => {
-        document.getElementById("1".concat(s1)).scrollIntoView()
-        document.getElementById("2".concat(s2)).scrollIntoView()
-      }
-
-
-      const hideLeftPanel = ref(false)
-      const togglePanel = () => {
-        hideLeftPanel.value = !hideLeftPanel.value
-      }
-
-      return {
-        json, filesOfFirst, filesOfSecond, selectedFileOfFirst, selectedFileOfSecond, hideLeftPanel,
-        coloringFirst, coloringSecond, groupedMatches,
-        selectFiles,
-        selectMatch,
-        togglePanel
-      }
+    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 toggleCollapseFirst = (title) => { filesOfFirst.value[title].collapsed = !filesOfFirst.value[title].collapsed }
+    const toggleCollapseSecond = (title) => { filesOfSecond.value[title].collapsed = !filesOfSecond.value[title].collapsed }
+
+    const showMatchInFirst = ( e, panel, file, line ) => {
+      if( !filesOfFirst.value[file].collapsed ) { toggleCollapseFirst(file) }
+      document.getElementById(generateLineCodeLink(panel, file, line)).scrollIntoView()
+    }
+
+    const showMatchInSecond = ( e, panel, file, line ) => {
+      if( !filesOfSecond.value[file].collapsed ) { toggleCollapseSecond(file) }
+      document.getElementById(generateLineCodeLink(panel, file, line)).scrollIntoView()
+    }
+
+    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)
+    }
+
+
+    const hideLeftPanel = ref(true)
+    const togglePanel = () => {
+      hideLeftPanel.value = !hideLeftPanel.value
+    }
+
+    return {
+      json,
+      filesOfFirst,
+      filesOfSecond,
+      matchesInFirst,
+      matchesInSecond,
+      coloredMatches,
+      hideLeftPanel,
+
+      toggleCollapseFirst,
+      toggleCollapseSecond,
+      showMatchInFirst,
+      showMatchInSecond,
+      showMatch,
+      togglePanel
+    }
   }
   }
 })
 })
 </script>
 </script>
 
 
 <style scoped>
 <style scoped>
+h1 {
+  color: var(--on-primary-color);
+  text-align: center;
+}
+
 .container {
 .container {
   display: flex;
   display: flex;
   align-items: stretch;
   align-items: stretch;
+  flex-wrap: nowrap;
   width: 100%;
   width: 100%;
   height: 100%;
   height: 100%;
-  margin: 0;
+  background: var(--background-color);
+}
+
+.files-container {
+  display: flex;
+  flex-wrap: nowrap;
+  flex-direction: column;
+  padding-top: 1%;
+  width: 100%;
+  overflow: auto;
 }
 }
 
 
-.logo-section {
+.title-section {
   display: flex;
   display: flex;
   justify-content: space-between;
   justify-content: space-between;
 }
 }
+.title-section > h1 {
+  text-align: left !important;
+}
 
 
 .hidden {
 .hidden {
   display: none !important;
   display: none !important;
 }
 }
 
 
-.extended {
-  width: 100% !important;
-}
-
-#leftPanel {
-  width: 25%;
-  background: var(--primary-color);
+#sidebar {
   display: flex;
   display: flex;
   flex-direction: column;
   flex-direction: column;
-  align-items: stretch;
-  padding: 1%;
-}
-
-#rightPanel {
-  width: 75%;
-  background: #ECECEC;
-  display: flex;
   flex-wrap: nowrap;
   flex-wrap: nowrap;
-  justify-content: stretch;
+  width: 60%;
+  background: var(--primary-color-light);
   padding: 1%;
   padding: 1%;
-}
-
-#logo {
-  margin-bottom: 5%;
+  border-top-right-radius: 10px;
+  border-bottom-right-radius: 10px;
 }
 }
 
 
 #hide-button {
 #hide-button {
-  height: 20%;
+  display: flex;
+  flex-direction: column;
   background: transparent;
   background: transparent;
+  border-radius: 10px;
+  height: max-content;
   border: none;
   border: none;
-  padding: 0;
-  margin: 0;
-  transform: rotate(180deg);
 }
 }
 
 
 #hide-button:hover {
 #hide-button:hover {
   cursor: pointer;
   cursor: pointer;
+  background: var(--primary-color-dark);
 }
 }
 
 
 #show-button {
 #show-button {
   position: absolute;
   position: absolute;
   z-index: 1000;
   z-index: 1000;
   left: 0;
   left: 0;
-  background: #FF5353;
+  background: var(--secondary-color);
   border: none;
   border: none;
   border-top-right-radius: 10px;
   border-top-right-radius: 10px;
   border-bottom-right-radius: 10px;
   border-bottom-right-radius: 10px;
@@ -168,15 +198,12 @@ export default defineComponent({
   width: 1%;
   width: 1%;
 }
 }
 
 
-#show-button:hover {
-  cursor: pointer;
-}
-
 #show-button img {
 #show-button img {
   display: none;
   display: none;
 }
 }
 
 
 #show-button:hover {
 #show-button:hover {
+  cursor: pointer;
   width: 3%;
   width: 3%;
 }
 }
 
 

+ 0 - 211
report-viewer/src/views/ComparisonView2.vue

@@ -1,211 +0,0 @@
-<template>
-  <div class="container">
-    <button id="show-button" :class="{hidden : !hideLeftPanel}" @click="togglePanel" title="Show sidebar">
-      <img src="@/assets/double_arrow_white_24dp.svg" alt="show">
-    </button>
-    <div id="sidebar" :class="{ hidden : hideLeftPanel }">
-      <div class="title-section">
-        <h1>JPlag Comparison</h1>
-        <button id="hide-button" @click="togglePanel" title="Hide sidebar">
-          <img src="@/assets/keyboard_double_arrow_left_white_24dp.svg" alt="hide"></button>
-      </div>
-      <TextInformation label="Submission 1" :value="id1" :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" />
-    </div>
-    <div class="files-container" id="files1">
-      <VueDraggableNext>
-      <CodePanel v-for="(file, index) in Object.keys(filesOfFirst)"
-                 :lines="filesOfFirst[file].lines"
-                 :title="file"
-                 :file-index="index"
-                 :matches="!matchesInFirst[file] ? [] : matchesInFirst[file]"
-                 :key="file.concat(index)"
-                 :collapse="filesOfFirst[file].collapsed"
-                 @toggle-collapse="toggleCollapseFirst(file)"
-                 @line-selected="showMatchInSecond"
-                 :panel-id="1"
-      />
-      </VueDraggableNext>
-    </div>
-    <div class="files-container" id="files2">
-      <VueDraggableNext>
-        <CodePanel v-for="(file, index) in Object.keys(filesOfSecond)"
-                   :lines="filesOfSecond[file].lines"
-                   :title="file"
-                   :file-index="index"
-                   :matches="!matchesInSecond[file] ? [] : matchesInSecond[file]"
-                   :key="file.concat(index)"
-                   :collapse="filesOfSecond[file].collapsed"
-                   @toggle-collapse="toggleCollapseSecond(file)"
-                   @line-selected="showMatchInFirst"
-                   :panel-id="2"
-                   />
-      </VueDraggableNext>
-    </div>
-  </div>
-</template>
-
-<script>
-import { defineComponent, ref } from "vue";
-import {convertToFilesByName, generateColor, generateColorsForMatches,generateLineCodeLink, groupMatchesByFileName} from "@/utils/Utils";
-import { VueDraggableNext } from 'vue-draggable-next'
-import CodePanel from "@/components/CodePanel";
-import TextInformation from "@/components/TextInformation";
-import MatchTable from "@/components/MatchTable";
-
-export default defineComponent({
-  name: "ComparisonView2",
-  components: {MatchTable, TextInformation, VueDraggableNext, CodePanel},
-  props: {
-    id1: {
-      type: String,
-    },
-    id2: {
-      type: String,
-    }
-  },
-  setup(props) {
-    const fileName = props.id1.concat("-").concat(props.id2)
-    // eslint-disable-next-line @typescript-eslint/no-var-requires
-    const json = require(`../files/${fileName}.json`)
-
-    const filesOfFirst = ref(convertToFilesByName(json.files_of_first_submission))
-    const filesOfSecond = ref(convertToFilesByName(json.files_of_second_submission))
-    const filesOfFirstCollapsed = ref(Object.keys(filesOfFirst.value).map( _ => false ))
-    const filesOfSecondCollapsed = ref(Object.keys(filesOfSecond.value).map( _ => false ))
-    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 toggleCollapseFirst = (title) => { filesOfFirst.value[title].collapsed = !filesOfFirst.value[title].collapsed }
-    const toggleCollapseSecond = (title) => { filesOfSecond.value[title].collapsed = !filesOfSecond.value[title].collapsed }
-
-    const showMatchInFirst = ( e, panel, file, line ) => {
-      if( !filesOfFirst.value[file].collapsed ) { toggleCollapseFirst(file) }
-      document.getElementById(generateLineCodeLink(panel, file, line)).scrollIntoView()
-    }
-
-    const showMatchInSecond = ( e, panel, file, line ) => {
-      if( !filesOfSecond.value[file].collapsed ) { toggleCollapseSecond(file) }
-      document.getElementById(generateLineCodeLink(panel, file, line)).scrollIntoView()
-    }
-
-    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)
-    }
-
-
-    const hideLeftPanel = ref(true)
-    const togglePanel = () => {
-      hideLeftPanel.value = !hideLeftPanel.value
-    }
-
-    return {
-      json,
-      filesOfFirst,
-      filesOfFirstCollapsed,
-      filesOfSecond,
-      filesOfSecondCollapsed,
-      matchesInFirst,
-      matchesInSecond,
-      coloredMatches,
-      hideLeftPanel,
-
-      toggleCollapseFirst,
-      toggleCollapseSecond,
-      showMatchInFirst,
-      showMatchInSecond,
-      showMatch,
-      togglePanel
-    }
-  }
-})
-</script>
-
-<style scoped>
-.container {
-  display: flex;
-  align-items: stretch;
-  flex-wrap: nowrap;
-  width: 100%;
-  height: 100%;
-  background: var(--background-color);
-}
-
-.files-container {
-  display: flex;
-  flex-wrap: nowrap;
-  flex-direction: column;
-  padding-top: 1%;
-  width: 100%;
-  overflow: auto;
-}
-
-.title-section {
-  display: flex;
-  justify-content: space-between;
-}
-
-.title-section > h1 {
-  color: var(--on-primary-color);
-}
-
-.hidden {
-  display: none !important;
-}
-
-#sidebar {
-  display: flex;
-  flex-direction: column;
-  flex-wrap: nowrap;
-  width: 60%;
-  background: var(--primary-color-light);
-  padding: 1%;
-  border-top-right-radius: 10px;
-  border-bottom-right-radius: 10px;
-}
-
-#hide-button {
-  display: flex;
-  flex-direction: column;
-  background: transparent;
-  border-radius: 10px;
-  height: max-content;
-  border: none;
-}
-
-#hide-button:hover {
-  cursor: pointer;
-  background: var(--primary-color-dark);
-}
-
-#show-button {
-  position: absolute;
-  z-index: 1000;
-  left: 0;
-  background: var(--secondary-color);
-  border: none;
-  border-top-right-radius: 10px;
-  border-bottom-right-radius: 10px;
-  height: 100%;
-  width: 1%;
-}
-
-#show-button img {
-  display: none;
-}
-
-#show-button:hover {
-  cursor: pointer;
-  width: 3%;
-}
-
-#show-button:hover img {
-  display: block;
-}
-</style>

+ 1 - 2
report-viewer/src/views/Overview.vue

@@ -46,7 +46,6 @@ import {defineComponent, ref} from "vue";
 import TextInformation from "../components/TextInformation";
 import TextInformation from "../components/TextInformation";
 import DistributionDiagram from "@/components/DistributionDiagram";
 import DistributionDiagram from "@/components/DistributionDiagram";
 import MetricButton from "@/components/MetricButton";
 import MetricButton from "@/components/MetricButton";
-import ComparisonListElement from "@/components/ComparisonListElement";
 import Overview from "../files/overview.json"
 import Overview from "../files/overview.json"
 import ComparisonsTable from "@/components/ComparisonsTable";
 import ComparisonsTable from "@/components/ComparisonsTable";
 
 
@@ -58,7 +57,7 @@ export default defineComponent({
       type: String,
       type: String,
     }
     }
   },
   },
-  setup(props) {
+  setup() {
     const json = Overview
     const json = Overview
 
 
     //Metrics
     //Metrics