-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi_generator.html
77 lines (67 loc) · 4.74 KB
/
api_generator.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<html lang="en">
<head>
<title>Model API generator</title>
<link rel="stylesheet" href="./StyleBase.css">
<link rel="stylesheet" href="./StyleCommon.css?v=0">
<link rel="stylesheet" href="./StyleMAG.css">
<script type="text/javascript" src="src/helpers.js"></script>
</head>
<body>
<div id="mainpage_all">
<div class="vbox">
<div class="hbox gap20 justify_content_flex_start align_items_flex_start header header_fixed">
<a href="../" class="cursor_pointer"><div class="mupif_logo_bgcolor"><img src="mupif-logo.png" class="mupif_logo"></div></a>
<h1>Model API generator</h1>
</div>
<div class="header_height_filler"></div>
<div class="hbox header p2" style="padding: 16px;">
This tool generates Model API implementation for given Model metadata.
The user must provide a valid metadata json, which must contain all information according to the <a class="link" href="https://json-schema-viewer.vercel.app/view?url=https://mupif.readthedocs.io/en/master/_static/schema/ModelMeta.json&expand_buttons=on&show_breadcrumbs=on" target="_blank" style="display: contents;">schema definition</a>. If the user doesn't have the metadata, the "Fill empty template" button can be used to get a valid template to modify.
<br>The essential part of this tool is the code generation of the Model's inputs and outputs, for which it generates class variables, checks for compulsory inputs being filled, and also the content of the "get" and "set" functions.
When the Model API implementation is generated, the user only needs to download it and modify its "solveStep" method.
</div>
<div id="basic_editor">
<div class="mainpage_content vbox align_items_stretch gap20">
<div class="hbox gap20">
<div class="vbox align_items_flex_start gap6" style="flex: 1 1 0;">
<h3><button onclick="setInteractiveEditorVisibility(true)">Open interactive editor</button> or insert model metadata or <button onclick="insertEmptyTemplateMetadata();">Fill empty template</button></h3>
</div>
<div class="vbox align_items_center" style="flex: 1 1 0;">
<div id="elem_error" class="vbox gap6" style="color:red;"></div>
<button id="download_output" style="background-color:white;color:black;border:none;visibility: hidden;" onclick="downloadCode();">Download Model API implementation</button>
</div>
</div>
<div class="hbox gap20">
<div class="vbox align_items_stretch" style="flex: 1 1 0;">
<div class="p2">Model metadata:</div>
<textarea id="data_input" style="width:100%;height:500px;resize: vertical;" wrap="off" onchange="generateApiImplementation();" onkeyup="generateApiImplementation();" spellcheck="false"></textarea>
</div>
<div class="vbox align_items_stretch" style="flex: 1 1 0;">
<div class="p2">Model implementation:</div>
<textarea id="data_output" style="background-color:white;color:black;border:none;width:100%;height:500px;resize: vertical;" wrap="off" disabled spellcheck="false"></textarea>
</div>
</div>
</div>
</div>
<div id="interactive_editor" style="display: none;">
<div class="mainpage_content vbox align_items_stretch gap20">
<div class="hbox gap20">
<button onclick="setInteractiveEditorVisibility(false)"><- Back to model metadata and implementation</button>
</div>
<div class="hbox gap40">
<div class="vbox gap6" id="interactive_input_params"></div>
<div class="vbox gap6" id="interactive_inputs"></div>
<div class="vbox gap6" id="interactive_outputs"></div>
</div>
</div>
</div>
<div class="hbox justify_content_center gap20" style="padding-bottom: 50px;">
<div class="mupif_logo_bgcolor"><img src="mupif-logo.png" class="footer_logo"></div>
<div class="mupif_logo_bgcolor"><img src="musicode-logo.png" class="footer_logo"></div>
</div>
</div>
</div>
<script type="text/javascript" src="src/mupifData.js"></script>
<script type="text/javascript" src="api_generator.js?v=3"></script>
</body>
</html>