diff --git a/client/admin/lockTools/lockTools.jsx b/client/admin/lockTools/lockTools.jsx index c528fb13d..c639adaca 100644 --- a/client/admin/lockTools/lockTools.jsx +++ b/client/admin/lockTools/lockTools.jsx @@ -1,9 +1,8 @@ -/*eslint max-lines: ["warn", {"max": 300, "skipBlankLines": true, "skipComments": true}]*/ +/*eslint max-lines: ["warn", {"max": 500, "skipBlankLines": true, "skipComments": true}]*/ require('./lockTools.less'); const React = require('react'); const createClass = require('create-react-class'); -// const request = require('superagent'); import request from '../../homebrew/utils/request-middleware.js'; const LockTools = createClass({ @@ -29,17 +28,23 @@ const LockTools = createClass({ } }, + updateLockData : function(lock){ + this.setState({ + lock : lock + }); + }, + render : function() { return

Lock Count

Number of brews currently locked: {this.state.reviewCount}


- +
- +
- +
@@ -55,12 +60,12 @@ const LockBrew = createClass({ getInitialState : function() { // Default values return { - brewId : '', - code : 455, - editMessage : '', - shareMessage : 'This Brew has been locked.', + brewId : this.props.lock?.shareId || '', + code : this.props.lock?.code || 455, + editMessage : this.props.lock?.editMessage || '', + shareMessage : this.props.lock?.shareMessage || 'This Brew has been locked.', result : {}, - overwrite : false + overwrite : false, }; }, @@ -186,7 +191,8 @@ const LockTable = createClass({ text : '', fetchURL : '/api/locks', resultName : '', - propertyNames : ['shareId'] + propertyNames : ['shareId'], + loadBrew : ()=>{} }; }, @@ -198,7 +204,9 @@ const LockTable = createClass({ }; }, - clickFn(){ + lockKey : React.createRef(0), + + clickFn : function (){ this.setState({ searching: true, error: null }); request.get(this.props.fetchURL) @@ -209,6 +217,18 @@ const LockTable = createClass({ }); }, + updateBrewLockData : function (lockData){ + this.lockKey.current++; + const brewData = { + key : this.lockKey.current, + shareId : lockData.shareId, + code : lockData.lock.code, + editMessage : lockData.lock.editMessage, + shareMessage : lockData.lock.shareMessage + }; + this.props.loadBrew(brewData); + }, + render : function () { return <>
@@ -229,7 +249,7 @@ const LockTable = createClass({ return {name}; })} clip - view + load @@ -240,8 +260,8 @@ const LockTable = createClass({ {result[name].toString()} ; })} - {navigator.clipboard.writeText(result.shareId.toString());}}> - + {navigator.clipboard.writeText(result.shareId.toString());}}> + {this.updateBrewLockData(result);}}> ; })}