-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathschema.html
More file actions
executable file
·167 lines (141 loc) · 7.49 KB
/
schema.html
File metadata and controls
executable file
·167 lines (141 loc) · 7.49 KB
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
165
166
<table style="width:100%">
<tr>
<td id="item-list" class="well">
<div id="grid-table">
<table id="app-list" class="table table-hover table-striped">
<thead>
<tr>
<th>Table</th>
<th class="no-border"></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="table in schemaData" id="row_{{table.name}}">
<td ng-click="showSchema()">{{table.name}}</td>
<td class="no-border">
<a class="btn btn-small btn-inverse" title="Delete this table" ng-click="delete()"><i class="icon-trash"></i></a>
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td> </td>
<td id="app-details" class="well">
<div class="navbar">
<div class="navbar-inner"><div class="brand">Manage Schema</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 class="alert alert-info">
<li class="icon-info-sign"></li>
Add or Delete fields from your database schema below. The first row is used to add a new field.
</div>
<div id="schema-main" ng-grid="browseOptions"></div>
</div>
<div id="create-form">
<div class="alert alert-info">
<li class="icon-info-sign"></li>
Propose table structure and click "Create Table" to save.
</div>
<div class="section">
<span>Table Name:</span><input id="table-name" type="text" ng-model="schema.table.name"/>
</div>
<div class="alert alert-info">
<li class="icon-info-sign"></li>
Add fields
</div>
<div class="section">
<span>Field Name:</span><input ng-disabled="!schema.table.name" type="text" ng-model="schema.table.field.name"/>
<br/>
<span>Field Type:</span><select ng-disabled="!schema.table.name || !schema.table.field.name" 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="float">Float</option>
<option value="decimal">Decimal</option>
<option value="datetime">Datetime</option>
<option value="date">Date</option>
<option value="time">Time</option>
</select>
<br/>
<span>Field Size:</span><input ng-disabled="!schema.table.name || !schema.table.field.name || !schema.table.field.type" type="text" ng-model="schema.table.field.size"/>
<br/>
<span>Allow Null:</span><input ng-disabled="!schema.table.name || !schema.table.field.name || !schema.table.field.type"type="checkbox" ng-model="schema.table.field.allow_null"/><br/>
<div><button ng-disabled="!schema.table.name || !schema.table.field.name || !schema.table.field.type" class="btn btn-success" ng-click="addField()">
<li class="icon-plus-sign-alt"></li>
Add Field</button></div>
</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><button ng-disabled = "!newTable.table.field.length" class="btn btn-primary" ng-click="create()">
<li class="icon-save"></li>
Create Table</button></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>
<div class="alert alert-info">Paste your JSON Schema below, Click Validate to use JSONlint before creating.</div>
<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(s)</button>
</p>
</div>
</div>
</td>
</tr>
</table>