Files
jibo-cli/node_modules/skills-service-manager/static/skills-service/index.js

9 lines
4.5 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* skills-service-manager - Skills Services Manager
* @version v4.0.6
* @license Copyright (c) 2017, Jibo, Inc. All rights reserved.
* All use of the Jibo SDK is subject to the Jibo SDK End User License Agreement (EULA)
* distributed herewith. If you did not receive a copy of the EULA, you may view a
* copy at https://developers.jibo.com/license.
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.index=e()}}(function(){return function e(t,n,a){function o(c,s){if(!n[c]){if(!t[c]){var i="function"==typeof require&&require;if(!s&&i)return i(c,!0);if(l)return l(c,!0);var r=new Error("Cannot find module '"+c+"'");throw r.code="MODULE_NOT_FOUND",r}var u=n[c]={exports:{}};t[c][0].call(u.exports,function(e){var n=t[c][1][e];return o(n?n:e)},u,u.exports,e,t,n,a)}return n[c].exports}for(var l="function"==typeof require&&require,c=0;c<a.length;c++)o(a[c]);return o}({1:[function(e,t,n){var a=React.createClass({getInitialState:function(){return{skills:[],version:""}},onListSkills:function(){var e=this;$.getJSON("http://"+location.host+"/version",function(t){e.setState({version:t.version})}),$.getJSON("http://"+location.host+"/skill/list",function(t){e.setState({skills:t.skills})})},onLaunch:function(e){var t=this,n=JSON.stringify({command:e.name});$.post("http://"+location.host+"/launch-dev",n,function(e){t.onListSkills()})},onStop:function(e){var t=this,n=JSON.stringify({command:e.name});$.post("http://"+location.host+"/terminate",n,function(e){t.onListSkills()})},launchConsole:function(){$.getJSON("http://"+location.host+"/devtools",function(e){var t=e[0].devtoolsFrontendUrl.replace("127.0.0.1",location.hostname);window.open("http://"+location.hostname+":9191"+t,"_blank")})},launchSSMConsole:function(){$.getJSON("http://"+location.host+"/ssm-devtools",function(e){var t=e[0].devtoolsFrontendUrl.replace("127.0.0.1",location.hostname);window.open("http://"+location.hostname+":12345"+t,"_blank")})},componentDidMount:function(){this.onListSkills()},render:function(){var e=this,t=[];return this.state.skills.forEach(function(n){n.running?t.push(React.createElement(ReactBootstrap.ListGroupItem,null,React.createElement("div",{className:"row"},React.createElement("div",{className:"col-xs-6 col-sm-8 col-md-10"},React.createElement("h4",null,n.name," ",React.createElement("small",null,"v",n.version))),React.createElement("div",{className:"col-xs-6 col-sm-4 col-md-2"},React.createElement(ReactBootstrap.ButtonGroup,{className:"running"},React.createElement(ReactBootstrap.Button,{bsStyle:"danger",onClick:function(){e.onStop(n)}},React.createElement("span",{className:"glyphicon glyphicon-stop"})," "),React.createElement(ReactBootstrap.Button,{bsStyle:"default",onClick:e.launchConsole},React.createElement("span",{className:"glyphicon glyphicon-cog"})," ")))))):t.push(React.createElement(ReactBootstrap.ListGroupItem,null,React.createElement("div",{className:"row"},React.createElement("div",{className:"col-xs-6 col-sm-8 col-md-10"},React.createElement("h4",null,n.name," ",React.createElement("small",null,"v",n.version))),React.createElement("div",{className:"col-xs-6 col-sm-4 col-md-2"},React.createElement(ReactBootstrap.Button,{bsStyle:"success",className:"btn-block",onClick:function(){e.onLaunch(n)}},React.createElement("span",{className:"glyphicon glyphicon-play"})," ",React.createElement("span",null,"Launch"))))))}),React.createElement("div",{className:"row"},React.createElement("div",{className:"col-sm-12"},React.createElement("h1",{className:"pull-left",style:{marginBottom:20}},"Skills Manager ",React.createElement("span",{className:"version"},"v",this.state.version)),React.createElement("div",{className:"pull-right",style:{paddingTop:20}},React.createElement(ReactBootstrap.ButtonGroup,null,React.createElement(ReactBootstrap.Button,{bsStyle:"default",onClick:this.onListSkills},React.createElement("span",{className:"glyphicon glyphicon-refresh"})," ",React.createElement("span",null,"Refresh")),React.createElement(ReactBootstrap.Button,{bsStyle:"default",onClick:this.launchSSMConsole},React.createElement("span",{className:"glyphicon glyphicon-cog"})," ",React.createElement("span",null,"Debug")))),React.createElement("div",{className:"clearfix"}),React.createElement(ReactBootstrap.ListGroup,null,t)))}});$(document).ready(function(){ReactDOM.render(React.createElement(a,null),document.getElementById("grid"))})},{}]},{},[1])(1)});