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

+ 21 - 1
report-viewer/package-lock.json

@@ -16,7 +16,8 @@
         "vue-chart-3": "^3.0.3",
         "vue-chart-3": "^3.0.3",
         "vue-draggable-next": "^2.1.1",
         "vue-draggable-next": "^2.1.1",
         "vue-router": "^4.0.0-0",
         "vue-router": "^4.0.0-0",
-        "vue3-highlightjs": "^1.0.5"
+        "vue3-highlightjs": "^1.0.5",
+        "vuex": "^4.0.2"
       },
       },
       "devDependencies": {
       "devDependencies": {
         "@typescript-eslint/eslint-plugin": "^4.18.0",
         "@typescript-eslint/eslint-plugin": "^4.18.0",
@@ -16558,6 +16559,17 @@
         "node": "*"
         "node": "*"
       }
       }
     },
     },
+    "node_modules/vuex": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmjs.org/vuex/-/vuex-4.0.2.tgz",
+      "integrity": "sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==",
+      "dependencies": {
+        "@vue/devtools-api": "^6.0.0-beta.11"
+      },
+      "peerDependencies": {
+        "vue": "^3.0.2"
+      }
+    },
     "node_modules/watchpack": {
     "node_modules/watchpack": {
       "version": "1.7.5",
       "version": "1.7.5",
       "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz",
       "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz",
@@ -30727,6 +30739,14 @@
         }
         }
       }
       }
     },
     },
