|
|
@@ -7,25 +7,51 @@
|
|
|
<h1>JPlag Report</h1>
|
|
|
<p class="section-title">Main Info:</p>
|
|
|
<div id="basicInfo">
|
|
|
- <TextInformation :has-additional-info="hasMoreSubmissionPaths" :value="submissionPathValue"
|
|
|
- additional-info-title="" label="Directory path">
|
|
|
- <p v-for="path in overview.submissionFolderPath" :key="path" :title="path">{{ path }}</p>
|
|
|
+ <TextInformation
|
|
|
+ :has-additional-info="hasMoreSubmissionPaths"
|
|
|
+ :value="submissionPathValue"
|
|
|
+ additional-info-title=""
|
|
|
+ label="Directory path"
|
|
|
+ >
|
|
|
+ <p
|
|
|
+ v-for="path in overview.submissionFolderPath"
|
|
|
+ :key="path"
|
|
|
+ :title="path"
|
|
|
+ >
|
|
|
+ {{ path }}
|
|
|
+ </p>
|
|
|
</TextInformation>
|
|
|
- <TextInformation :has-additional-info="true" :value="overview.language" additional-info-title="File extensions:"
|
|
|
- label="Language">
|
|
|
+ <TextInformation
|
|
|
+ :has-additional-info="true"
|
|
|
+ :value="overview.language"
|
|
|
+ additional-info-title="File extensions:"
|
|
|
+ label="Language"
|
|
|
+ >
|
|
|
<p v-for="info in overview.fileExtensions" :key="info">{{ info }}</p>
|
|
|
</TextInformation>
|
|
|
- <TextInformation :value="overview.matchSensitivity" label="Match Sensitivity"/>
|
|
|
- <TextInformation :has-additional-info="true" :value="overview.submissionIds.length"
|
|
|
- additional-info-title="Submission IDs:"
|
|
|
- label="Submissions">
|
|
|
- <IDsList :ids="overview.submissionIds" @id-sent="handleId"/>
|
|
|
+ <TextInformation
|
|
|
+ :value="overview.matchSensitivity"
|
|
|
+ label="Match Sensitivity"
|
|
|
+ />
|
|
|
+ <TextInformation
|
|
|
+ :has-additional-info="true"
|
|
|
+ :value="overview.submissionIds.length"
|
|
|
+ additional-info-title="Submission IDs:"
|
|
|
+ label="Submissions"
|
|
|
+ >
|
|
|
+ <IDsList :ids="overview.submissionIds" @id-sent="handleId" />
|
|
|
</TextInformation>
|
|
|
- <TextInformation :value="overview.dateOfExecution" label="Date of execution"/>
|
|
|
- <TextInformation :value="overview.durationOfExecution" label="Duration (in ms)"/>
|
|
|
+ <TextInformation
|
|
|
+ :value="overview.dateOfExecution"
|
|
|
+ label="Date of execution"
|
|
|
+ />
|
|
|
+ <TextInformation
|
|
|
+ :value="overview.durationOfExecution"
|
|
|
+ label="Duration (in ms)"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div id="logo-section">
|
|
|
- <img id="logo" alt="JPlag" src="@/assets/logo-nobg.png">
|
|
|
+ <img id="logo" alt="JPlag" src="@/assets/logo-nobg.png" />
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -33,55 +59,88 @@
|
|
|
<div id="metrics">
|
|
|
<p class="section-title">Metric:</p>
|
|
|
<div id="metrics-list">
|
|
|
- <MetricButton v-for="(metric, i) in overview.metrics" :id="metric.metricName"
|
|
|
- :key="metric.metricName"
|
|
|
- :is-selected="selectedMetric[i]"
|
|
|
- :metric-name="metric.metricName"
|
|
|
- :metric-threshold="metric.metricThreshold"
|
|
|
- @click="selectMetric(i)"/>
|
|
|
+ <MetricButton
|
|
|
+ v-for="(metric, index) in overview.metrics"
|
|
|
+ :id="metric.metricName"
|
|
|
+ :key="metric.metricName"
|
|
|
+ :is-selected="selectedMetric[index]"
|
|
|
+ :metric-name="metric.metricName"
|
|
|
+ :metric-threshold="metric.metricThreshold"
|
|
|
+ @click="selectMetric(index)"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
<p class="section-title">Distribution:</p>
|
|
|
- <DistributionDiagram :distribution="distributions[selectedMetricIndex]" class="full-width"/>
|
|
|
+ <DistributionDiagram
|
|
|
+ :distribution="distributions[selectedMetricIndex]"
|
|
|
+ class="full-width"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class="column-container" style="width: 35%">
|
|
|
<p class="section-title">Top Comparisons:</p>
|
|
|
<div id="comparisonsList">
|
|
|
- <ComparisonsTable :clusters="overview.clusters" :top-comparisons="topComps[selectedMetricIndex]"/>
|
|
|
+ <ComparisonsTable
|
|
|
+ :clusters="overview.clusters"
|
|
|
+ :top-comparisons="topComps[selectedMetricIndex]"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
-<script>
|
|
|
-import {defineComponent, ref} from "vue";
|
|
|
-import store from "@/store/store";
|
|
|
+<script lang="ts">
|
|
|
+import { computed, defineComponent, Ref, ref } from "vue";
|
|
|
import router from "@/router";
|
|
|
-import TextInformation from "../components/TextInformation";
|
|
|
-import DistributionDiagram from "@/components/DistributionDiagram";
|
|
|
-import MetricButton from "@/components/MetricButton";
|
|
|
-import ComparisonsTable from "@/components/ComparisonsTable";
|
|
|
-import {OverviewFactory} from "@/model/factories/OverviewFactory";
|
|
|
-import IDsList from "@/components/IDsList";
|
|
|
+import TextInformation from "../components/TextInformation.vue";
|
|
|
+import DistributionDiagram from "@/components/DistributionDiagram.vue";
|
|
|
+import MetricButton from "@/components/MetricButton.vue";
|
|
|
+import ComparisonsTable from "@/components/ComparisonsTable.vue";
|
|
|
+import { OverviewFactory } from "@/model/factories/OverviewFactory";
|
|
|
+import IDsList from "@/components/IDsList.vue";
|
|
|
+import { useStore } from "vuex";
|
|
|
+import { Overview } from "@/model/Overview";
|
|
|
+import { ComparisonListElement } from "@/model/ComparisonListElement";
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: "OverviewView",
|
|
|
- components: {IDsList, ComparisonsTable, DistributionDiagram, MetricButton, TextInformation},
|
|
|
+ components: {
|
|
|
+ IDsList,
|
|
|
+ ComparisonsTable,
|
|
|
+ DistributionDiagram,
|
|
|
+ MetricButton,
|
|
|
+ TextInformation,
|
|
|
+ },
|
|
|
setup() {
|
|
|
- let overview;
|
|
|
- //Gets the overview file based on the used mode (zip, local, single).
|
|
|
- if (store.state.local) {
|
|
|
- try {
|
|
|
- // eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
|
- overview = OverviewFactory.getOverview(require("../files/overview.json"))
|
|
|
- } catch (e) {
|
|
|
- router.back()
|
|
|
+ const store = useStore();
|
|
|
+ const overviewFile = computed(() => {
|
|
|
+ const index = Object.keys(store.state.files).find((name) =>
|
|
|
+ name.endsWith("overview.json")
|
|
|
+ );
|
|
|
+ return index != undefined
|
|
|
+ ? store.state.files[index]
|
|
|
+ : console.log("Could not find overview.json"); // TODO introduce error page to navigate to
|
|
|
+ });
|
|
|
+
|
|
|
+ const getOverview = (): Overview => {
|
|
|
+ let temp!: Overview;
|
|
|
+ //Gets the overview file based on the used mode (zip, local, single).
|
|
|
+ if (store.state.local) {
|
|
|
+ try {
|
|
|
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
|
+ temp = OverviewFactory.getOverview(require("../files/overview.json"));
|
|
|
+ } catch (e) {
|
|
|
+ router.back();
|
|
|
+ }
|
|
|
+ } else if (store.state.zip) {
|
|
|
+ const overviewJson = JSON.parse(overviewFile.value);
|
|
|
+ temp = OverviewFactory.getOverview(overviewJson);
|
|
|
+ } else if (store.state.single) {
|
|
|
+ temp = OverviewFactory.getOverview(JSON.parse(store.state.fileString));
|
|
|
}
|
|
|
- } else if (store.state.zip) {
|
|
|
- overview = OverviewFactory.getOverview(JSON.parse(store.state.files["overview.json"]))
|
|
|
- } else if (store.state.single) {
|
|
|
- overview = OverviewFactory.getOverview(JSON.parse(store.state.fileString))
|
|
|
- }
|
|
|
+ return temp;
|
|
|
+ };
|
|
|
+
|
|
|
+ let overview = getOverview();
|
|
|
|
|
|
/**
|
|
|
* Handles the selection of an Id to anonymize.
|
|
|
@@ -89,58 +148,63 @@ export default defineComponent({
|
|
|
* If a single id is provided it hides all of the other ids except for the chosen one.
|
|
|
* @param id
|
|
|
*/
|
|
|
- const handleId = (id) => {
|
|
|
+ const handleId = (id: string) => {
|
|
|
if (id.length === overview.submissionIds.length) {
|
|
|
if (store.state.anonymous.size > 0) {
|
|
|
- store.commit("resetAnonymous")
|
|
|
+ store.commit("resetAnonymous");
|
|
|
} else {
|
|
|
- store.commit("addAnonymous", id)
|
|
|
+ store.commit("addAnonymous", id);
|
|
|
}
|
|
|
} else {
|
|
|
if (store.state.anonymous.has(id[0])) {
|
|
|
- store.commit("removeAnonymous", id)
|
|
|
+ store.commit("removeAnonymous", id);
|
|
|
} else {
|
|
|
if (store.state.anonymous.size === 0) {
|
|
|
- store.commit("addAnonymous", overview.submissionIds.filter(s => s !== id[0]))
|
|
|
+ store.commit(
|
|
|
+ "addAnonymous",
|
|
|
+ overview.submissionIds.filter((s) => s !== id[0])
|
|
|
+ );
|
|
|
} else {
|
|
|
- store.commit("addAnonymous", id)
|
|
|
+ store.commit("addAnonymous", id);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
+ };
|
|
|
|
|
|
//Metrics
|
|
|
/**
|
|
|
* Current metric to display distribution and comparisons for.
|
|
|
* @type {Ref<UnwrapRef<boolean[]>>}
|
|
|
*/
|
|
|
- let selectedMetric = ref(overview.metrics.map(() => false))
|
|
|
+ let selectedMetric = ref(overview.metrics.map(() => false));
|
|
|
/**
|
|
|
* Index of current selected metric. Used to obtain information for the metric from the distribution and top
|
|
|
* comparisons array.
|
|
|
* @type {Ref<UnwrapRef<number>>}
|
|
|
*/
|
|
|
- let selectedMetricIndex = ref(0)
|
|
|
+ let selectedMetricIndex = ref(0);
|
|
|
selectedMetric.value[0] = true;
|
|
|
|
|
|
- const selectMetric = (metric) => {
|
|
|
+ const selectMetric = (metric: number) => {
|
|
|
selectedMetric.value = selectedMetric.value.map(() => {
|
|
|
- return false
|
|
|
- })
|
|
|
- selectedMetric.value[metric] = true
|
|
|
- selectedMetricIndex.value = metric
|
|
|
- }
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+ selectedMetric.value[metric] = true;
|
|
|
+ selectedMetricIndex.value = metric;
|
|
|
+ };
|
|
|
|
|
|
//Distribution
|
|
|
- let distributions = ref(overview.metrics.map((m) => m.distribution))
|
|
|
+ let distributions = ref(overview.metrics.map((m) => m.distribution));
|
|
|
|
|
|
//Top Comparisons
|
|
|
- let topComps = ref(overview.metrics.map((m) => m.comparisons))
|
|
|
+ let topComps: Ref<Array<Array<ComparisonListElement>>> = ref(
|
|
|
+ overview.metrics.map((m) => m.comparisons)
|
|
|
+ );
|
|
|
|
|
|
const hasMoreSubmissionPaths = overview.submissionFolderPath.length > 1;
|
|
|
- const submissionPathValue = hasMoreSubmissionPaths ? "Click arrow to see all paths"
|
|
|
- : overview.submissionFolderPath[0]
|
|
|
+ const submissionPathValue = hasMoreSubmissionPaths
|
|
|
+ ? "Click arrow to see all paths"
|
|
|
+ : overview.submissionFolderPath[0];
|
|
|
|
|
|
return {
|
|
|
overview,
|
|
|
@@ -152,10 +216,10 @@ export default defineComponent({
|
|
|
submissionPathValue,
|
|
|
handleId,
|
|
|
selectMetric,
|
|
|
- store
|
|
|
- }
|
|
|
- }
|
|
|
-})
|
|
|
+ store,
|
|
|
+ };
|
|
|
+ },
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
@@ -168,9 +232,9 @@ h1 {
|
|
|
hr {
|
|
|
border: 0;
|
|
|
height: 2px;
|
|
|
- background: linear-gradient(to right, #EDF2FB, transparent, transparent);
|
|
|
+ background: linear-gradient(to right, #edf2fb, transparent, transparent);
|
|
|
width: 100%;
|
|
|
- box-shadow: #D7E3FC 0 1px;
|
|
|
+ box-shadow: #d7e3fc 0 1px;
|
|
|
}
|
|
|
|
|
|
.container {
|
|
|
@@ -244,6 +308,4 @@ hr {
|
|
|
#logo {
|
|
|
flex-shrink: 2;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-</style>
|
|
|
+</style>
|