UNPKG

inversify-devtools

Version:
42 lines (41 loc) 2.31 kB
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var React = require("react"); var panel_1 = require("./panel"); var tip_1 = require("./tip"); var BindingExplorer = (function (_super) { __extends(BindingExplorer, _super); function BindingExplorer(props) { _super.call(this, props); } BindingExplorer.prototype.render = function () { return (React.createElement(panel_1.default, {title: "Services", subtitle: "Explorer", columnSize: this.props.columnSize, height: this.props.height}, this._renderTip(), this._renderBindings(this.props.dictionary))); }; BindingExplorer.prototype._renderTip = function () { if (this.props.dictionary.length === 0) { return (React.createElement(tip_1.default, null, "Click on one of the kernels on the kernel panel (left) to see its binding!")); } else { return (React.createElement(tip_1.default, null, "Services with more than one implementation are displayed in yellow." + ' ' + "Remember to add some metadata and constraints to avoid ambiguous match exceptions!")); } }; BindingExplorer.prototype._handleClick = function (keyVal) { this.props.selectBinding(keyVal, this.props.kernelGuid); }; BindingExplorer.prototype._renderClass = function (length) { return (length > 1) ? "request requestBox warningBox" : "request requestBox defaultBox"; }; BindingExplorer.prototype._renderBindings = function (dictionary) { var _this = this; return dictionary.map(function (keyVal, id) { return (React.createElement("div", {key: id, className: _this._renderClass(keyVal.value.length), onClick: function (e) { _this._handleClick(keyVal); }}, React.createElement("div", {class: "title"}, React.createElement("h6", null, "IMPLEMENTATIONS: ", keyVal.value.length), React.createElement("h2", null, keyVal.serviceIdentifier.toString())))); }); }; return BindingExplorer; }(React.Component)); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = BindingExplorer;