+    "vuex": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmjs.org/vuex/-/vuex-4.0.2.tgz",
+      "integrity": "sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==",
+      "requires": {
+        "@vue/devtools-api": "^6.0.0-beta.11"
+      }
+    },
     "watchpack": {
     "watchpack": {
       "version": "1.7.5",
       "version": "1.7.5",
       "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz",
       "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz",

+ 2 - 1
report-viewer/package.json

@@ -17,7 +17,8 @@
     "vue-chart-3": "^3.0.3",
     "vue-chart-3": "^3.0.3",
     "vue-draggable-next": "^2.1.1",
     "vue-draggable-next": "^2.1.1",
     "vue-router": "^4.0.0-0",
     "vue-router": "^4.0.0-0",
-    "vue3-highlightjs": "^1.0.5"
+    "vue3-highlightjs": "^1.0.5",
+    "vuex": "^4.0.2"
   },
   },
   "devDependencies": {
   "devDependencies": {
     "@typescript-eslint/eslint-plugin": "^4.18.0",
     "@typescript-eslint/eslint-plugin": "^4.18.0",

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

@@ -16,9 +16,13 @@
       @click="navigateToComparisonView(comparison.firstSubmissionId, comparison.secondSubmissionId)"
       @click="navigateToComparisonView(comparison.firstSubmissionId, comparison.secondSubmissionId)"
       >
       >
     <td>{{ index + 1 }}.</td>
     <td>{{ index + 1 }}.</td>
-    <td :class="{ anonymous : !notAnonymized.includes(comparison.firstSubmissionId)}">{{ notAnonymized.includes(comparison.firstSubmissionId) ? comparison.firstSubmissionId : "Hidden" }}</td>
+    <td :class="{ 'anonymous-style' : anonymous.has(comparison.firstSubmissionId)}">
+      {{ anonymous.has(comparison.firstSubmissionId) ? "Hidden" : 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 :class="{ anonymous : !notAnonymized.includes(comparison.secondSubmissionId)}">{{ notAnonymized.includes(comparison.secondSubmissionId) ? comparison.secondSubmissionId : "Hidden" }}</td>
+    <td :class="{ 'anonymous-style' : anonymous.has(comparison.secondSubmissionId)}">
+      {{ anonymous.has(comparison.secondSubmissionId) ? "Hidden" : comparison.secondSubmissionId }}
+    </td>
     <td>{{ formattedMatchPercentage(comparison.matchPercentage) }}</td>
     <td>{{ formattedMatchPercentage(comparison.matchPercentage) }}</td>
   </tr>
   </tr>
 </table>
 </table>
@@ -35,8 +39,8 @@ export default defineComponent({
      type: Array,
      type: Array,
      required: true
      required: true
    },
    },
-    notAnonymized : {
-     type: Array
+    anonymous : {
+     type: Set
     }
     }
   },
   },
   setup(props) {
   setup(props) {
@@ -46,7 +50,6 @@ export default defineComponent({
       router.push({
       router.push({
         name: "ComparisonView",
         name: "ComparisonView",
         query: {id1: id1, id2: id2},
         query: {id1: id1, id2: id2},
-        params: { notAnonymized: props.notAnonymized}
       })
       })
     }
     }
     return {
     return {
@@ -76,7 +79,7 @@ td {
   padding-bottom: 3%;
   padding-bottom: 3%;
 }
 }
 
 
-.anonymous {
+.anonymous-style {
   color: #777777;
   color: #777777;
   filter: blur(1px);
   filter: blur(1px);
 }
 }

+ 2 - 2
report-viewer/src/components/IDsList.vue

@@ -1,11 +1,11 @@
 <template>
 <template>
 <div class="container">
 <div class="container">
   <div class="column-list">
   <div class="column-list">
-    <p v-for="(id, index) in ids" :key="index" @click="$emit('idSent', id)">
+    <p v-for="(id, index) in ids" :key="index" @click="$emit('idSent', [id])">
       {{ id }}
       {{ id }}
     </p>
     </p>
   </div>
   </div>
-  <button @click="$emit('idSent', ...ids)">Hide/Show all</button>
+  <button @click="$emit('idSent', ids)">Hide/Show all</button>
 </div>
 </div>
 </template>
 </template>
 
 

+ 5 - 2
report-viewer/src/main.ts

@@ -1,7 +1,10 @@
 import { createApp } from "vue";
 import { createApp } from "vue";
 import App from "./App.vue";
 import App from "./App.vue";
 import router from "./router";
 import router from "./router";
+import store from "./store/store"
 import './libs/highlightjs/styles/edited/vs.min.css'
 import './libs/highlightjs/styles/edited/vs.min.css'
 import 'highlight.js/lib/common';
 import 'highlight.js/lib/common';
-import hljsVuePlugin from "@highlightjs/vue-plugin";
-createApp(App).use(router).use(hljsVuePlugin).mount("#app");
+
+
+
+createApp(App).use(router).use(store).mount("#app");

+ 26 - 0
report-viewer/src/store/store.ts

@@ -0,0 +1,26 @@
+import { createStore} from "vuex";
+
+const store = createStore({
+    state () {
+        return {
+            anonymous : new Set()
+        }
+    },
+    mutations: {
+        addAnonymous (state: any, id) {
+            for (let i = 0; i < id.length; i++) {
+                state.anonymous.add(id[i])
+            }
+        },
+        removeAnonymous (state, id) {
+            for (let i = 0; i < id.length; i++) {
+                state.anonymous.delete(id[i])
+            }
+        },
+        resetAnonymous (state) {
+            state.anonymous = new Set()
+        }
+    }
+})
+
+export default store

+ 6 - 6
report-viewer/src/views/ComparisonView.vue

@@ -9,8 +9,8 @@
         <button id="hide-button" @click="togglePanel" title="Hide sidebar">
         <button id="hide-button" @click="togglePanel" title="Hide sidebar">
           <img src="@/assets/keyboard_double_arrow_left_white_24dp.svg" alt="hide"></button>
           <img src="@/assets/keyboard_double_arrow_left_white_24dp.svg" alt="hide"></button>
       </div>
       </div>
-      <TextInformation label="Submission 1" :value="id1" :anonymous="!notAnonymized.includes(id1)"/>
-      <TextInformation label="Submission 2" :value="id2" :anonymous="!notAnonymized.includes(id2)"/>
+      <TextInformation label="Submission 1" :value="id1" :anonymous="store.state.anonymous.has(id1)"/>
+      <TextInformation label="Submission 2" :value="id2" :anonymous="store.state.anonymous.has(id2)"/>
       <TextInformation label="Match %" :value="comparison.match_percentage"/>
       <TextInformation label="Match %" :value="comparison.match_percentage"/>
       <MatchTable :matches="comparison.allMatches" :id1="id1" :id2="id2" @match-selected="showMatch" />
       <MatchTable :matches="comparison.allMatches" :id1="id1" :id2="id2" @match-selected="showMatch" />
     </div>
     </div>
@@ -28,6 +28,7 @@
 <script>
 <script>
 import { defineComponent, ref } from "vue";
 import { defineComponent, ref } from "vue";
 import {generateLineCodeLink} from "@/utils/Utils";
 import {generateLineCodeLink} from "@/utils/Utils";
+import store from "@/store/store";
 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";
 import {ComparisonFactory} from "@/model/factories/ComparisonFactory";
@@ -43,9 +44,6 @@ export default defineComponent({
     id2: {
     id2: {
       type: String,
       type: String,
     },
     },
-    notAnonymized: {
-      type: Array
-    }
   },
   },
   setup(props) {
   setup(props) {
     const fileName = props.id1.concat("-").concat(props.id2)
     const fileName = props.id1.concat("-").concat(props.id2)
@@ -91,7 +89,9 @@ export default defineComponent({
       showMatchInFirst,
       showMatchInFirst,
       showMatchInSecond,
       showMatchInSecond,
       showMatch,
       showMatch,
-      togglePanel
+      togglePanel,
+
+      store
     }
     }
   }
   }
 })
 })

+ 15 - 14
report-viewer/src/views/Overview.vue

@@ -39,7 +39,7 @@
         <p class="section-title">Top Comparisons:</p>
         <p class="section-title">Top Comparisons:</p>
         <p class="section-subtitle">(Top n comparisons)</p>
         <p class="section-subtitle">(Top n comparisons)</p>
         <div id="comparisonsList">
         <div id="comparisonsList">
-          <ComparisonsTable :top-comparisons="topComps[selectedMetricIndex]" :not-anonymized="notAnonymized"/>
+          <ComparisonsTable :top-comparisons="topComps[selectedMetricIndex]" :anonymous="store.state.anonymous"/>
         </div>
         </div>
     </div>
     </div>
   </div>
   </div>
@@ -47,6 +47,7 @@
 
 
 <script>
 <script>
 import {defineComponent, ref} from "vue";
 import {defineComponent, ref} from "vue";
+import store from "@/store/store";
 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";
@@ -62,23 +63,23 @@ export default defineComponent({
   },
   },
   setup() {
   setup() {
     const overview = OverviewFactory.getOverview(Overview)
     const overview = OverviewFactory.getOverview(Overview)
-    let notAnonymized = ref([...overview.submissionIds])
 
 
-    const handleId = (...id) => {
+    const handleId = (id) => {
       if( id.length === overview.submissionIds.length) {
       if( id.length === overview.submissionIds.length) {
-        if(notAnonymized.value.length > 0) {
-          notAnonymized.value = []
+        if(store.state.anonymous.size > 0) {
+          store.commit("resetAnonymous")
         } else {
         } else {
-          notAnonymized.value = [...overview.submissionIds]
+          store.commit("addAnonymous", id)
         }
         }
       } else {
       } else {
-          if ( notAnonymized.value.length === overview.submissionIds.length) {
-            notAnonymized.value = []
-          }
-          if (notAnonymized.value.includes(id[0])) {
-            notAnonymized.value.splice(notAnonymized.value.indexOf(id[0]), 1)
+          if (store.state.anonymous.has(id[0])) {
+            store.commit("removeAnonymous", id)
           } else {
           } else {
-            notAnonymized.value.push(id[0])
+            if(store.state.anonymous.size === 0) {
+              store.commit("addAnonymous", overview.submissionIds.filter(s => s !== id[0]))
+            } else  {
+              store.commit("addAnonymous", id)
+            }
           }
           }
       }
       }
     }
     }
@@ -108,9 +109,9 @@ export default defineComponent({
       selectedMetric,
       selectedMetric,
       distributions,
       distributions,
       topComps,
       topComps,
-      notAnonymized,
       handleId,
       handleId,
-      selectMetric
+      selectMetric,
+      store
     }
     }
   }
   }
 })
 })