(web) disable join btn when recording proxy

This commit is contained in:
Alexey Kontsevoy 2018-01-13 16:40:01 -05:00
parent 736b21effb
commit 11d4169da9
7 changed files with 62 additions and 32 deletions

View file

@ -1201,6 +1201,8 @@ webpackJsonp([0],[
auth: {},
canJoinSessions: true,
routes: {
app: '/web',
login: '/web/login',
@ -15402,6 +15404,10 @@ webpackJsonp([0],[
var _clusterSelector2 = _interopRequireDefault(_clusterSelector);
var _config = __webpack_require__(228);
var _config2 = _interopRequireDefault(_config);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@ -15516,7 +15522,7 @@ webpackJsonp([0],[
var start = filter.start,
end = filter.end;
var canJoin = _config2.default.canJoinSessions;
var searchValue = this.state.searchValue;
var stored = storedSessions.filter(function (item) {
@ -15577,7 +15583,7 @@ webpackJsonp([0],[
{ className: 'grv-sessions-col-sid' },
' Session ID '
),
cell: _react2.default.createElement(_listItems.SessionIdCell, { data: data, container: this })
cell: _react2.default.createElement(_listItems.SessionIdCell, { canJoin: canJoin, data: data, container: this })
}),
_react2.default.createElement(_table.Column, {
header: _react2.default.createElement(
@ -15682,6 +15688,10 @@ webpackJsonp([0],[
var _popover2 = _interopRequireDefault(_popover);
var _classnames = __webpack_require__(257);
var _classnames2 = _interopRequireDefault(_classnames);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } /*
@ -15797,32 +15807,40 @@ webpackJsonp([0],[
var SessionIdCell = function SessionIdCell(_ref5) {
var rowIndex = _ref5.rowIndex,
canJoin = _ref5.canJoin,
data = _ref5.data,
container = _ref5.container,
props = _objectWithoutProperties(_ref5, ['rowIndex', 'data', 'container']);
props = _objectWithoutProperties(_ref5, ['rowIndex', 'canJoin', 'data', 'container']);
var _data$rowIndex2 = data[rowIndex],
sessionUrl = _data$rowIndex2.sessionUrl,
active = _data$rowIndex2.active,
sid = _data$rowIndex2.sid;
var _ref6 = active ? ['join', 'btn-warning'] : ['play', 'btn-primary'],
actionText = _ref6[0],
actionClass = _ref6[1];
var isDisabled = active && !canJoin;
var sidShort = sid.slice(0, 8);
var actionText = active ? 'join' : 'play';
var btnClass = (0, _classnames2.default)('btn btn-xs m-r-sm', {
'btn-primary': !active,
'btn-warning': active,
'disabled': isDisabled
});
return _react2.default.createElement(
_table.Cell,
props,
_react2.default.createElement(
_layout2.default.Flex,
{ dir: 'row', align: 'center' },
_react2.default.createElement(
isDisabled && _react2.default.createElement(
'button',
{ className: btnClass },
actionText
),
!isDisabled && _react2.default.createElement(
_reactRouter.Link,
{
to: sessionUrl,
className: "btn " + actionClass + " btn-xs m-r-sm",
type: 'button' },
{ to: sessionUrl, className: btnClass, type: 'button' },
actionText
),
_react2.default.createElement(
@ -15839,10 +15857,10 @@ webpackJsonp([0],[
);
};
var NodeCell = function NodeCell(_ref7) {
var rowIndex = _ref7.rowIndex,
data = _ref7.data,
props = _objectWithoutProperties(_ref7, ['rowIndex', 'data']);
var NodeCell = function NodeCell(_ref6) {
var rowIndex = _ref6.rowIndex,
data = _ref6.data,
props = _objectWithoutProperties(_ref6, ['rowIndex', 'data']);
var nodeDisplayText = data[rowIndex].nodeDisplayText;

View file

@ -1,4 +1,4 @@
!function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n=window.webpackJsonp;window.webpackJsonp=function(o,a){for(var s,u,l=0,c=[];l<o.length;l++)u=o[l],i[u]&&c.push.apply(c,i[u]),i[u]=0;for(s in a)Object.prototype.hasOwnProperty.call(a,s)&&(t[s]=a[s]);for(n&&n(o,a);c.length;)c.shift().call(null,e);if(a[0])return r[0]=0,e(0)};var r={},i={2:0};return e.e=function(t,n){if(0===i[t])return n.call(null,e);if(void 0!==i[t])i[t].push(n);else{i[t]=[n];var r=document.getElementsByTagName("head")[0],o=document.createElement("script");o.type="text/javascript",o.charset="utf-8",o.async=!0,o.src=e.p+""+{0:"f6165751eed95a6fc9b2",1:"2d4403088769e0d5c989"}[t]+".js",r.appendChild(o)}},e.m=t,e.c=r,e.p="/web/app",e(0)}([function(t,e,n){t.exports=n(563)},,function(t,e,n){"use strict";t.exports=n(3)},function(t,e,n){"use strict";var r=n(4),i=n(5),o=n(17),a=n(20),s=n(21),u=n(26),l=n(9),c=n(27),d=n(29),h=n(30),f=(n(11),l.createElement),p=l.createFactory,m=l.cloneElement,_=r,v={Children:{map:i.map,forEach:i.forEach,count:i.count,toArray:i.toArray,only:h},Component:o,PureComponent:a,createElement:f,cloneElement:m,isValidElement:l.isValidElement,PropTypes:c,createClass:s.createClass,createFactory:p,createMixin:function(t){return t},DOM:u,version:d,__spread:_};t.exports=v},function(t,e){/*
!function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n=window.webpackJsonp;window.webpackJsonp=function(o,a){for(var s,u,l=0,c=[];l<o.length;l++)u=o[l],i[u]&&c.push.apply(c,i[u]),i[u]=0;for(s in a)Object.prototype.hasOwnProperty.call(a,s)&&(t[s]=a[s]);for(n&&n(o,a);c.length;)c.shift().call(null,e);if(a[0])return r[0]=0,e(0)};var r={},i={2:0};return e.e=function(t,n){if(0===i[t])return n.call(null,e);if(void 0!==i[t])i[t].push(n);else{i[t]=[n];var r=document.getElementsByTagName("head")[0],o=document.createElement("script");o.type="text/javascript",o.charset="utf-8",o.async=!0,o.src=e.p+""+{0:"0b0068b525e727c49946",1:"2d4403088769e0d5c989"}[t]+".js",r.appendChild(o)}},e.m=t,e.c=r,e.p="/web/app",e(0)}([function(t,e,n){t.exports=n(563)},,function(t,e,n){"use strict";t.exports=n(3)},function(t,e,n){"use strict";var r=n(4),i=n(5),o=n(17),a=n(20),s=n(21),u=n(26),l=n(9),c=n(27),d=n(29),h=n(30),f=(n(11),l.createElement),p=l.createFactory,m=l.cloneElement,_=r,v={Children:{map:i.map,forEach:i.forEach,count:i.count,toArray:i.toArray,only:h},Component:o,PureComponent:a,createElement:f,cloneElement:m,isValidElement:l.isValidElement,PropTypes:c,createClass:s.createClass,createFactory:p,createMixin:function(t){return t},DOM:u,version:d,__spread:_};t.exports=v},function(t,e){/*
object-assign
(c) Sindre Sorhus
@license MIT

2
web/dist/index.html vendored
View file

@ -11,5 +11,5 @@
<link rel="shortcut icon" href="/web/app/favicon.ico"><link href="/web/app/vendor.2cc1650635c35b62e72c5db77686d8bb.css" rel="stylesheet"></head>
<body class="grv">
<div id="app"></div>
<script type="text/javascript" src="/web/app/vendor.0da8efdb52904dde7926.js"></script><script type="text/javascript" src="/web/app/styles.0da8efdb52904dde7926.js"></script><script type="text/javascript" src="/web/app/app.0da8efdb52904dde7926.js"></script></body>
<script type="text/javascript" src="/web/app/vendor.4ea4c465a2ce7e294a56.js"></script><script type="text/javascript" src="/web/app/styles.4ea4c465a2ce7e294a56.js"></script><script type="text/javascript" src="/web/app/app.4ea4c465a2ce7e294a56.js"></script></body>
</html>

View file

@ -21,6 +21,7 @@ import moment from 'moment';
import Layout from 'app/components/layout';
import MoreButton from 'app/components/moreButton';
import Popover from 'app/components/popover';
import classnames from 'classnames';
const DateCreatedCell = ({ rowIndex, data, ...props }) => {
let { createdDisplayText } = data[rowIndex];
@ -77,19 +78,27 @@ const sessionInfo = sid => (
</Popover>
);
const SessionIdCell = ({ rowIndex, data, container, ...props }) => {
let { sessionUrl, active, sid } = data[rowIndex];
let [actionText, actionClass] = active ? ['join', 'btn-warning'] : ['play', 'btn-primary'];
let sidShort = sid.slice(0, 8);
const SessionIdCell = ({ rowIndex, canJoin, data, container, ...props }) => {
const { sessionUrl, active, sid } = data[rowIndex];
const isDisabled = active && !canJoin;
const sidShort = sid.slice(0, 8);
const actionText = active ? 'join' : 'play';
const btnClass = classnames('btn btn-xs m-r-sm', {
'btn-primary': !active,
'btn-warning': active,
'disabled': isDisabled
});
return (
<Cell {...props}>
<Layout.Flex dir="row" align="center">
<Link
to={sessionUrl}
className={"btn " + actionClass + " btn-xs m-r-sm"}
type="button">
{isDisabled && <button className={btnClass}>{actionText}</button> }
{!isDisabled && (
<Link to={sessionUrl} className={btnClass} type="button" >
{actionText}
</Link>
</Link>
)}
<span style={{ width: "75px" }}>{sidShort}</span>
<MoreButton.WithOverlay
trigger="click"

View file

@ -24,6 +24,7 @@ import { Table, Column, Cell, SortHeaderCell, SortTypes, EmptyIndicator } from '
import { SessionIdCell, NodeCell, UsersCell, DateCreatedCell, DurationCell } from './listItems';
import DateRangePicker from './../datePicker';
import ClusterSelector from './../clusterSelector.jsx';
import cfg from 'app/config';
class SessionList extends React.Component {
@ -101,7 +102,7 @@ class SessionList extends React.Component {
render() {
const { filter, storedSessions, activeSessions } = this.props;
const { start, end } = filter;
const canJoin = cfg.canJoinSessions;
const searchValue = this.state.searchValue;
let stored = storedSessions.filter(
@ -113,7 +114,7 @@ class SessionList extends React.Component {
stored = this.sortAndFilter(stored);
active = this.sortAndFilter(active);
// always display active sessions first
const data = [...active, ...stored];
return (
@ -138,7 +139,7 @@ class SessionList extends React.Component {
<Column
header={<Cell className="grv-sessions-col-sid"> Session ID </Cell> }
cell={
<SessionIdCell data={data} container={this} />
<SessionIdCell canJoin={canJoin} data={data} container={this} />
}
/>
<Column

View file

@ -33,6 +33,8 @@ const cfg = {
auth: {
},
canJoinSessions: true,
routes: {
app: '/web',
login: '/web/login',
@ -152,8 +154,8 @@ const cfg = {
const hostport = location.hostname+(location.port ? ':'+location.port: '');
return `${prefix}${hostport}`;
},
init(config={}){
init(config = {}) {
$.extend(true, this, config);
},