@@ -1054,10 +1054,20 @@ export default {
1054
1054
// process connected vtu/vtk & csv files
1055
1055
let connectedVtks = {};
1056
1056
let { artifacts } = this .returnedOutputJson ;
1057
- // let created = false;
1057
+ // isNew flag to ensure that connected files are only added once
1058
+ artifacts .forEach ( (artifact ) => {
1059
+ if (artifact .basename ) {
1060
+ connectedVtks[artifact .basename ] = artifact;
1061
+ connectedVtks[artifact .basename ].isNew = false ;
1062
+ }
1063
+ });
1058
1064
1059
1065
// sort result artifacts alphabetically to make sure that connected files are in correct order
1060
- artifacts .sort ((a , b ) => a .path .localeCompare (b .path ));
1066
+ artifacts .sort ((a , b ) => {
1067
+ let a_path = a .path ?? a .basename ;
1068
+ let b_path = b .path ?? b .basename ;
1069
+ return a_path .localeCompare (b_path);
1070
+ });
1061
1071
1062
1072
// get basenames for collections of files
1063
1073
let outputConfig = [];
@@ -1088,12 +1098,14 @@ export default {
1088
1098
connectedVtks[currentBasename].urlsOrContents = [];
1089
1099
connectedVtks[currentBasename].plots = currentConfig .plots ;
1090
1100
connectedVtks[currentBasename].xlabel = currentConfig .xlabel ;
1101
+ connectedVtks[currentBasename].isConnected = true ;
1102
+ connectedVtks[currentBasename].isNew = true ;
1091
1103
}
1092
1104
}
1093
1105
1094
1106
// group results according to the available basenames
1095
1107
for (let a = 0 ; a < artifacts .length ; a += 1 ) {
1096
- if ((artifacts[a].MIMEtype === ' application/vnd.kitware' || artifacts[a].MIMEtype === ' text/csv' ) && ! artifacts[a].artifacts ) {
1108
+ if ((artifacts[a].MIMEtype === ' application/vnd.kitware' || artifacts[a].MIMEtype === ' text/csv' ) && ! artifacts[a].isConnected ) {
1097
1109
const { path } = artifacts[a];
1098
1110
const lastIndex = path .lastIndexOf (' /' );
1099
1111
const filenamePart = path .substr (lastIndex + 1 , path .length );
@@ -1102,7 +1114,6 @@ export default {
1102
1114
const currentBasename = basenames[base];
1103
1115
// filename has to start with basename
1104
1116
if (filenamePart .startsWith (currentBasename)) {
1105
- // console.log(currentBasename + " - " + filenamePart);
1106
1117
connectedVtks[currentBasename].type = artifacts[a].type ;
1107
1118
connectedVtks[currentBasename].MIMEtype = artifacts[a].MIMEtype ;
1108
1119
connectedVtks[currentBasename].basename = currentBasename;
@@ -1130,7 +1141,7 @@ export default {
1130
1141
// delete all vtk and csv artifacts that are part of a collection
1131
1142
artifacts = this .returnedOutputJson .artifacts ;
1132
1143
let b = artifacts .length - 1 ;
1133
- while (b > 0 ) {
1144
+ while (b >= 0 ) {
1134
1145
if (artifacts[b].inCollection ) {
1135
1146
artifacts .splice (b, 1 );
1136
1147
}
@@ -1140,7 +1151,9 @@ export default {
1140
1151
// add vtk/csv collections
1141
1152
const connectedFilesKeys = Object .keys (connectedVtks);
1142
1153
for (let c = 0 ; c < connectedFilesKeys .length ; c += 1 ) {
1143
- this .returnedOutputJson .artifacts .push (connectedVtks[connectedFilesKeys[c]]);
1154
+ if (connectedVtks[connectedFilesKeys[c]].isNew && connectedVtks[connectedFilesKeys[c]].urlsOrContents .length > 0 ) {
1155
+ this .returnedOutputJson .artifacts .push (connectedVtks[connectedFilesKeys[c]]);
1156
+ }
1144
1157
}
1145
1158
}
1146
1159
@@ -1160,9 +1173,9 @@ export default {
1160
1173
}
1161
1174
});
1162
1175
1163
- // TODO: Vars nicht überschreiben, sondern ergänzen für intermediate
1164
1176
this .outputFiles = this .outputFiles .concat (base64url .decode (result .result .output .stdout ));
1165
1177
this .errorFiles = this .errorFiles .concat (base64url .decode (result .result .output .stderr ));
1178
+ this .$forceUpdate ();
1166
1179
},
1167
1180
/** get content from s3 */
1168
1181
async getContentFromS3 (url , isViPLabGraphics = false ) {
0 commit comments