Skip to content

Commit 9846cc0

Browse files
committed
laravel-admin 2.0适配
1 parent eb22bef commit 9846cc0

File tree

11 files changed

+318
-360
lines changed

11 files changed

+318
-360
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"require": {
1515
"php": ">=7.0.0",
16-
"encore/laravel-admin": "*"
16+
"encore/laravel-admin": "~2.*"
1717
},
1818
"require-dev": {
1919
"phpunit/phpunit": "~6.0"

resources/views/artisan.blade.php

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
<script>
2-
$(function () {
3-
1+
<script require="slimscroll">
42
var storageKey = function () {
53
var connection = $('#connections').val();
64
return 'la-'+connection+'-history'
@@ -67,14 +65,13 @@ function History () {
6765
method: 'post',
6866
data: {
6967
c: $input.val(),
70-
_token: LA.token
7168
},
7269
success: function (response) {
7370
7471
history.push($input.val());
7572
7673
$('#terminal-box')
77-
.append('<div class="item"><small class="label label-default"> > artisan '+$input.val()+'<\/small><\/div>')
74+
.append('<div class="item"><small class="badge badge-secondary"> > artisan '+$input.val()+'<\/small><\/div>')
7875
.append('<div class="item">'+response+'<\/div>')
7976
.slimScroll({ scrollTo: $("#terminal-box")[0].scrollHeight });
8077
@@ -114,20 +111,19 @@ function History () {
114111
send();
115112
});
116113
117-
});
118114
</script>
119115
<!-- Chat box -->
120-
<div class="box box-primary">
121-
<div class="box-header with-border">
116+
<div class="card card-@color card-outline">
117+
<div class="card-header with-border">
122118
<i class="fa fa-terminal"></i>
123119
</div>
124-
<div class="box-body chat" id="terminal-box">
120+
<div class="card-body chat" id="terminal-box">
125121
<!-- chat item -->
126122

127123
<!-- /.item -->
128124
</div>
129125
<!-- /.chat -->
130-
<div class="box-footer with-border">
126+
<div class="card-footer with-border">
131127

132128
<div style="margin-bottom: 10px;">
133129

@@ -140,7 +136,7 @@ function History () {
140136
</button>
141137
<ul class="dropdown-menu" role="menu">
142138
@foreach($command as $item)
143-
<li><a href="#" class="loaded-command">{{$item}}</a></li>
139+
<a href="#" class="loaded-command dropdown-item">{{$item}}</a>
144140
@endforeach
145141
</ul>
146142
</div>
@@ -154,20 +150,25 @@ function History () {
154150
</button>
155151
<ul class="dropdown-menu" role="menu">
156152
@foreach($commands['others'] as $item)
157-
<li><a href="#" class="loaded-command">{{$item}}</a></li>
153+
<a href="#" class="loaded-command dropdown-item">{{$item}}</a>
158154
@endforeach
159155
</ul>
160156
</div>
161157

162-
<button type="button" class="btn btn-success" id="terminal-send"><i class="fa fa-paper-plane"></i> send</button>
163158

164-
<button type="button" class="btn btn-warning" id="terminal-clear"><i class="fa fa-refresh"></i> clear</button>
165159
</div>
166160

167161
<div class="input-group">
168-
<span class="input-group-addon" style="font-size: 18px; line-height: 1.3333333;">artisan</span>
169-
<input class="form-control input-lg" id="terminal-query" placeholder="command" style="border-left: 0px;padding-left: 0px;">
162+
<div class="input-group-prepend">
163+
<span class="input-group-text" >artisan</span>
164+
</div>
165+
<input class="form-control input-lg" id="terminal-query" placeholder="command">
166+
<div class="input-group-append">
167+
<button type="button" class="btn btn-success" id="terminal-send"><i class="fas fa-paper-plane"></i> send</button>
168+
169+
<button type="button" class="btn btn-warning" id="terminal-clear"><i class="fas fa-sync"></i> clear</button>
170+
</div>
170171
</div>
171172
</div>
172173
</div>
173-
<!-- /.box (chat box) -->
174+
<!-- /.card (chat card) -->

resources/views/database.blade.php

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<script> Sfdump = window.Sfdump || (function (doc) { var refStyle = doc.createElement('style'), rxEsc = /([.*+?^${}()|\[\]\/\\])/g, idRx = /\bsf-dump-\d+-ref[012]\w+\b/, keyHint = 0 <= navigator.platform.toUpperCase().indexOf('MAC') ? 'Cmd' : 'Ctrl', addEventListener = function (e, n, cb) { e.addEventListener(n, cb, false); }; (doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle); if (!doc.addEventListener) { addEventListener = function (element, eventName, callback) { element.attachEvent('on' + eventName, function (e) { e.preventDefault = function () {e.returnValue = false;}; e.target = e.srcElement; callback(e); }); }; } function toggle(a, recursive) { var s = a.nextSibling || {}, oldClass = s.className, arrow, newClass; if ('sf-dump-compact' == oldClass) { arrow = '&#9660;'; newClass = 'sf-dump-expanded'; } else if ('sf-dump-expanded' == oldClass) { arrow = '&#9654;'; newClass = 'sf-dump-compact'; } else { return false; } a.lastChild.innerHTML = arrow; s.className = newClass; if (recursive) { try { a = s.querySelectorAll('.'+oldClass); for (s = 0; s < a.length; ++s) { if (a[s].className !== newClass) { a[s].className = newClass; a[s].previousSibling.lastChild.innerHTML = arrow; } } } catch (e) { } } return true; }; return function (root) { root = doc.getElementById(root); function a(e, f) { addEventListener(root, e, function (e) { if ('A' == e.target.tagName) { f(e.target, e); } else if ('A' == e.target.parentNode.tagName) { f(e.target.parentNode, e); } }); }; function isCtrlKey(e) { return e.ctrlKey || e.metaKey; } addEventListener(root, 'mouseover', function (e) { if ('' != refStyle.innerHTML) { refStyle.innerHTML = ''; } }); a('mouseover', function (a) { if (a = idRx.exec(a.className)) { try { refStyle.innerHTML = 'pre.sf-dump .'+a[0]+'{background-color: #B729D9; color: #FFF !important; border-radius: 2px}'; } catch (e) { } } }); a('click', function (a, e) { if (/\bsf-dump-toggle\b/.test(a.className)) { e.preventDefault(); if (!toggle(a, isCtrlKey(e))) { var r = doc.getElementById(a.getAttribute('href').substr(1)), s = r.previousSibling, f = r.parentNode, t = a.parentNode; t.replaceChild(r, a); f.replaceChild(a, s); t.insertBefore(s, r); f = f.firstChild.nodeValue.match(indentRx); t = t.firstChild.nodeValue.match(indentRx); if (f && t && f[0] !== t[0]) { r.innerHTML = r.innerHTML.replace(new RegExp('^'+f[0].replace(rxEsc, '\\$1'), 'mg'), t[0]); } if ('sf-dump-compact' == r.className) { toggle(s, isCtrlKey(e)); } } if (doc.getSelection) { try { doc.getSelection().removeAllRanges(); } catch (e) { doc.getSelection().empty(); } } else { doc.selection.empty(); } } }); var indentRx = new RegExp('^('+(root.getAttribute('data-indent-pad') || ' ').replace(rxEsc, '\\$1')+')+', 'm'), elt = root.getElementsByTagName('A'), len = elt.length, i = 0, t = []; while (i < len) t.push(elt[i++]); elt = root.getElementsByTagName('SAMP'); len = elt.length; i = 0; while (i < len) t.push(elt[i++]); root = t; len = t.length; i = t = 0; while (i < len) { elt = root[i]; if ("SAMP" == elt.tagName) { elt.className = "sf-dump-expanded"; a = elt.previousSibling || {}; if ('A' != a.tagName) { a = doc.createElement('A'); a.className = 'sf-dump-ref'; elt.parentNode.insertBefore(a, elt); } else { a.innerHTML += ' '; } a.title = (a.title ? a.title+'\n[' : '[')+keyHint+'+click] Expand all children'; a.innerHTML += '<span>&#9660;</span>'; a.className += ' sf-dump-toggle'; if ('sf-dump' != elt.parentNode.className) { toggle(a); } } else if ("sf-dump-ref" == elt.className && (a = elt.getAttribute('href'))) { a = a.substr(1); elt.className += ' '+a; if (/[\[{]$/.test(elt.previousSibling.nodeValue)) { a = a != elt.nextSibling.id && doc.getElementById(a); try { t = a.nextSibling; elt.appendChild(a); t.parentNode.insertBefore(a, t); if (/^[@#]/.test(elt.innerHTML)) { elt.innerHTML += ' <span>&#9654;</span>'; } else { elt.innerHTML = '<span>&#9654;</span>'; elt.className = 'sf-dump-ref'; } elt.className += ' sf-dump-toggle'; } catch (e) { if ('&' == elt.innerHTML.charAt(0)) { elt.innerHTML = '&hellip;'; elt.className = 'sf-dump-ref'; } } } } ++i; } }; })(document); </script><style> pre.sf-dump { display: block; white-space: pre; padding: 5px; } pre.sf-dump span { display: inline; } pre.sf-dump .sf-dump-compact { display: none; } pre.sf-dump abbr { text-decoration: none; border: none; cursor: help; } pre.sf-dump a { text-decoration: none; cursor: pointer; border: 0; outline: none; }pre.sf-dump{ color:#FF8400; line-height:1.2em; font:12px Menlo, Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; word-break: normal}pre.sf-dump .sf-dump-num{font-weight:bold; color:#1299DA}pre.sf-dump .sf-dump-const{font-weight:bold}pre.sf-dump .sf-dump-str{font-weight:bold; color:#56DB3A}pre.sf-dump .sf-dump-note{color:#1299DA}pre.sf-dump .sf-dump-ref{color:#A0A0A0}pre.sf-dump .sf-dump-public{color:#FFFFFF}pre.sf-dump .sf-dump-protected{color:#FFFFFF}pre.sf-dump .sf-dump-private{color:#FFFFFF}pre.sf-dump .sf-dump-meta{color:#B729D9}pre.sf-dump .sf-dump-key{color:#56DB3A}pre.sf-dump .sf-dump-index{color:#1299DA}</style>
2-
<script>
3-
$(function () {
4-
2+
<script require="slimscroll">
53
var storageKey = function () {
64
var connection = $('#connections').val();
75
return 'la-'+connection+'-history'
@@ -22,7 +20,7 @@ function History () {
2220
} else {
2321
history = JSON.parse(history);
2422
}
25-
return history;
23+
return history;ScaffoldController.php
2624
};
2725
2826
History.prototype.push = function (record) {
@@ -69,14 +67,13 @@ function History () {
6967
data: {
7068
c: $('#connections').val(),
7169
q: $input.val(),
72-
_token: LA.token
73-
},
70+
},
7471
success: function (response) {
7572
7673
history.push($input.val());
7774
7875
$('#terminal-box')
79-
.append('<div class="item"><small class="label label-default">'+$('#connections').val()+'> '+$input.val()+'<\/small><\/div>')
76+
.append('<div class="item"><small class="badge badge-secondary">'+$('#connections').val()+'> '+$input.val()+'<\/small><\/div>')
8077
.append('<div class="item">'+response+'<\/div>')
8178
.slimScroll({ scrollTo: $("#terminal-box")[0].scrollHeight });
8279
@@ -108,14 +105,13 @@ function History () {
108105
//history.clear();
109106
});
110107
111-
});
112108
</script>
113109
<!-- Chat box -->
114-
<div class="box box-primary">
115-
<div class="box-header with-border">
110+
<div class="card card-@color card-outline">
111+
<div class="card-header with-border">
116112
<i class="fa fa-terminal"></i>
117113

118-
<div class="box-tools pull-right" data-toggle="tooltip" title="Status">
114+
<div class="card-tools pull-right" data-toggle="tooltip" title="Status">
119115

120116
<div class="input-group input-group-sm" style="width: 150px;">
121117

@@ -142,13 +138,13 @@ function History () {
142138

143139
</div>
144140
</div>
145-
<div class="box-body chat" id="terminal-box">
141+
<div class="card-body chat" id="terminal-box">
146142
<!-- chat item -->
147143

148144
<!-- /.item -->
149145
</div>
150146
<!-- /.chat -->
151-
<div class="box-footer with-border">
147+
<div class="card-footer with-border">
152148
<div class="input-group">
153149

154150
<input class="form-control input-lg" id="terminal-query" placeholder="Type query...">
@@ -163,4 +159,4 @@ function History () {
163159
</div>
164160
</div>
165161
</div>
166-
<!-- /.box (chat box) -->
162+
<!-- /.card (chat card) -->

0 commit comments

Comments
 (0)