-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.html
executable file
·494 lines (477 loc) · 16.6 KB
/
profile.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if !IE]><!-->
<html lang="zh-CN">
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<title>操作系统自动化安装管理系统</title>
<meta
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
name="viewport"
/>
<meta content="" name="description" />
<meta content="" name="author" />
<!-- ================== BEGIN BASE CSS STYLE ================== -->
<link
href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700"
rel="stylesheet"
/>
<link
href="assets/plugins/jquery-ui/themes/base/minified/jquery-ui.min.css"
rel="stylesheet"
/>
<link
href="assets/plugins/bootstrap/css/bootstrap.min.css"
rel="stylesheet"
/>
<link
href="assets/plugins/font-awesome/css/font-awesome.min.css"
rel="stylesheet"
/>
<link href="assets/css/animate.min.css" rel="stylesheet" />
<link href="assets/css/style.min.css" rel="stylesheet" />
<link href="assets/css/style-responsive.min.css" rel="stylesheet" />
<link href="assets/css/theme/default.css" rel="stylesheet" id="theme" />
<!-- ================== END BASE CSS STYLE ================== -->
<!-- ================== BEGIN BASE JS ================== -->
<link
href="assets/plugins/DataTables/css/data-table.css"
rel="stylesheet"
/>
<script src="assets/plugins/pace/pace.min.js"></script>
<!-- ================== END BASE JS ================== -->
</head>
<body>
<!-- begin #page-loader -->
<div id="page-loader" class="fade in"><span class="spinner"></span></div>
<!-- end #page-loader -->
<!-- begin #page-container -->
<div id="page-container" class="fade page-sidebar-fixed page-header-fixed">
<!-- begin #header -->
<div id="header" class="header navbar navbar-default navbar-fixed-top">
<!-- begin container-fluid -->
<div class="container-fluid">
<!-- begin mobile sidebar expand / collapse button -->
<div class="navbar-header">
<a href="index.html" class="navbar-brand"
><span class="navbar-logo"></span> OSAIMS
</a>
<button
type="button"
class="navbar-toggle"
data-click="sidebar-toggled"
>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- end mobile sidebar expand / collapse button -->
<!-- begin header navigation right -->
<ul class="nav navbar-nav navbar-right">
<li class="dropdown navbar-user">
<a
href="javascript:;"
class="dropdown-toggle"
data-toggle="dropdown"
>
<img
src="http://ww1.sinaimg.cn/large/006tNc79ly1g3chy90b1vj303a03c0sp.jpg"
alt="avatar"
/>
<span class="hidden-xs">陶俊存</span> <b class="caret"></b>
</a>
<ul class="dropdown-menu animated fadeInLeft">
<li class="arrow"></li>
<li><a href="javascript:;">个人中心</a></li>
<li class="divider"></li>
<li><a href="javascript:;">系统设置</a></li>
<li class="divider"></li>
<li><a href="javascript:;">退出登录</a></li>
</ul>
</li>
</ul>
<!-- end header navigation right -->
</div>
<!-- end container-fluid -->
</div>
<!-- end #header -->
<!-- begin #sidebar -->
<div id="sidebar" class="sidebar">
<!-- begin sidebar scrollbar -->
<div data-scrollbar="true" data-height="100%">
<!-- begin sidebar nav -->
<ul class="nav">
<li class="has-sub">
<a href="javascript:;">
<b class="caret pull-right"></b>
<i class="fa fa-laptop"></i>
<span>Dashboard</span>
</a>
<ul class="sub-menu">
<li><a href="index.html">Dashboard v1</a></li>
<li><a href="index_v2.html">Dashboard v2</a></li>
</ul>
</li>
<li class="active">
<a href="javascript:;">
<b class="caret pull-right"></b>
<i class="fa fa-cogs"></i>
<span>Profile</span>
</a>
</li>
<!-- begin sidebar minify button -->
<li>
<a
href="javascript:;"
class="sidebar-minify-btn"
data-click="sidebar-minify"
><i class="fa fa-angle-double-left"></i
></a>
</li>
<!-- end sidebar minify button -->
</ul>
<!-- end sidebar nav -->
</div>
<!-- end sidebar scrollbar -->
</div>
<div class="sidebar-bg"></div>
<!-- end #sidebar -->
<!-- begin #content -->
<div id="content" class="content">
<!-- begin breadcrumb -->
<ol class="breadcrumb pull-right">
<li><a href="javascript:;">Home</a></li>
<li><a href="javascript:;">Configuration</a></li>
<li class="active">Distros</li>
</ol>
<!-- end breadcrumb -->
<!-- begin page-header -->
<h1 class="page-header">Profile</h1>
<!-- end page-header -->
<div class="panel panel-inverse">
<div class="panel-heading">
<div class="panel-heading-btn">
<a
href="javascript:;"
class="btn btn-xs btn-icon btn-circle btn-default"
data-click="panel-expand"
><i class="fa fa-expand"></i
></a>
<a
href="javascript:;"
class="btn btn-xs btn-icon btn-circle btn-warning"
data-click="panel-collapse"
><i class="fa fa-minus"></i
></a>
<a
href="javascript:;"
class="btn btn-xs btn-icon btn-circle btn-danger"
data-click="panel-remove"
><i class="fa fa-times"></i
></a>
</div>
<h4 class="panel-title">输入分发信息</h4>
</div>
<!-- panel body -->
<div class="panel-body">
<div class="table-responsive">
<table
id="data-table"
class="table table-striped table-bordered"
></table>
</div>
</div>
</div>
</div>
<!-- end #content -->
<!-- begin scroll to top btn -->
<a
href="javascript:;"
class="btn btn-icon btn-circle btn-success btn-scroll-to-top fade"
data-click="scroll-top"
><i class="fa fa-angle-up"></i
></a>
<!-- end scroll to top btn -->
</div>
<!-- end page container -->
<!-- out of page -->
<!-- #modal-dialog -->
<div class="modal fade" id="modal-dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">增加profile</h4>
</div>
<div class="modal-body">
<form class="form-horizontal">
<div class="form-group">
<label class="col-md-3 control-label">Name</label>
<div class="col-md-9">
<input type="text" class="form-control" id="name" />
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Distro</label>
<div class="col-md-9" id="distros">
<select class="form-control">
<option>选择分发版本</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">kickstart</label>
<div class="col-md-9" id="kss">
<select class="form-control">
<option>选择ks</option>
</select>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<a
href="javascript:;"
class="btn btn-sm btn-white"
onclick="ClearForm()"
>取消</a
>
<a
href="javascript:;"
class="btn btn-sm btn-primary"
onclick="SaveProfile()"
>保存</a
>
</div>
</div>
</div>
</div>
<!-- ================== BEGIN BASE JS ================== -->
<script src="assets/plugins/jquery/jquery-1.9.1.min.js"></script>
<script src="assets/plugins/jquery/jquery-migrate-1.1.0.min.js"></script>
<script src="assets/plugins/jquery-ui/ui/minified/jquery-ui.min.js"></script>
<script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="assets/crossbrowserjs/html5shiv.js"></script>
<script src="assets/crossbrowserjs/respond.min.js"></script>
<script src="assets/crossbrowserjs/excanvas.min.js"></script>
<![endif]-->
<script src="assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="assets/plugins/jquery-cookie/jquery.cookie.js"></script>
<!-- ================== END BASE JS ================== -->
<!-- ================== BEGIN PAGE LEVEL JS ================== -->
<script src="assets/plugins/DataTables/js/jquery.dataTables.js"></script>
<script src="assets/plugins/DataTables/js/dataTables.tableTools.js"></script>
<script src="assets/js/apps.min.js"></script>
<!-- ================== END PAGE LEVEL JS ================== -->
<script>
$(document).ready(function() {
App.init();
});
</script>
<script>
$(function() {
var table = $("#data-table").DataTable({
dom: 'T<"clear">lfrtip',
tableTools: {
// sSwfPath: "assets/plugins/DataTables/swf/copy_csv_xls_pdf.swf"
aButtons: [
{
sExtends: "select",
sButtonText: "新增profile项目",
fnClick: function(nButton, oConfig, oFlash) {
$.ajax({
type: "get",
url: "http://10.241.53.227:22222/distros",
dataType: "json",
success: function(response) {
distros = Array.from(response);
distrosSelect = $("#distros select");
distros.forEach(element => {
distrosSelect.append(
"<option>" + element["name"] + "</option>"
);
});
}
});
$.ajax({
type: "get",
url: "http://10.241.53.227:22222/ks_list",
dataType: "json",
success: function(response) {
kss = Array.from(response);
kssSelect = $("#kss select");
console.log(response, kssSelect);
kss.forEach(element => {
kssSelect.append(
"<option>" + element["path"] + "</option>"
);
});
}
});
$("#modal-dialog").modal({
backdrop: "static",
keyboard: false
});
}
}
]
},
ajax: {
url: "http://10.241.53.227:22222/profiles",
dataSrc: "", //默认为data
type: "get",
error: function() {
alert("服务器未正常响应,请重试");
}
},
// bAutoWidth: false,
// aoColumns: [{ sWidth: "20%" }, { sWidth: "60%" }, { sWidth: "20%" }],
columns: [
{
data: "name",
title: "名称",
defaultContent: ""
},
{
data: "distro",
title: "分发",
defaultContent: ""
},
{
data: null,
title: "操作",
defaultContent:
"<button class='btn btn-success btn-sm'>提交</button> <button class='btn btn-warning btn-sm'>删除</button>"
}
],
language: {
sProcessing: "处理中...",
sLengthMenu: "显示 _MENU_ 项结果",
sZeroRecords: "没有匹配结果",
sInfo: "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
sInfoEmpty: "显示第 0 至 0 项结果,共 0 项",
sInfoFiltered: "(由 _MAX_ 项结果过滤)",
sInfoPostFix: "",
sSearch: "搜索:",
sUrl: "",
sEmptyTable: "表中数据为空",
sLoadingRecords: "载入中...",
sInfoThousands: ",",
oPaginate: {
sFirst: "首页",
sPrevious: "上页",
sNext: "下页",
sLast: "末页"
},
oAria: {
sSortAscending: ": 以升序排列此列",
sSortDescending: ": 以降序排列此列"
}
}
});
var oldValue = "";
// 双击变input,失焦设置tr及data
$("#data-table tbody").on("dblclick", "td", function() {
if (table.cell(this).index().columnVisible == 1) {
return false;
}
var tr = $(this).parents("tr");
var that = this;
var tds = tr.children();
oldValue = $(tds[0]).html();
$(tds[0]).html(
"<input type='text' class='form-control' value='" +
oldValue +
"' />"
);
$(tds[0])
.children("input")
.focus();
$($(tds[0]).children("input")[0]).on("blur", function() {
var newValue = $($(this)[0]).val();
$(
$($(this)[0])
.parents("tr")
.children()[0]
).html(newValue);
table.cell(that).data(newValue);
});
});
// 点击
$("#data-table tbody").on("click", "button", function() {
var tds = $(this)
.parents("tr")
.children();
var td = tds[0];
// var index = table.cell(td).index().row;
// 提交
if ($(this).hasClass("btn-success")) {
SubmitData($(td).text());
} else {
// 删除
DeleteData($(td).text());
}
});
// 提交重命名 rename
function SubmitData(newValue) {
// 发送指定index的数据
console.log(oldValue, newValue);
$.ajax({
type: "method",
url: "url",
data: "data",
dataType: "dataType",
success: function(response) {}
});
}
// 删除数据
function DeleteData(name) {
$.ajax({
type: "post",
url: "http://10.241.53.227:22222/delete",
data: { profile_name: name },
dataType: "json",
success: function() {
table.ajax.reload();
}
});
}
});
</script>
<script>
function SaveProfile() {
var name = $("#name").val();
var distro_name = $("#distros select")
.find("option:selected")
.text();
var ksfile_name = $("#kss select")
.find("option:selected")
.text();
$.ajax({
type: "post",
url: "http://10.241.53.227:22222/new_profile",
data: {
name,
distro_name,
ksfile_name
},
dataType: "json",
success: function(response) {
var table = $("#data-table").DataTable();
table.ajax.reload();
ClearForm();
}
});
}
// 恢复初始状态,每次重新请求
function ClearForm() {
$("#modal-dialog").modal("hide");
$("#name").val("");
$("#distros select").html("<option>选择分发版本</option>");
$("#kss select").html("<option>选择kickstart版本</option>");
}
</script>
</body>
</html>