Skip to content

Commit 24ff444

Browse files
Bug fixes
1 parent 5a5628c commit 24ff444

File tree

5 files changed

+37
-10
lines changed

5 files changed

+37
-10
lines changed

viplab-standalone-frontend-vue/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VUE_APP_FILENAME = hello-world.docker-container-example
1+
VUE_APP_FILENAME = leap-year.computation-template
22
#leap-year.computation-template
33
#case_1.computation-template
44
#viplab-computation-template

viplab-standalone-frontend-vue/src/input/case_1.computation-template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
},
6262
"parts": [
6363
{
64-
"identifier": "f3fc4404-3529-4962-b252-47bc4ddd02a1",
64+
"identifier": "f3fc4404-3529-4962-b252-47bc4ddd02a2",
6565
"access": "template",
6666
"metadata": {
6767
"name": "Parameters for Execution of Case 1"

viplab-standalone-frontend-vue/src/main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ const store = new Vuex.Store({
8585
"resources.numCPUs": 1
8686
},
8787
"files": []
88-
}
88+
},
89+
modifiedByTeacher: false,
8990
},
9091
mutations: {
9192
updateJsonTemplate (state, newValue) {
@@ -102,6 +103,9 @@ const store = new Vuex.Store({
102103
},
103104
updateGeneratedComputationTemplate (state, newValue) {
104105
state.generatedComputationTemplate = newValue;
106+
},
107+
updateModifiedByTeacher (state, newValue) {
108+
state.modifiedByTeacher = newValue;
105109
}
106110
},
107111
plugins: [

viplab-standalone-frontend-vue/src/pages/teacher/App.vue

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
</b-collapse>
150150

151151
<!-- Graphical View of Template -->
152-
<div class="dnd-window" id="drag-components-here">
152+
<div class="dnd-window" id="drag-components-here" :key="signifyChange">
153153
<b-card no-body>
154154
<b-tabs card class="files" content-class="m-2" fill>
155155

@@ -235,7 +235,7 @@
235235
<b-icon class="when-open" icon="caret-up"></b-icon>
236236
</b-button>
237237
</b-card-header>
238-
<b-collapse :id="item.identifier+'content'" visible accordion="my-accordion-2" role="tabpanel">
238+
<b-collapse :id="item.identifier +'content'" visible accordion="my-accordion-2" role="tabpanel">
239239
<b-card-body>
240240
<div class="part-content-field">
241241
<div class="d-flex">
@@ -1279,7 +1279,8 @@ export default {
12791279
}
12801280
],
12811281
validationRunning: false,
1282-
classValidity: ""
1282+
classValidity: "",
1283+
signifyChange: true,
12831284
};
12841285
},
12851286
computed: {
@@ -1320,6 +1321,14 @@ export default {
13201321
this.$store.commit("updateGeneratedComputationTemplate", newValue)
13211322
}
13221323
},
1324+
modifiedByTeacher : {
1325+
get () {
1326+
return this.$store.state.modifiedByTeacher;
1327+
},
1328+
set (newValue) {
1329+
this.$store.commit("updateModifiedByTeacher", newValue)
1330+
}
1331+
},
13231332
thereIsTemplate() {
13241333
for (var file in this.computationTemplate.files) {
13251334
for (var part in this.computationTemplate.files[file].parts) {
@@ -1633,6 +1642,8 @@ export default {
16331642
this.validationPartParameterResult = null;
16341643
this.validationArgsResult = null;
16351644
this.validationRunning = false;
1645+
1646+
this.$forceUpdate()
16361647
},
16371648
deep: true
16381649
},
@@ -2567,15 +2578,17 @@ export default {
25672578
// TODO: Should also function without metadata as it is not required
25682579
// add metadata if missing
25692580
2581+
// save current template, as it will be overwritten to perform validation
25702582
let tmp = this.computationTemplate;
2583+
// set generatedTemplate/computationTemplate so validation can be performed
25712584
this.$store.commit("updateGeneratedComputationTemplate", obj)
25722585
let isValid = this.validateJson(true)
25732586
if (!isValid) {
25742587
this.$alert("Your template is not valid. Thus, it can not be imported!", "Import Error", "error");
25752588
this.$store.commit("updateGeneratedComputationTemplate", tmp)
25762589
} else {
25772590
this.$store.commit("updateGeneratedComputationTemplate", obj)
2578-
2591+
this.signifyChange = !this.signifyChange
25792592
// set number of options for configuring parameters and commandline arguments
25802593
this.setNumbersOfOptions();
25812594
}
@@ -2615,7 +2628,7 @@ export default {
26152628
let file = JSON.stringify(this.computationTemplate);
26162629
let dataBase64url = base64url(Buffer.from(file).toString());
26172630
2618-
//baseUrl = "http://localhost:3000/";
2631+
baseUrl = "http://localhost:3000/";
26192632
fetch(baseUrl + "sign", {
26202633
method: 'POST',
26212634
body: dataBase64url
@@ -2629,8 +2642,9 @@ export default {
26292642
}).then(jsonResponse => {
26302643
// get token from sign-endpoint
26312644
let token = jsonResponse.token;
2632-
2645+
26332646
// set all values in Vuex store
2647+
this.$store.commit("updateModifiedByTeacher", true);
26342648
this.$store.commit("updateJsonTemplate", this.computationTemplate)
26352649
this.$store.commit("updateToken", token);
26362650
this.$store.commit("updateDataTemplate", dataBase64url);

viplab-standalone-frontend-vue/src/pages/viplab/App.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,14 @@ export default {
627627
this.$store.commit("updateWebSocket", newValue)
628628
}
629629
},
630+
modifiedByTeacher : {
631+
get () {
632+
return this.$store.state.modifiedByTeacher;
633+
},
634+
set (newValue) {
635+
this.$store.commit("updateModifiedByTeacher", newValue)
636+
}
637+
},
630638
/* return parameters section of json file */
631639
parsedParametersJson: function () {
632640
var parsed = this.json.parameters;
@@ -685,9 +693,10 @@ export default {
685693
this.$store.commit("updateDataTemplate", data);
686694
} else if (Object.keys(this.$store.state.jsonTemplate).length > 0) {
687695
console.log("2")
688-
if (data && (data === "{{ data }}" || data === "")) {
696+
if (data && (data === "{{ data }}" || data === "") || this.modifiedByTeacher) {
689697
this.json = this.$store.state.jsonTemplate;
690698
this.dataTemplate = this.$store.state.dataTemplate;
699+
this.$store.commit("updateModifiedByTeacher", false);
691700
} else {
692701
this.json = JSON.parse(base64url.decode(data));
693702
this.$store.commit("updateDataTemplate", data);

0 commit comments

Comments
 (0)