Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
KADMOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LR-FPP-MDO
KADMOS
Commits
49c1a268
Commit
49c1a268
authored
6 years ago
by
imcovangent
Browse files
Options
Downloads
Patches
Plain Diff
Small bug fix for VISTOMS interface.
Former-commit-id: d460b22e25efe8e609fb5f65c60a99948436e6fc
parent
5c78c50d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kadmos/vistoms/interface_vistoms.py
+32
-34
32 additions, 34 deletions
kadmos/vistoms/interface_vistoms.py
kadmos/vistoms/templates/VISTOMS_sessions.html
+1
-1
1 addition, 1 deletion
kadmos/vistoms/templates/VISTOMS_sessions.html
with
33 additions
and
35 deletions
kadmos/vistoms/interface_vistoms.py
+
32
−
34
View file @
49c1a268
...
...
@@ -193,43 +193,41 @@ def interface(debug=True, tempdir=None):
loaded_graph
=
load
(
graphFileName
,
file_check_critical
=
False
)
if
"
name
"
not
in
loaded_graph
.
graph
:
loaded_graph
.
graph
[
"
name
"
]
=
os
.
path
.
splitext
(
dgFile
.
filename
)[
0
].
replace
(
"
_
"
,
"
.
"
)
# Remove the uploaded file (and if existing, database directory) from the temp folder
os
.
remove
(
graphFileName
)
if
os
.
path
.
exists
(
database_dir
):
shutil
.
rmtree
(
database_dir
)
if
isinstance
(
loaded_graph
,
tuple
):
graph
=
loaded_graph
[
0
]
mpg
=
loaded_graph
[
1
]
elif
mpgFile
:
# Check if the right filetype was chosen
if
mpgFile
.
filename
.
rsplit
(
'
.
'
,
1
)[
1
].
lower
()
!=
"
kdms
"
:
return
(
"
ERROR: Wrong file type! Please use a valid KDMS file
"
)
graph
=
loaded_graph
mpgFileName
=
mpgFile
.
filename
mpgFile
.
save
(
os
.
path
.
join
(
upload_folder
,
mpgFileName
))
mpg
=
load
(
os
.
path
.
join
(
upload_folder
,
mpgFileName
),
file_check_critical
=
True
)
# Remove the uploaded file from the temp folder
os
.
remove
(
os
.
path
.
join
(
upload_folder
,
mpgFileName
))
else
:
graph
=
loaded_graph
mpg
=
None
# save the graph as kdms file in temp folder
graph
.
save
(
os
.
path
.
join
(
upload_folder
,
TEMP_FILE
+
'
_
'
+
newGraphID
+
'
.kdms
'
),
file_type
=
'
kdms
'
,
graph_check_critical
=
False
,
mpg
=
mpg
)
# Remove the uploaded file (and if existing, database directory) from the temp folder
os
.
remove
(
graphFileName
)
if
os
.
path
.
exists
(
database_dir
):
shutil
.
rmtree
(
database_dir
)
if
isinstance
(
loaded_graph
,
tuple
):
graph
=
loaded_graph
[
0
]
mpg
=
loaded_graph
[
1
]
elif
mpgFile
:
# Check if the right filetype was chosen
if
mpgFile
.
filename
.
rsplit
(
'
.
'
,
1
)[
1
].
lower
()
!=
"
kdms
"
:
return
(
"
ERROR: Wrong file type! Please use a valid KDMS file
"
)
graph
=
loaded_graph
mpgFileName
=
mpgFile
.
filename
mpgFile
.
save
(
os
.
path
.
join
(
upload_folder
,
mpgFileName
))
mpg
=
load
(
os
.
path
.
join
(
upload_folder
,
mpgFileName
),
file_check_critical
=
True
)
# Remove the uploaded file from the temp folder
os
.
remove
(
os
.
path
.
join
(
upload_folder
,
mpgFileName
))
else
:
graph
=
loaded_graph
mpg
=
None
# Use function order for VISTOMS if it is available in the graph information
function_order
=
None
if
graph
.
graph_has_nested_attributes
(
'
problem_formulation
'
,
'
function_order
'
)
and
mpg
==
None
:
function_order
=
graph
.
graph
[
'
problem_formulation
'
][
'
function_order
'
]
# save the graph as kdms file in temp folder
graph
.
save
(
os
.
path
.
join
(
upload_folder
,
TEMP_FILE
+
'
_
'
+
newGraphID
+
'
.kdms
'
),
file_type
=
'
kdms
'
,
graph_check_critical
=
False
,
mpg
=
mpg
)
# Add the graph with the updated function order to VISTOMS
newVistomsData
=
graph
.
vistoms_add_json
(
graph_id
=
newGraphID
,
function_order
=
function_order
,
mpg
=
mpg
)
# Use function order for VISTOMS if it is available in the graph information
function_order
=
None
if
graph
.
graph_has_nested_attributes
(
'
problem_formulation
'
,
'
function_order
'
)
and
mpg
==
None
:
function_order
=
graph
.
graph
[
'
problem_formulation
'
][
'
function_order
'
]
return
newVistomsData
# Add the graph with the updated function order to VISTOMS
newVistomsData
=
graph
.
vistoms_add_json
(
graph_id
=
newGraphID
,
function_order
=
function_order
,
mpg
=
mpg
)
return
(
"
ERROR: File type
"
+
dgFile
.
filename
.
rsplit
(
'
.
'
,
1
)[
1
].
lower
()
+
"
not allowed!
"
)
return
newVistomsData
except
Exception
as
e
:
return
"
ERROR:
"
+
e
.
message
...
...
@@ -514,7 +512,7 @@ def interface(debug=True, tempdir=None):
upload_folder
=
UPLOAD_FOLDERS
[
sessionID
]
# First of all, delete all graphs, that end with a _backup
delete_backup_graphs
()
delete_backup_graphs
(
upload_folder
)
tmpDir
=
upload_folder
newVIstomsDataArray
=
[]
...
...
This diff is collapsed.
Click to expand it.
kadmos/vistoms/templates/VISTOMS_sessions.html
+
1
−
1
View file @
49c1a268
...
...
@@ -434,7 +434,7 @@
var xhr = $.ajax({
type: 'POST',
url: '/kadmos_add_design_competence',
data: {'graphID':graphID, 'currentOrder':nodeOrder, 'form_data':JSON.stringify(form_data), 'sessionID:sessionID},
data: {'graphID':graphID, 'currentOrder':nodeOrder, 'form_data':JSON.stringify(form_data), 'sessionID
'
:sessionID},
success: function(result)
{
if (result.includes("ERROR:"))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment