forked from dreamfactorysoftware/app-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.html
165 lines (142 loc) · 6.83 KB
/
schema.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<table style="width:100%" ng-controller="SchemaCtrl">
<tr>
<td id="item-list">
<div id="grid-table" class="well">
<table id="app-list" class="table table-hover table-striped">
<thead>
<tr>
<th>Table Name</th>
<th class="no-border"></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="table in schemaData" id="row_{{table.name}}">
<td ng-click="showData()">{{table.name}}</td>
<td class="no-border">
<div class="btn-group">
<a class="btn btn-small btn-inverse"><i class="icon-edit"></i></a>
<a class="btn btn-small btn-inverse" ng-click="delete()"><i class="icon-trash"></i></a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td> </td>
<td id="app-details" class="well">
<div class="navbar">
<div class="navbar-inner"><div class="brand">Tables</div>
<div class="btn-group pull-right">
<a ng-click="showJSON()" class="btn btn-small">
<li class="icon-upload-alt"></li>
Import JSON Schema
</a><a ng-click="showForm()" class="btn btn-small">
<li class="icon-plus-sign-alt"></li>
Create New Table</a>
</div>
</div>
</div>
<div>
<div class="detail-view">
<div id="grid-container">
<div id="schema-main" ng-grid="browseOptions"></div>
</div>
<div id="create-form">
<div class="section">
<b>Create Table</b>
</div>
<div class="section">
Table Name: <input id="table-name" type="text" ng-model="schema.table.name"/>
</div>
<div class="section">
<b>Add Fields</b>
</div>
<div class="section">
Field Name: <input type="text" ng-model="schema.table.field.name"/>
</div>
<div class="section">
Field Type: <select ng-model="schema.table.field.type">
<option value="id">ID / Primary Key</option>
<option value="string">String</option>
<option value="integer">Integer</option>
<option value="text">Text</option>
<option value="boolean">Boolean</option>
<option value="binary">Binary</option>
<option value="blob">Blob</option>
<option value="float">Float</option>
<option value="decimal">Decimal</option>
<option value="datetime">Datetime</option>
<option value="date">Date</option>
<option value="time">Time</option>
</select>
</div>
<div class="section">
Field Size: <input type="text" ng-model="schema.table.field.size"/>
</div>
<div class="section">
Allow Null: <input type="checkbox" ng-model="schema.table.field.allow_null"/>
</div>
<div><a class="btn btn-primary" ng-click="addField()">
<li class="icon-plus-sign-alt"></li>
Add Field</a></div>
<div id="fields_container"></div>
<table id="field-list" class="table table-hover table-striped">
<tbody>
<tr ng-repeat="field in newTable.table.field">
<td>{{field.name}}</td>
<td>{{field.type}}</td>
<td>{{field.size}}</td>
<td>{{field.allow_null}}</td>
<td class="no-border">
<div class="btn-group">
<a class="btn btn-small btn-inverse" ng-click="removeField()"><i
class="icon-trash"></i></a>
</div>
</td>
</tr>
</tbody>
</table>
<div><a class="btn btn-primary" ng-click="create()">
<li class="icon-save"></li>
Create Table</a></div>
</div>
</div>
<div id="json_upload" style="display:none;">
<style>
body {
font-family: sans-serif;
}
#result {
padding: 1em;
}
.pass {
background-color: #efe;
color: #393;
border: 2px solid #393;
}
.fail {
background-color: #fee;
color: #933;
border: 2px solid #933;
}
textarea {
width: 100%;
}
</style>
<h5>Enter JSON Schema</h5>
<textarea id="source" rows="20" cols="50"></textarea>
<div style="white-space: nowrap" class="form-inline">
<button ng-click="validateJSON()" id="button">Validate</button> <input type="checkbox" value="yes" id="reformat"/>
<label for="reformat">Reformat JSON?</label>
</div>
<h2>Results</h2>
<pre id="result"></pre>
<p>
<button class="btn btn-primary" ng-click="postJSON()" class="icon-save"> Create Table</button>
</p>
</div>
</div>
</td>
</tr>
</table>