From 15fddc071c8430a503a39862177394d6b5ca14f6 Mon Sep 17 00:00:00 2001 From: Joe Walker Date: Sun, 12 Dec 2010 17:01:45 +0000 Subject: [PATCH] separation of rows and cli, more refactoring for new world, copying images from skywriter --- plugins/cockpit/lib/cli.js | 5 +- plugins/cockpit/lib/ui/images/closer.png | Bin 0 -> 669 bytes plugins/cockpit/lib/ui/images/dot_clear.gif | Bin 0 -> 42 bytes plugins/cockpit/lib/ui/images/minus.png | Bin 0 -> 604 bytes plugins/cockpit/lib/ui/images/pinaction.png | Bin 0 -> 1502 bytes plugins/cockpit/lib/ui/images/pinin.png | Bin 0 -> 1199 bytes plugins/cockpit/lib/ui/images/pinout.png | Bin 0 -> 1553 bytes plugins/cockpit/lib/ui/images/pins.png | Bin 0 -> 1712 bytes plugins/cockpit/lib/ui/images/plus.png | Bin 0 -> 635 bytes plugins/cockpit/lib/ui/images/throbber.gif | Bin 0 -> 10819 bytes plugins/cockpit/lib/ui/plain.css | 70 +++------ plugins/cockpit/lib/ui/plain.js | 118 ++++++++------- plugins/cockpit/lib/ui/plainRow.html | 47 ------ plugins/cockpit/lib/ui/requestView.css | 38 +++++ plugins/cockpit/lib/ui/requestView.html | 28 ++++ plugins/cockpit/lib/ui/requestView.js | 152 ++++++++++++++++++++ plugins/pilot/lib/canon.js | 39 +++-- plugins/pilot/lib/commands/settings.js | 16 +-- plugins/pilot/lib/domtemplate.js | 4 +- 19 files changed, 334 insertions(+), 183 deletions(-) create mode 100644 plugins/cockpit/lib/ui/images/closer.png create mode 100644 plugins/cockpit/lib/ui/images/dot_clear.gif create mode 100644 plugins/cockpit/lib/ui/images/minus.png create mode 100644 plugins/cockpit/lib/ui/images/pinaction.png create mode 100644 plugins/cockpit/lib/ui/images/pinin.png create mode 100644 plugins/cockpit/lib/ui/images/pinout.png create mode 100644 plugins/cockpit/lib/ui/images/pins.png create mode 100644 plugins/cockpit/lib/ui/images/plus.png create mode 100644 plugins/cockpit/lib/ui/images/throbber.gif delete mode 100644 plugins/cockpit/lib/ui/plainRow.html create mode 100644 plugins/cockpit/lib/ui/requestView.css create mode 100644 plugins/cockpit/lib/ui/requestView.html create mode 100644 plugins/cockpit/lib/ui/requestView.js diff --git a/plugins/cockpit/lib/cli.js b/plugins/cockpit/lib/cli.js index cfdbcc00..01d81a34 100644 --- a/plugins/cockpit/lib/cli.js +++ b/plugins/cockpit/lib/cli.js @@ -446,7 +446,8 @@ Requisition.prototype = { * Helper to call canon.exec */ exec: function() { - canon.exec(this.command, this.getArgs()); + // TODO: have a toString rather than hack this.input + canon.exec(this.command, this.getArgs(), this.input.typed); } }; exports.Requisition = Requisition; @@ -492,8 +493,8 @@ oop.inherits(CliRequisition, Requisition); * */ CliRequisition.prototype.update = function(input) { - // TODO: We only store this so getHints can work. Find a better way. this.input = input; + // TODO: We only store this so getHints can work. Find a better way. this.localHints = []; if (util.none(input.typed)) { diff --git a/plugins/cockpit/lib/ui/images/closer.png b/plugins/cockpit/lib/ui/images/closer.png new file mode 100644 index 0000000000000000000000000000000000000000..d49bf2040a11eac0583fe8c5ba977d8289e0454a GIT binary patch literal 669 zcmV;O0%HA%P)Wa|n@xYW+l8iS+;6d1psFfdE?15H-YXW1r8yXj#Wq;*i%zG*0ScBRiG$BOX$>Fh0z^@S&*%He+yN;V z3_fJni;qSlTy_ue?9O+r2TriFXM=2x@bq>K>9u3LYb@ZPBfu~WtIcLJWR~S-zuyOe zZ$36qziwi6X^8EOuh0!0A(x50mV$3>34$PiVu=x1FP8`+=kZWRWXr_vp@5ZhBV2S( z_sOgqM<)~BFRMuX`xz__sJF>vLN5nJR`BX&2(+<;AHPI+JRSrB0TMtmm&?7MOD>g4amiJyRe!x+N4wqTe!801 z>qRIO;*!f|v!#EuN-LdClgKy!Bl1U?OlB_f-vSH(!8j5q2U-HB00000NkvXXu0mjf D?{qAq literal 0 HcmV?d00001 diff --git a/plugins/cockpit/lib/ui/images/dot_clear.gif b/plugins/cockpit/lib/ui/images/dot_clear.gif new file mode 100644 index 0000000000000000000000000000000000000000..1d9a4f524c97fa9d148cc15d7e114acce53520a7 GIT binary patch literal 42 rcmZ?wbhEHbWMp7uX!y@?;J^U}1_s5SEQ~;kK?g*DWEdD3jTo!}%isql literal 0 HcmV?d00001 diff --git a/plugins/cockpit/lib/ui/images/minus.png b/plugins/cockpit/lib/ui/images/minus.png new file mode 100644 index 0000000000000000000000000000000000000000..4c029f119428c7a7bec59c874033989c9ed1dbb9 GIT binary patch literal 604 zcmV-i0;BzjP)Px#24YJ`L;%tN(g4!zrp4d@000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXN1 z4ly#a3B!>900G=dL_t(2&xMjPOB-<*#((#|mxPc%L=Hp)B3u?rC#S9%X0I&YaKY(w*(Qr77mb=c<*zI;Z!0~)O_oFBxNfH2RwHn44R##WYz`b)K*qjFvh&SyuAGC?Ck7#z+^I+7;7z!MuUG5 z$1x(p=H})d&~{bza5kHn<;igz^BhG{aC39hTw7Z^bVX!$u~?9%X}R!t2B=o6<-d!? z0ukADRrO_>rZ|p6Q51ZCKjp=`ePX=+?XdgVC(m;LRMmGy(6}nU~DuRsOm3QRWCfx+YW*N5#fJ$o`&Bu!JoFhsKlEz2^R%_hF@--*bPUR_ zT2z%JS1OeXtyYV6yNxks@9gaCXIZ&^zuy6lN28HHolXgYpge73V}q@&tub(LdU`s1 q(p7-{{e1&`c&6kZPfkwClK%n4MbXcFG@p+E00004Tx0C)j~RL^S@K@|QrZmG~B2wH0nvUrdpNm;9CMbtL^5n^i$+aIn^?(HA4aZWV5ov6ELTdbo0FI&wK{O>*+w4vx20?>!`FrQsdJlnHR>OPy zcd~b_n$otK2Za4V;76L-DzNVtaSB-y0*E}{p()372;bw_^6ZZ}PI-92wGS&j#91PI zKs7DSe@(bk%_Y-7gGe}(^>I=@oY#w#*Bu9GZf3^F5WP>3rn}7Ut74&?PWBFvy`A)a zPP5)V!Xd&78LdA?xQ(9mjMYElVd13a#D+Z_7&Y|xU=_C-srWU*6kiZcC!$nw*)9$7 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44k86wIV=S97U~DpfzGEQ2 z`9b2$iPDA6?cL-1>*AxKg|Uf)>A}gZ<(%L6(N$65u;wo_$eG`%t&H%&ll((uPXeHM zTdq(nv9$3G(8;~l`QM`ZBc!`mFTUt#xLz+ou}fhk7K=HAkI#j`ETTA%h>mUF-sMX} zDM;DPjF?9ufF}JlWk07*qoM6N<$ Ef@=2EWdHyG literal 0 HcmV?d00001 diff --git a/plugins/cockpit/lib/ui/images/pinin.png b/plugins/cockpit/lib/ui/images/pinin.png new file mode 100644 index 0000000000000000000000000000000000000000..e761de0e29fa8068b3ed731148c11ea72910b112 GIT binary patch literal 1199 zcmV;g1W@~lP)4Tx0C)j~RL^S@K@|QrZmG~B2wH0nvUrdpNm;9CMbtL^5n^i$+aIn^?(HA4aZWV5ov6ELTdbo0FI&wK{O>*+w4vx20?>!`FrQsdJlnHR>OPy zcd~b_n$otK2Za4V;76L-DzNVtaSB-y0*E}{p()372;bw_^6ZZ}PI-92wGS&j#91PI zKs7DSe@(bk%_Y-7gGe}(^>I=@oY#w#*Bu9GZf3^F5WP>3rn}7Ut74&?PWBFvy`A)a zPP5)V!Xd&78LdA?xQ(9mjMYElVd13a#D+Z_7&Y|xU=_C-srWU*6kiZcC!$nw*)9$7 zn6CX+@=AhmkT}X@VSsa5NKe;HZuq)~1$`#h6R+ZTR#D-3j}vF!)ZOnz+5)dI4jl{{ z44Mr{P!L4~VVJN`K!!XTF*LGrKO?IK8z<8w`3e3jI8lUGNUta*C8 zn(P`s>{pjD=7Kek#B;Fw@hxAK%$F&Q6vg9J^Xf~4by_hu-=A!MJ3Znq&n~srbFGPs zH&&aMXZ>nO`|hf|ljc?VPhR!${AbO?W8x_>CU%PFA&Hm8F7cAsOREdwU~R_;ot1_u z(ruCYB-LPGn!NQdT|ZlRy+(fw^-+`=%+gee_kY4FWHg<*4sZI8+sFJD270UUORdLHO0nA4V) z%{fwsET5CQ>B?eK%uw4yQc~9?*JVo2}ze(;aRcp*ceL#HUJSllrgm5wQKR zQu+C;QrUh^8rFfA`ftFz{YAidi-`aL010qNS#tmY3ljhU3ljkVnw%H_00C!7L_t(I z5v`LwO9Md=hG)-2qk%vQMGFxNH3)tbYG>o0v9S??MIcq+3K48<{4+LoVxbWvY9YZw z(IOB?j7D$WXTyXT3{m31amUX4K0CWJXRNg{NW{9$xm+$Y6a>dcWX-`x$s1!{-8Sc+ zQM4U~VX4z&IxEQM^ZTiIHM=u^Y2v~6%9@dpquUi*ZKe(ig~Faf+5pU(o^ z8BGfyt~M8XX1;rcYP3TN=%w$w?g8`}CAZx#RHGgbU`XgQt>U(S8cx>8p+Sp>%{+h! zV@T*Ttx^akeYA~e(Bc8`KZ68`7-*DR2oe36m<_k)+xzRENg;oEe*s~@-UB<3B~<_b N002ovPDHLkV1hZZHWvT@ literal 0 HcmV?d00001 diff --git a/plugins/cockpit/lib/ui/images/pinout.png b/plugins/cockpit/lib/ui/images/pinout.png new file mode 100644 index 0000000000000000000000000000000000000000..a53536240f06b181b48db5903d463409e87d0192 GIT binary patch literal 1553 zcmV+s2JZQZP)4Tx0C)j~RL^S@K@|QrZmG~B2wH0nvUrdpNm;9CMbtL^5n^i$+aIn^?(HA4aZWV5ov6ELTdbo0FI&wK{O>*+w4vx20?>!`FrQsdJlnHR>OPy zcd~b_n$otK2Za4V;76L-DzNVtaSB-y0*E}{p()372;bw_^6ZZ}PI-92wGS&j#91PI zKs7DSe@(bk%_Y-7gGe}(^>I=@oY#w#*Bu9GZf3^F5WP>3rn}7Ut74&?PWBFvy`A)a zPP5)V!Xd&78LdA?xQ(9mjMYElVd13a#D+Z_7&Y|xU=_C-srWU*6kiZcC!$nw*)9$7 zn6CX+@=AhmkT}X@VSsa5NKe;HZuq)~1$`#h6R+ZTR#D-3j}vF!)ZOnz+5)dI4jl{{ z44Mr{P!L4~VVJN`K!!XTF*LGrKO?IK8z<8w`3e3jI8lUGNUta*C8 zn(P`s>{pjD=7Kek#B;Fw@hxAK%$F&Q6vg9J^Xf~4by_hu-=A!MJ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 z4l)%yE+sht00H|+L_t(2&vlZqYg17a#((#omt@EV%OfQTltAJTaq3W9Lrn&uh`6*% zEfo9<0?y(rIJ*^VhfWrhf(W4mGC4V9Xg~>pKvEJy3-6`87v8%LX&wstjfe9)-#MI5 zS!-FTR;wAH2|NKF-Ic!sUx9b+cH3L^suj4sydLHE_I)3KFE4%p@bu&T1dijF>2!K8pU*cPt@X})J|_&r zq#+DL9u$^?JkKMYPAB)y=X12yJC2Av48stm6mcB$?d33m07h@dT#gkxAId~g1b~Q? z9j*1PwKg5cF>xI8=X+KXM_4Qt%Qq;6)><49={t_I>H9t+!sGXa#0jAIx^Rat!E82* zi2QU!mnlOYIk?n1qPi?$BafJlv2rL-}lKG%hXdC zW60%lY;A4b02S$WySHa&XP3s9y~Scd5Co)BDXg`K2tg#IQYnhXB9%%7W6a*^>FJLo za{K%HHQ=b%>y?MYA+y;mS#4uugKD+f2M$k8PTGHE72x3DzyPoQ6Y{sm$Hz&?e*?bu V*c&phTIm1)002ovPDHLkV1kf!6Gs35 literal 0 HcmV?d00001 diff --git a/plugins/cockpit/lib/ui/images/throbber.gif b/plugins/cockpit/lib/ui/images/throbber.gif new file mode 100644 index 0000000000000000000000000000000000000000..d84f653789e5008da64ff04ee109471284a9e284 GIT binary patch literal 10819 zcmb`NXHZjX->;L91QJksO+b()O%YU3Q9(BX7GztHZs?ta9(o#~_ui}YE>aZ(NQ;0- z4L$TKAR+=54({iD-gD-B-kDi5`LJfznl!Zf0ITjX< zw6M*zDXDPSXu-&SbaR}=R&4ujA5*e1nqVdtemfLlxx z`s#5BI0&c9darz3!be?Y&*jZS&Z2>wmCzZLYxvcVFEuibNYYPB`m&$J-Rx)@D*04o zQ0OwUmSFchNrnlj2T)s)Gr&C2Prg6aM)1H`_mp4%?qu?o`(VE#&GW*GcLAry)Qyy@ zP@T?#XC#pNRmRj>uA#tm{av$OoZPH>>1{b86PN6c>^*y8|LLmhWxpra-8aVrjJsOi z;=jpGH(P!$IOVIf^`^t?M}?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(phxmGznO&ZURaP(0paW5&Mg`*+`N*!lX< zJvHqjNC7m_;x?B~y^+kyhR6=!0!p;H * { padding-left: 2px; padding-right: 2px; } -.cptRowIn > img { cursor: pointer; } -.cptHover { display: none; } -.cptRowIn:hover > .cptHover { display: block; } -.cptRowIn:hover > .cptHover.cptHidden { display: none; } -.cptOutTyped { - box-flex: 1; -moz-box-flex: 1; -webkit-box-flex: 1; - font-weight: bold; color: @hi_text; font-size: 120%; -} -.cptRowOutput { padding-left: 10px; line-height: 1.2em; } -.cptRowOutput strong, -.cptRowOutput b, -.cptRowOutput th, -.cptRowOutput h1, -.cptRowOutput h2, -.cptRowOutput h3 { color: @hi_text; } -.cptRowOutput a { font-weight: bold; color: @link_text; text-decoration: none; } -.cptRowOutput a: hover { text-decoration: underline; cursor: pointer; } -.cptRowOutput input[type=password], -.cptRowOutput input[type=text], -.cptRowOutput textarea { - color: @hi_text; font-size: 120%; - background: transparent; padding: 3px; - border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; -} -.cptRowOutput table, -.cptRowOutput td, -.cptRowOutput th { border: 0; padding: 0 2px; } -.cptRowOutput .right { text-align: right; } diff --git a/plugins/cockpit/lib/ui/plain.js b/plugins/cockpit/lib/ui/plain.js index f1d2f81d..cb0ea8ac 100644 --- a/plugins/cockpit/lib/ui/plain.js +++ b/plugins/cockpit/lib/ui/plain.js @@ -37,18 +37,18 @@ define(function(require, exports, module) { + var editorCss = require("text!cockpit/ui/plain.css"); var dom = require("pilot/dom").dom; dom.importCssString(editorCss); -var CliRequisition = require('cockpit/cli').CliRequisition; -var Hint = require('cockpit/cli').Hint; -var keyutil = require('pilot/keyboard/keyutil'); - -var plainRow = require("text!cockpit/ui/plainRow.html"); -var Templater = require("pilot/domtemplate").Templater; var canon = require("pilot/canon"); var Status = require('pilot/types').Status; +var keyutil = require('pilot/keyboard/keyutil'); + +var CliRequisition = require('cockpit/cli').CliRequisition; +var Hint = require('cockpit/cli').Hint; +var RequestView = require('cockpit/ui/requestView').RequestView; var NO_HINT = new Hint(Status.VALID, '', 0, 0); @@ -61,19 +61,19 @@ var NO_HINT = new Hint(Status.VALID, '', 0, 0); * 2. Attach a set of events so the command line works */ exports.startup = function(data, reason) { - var plainUi = new PlainUi(data); + var plainUi = new CliView(data); }; /** * A class to handle the simplest UI implementation */ -function PlainUi(data) { +function CliView(data) { this.doc = document; this.win = this.doc.defaultView; // TODO: we should have a better way to specify command lines??? - this.input = this.doc.getElementById('cockpit'); - if (!this.input) { + this.element = this.doc.getElementById('cockpit'); + if (!this.element) { console.log('No element with an id of cockpit. Bailing on plain cli'); return; } @@ -90,26 +90,22 @@ function PlainUi(data) { this.createElements(); } -PlainUi.prototype = { +CliView.prototype = { /** - * Create divs for templates, completion, hints and output + * Create divs for completion, hints and output */ createElements: function() { - this.templates = this.doc.createElement('div'); - this.templates.innerHTML = plainRow; - this.row = this.templates.firstChild; - this.completer = this.doc.createElement('div'); this.completer.className = 'cptCompletion VALID'; - this.input.parentNode.insertBefore(this.completer, this.input); + this.element.parentNode.insertBefore(this.completer, this.element); this.hinter = this.doc.createElement('div'); this.hinter.className = 'cptHints'; - this.input.parentNode.insertBefore(this.hinter, this.input); + this.element.parentNode.insertBefore(this.hinter, this.element); this.output = this.doc.createElement('div'); this.output.className = 'cptOutput'; - this.input.parentNode.insertBefore(this.output, this.input); + this.element.parentNode.insertBefore(this.output, this.element); this.win.addEventListener('resize', this.resizer.bind(this), false); this.resizer(); @@ -119,9 +115,9 @@ PlainUi.prototype = { this.showHint.addEventListener('change', this.hintShower.bind(this)); this.hintShower(); - keyutil.addKeyDownListener(this.input, this.onKeyDown.bind(this)); - this.input.addEventListener('mouseup', this.onMouseUp.bind(this), false); - this.input.addEventListener('keyup', this.onKeyUp.bind(this), true); + keyutil.addKeyDownListener(this.element, this.onKeyDown.bind(this)); + this.element.addEventListener('mouseup', this.onMouseUp.bind(this), false); + this.element.addEventListener('keyup', this.onKeyUp.bind(this), true); }, /** @@ -131,15 +127,15 @@ PlainUi.prototype = { resizer: function() { var top, height, left, width; - if (this.input.getClientRects) { - var rect = this.input.getClientRects()[0]; + if (this.element.getClientRects) { + var rect = this.element.getClientRects()[0]; top = rect.top; height = rect.height; left = rect.left; width = rect.width; } else { - var style = this.win.getComputedStyle(this.input, null); + var style = this.win.getComputedStyle(this.element, null); top = parseInt(style.getPropertyValue('top'), 10); height = parseInt(style.getPropertyValue('height'), 10); left = parseInt(style.getPropertyValue('left'), 10); @@ -156,25 +152,42 @@ PlainUi.prototype = { this.output.style.bottom = (this.win.innerHeight - top) + 'px'; this.output.style.left = left + 'px'; - this.output.style.width = width + 'px'; + this.output.style.width = (width - 60) + 'px'; }, /** * Update the display of executed commands */ showOutput: function(ev) { + var requestOutput = new RequestView(ev.request, this); + + /* // TODO: be less brutal in how we update this this.output.innerHTML = ''; + new RequestView(ev.request, this); ev.requests.forEach(function(request) { - request.outputs.forEach(function(out) { - if (typeof out === 'string') { - this.output.appendChild(this.doc.createTextNode(out)); + // this.duration.innerHTML = this.request.duration ? + // 'completed in ' + (this.request.duration / 1000) + ' sec ' : + // ''; + // this.typed.innerHTML = this.request.typed; + + request.outputs.forEach(function(output) { + var node; + if (typeof output == 'string') { + node = document.createElement('p'); + node.innerHTML = output; } else { - this.output.appendChild(out); + node = output; } + this.output.appendChild(node); }, this); + + // this.cliView.scrollToBottom(); + // util.setClass(this.output, 'cmd_error', this.request.error); + // this.throb.style.display = this.request.completed ? 'none' : 'block'; }, this); + */ }, /** @@ -219,27 +232,26 @@ PlainUi.prototype = { if (ev.keyCode === keyutil.KeyHelper.KEY.RETURN) { if (this.worstHint && this.worstHint.status !== Status.VALID) { - this.input.selectionStart = this.worstHint.start; - this.input.selectionEnd = this.worstHint.end; + this.element.selectionStart = this.worstHint.start; + this.element.selectionEnd = this.worstHint.end; } else { this.cli.exec(); - this.input.value = ''; + this.element.value = ''; } } - if (ev.keyCode === keyutil.KeyHelper.KEY.TAB) { - if (this.shownHint && this.shownHint.predictions && this.shownHint.predictions.length > 0) { - var prefix = this.input.value.substring(0, this.shownHint.start); - var suffix = this.input.value.substring(this.shownHint.end); - var insert = this.shownHint.predictions[0]; - insert = typeof insert === 'string' ? insert : insert.name; - this.input.value = prefix + insert + suffix; - // Fix the cursor. - var insertEnd = (prefix + insert).length; - this.input.selectionStart = insertEnd; - this.input.selectionEnd = insertEnd; - } + if (ev.keyCode === keyutil.KeyHelper.KEY.TAB && this.shownHint && + this.shownHint.predictions && this.shownHint.predictions.length > 0) { + var prefix = this.element.value.substring(0, this.shownHint.start); + var suffix = this.element.value.substring(this.shownHint.end); + var insert = this.shownHint.predictions[0]; + insert = typeof insert === 'string' ? insert : insert.name; + this.element.value = prefix + insert + suffix; + // Fix the cursor. + var insertEnd = (prefix + insert).length; + this.element.selectionStart = insertEnd; + this.element.selectionEnd = insertEnd; } this.update(); @@ -260,10 +272,10 @@ PlainUi.prototype = { */ update: function() { this.cli.update({ - typed: this.input.value, + typed: this.element.value, cursor: { - start: this.input.selectionStart, - end: this.input.selectionEnd + start: this.element.selectionStart, + end: this.element.selectionEnd } }); @@ -288,10 +300,10 @@ PlainUi.prototype = { // Create a marked up version of the input var highlightedInput = ''; - if (this.input.value.length > 0) { + if (this.element.value.length > 0) { // 'scores' is an array which tells us what chars are errors // Initialize with everything VALID - var scores = this.input.value.split('').map(function(char) { + var scores = this.element.value.split('').map(function(char) { return Status.VALID; }); // For all chars in all hints, check and upgrade the score @@ -310,9 +322,9 @@ PlainUi.prototype = { highlightedInput += ''; lastStatus = scores[i]; } - highlightedInput += this.input.value[i]; + highlightedInput += this.element.value[i]; i++; - if (i === this.input.value.length) { + if (i === this.element.value.length) { highlightedInput += ''; break; } @@ -351,7 +363,7 @@ PlainUi.prototype = { // dom.addCssClass(input, status.toString()); } }; -exports.PlainUi = PlainUi; +exports.CliView = CliView; }); diff --git a/plugins/cockpit/lib/ui/plainRow.html b/plugins/cockpit/lib/ui/plainRow.html deleted file mode 100644 index ca40e36c..00000000 --- a/plugins/cockpit/lib/ui/plainRow.html +++ /dev/null @@ -1,47 +0,0 @@ - - - -
- -
{ } >
- -
-
- -
- -
-
-
- - - - - -
- -
- - -
>
-
- - -
- Hide command output - Show command output - Remove this command from the history - -
- - -
-
- -
-
diff --git a/plugins/cockpit/lib/ui/requestView.css b/plugins/cockpit/lib/ui/requestView.css new file mode 100644 index 00000000..7d014eb7 --- /dev/null +++ b/plugins/cockpit/lib/ui/requestView.css @@ -0,0 +1,38 @@ + +.cptRowIn { + display: box; display: -moz-box; display: -webkit-box; + box-orient: horizontal; -moz-box-orient: horizontal; -webkit-box-orient: horizontal; + box-align: center; -moz-box-align: center; -webkit-box-align: center; + color: #333; + background-color: @input_bg; + width: 100%; +} +.cptRowIn > * { padding-left: 2px; padding-right: 2px; } +.cptRowIn > img { cursor: pointer; } +.cptHover { display: none; } +.cptRowIn:hover > .cptHover { display: block; } +.cptRowIn:hover > .cptHover.cptHidden { display: none; } +.cptOutTyped { + box-flex: 1; -moz-box-flex: 1; -webkit-box-flex: 1; + font-weight: bold; color: #000; font-size: 120%; +} +.cptRowOutput { padding-left: 10px; line-height: 1.2em; } +.cptRowOutput strong, +.cptRowOutput b, +.cptRowOutput th, +.cptRowOutput h1, +.cptRowOutput h2, +.cptRowOutput h3 { color: #000; } +.cptRowOutput a { font-weight: bold; color: #666; text-decoration: none; } +.cptRowOutput a: hover { text-decoration: underline; cursor: pointer; } +.cptRowOutput input[type=password], +.cptRowOutput input[type=text], +.cptRowOutput textarea { + color: #000; font-size: 120%; + background: transparent; padding: 3px; + border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; +} +.cptRowOutput table, +.cptRowOutput td, +.cptRowOutput th { border: 0; padding: 0 2px; } +.cptRowOutput .right { text-align: right; } diff --git a/plugins/cockpit/lib/ui/requestView.html b/plugins/cockpit/lib/ui/requestView.html new file mode 100644 index 00000000..5ecbfc1b --- /dev/null +++ b/plugins/cockpit/lib/ui/requestView.html @@ -0,0 +1,28 @@ + +
+ +
+ + +
>
+
${request.typed}
+ + +
+ Hide command output + Show command output + Remove this command from the history + +
+ + +
+
+ +
+
diff --git a/plugins/cockpit/lib/ui/requestView.js b/plugins/cockpit/lib/ui/requestView.js new file mode 100644 index 00000000..b9cb3708 --- /dev/null +++ b/plugins/cockpit/lib/ui/requestView.js @@ -0,0 +1,152 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Skywriter. + * + * The Initial Developer of the Original Code is + * Mozilla. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joe Walker (jwalker@mozilla.com) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { + + +var util = require('pilot/util'); + +var editorCss = require("text!cockpit/ui/requestView.css"); +var dom = require("pilot/dom").dom; +dom.importCssString(editorCss); + +var plainRow = require("text!cockpit/ui/requestView.html"); +var Templater = require("pilot/domtemplate").Templater; + +/** + * Pull the HTML into the DOM, but don't add it to the document + */ +var templates = document.createElement('div'); +templates.innerHTML = plainRow; +var row = templates.querySelector('.cptRow'); + +/** + * Adds a row to the CLI output display + */ +function RequestView(request, cliView) { + this.request = request; + this.cliView = cliView; + + this.imagePath = '/plugins/ace/pluging/cockpit/ui'; + + // Elements attached to this by the templater. For info only + this.rowin = null; + this.rowout = null; + this.output = null; + this.hide = null; + this.show = null; + this.duration = null; + this.throb = null; + + new Templater().processNode(row.cloneNode(true), this); + + this.cliView.output.appendChild(this.rowin); + this.cliView.output.appendChild(this.rowout); + + this.request.addEventListener('output', this.onRequestChange.bind(this)); +}; + +RequestView.prototype = { + /** + * A single click on an invocation line in the console copies the command to + * the command line + */ + copyToInput: function() { + this.cliView.input.value = this.request.typed; + }, + + /** + * A double click on an invocation line in the console executes the command + */ + executeRequest: function(ev) { + this.cliView.cli.update({ + typed: this.request.typed, + cursor: { start:0, end:0 } + }); + this.cliView.cli.exec(); + }, + + hideOutput: function(ev) { + this.output.style.display = 'none'; + util.addClass(this.hide, 'cmd_hidden'); + util.removeClass(this.show, 'cmd_hidden'); + + ev.stopPropagation(); + }, + + showOutput: function(ev) { + this.output.style.display = 'block'; + util.removeClass(this.hide, 'cmd_hidden'); + util.addClass(this.show, 'cmd_hidden'); + + ev.stopPropagation(); + }, + + remove: function(ev) { + this.cliView.output.removeChild(this.rowin); + this.cliView.output.removeChild(this.rowout); + ev.stopPropagation(); + }, + + onRequestChange: function(ev) { + this.duration.innerHTML = this.request.duration ? + 'completed in ' + (this.request.duration / 1000) + ' sec ' : + ''; + + this.output.innerHTML = ''; + this.request.outputs.forEach(function(output) { + var node; + if (typeof output == 'string') { + node = document.createElement('p'); + node.innerHTML = output; + } else { + node = output; + } + this.output.appendChild(node); + }, this); + // TODO: Fix this + // this.cliView.scrollToBottom(); + + util.setClass(this.output, 'cmd_error', this.request.error); + + this.throb.style.display = this.request.completed ? 'none' : 'block'; + } +}; +exports.RequestView = RequestView; + + +}); diff --git a/plugins/pilot/lib/canon.js b/plugins/pilot/lib/canon.js index dc303de4..0e3644d3 100644 --- a/plugins/pilot/lib/canon.js +++ b/plugins/pilot/lib/canon.js @@ -160,7 +160,8 @@ function getCommandNames() { * everything it needs to about the command params * @param command Either a command, or the name of one */ -function exec(command, args) { +function exec(command, args, typed) { + // TODO: Use requisition.toString rather than 'typed' if (typeof command === 'string') { command = commands[command]; } @@ -171,7 +172,12 @@ function exec(command, args) { // TODO: Ugg. really? env.selection = env.editor.getSelection(); - var request = new Request(); + + var request = new Request({ + command: command, + args: args, + typed: typed + }); command.exec(env, args || {}, request); return true; }; @@ -216,21 +222,6 @@ var requests = []; */ var maxRequestLength = 100; -/** - * Called by Request instances when some output (or a cell to async() happens) - */ -function addRequestOutput(request) { - requests.push(request); - // This could probably be optimized with some maths, but 99.99% of the - // time we will only be off by one, and I'm feeling lazy. - while (requests.length > maxRequestLength) { - requests.shiftObject(); - } - - exports._dispatchEvent('output', { requests: requests }); -}; -exports.addRequestOutput = addRequestOutput; - /** * To create an invocation, you need to do something like this (all the ctor * args are optional): @@ -249,7 +240,6 @@ function Request(options) { // Will be used in the keyboard case and the cli case this.command = options.command; - this.commandExt = options.commandExt; // Will be used only in the cli case this.args = options.args; @@ -274,7 +264,14 @@ Request.prototype._beginOutput = function() { this._begunOutput = true; this.outputs = []; - exports.addRequestOutput(this); + requests.push(this); + // This could probably be optimized with some maths, but 99.99% of the + // time we will only be off by one, and I'm feeling lazy. + while (requests.length > maxRequestLength) { + requests.shiftObject(); + } + + exports._dispatchEvent('output', { requests: requests, request: this }); }; /** @@ -311,7 +308,7 @@ Request.prototype.output = function(content) { } this.outputs.push(content); - this._dispatchEvent('changed', {}); + this._dispatchEvent('output', {}); return this; }; @@ -329,7 +326,7 @@ Request.prototype.done = function(content) { this.output(content); } - this._dispatchEvent('changed', {}); + this._dispatchEvent('output', {}); }; exports.Request = Request; diff --git a/plugins/pilot/lib/commands/settings.js b/plugins/pilot/lib/commands/settings.js index c6679bc9..1cfb9ae6 100644 --- a/plugins/pilot/lib/commands/settings.js +++ b/plugins/pilot/lib/commands/settings.js @@ -59,19 +59,15 @@ var setCommandSpec = { var html; if (!args.setting) { // 'set' by itself lists all the settings - var settingsList = env.settings._list(); + var names = env.settings.getSettingNames(); html = ''; // first sort the settingsList based on the name - settingsList.sort(function(a, b) { - if (a.name < b.name) { - return -1; - } else if (a.name == b.name) { - return 0; - } else { - return 1; - } + names.sort(function(name1, name2) { + return name1.localeCompare(name2); }); - settingsList.forEach(function(setting) { + + names.forEach(function(name) { + var setting = env.settings.getSetting(name); var url = 'https://wiki.mozilla.org/Labs/Skywriter/Settings#' + setting.name; html += '