oclif-web-ui
Version:
A Web UI for any CLI written with oclif
2 lines • 5.08 kB
JavaScript
(function(n){function t(t){for(var r,i,c=t[0],u=t[1],s=t[2],f=0,l=[];f<c.length;f++)i=c[f],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&l.push(o[i][0]),o[i]=0;for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(n[r]=u[r]);d&&d(t);while(l.length)l.shift()();return a.push.apply(a,s||[]),e()}function e(){for(var n,t=0;t<a.length;t++){for(var e=a[t],r=!0,c=1;c<e.length;c++){var u=e[c];0!==o[u]&&(r=!1)}r&&(a.splice(t--,1),n=i(i.s=e[0]))}return n}var r={},o={app:0},a=[];function i(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}i.m=n,i.c=r,i.d=function(n,t,e){i.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:e})},i.r=function(n){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},i.t=function(n,t){if(1&t&&(n=i(n)),8&t)return n;if(4&t&&"object"===typeof n&&n&&n.__esModule)return n;var e=Object.create(null);if(i.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var r in n)i.d(e,r,function(t){return n[t]}.bind(null,r));return e},i.n=function(n){var t=n&&n.__esModule?function(){return n["default"]}:function(){return n};return i.d(t,"a",t),t},i.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},i.p="/";var c=window["webpackJsonp"]=window["webpackJsonp"]||[],u=c.push.bind(c);c.push=t,c=c.slice();for(var s=0;s<c.length;s++)t(c[s]);var d=u;a.push([0,"chunk-vendors"]),e()})({0:function(n,t,e){n.exports=e("cd49")},"034f":function(n,t,e){"use strict";var r=e("85ec"),o=e.n(r);o.a},"85ec":function(n,t,e){},9787:function(n,t,e){},c41c:function(n,t,e){"use strict";var r=e("9787"),o=e.n(r);o.a},cd49:function(n,t,e){"use strict";e.r(t);var r=e("2b0e"),o=function(){var n=this,t=n.$createElement,e=n._self._c||t;return e("div",{attrs:{id:"app"}},[e("h1",[n._v("Web CLI")]),e("CLIContainer")],1)},a=[],i=function(){var n=this,t=n.$createElement,e=n._self._c||t;return e("div",{staticClass:"container",attrs:{id:"cli-container"}},[e("div",{staticClass:"row"},[e("div",{staticClass:"col-6"},n._l(n.commands,(function(n){return e("ul",{key:n.id},[e("li",[e("CLICommand",{attrs:{command:n}})],1)])})),0),e("div",{staticClass:"col-6"})])])},c=[],u=e("9ab4"),s=function(){function n(){}return n.getConfig=function(){return Object(u["a"])(this,void 0,void 0,(function(){var n;return Object(u["b"])(this,(function(t){switch(t.label){case 0:return[4,r["a"].axios.get("/data/config")];case 1:return n=t.sent(),[2,n.data]}}))}))},n.getCommands=function(){return Object(u["a"])(this,void 0,void 0,(function(){var n;return Object(u["b"])(this,(function(t){switch(t.label){case 0:return[4,r["a"].axios.get("/data/commands")];case 1:return n=t.sent(),[2,n.data]}}))}))},n.runCommand=function(n){return Object(u["a"])(this,void 0,void 0,(function(){var t;return Object(u["b"])(this,(function(e){switch(e.label){case 0:return[4,r["a"].axios.post("/data/run",{commandId:n})];case 1:return t=e.sent(),[2,t.data]}}))}))},n}(),d=function(){var n=this,t=n.$createElement,e=n._self._c||t;return e("div",[n._v(" Action: "+n._s(n.command.id)+" "),e("br"),n._v(" Description: "+n._s(n.command.description)+" "),e("br"),e("b-button",{attrs:{variant:"info"},on:{click:function(t){return n.runCommand(n.command.id)}}},[n._v("Run command")]),n._v(" "),e("br"),n._v(" Response: "+n._s(n.response)+" ")],1)},f=[],l=r["a"].extend({name:"CLICommand",props:{command:{}},data:function(){return{response:""}},methods:{runCommand:function(n){return Object(u["a"])(this,void 0,void 0,(function(){var t;return Object(u["b"])(this,(function(e){switch(e.label){case 0:return t=this,[4,s.runCommand(n)];case 1:return t.response=e.sent(),[2]}}))}))}}}),m=l,p=e("2877"),b=Object(p["a"])(m,d,f,!1,null,null,null),v=b.exports,h=r["a"].extend({name:"CLIContainer",components:{CLICommand:v},data:function(){return{config:{},commands:[],response:""}},created:function(){this.loadConfig()},methods:{loadConfig:function(){return Object(u["a"])(this,void 0,void 0,(function(){var n,t;return Object(u["b"])(this,(function(e){switch(e.label){case 0:return n=this,[4,s.getConfig()];case 1:return n.config=e.sent(),t=this,[4,s.getCommands()];case 2:return t.commands=e.sent(),[2]}}))}))},runCommand:function(n){return Object(u["a"])(this,void 0,void 0,(function(){var t;return Object(u["b"])(this,(function(e){switch(e.label){case 0:return t=this,[4,s.runCommand(n)];case 1:return t.response=e.sent(),[2]}}))}))}}}),C=h,O=(e("c41c"),Object(p["a"])(C,i,c,!1,null,"04a86356",null)),g=O.exports,j=(e("f9e3"),e("2dd8"),r["a"].extend({name:"App",components:{CLIContainer:g},methods:{exit:function(){window.close()}}})),_=j,w=(e("034f"),Object(p["a"])(_,o,a,!1,null,null,null)),y=w.exports,x=e("bc3a"),I=e.n(x),L=e("a7fe"),P=e.n(L),k=e("8c4f"),S=e("7049");r["a"].use(S["a"]),r["a"].use(k["a"]),r["a"].use(P.a,I.a),r["a"].config.productionTip=!1;var M=new k["a"]({routes:[]});new r["a"]({render:function(n){return n(y)},router:M}).$mount("#app")}});
//# sourceMappingURL=app.fc469797.js.map