From dbd29981fed0d614d3ac3ad0af3e7e77656bb210 Mon Sep 17 00:00:00 2001 From: Yuze Jiang Date: Tue, 19 Nov 2019 18:34:31 -0600 Subject: [PATCH 1/7] Add react-act, add a component to display javascript code --- package.json | 1 + src/views/tickets/CodeView.js | 32 +++++++ src/views/tickets/JSViewer.js | 111 ++++++++++++++++++++++++ src/views/tickets/Screenshot.js | 13 +-- src/views/tickets/Ticket.js | 45 +++++++--- yarn.lock | 144 +++++++++++++++++++++++++++++++- 6 files changed, 324 insertions(+), 22 deletions(-) create mode 100644 src/views/tickets/CodeView.js create mode 100644 src/views/tickets/JSViewer.js diff --git a/package.json b/package.json index 77be1ac..4470444 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "moment": "^2.24.0", "perms": "^0.1.0", "react": "^16.9.0", + "react-ace": "^8.0.0", "react-dom": "^16.9.0", "react-moment": "^0.9.6", "react-router-dom": "^5.1.2", diff --git a/src/views/tickets/CodeView.js b/src/views/tickets/CodeView.js new file mode 100644 index 0000000..8672e9b --- /dev/null +++ b/src/views/tickets/CodeView.js @@ -0,0 +1,32 @@ +import React, { Component } from 'react'; + +// import Prism from "prismjs" +// import 'prismjs/themes/prism-okaidia.css' + +export default class CodeView extends Component { + constructor(props) { + super(props); + this.ref = React.createRef(); + } + componentDidMount() { + this.highlight(); + } + componentDidUpdate() { + this.highlight(); + } + highlight = () => { + if (this.ref && this.ref.current) { + // Prism.highlightElement(this.ref.current) + } + }; + render() { + const code = this.props.code; + return ( +
+        
+          {code}
+        
+      
+ ); + } +} diff --git a/src/views/tickets/JSViewer.js b/src/views/tickets/JSViewer.js new file mode 100644 index 0000000..0e23301 --- /dev/null +++ b/src/views/tickets/JSViewer.js @@ -0,0 +1,111 @@ +import React, { Component } from 'react'; + +import { Dropdown } from 'semantic-ui-react'; + +import AceEditor from 'react-ace'; + +import 'ace-builds/src-noconflict/mode-javascript'; +import 'ace-builds/src-noconflict/theme-monokai'; + +export default class CodeBlock extends Component { + state = { + id: '', + processed: '', + count: 0, + }; + + fileList = []; + + onResponseReceived = async e => { + this.state.id = this.props.ticketID; + //there is not reason why this should be called twice but + //I can't figure out how to pass the processed flag through the routes + try { + const res = await fetch( + 'http://localhost:8080/api/tickets/' + this.state.id, + { + method: 'GET', + } + ); + + const response = await res.json(); + var processed = response.ticket.processed; + } catch (error) { + console.log(error); + } + + if (processed) { + this.setState({ processed: true }); + const endpoint = + 'http://localhost:8080/api/tickets/' + this.state.id + '/artifacts'; + try { + const res = await fetch(endpoint, { + method: 'GET', + }); + const json = await res.json(); + const artifacts = json.fileArtifacts.filter(artifact => + artifact.filename.endsWith('.js') + ); + artifacts.forEach(async artifact => { + const e = + 'http://localhost:8080/api/tickets/' + + this.state.id + + '/artifacts/' + + artifact.filename; + + const c = await fetch(e, { + method: 'GET', + responseType: 'text', + }); + const cc = await c.text(); + const name = artifact.filename; + if ( + this.fileList.find(i => { + return i.key === name; + }) === undefined + ) { + this.fileList.push({ + key: name, + text: {name}, + value: cc, + image: null, + }); + this.setState({ count: this.state.count + 1 }); + } + }); + } catch (error) { + console.log(error); + } + } + }; + + handleOnChange = (e, data) => { + this.props.onFileSelectionChange(e, data); + }; + + render() { + if (!this.state.processed) { + this.onResponseReceived(); + } + + return ( +
+ + +
+ ); + } +} diff --git a/src/views/tickets/Screenshot.js b/src/views/tickets/Screenshot.js index 453abff..d8c1048 100644 --- a/src/views/tickets/Screenshot.js +++ b/src/views/tickets/Screenshot.js @@ -27,22 +27,15 @@ export default class Screenshot extends Component { if (processed) { this.setState({ processed: true }); - const endpoint = - 'http://localhost:8080/api/tickets/' + this.state.id + '/artifacts'; - try { - const res = await fetch(endpoint, { - method: 'GET', - }); - } catch (error) { - console.log(error); - } } else { this.setState({ processed: false }); } }; render() { - this.onResponseReceived(); + if (!this.state.processed) { + this.onResponseReceived(); + } return (
diff --git a/src/views/tickets/Ticket.js b/src/views/tickets/Ticket.js index a4ab0db..a505d7a 100644 --- a/src/views/tickets/Ticket.js +++ b/src/views/tickets/Ticket.js @@ -1,16 +1,39 @@ import React from 'react'; -import { Header } from 'semantic-ui-react'; -import { useParams } from 'react-router-dom'; +import { withRouter } from 'react-router'; import Screenshot from './Screenshot'; +import JSViewer from './JSViewer'; -const Ticket = () => { - const { ticketID, url } = useParams(); - return ( - <> - - - ); -}; +class Ticket extends React.Component { + constructor(props) { + super(props); + this.state = { + currentCode: '', + processed: false, + ticketID: '', + }; + } -export default Ticket; + componentDidMount() { + this.setState({ ticketID: this.props.match.params.ticketID }); + } + + onFileSelectionChange = (e, data) => { + this.setState({ currentCode: data.value }); + }; + + render() { + return ( + <> + + + + ); + } +} + +export default withRouter(Ticket); diff --git a/yarn.lock b/yarn.lock index 6225810..4174cab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -864,6 +864,13 @@ dependencies: regenerator-runtime "^0.13.2" +"@babel/runtime@^7.4.0": + version "7.7.2" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.2.tgz#111a78002a5c25fc8e3361bedc9529c696b85a6a" + integrity sha512-JONRbXbTXc9WQE2mAZd1p0Z3DZ/6vaQIkgYMSTP3KjRCyd7rCZCcfhCyX+YjwcKxcZ82UrxbRD358bpExNgrjw== + dependencies: + regenerator-runtime "^0.13.2" + "@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4", "@babel/template@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6" @@ -1547,6 +1554,11 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7: mime-types "~2.1.24" negotiator "0.6.2" +ace-builds@^1.4.6: + version "1.4.7" + resolved "https://registry.yarnpkg.com/ace-builds/-/ace-builds-1.4.7.tgz#56e5465270b6c48a48d30e70d6b8f6b92fbf2b08" + integrity sha512-gwQGVFewBopRLho08BfahyvRa9FlB43JUig5ItAKTYc9kJJsbA9QNz75p28QtQomoPQ9rJx82ymL21x4ZSZmdg== + acorn-globals@^4.1.0, acorn-globals@^4.3.0: version "4.3.4" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7" @@ -3299,6 +3311,11 @@ detect-port-alt@1.1.6: address "^1.0.1" debug "^2.6.0" +diff-match-patch@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/diff-match-patch/-/diff-match-patch-1.0.4.tgz#6ac4b55237463761c4daf0dc603eb869124744b1" + integrity sha512-Uv3SW8bmH9nAtHKaKSanOQmj2DnlH65fUpcrMdfdaOxUG02QQ4YGZ8AE7kKOMisF7UqvOlGKVYWRvezdncW9lg== + diff-sequences@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" @@ -4624,6 +4641,18 @@ hex-color-regex@^1.1.0: resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e" integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ== +history@^4.9.0: + version "4.10.1" + resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3" + integrity sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew== + dependencies: + "@babel/runtime" "^7.1.2" + loose-envify "^1.2.0" + resolve-pathname "^3.0.0" + tiny-invariant "^1.0.2" + tiny-warning "^1.0.0" + value-equal "^1.0.1" + hmac-drbg@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" @@ -4633,6 +4662,13 @@ hmac-drbg@^1.0.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" +hoist-non-react-statics@^3.1.0: + version "3.3.1" + resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#101685d3aff3b23ea213163f6e8e12f4f111e19f" + integrity sha512-wbg3bpgA/ZqWrZuMOeJi8+SKMhr7X9TesL/rXMjTzh0p0JUBo3II8DHboYbuIXWRlttrUFxwcu/5kygrCw8fJw== + dependencies: + react-is "^16.7.0" + hosted-git-info@^2.1.4: version "2.8.5" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.5.tgz#759cfcf2c4d156ade59b0b2dfabddc42a6b9c70c" @@ -5300,6 +5336,11 @@ is-wsl@^1.1.0: resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= +isarray@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= + isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -6099,6 +6140,16 @@ lodash._reinterpolate@^3.0.0: resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= +lodash.get@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" + integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= + +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= + lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" @@ -6144,7 +6195,7 @@ loglevel@^1.4.1: resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.4.tgz#f408f4f006db8354d0577dcf6d33485b3cb90d56" integrity sha512-p0b6mOGKcGa+7nnmKbpzR6qloPbrgLcnio++E+14Vo/XffOGwZtRpUhr8dTH/x2oCMmEoIU0Zwm3ZauhvYD17g== -loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: +loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== @@ -6344,6 +6395,15 @@ mimic-fn@^2.0.0, mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== +mini-create-react-context@^0.3.0: + version "0.3.2" + resolved "https://registry.yarnpkg.com/mini-create-react-context/-/mini-create-react-context-0.3.2.tgz#79fc598f283dd623da8e088b05db8cddab250189" + integrity sha512-2v+OeetEyliMt5VHMXsBhABoJ0/M4RCe7fatd/fBy6SMiKazUSEt3gxxypfnk2SHMkdBYvorHRoQxuGoiwbzAw== + dependencies: + "@babel/runtime" "^7.4.0" + gud "^1.0.0" + tiny-warning "^1.0.2" + mini-css-extract-plugin@0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.8.0.tgz#81d41ec4fe58c713a96ad7c723cdb2d0bd4d70e1" @@ -6440,6 +6500,11 @@ mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: dependencies: minimist "0.0.8" +moment@^2.24.0: + version "2.24.0" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" + integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg== + move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" @@ -7210,6 +7275,13 @@ path-to-regexp@0.1.7: resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= +path-to-regexp@^1.7.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.8.0.tgz#887b3ba9d84393e87a0a0b9f4cb756198b53548a" + integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA== + dependencies: + isarray "0.0.1" + path-type@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" @@ -8266,6 +8338,17 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" +react-ace@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/react-ace/-/react-ace-8.0.0.tgz#e6fc155ec3cf240e92bdf2e156a50458a78ed0a4" + integrity sha512-EvU14vXbZpAenb1ZVKdn8yTQs/shZ9RghFulHtt67bBXT6sjrNHcfOEXHYtSEmwMb6pQVVNNuulzzd8o+Uouig== + dependencies: + ace-builds "^1.4.6" + diff-match-patch "^1.0.4" + lodash.get "^4.4.2" + lodash.isequal "^4.5.0" + prop-types "^15.7.2" + react-app-polyfill@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/react-app-polyfill/-/react-app-polyfill-1.0.4.tgz#4dd2636846b585c2d842b1e44e1bc29044345874" @@ -8324,11 +8407,21 @@ react-error-overlay@^6.0.3: resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.3.tgz#c378c4b0a21e88b2e159a3e62b2f531fd63bf60d" integrity sha512-bOUvMWFQVk5oz8Ded9Xb7WVdEi3QGLC8tH7HmYP0Fdp4Bn3qw0tRFmr5TW6mvahzvmrK4a6bqWGfCevBflP+Xw== +react-is@^16.6.0, react-is@^16.7.0: + version "16.12.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" + integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q== + react-is@^16.6.3, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: version "16.11.0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.11.0.tgz#b85dfecd48ad1ce469ff558a882ca8e8313928fa" integrity sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw== +react-moment@^0.9.6: + version "0.9.6" + resolved "https://registry.yarnpkg.com/react-moment/-/react-moment-0.9.6.tgz#6b359a48205a52196408303e30bc982cd46d0bee" + integrity sha512-GAnd5NRIpGjDqLoGahJCkiCEQS1d8+dIZbIfPuy/eQ0O5Rio43fEkj5G+qrKbZCQY55fiNafpHpuirVIHqPoSg== + react-popper@^1.3.4: version "1.3.4" resolved "https://registry.yarnpkg.com/react-popper/-/react-popper-1.3.4.tgz#f0cd3b0d30378e1f663b0d79bcc8614221652ced" @@ -8341,6 +8434,35 @@ react-popper@^1.3.4: typed-styles "^0.0.7" warning "^4.0.2" +react-router-dom@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.1.2.tgz#06701b834352f44d37fbb6311f870f84c76b9c18" + integrity sha512-7BPHAaIwWpZS074UKaw1FjVdZBSVWEk8IuDXdB+OkLb8vd/WRQIpA4ag9WQk61aEfQs47wHyjWUoUGGZxpQXew== + dependencies: + "@babel/runtime" "^7.1.2" + history "^4.9.0" + loose-envify "^1.3.1" + prop-types "^15.6.2" + react-router "5.1.2" + tiny-invariant "^1.0.2" + tiny-warning "^1.0.0" + +react-router@5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.1.2.tgz#6ea51d789cb36a6be1ba5f7c0d48dd9e817d3418" + integrity sha512-yjEuMFy1ONK246B+rsa0cUam5OeAQ8pyclRDgpxuSCrAlJ1qN9uZ5IgyKC7gQg0w8OM50NXHEegPh/ks9YuR2A== + dependencies: + "@babel/runtime" "^7.1.2" + history "^4.9.0" + hoist-non-react-statics "^3.1.0" + loose-envify "^1.3.1" + mini-create-react-context "^0.3.0" + path-to-regexp "^1.7.0" + prop-types "^15.6.2" + react-is "^16.6.0" + tiny-invariant "^1.0.2" + tiny-warning "^1.0.0" + react-scripts@3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-3.1.2.tgz#40b166d380bfd8b425a41dee96e8e725c82bf9e6" @@ -8688,6 +8810,11 @@ resolve-from@^4.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== +resolve-pathname@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd" + integrity sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng== + resolve-url-loader@3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/resolve-url-loader/-/resolve-url-loader-3.1.0.tgz#54d8181d33cd1b66a59544d05cadf8e4aa7d37cc" @@ -9703,6 +9830,16 @@ timsort@^0.3.0: resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q= +tiny-invariant@^1.0.2: + version "1.0.6" + resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.0.6.tgz#b3f9b38835e36a41c843a3b0907a5a7b3755de73" + integrity sha512-FOyLWWVjG+aC0UqG76V53yAWdXfH8bO6FNmyZOuUrzDzK8DI3/JRY25UD7+g49JWM1LXwymsKERB+DzI0dTEQA== + +tiny-warning@^1.0.0, tiny-warning@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" + integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== + tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" @@ -10060,6 +10197,11 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +value-equal@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c" + integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw== + vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" From 94c40653fd11e607274b3edcd9a4976e237bf998 Mon Sep 17 00:00:00 2001 From: Yuze Jiang Date: Tue, 19 Nov 2019 22:46:52 -0600 Subject: [PATCH 2/7] Move processed from Screenshot to Ticket, recurring every 5 secs --- src/views/tickets/JSViewer.js | 111 ++++++++++++++------------------ src/views/tickets/Screenshot.js | 70 ++++---------------- src/views/tickets/Ticket.js | 57 +++++++++++++--- 3 files changed, 106 insertions(+), 132 deletions(-) diff --git a/src/views/tickets/JSViewer.js b/src/views/tickets/JSViewer.js index 0e23301..6a27b16 100644 --- a/src/views/tickets/JSViewer.js +++ b/src/views/tickets/JSViewer.js @@ -8,86 +8,70 @@ import 'ace-builds/src-noconflict/mode-javascript'; import 'ace-builds/src-noconflict/theme-monokai'; export default class CodeBlock extends Component { - state = { - id: '', - processed: '', - count: 0, - }; + constructor(props) { + super(props); + this.state = { + ready: false, + }; + } fileList = []; - onResponseReceived = async e => { - this.state.id = this.props.ticketID; - //there is not reason why this should be called twice but - //I can't figure out how to pass the processed flag through the routes + async fetchArtifacts() { + const endpoint = + 'http://localhost:8080/api/tickets/' + this.props.ticketID + '/artifacts'; try { - const res = await fetch( - 'http://localhost:8080/api/tickets/' + this.state.id, - { - method: 'GET', - } + const res = await fetch(endpoint, { + method: 'GET', + }); + const json = await res.json(); + const artifacts = json.fileArtifacts.filter(artifact => + artifact.filename.endsWith('.js') ); + const numberOfFiles = artifacts.count; + artifacts.forEach(async artifact => { + const e = + 'http://localhost:8080/api/tickets/' + + this.props.ticketID + + '/artifacts/' + + artifact.filename; - const response = await res.json(); - var processed = response.ticket.processed; - } catch (error) { - console.log(error); - } - - if (processed) { - this.setState({ processed: true }); - const endpoint = - 'http://localhost:8080/api/tickets/' + this.state.id + '/artifacts'; - try { - const res = await fetch(endpoint, { + const c = await fetch(e, { method: 'GET', + responseType: 'text', }); - const json = await res.json(); - const artifacts = json.fileArtifacts.filter(artifact => - artifact.filename.endsWith('.js') - ); - artifacts.forEach(async artifact => { - const e = - 'http://localhost:8080/api/tickets/' + - this.state.id + - '/artifacts/' + - artifact.filename; - - const c = await fetch(e, { - method: 'GET', - responseType: 'text', + const cc = await c.text(); + const name = artifact.filename; + if ( + this.fileList.find(i => { + return i.key === name; + }) === undefined + ) { + this.fileList.push({ + key: name, + text: {name}, + value: cc, + image: null, }); - const cc = await c.text(); - const name = artifact.filename; - if ( - this.fileList.find(i => { - return i.key === name; - }) === undefined - ) { - this.fileList.push({ - key: name, - text: {name}, - value: cc, - image: null, - }); - this.setState({ count: this.state.count + 1 }); + if (this.fileList.count === numberOfFiles) { + this.setState({ ready: true }); } - }); - } catch (error) { - console.log(error); - } + } + }); + } catch (error) { + console.log(error); } - }; + } + + componentDidMount() { + this.fetchArtifacts(); + } handleOnChange = (e, data) => { this.props.onFileSelectionChange(e, data); }; render() { - if (!this.state.processed) { - this.onResponseReceived(); - } - return (
diff --git a/src/views/tickets/Screenshot.js b/src/views/tickets/Screenshot.js index d8c1048..794864f 100644 --- a/src/views/tickets/Screenshot.js +++ b/src/views/tickets/Screenshot.js @@ -2,67 +2,19 @@ import React, { Component } from 'react'; import { Header, Image, Segment } from 'semantic-ui-react'; export default class Screenshot extends Component { - state = { - id: '', - processed: '', - }; - - onResponseReceived = async e => { - this.state.id = this.props.ticketID; - //there is not reason why this should be called twice but - //I can't figure out how to pass the processed flag through the routes - try { - const res = await fetch( - 'http://localhost:8080/api/tickets/' + this.state.id, - { - method: 'GET', - } - ); - - const response = await res.json(); - var processed = response.ticket.processed; - } catch (error) { - console.log(error); - } - - if (processed) { - this.setState({ processed: true }); - } else { - this.setState({ processed: false }); - } - }; - render() { - if (!this.state.processed) { - this.onResponseReceived(); - } - return ( -
- -
- {' '} - Screenshot for ticket #{this.state.id}{' '} -
- {this.state.processed && ( - fullpage screenshot - )} - {!this.state.processed && ( -
- {' '} - This ticket has not been processed. Please wait.{' '} -
- )} -
-
+ + fullpage screenshot + ); } } diff --git a/src/views/tickets/Ticket.js b/src/views/tickets/Ticket.js index a505d7a..af1f3a2 100644 --- a/src/views/tickets/Ticket.js +++ b/src/views/tickets/Ticket.js @@ -1,4 +1,5 @@ import React from 'react'; +import { Header } from 'semantic-ui-react'; import { withRouter } from 'react-router'; import Screenshot from './Screenshot'; @@ -10,12 +11,34 @@ class Ticket extends React.Component { this.state = { currentCode: '', processed: false, - ticketID: '', + ticketID: this.props.match.params.ticketID, }; } + async checkProcessed() { + console.log('checking'); + try { + const res = await fetch( + 'http://localhost:8080/api/tickets/' + this.state.ticketID, + { + method: 'GET', + } + ); + + const response = await res.json(); + const processed = response.ticket.processed; + this.setState({ processed: processed }); + if (processed) { + clearInterval(this.interval); + } + } catch (error) { + console.log(error); + } + } + componentDidMount() { - this.setState({ ticketID: this.props.match.params.ticketID }); + this.interval = setInterval(this.checkProcessed.bind(this), 5000); + this.checkProcessed(); } onFileSelectionChange = (e, data) => { @@ -24,14 +47,28 @@ class Ticket extends React.Component { render() { return ( - <> - - - +
+ {!this.state.processed && ( +
+ {' '} + This ticket has not been processed. Please wait.{' '} +
+ )} + {this.state.processed && ( +
+
+ {' '} + Screenshot for ticket #{this.state.id}{' '} +
+ + +
+ )} +
); } } From a4e6885ef6125c9d9b413613f35941bc6f617ee3 Mon Sep 17 00:00:00 2001 From: Yuze Jiang Date: Tue, 19 Nov 2019 23:00:09 -0600 Subject: [PATCH 3/7] Cleanup --- src/views/tickets/CodeView.js | 32 -------------------------------- src/views/tickets/Ticket.js | 1 - 2 files changed, 33 deletions(-) delete mode 100644 src/views/tickets/CodeView.js diff --git a/src/views/tickets/CodeView.js b/src/views/tickets/CodeView.js deleted file mode 100644 index 8672e9b..0000000 --- a/src/views/tickets/CodeView.js +++ /dev/null @@ -1,32 +0,0 @@ -import React, { Component } from 'react'; - -// import Prism from "prismjs" -// import 'prismjs/themes/prism-okaidia.css' - -export default class CodeView extends Component { - constructor(props) { - super(props); - this.ref = React.createRef(); - } - componentDidMount() { - this.highlight(); - } - componentDidUpdate() { - this.highlight(); - } - highlight = () => { - if (this.ref && this.ref.current) { - // Prism.highlightElement(this.ref.current) - } - }; - render() { - const code = this.props.code; - return ( -
-        
-          {code}
-        
-      
- ); - } -} diff --git a/src/views/tickets/Ticket.js b/src/views/tickets/Ticket.js index af1f3a2..76d32b8 100644 --- a/src/views/tickets/Ticket.js +++ b/src/views/tickets/Ticket.js @@ -16,7 +16,6 @@ class Ticket extends React.Component { } async checkProcessed() { - console.log('checking'); try { const res = await fetch( 'http://localhost:8080/api/tickets/' + this.state.ticketID, From b62ce20c0b45bdc66be5524ccd99d15b537fa2ab Mon Sep 17 00:00:00 2001 From: Yuze Jiang Date: Tue, 19 Nov 2019 23:51:36 -0600 Subject: [PATCH 4/7] Fix ticket # not showing --- src/views/tickets/Ticket.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/tickets/Ticket.js b/src/views/tickets/Ticket.js index 76d32b8..1872938 100644 --- a/src/views/tickets/Ticket.js +++ b/src/views/tickets/Ticket.js @@ -57,7 +57,7 @@ class Ticket extends React.Component {
{' '} - Screenshot for ticket #{this.state.id}{' '} + Screenshot for ticket #{this.state.ticketID}{' '}
Date: Thu, 21 Nov 2019 20:00:01 -0600 Subject: [PATCH 5/7] Cleanup after rebasing, add loading & placeholder components --- package.json | 1 + src/views/home/Home.js | 2 +- src/views/tickets/JSViewer.js | 82 ++++++++++++++++----------------- src/views/tickets/Screenshot.js | 2 +- src/views/tickets/Ticket.js | 50 +++++++++++++++++--- src/views/tickets/Tickets.js | 3 +- yarn.lock | 63 +++++++++++++++++++++++-- 7 files changed, 147 insertions(+), 56 deletions(-) diff --git a/package.json b/package.json index 4470444..7ac0604 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { + "js-beautify": "^1.10.2", "moment": "^2.24.0", "perms": "^0.1.0", "react": "^16.9.0", diff --git a/src/views/home/Home.js b/src/views/home/Home.js index 9b7c097..3b54f07 100644 --- a/src/views/home/Home.js +++ b/src/views/home/Home.js @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React from 'react'; // Components import UserInput from './UserInput'; diff --git a/src/views/tickets/JSViewer.js b/src/views/tickets/JSViewer.js index 6a27b16..3171671 100644 --- a/src/views/tickets/JSViewer.js +++ b/src/views/tickets/JSViewer.js @@ -3,6 +3,7 @@ import React, { Component } from 'react'; import { Dropdown } from 'semantic-ui-react'; import AceEditor from 'react-ace'; +import { js as beautify } from 'js-beautify'; import 'ace-builds/src-noconflict/mode-javascript'; import 'ace-builds/src-noconflict/theme-monokai'; @@ -17,47 +18,42 @@ export default class CodeBlock extends Component { fileList = []; - async fetchArtifacts() { - const endpoint = - 'http://localhost:8080/api/tickets/' + this.props.ticketID + '/artifacts'; + fetchArtifacts() { + const artifactURL = `http://localhost:8080/api/tickets/${this.props.ticketID}/artifacts`; try { - const res = await fetch(endpoint, { - method: 'GET', - }); - const json = await res.json(); - const artifacts = json.fileArtifacts.filter(artifact => - artifact.filename.endsWith('.js') - ); - const numberOfFiles = artifacts.count; - artifacts.forEach(async artifact => { - const e = - 'http://localhost:8080/api/tickets/' + - this.props.ticketID + - '/artifacts/' + - artifact.filename; - - const c = await fetch(e, { - method: 'GET', - responseType: 'text', - }); - const cc = await c.text(); - const name = artifact.filename; - if ( - this.fileList.find(i => { - return i.key === name; - }) === undefined - ) { - this.fileList.push({ - key: name, - text: {name}, - value: cc, - image: null, - }); - if (this.fileList.count === numberOfFiles) { - this.setState({ ready: true }); + fetch(artifactURL, { method: 'GET' }) + .then(res => res.json()) + .then(res => { + const artifacts = res.fileArtifacts.filter(artifact => + artifact.filename.endsWith('.js') + ); + const numberOfFiles = artifacts.count; + for (let i in artifacts) { + const name = artifacts[i].filename; + if ( + this.fileList.find(i => { + return i.key === name; + }) === undefined + ) { + const fileURL = `http://localhost:8080/api/tickets/${this.props.ticketID}/artifacts/${name}`; + fetch(fileURL, { + method: 'GET', + responseType: 'text', + }) + .then(res => res.text()) + .then(res => { + this.fileList.push({ + key: name, + text: {name}, + value: beautify(res), + }); + if (this.fileList.count === numberOfFiles) { + this.setState({ ready: true }); + } + }); + } } - } - }); + }); } catch (error) { console.log(error); } @@ -73,7 +69,7 @@ export default class CodeBlock extends Component { render() { return ( -
+ <> -
+ ); } } diff --git a/src/views/tickets/Screenshot.js b/src/views/tickets/Screenshot.js index 794864f..03f8853 100644 --- a/src/views/tickets/Screenshot.js +++ b/src/views/tickets/Screenshot.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import { Header, Image, Segment } from 'semantic-ui-react'; +import { Image, Segment } from 'semantic-ui-react'; export default class Screenshot extends Component { render() { diff --git a/src/views/tickets/Ticket.js b/src/views/tickets/Ticket.js index 7bbe745..4e3c075 100644 --- a/src/views/tickets/Ticket.js +++ b/src/views/tickets/Ticket.js @@ -1,11 +1,9 @@ import React, { Component } from 'react'; -import { Header } from 'semantic-ui-react'; -import { withRouter } from 'react-router'; +import { Loader, Placeholder, Segment } from 'semantic-ui-react'; import Screenshot from './Screenshot'; import JSViewer from './JSViewer'; - const REFRESH_EVERY_MS = 1000; export default class Ticket extends Component { @@ -17,14 +15,17 @@ export default class Ticket extends Component { ticketID: props.match.params.ticketID, processed: false, }, - refreshInterval: setInterval(this.refreshTicketState, REFRESH_EVERY_MS), + currentCode: '', }; - + this.refreshInterval = setInterval( + this.refreshTicketState, + REFRESH_EVERY_MS + ); this.refreshTicketState(); } stopAutomaticRefreshing() { - clearInterval(this.state.refreshInterval); + clearInterval(this.refreshInterval); } componentWillUnmount() { @@ -56,11 +57,46 @@ export default class Ticket extends Component { } }; + onFileSelectionChange = (e, data) => { + this.setState({ currentCode: data.value }); + }; + render() { const { ticketInfo } = this.state; return ( <> - + {!this.state.ticketInfo.processed && ( +
+ + + + + + + + + + + + + + +
+ )} + {this.state.ticketInfo.processed && ( + <> + + + + )} ); } diff --git a/src/views/tickets/Tickets.js b/src/views/tickets/Tickets.js index 6c5d0ec..9aa4fdf 100644 --- a/src/views/tickets/Tickets.js +++ b/src/views/tickets/Tickets.js @@ -1,12 +1,11 @@ import React from 'react'; -import { Header } from 'semantic-ui-react'; import { useRouteMatch } from 'react-router-dom'; // Routes import NestedTicketRoutes from '../../routes/NestedTicketRoutes'; const Tickets = ({ ticket }) => { - const { path, url } = useRouteMatch(); + const { path } = useRouteMatch(); return ( <> diff --git a/yarn.lock b/yarn.lock index 4174cab..6ff4e11 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2653,7 +2653,7 @@ commander@2.17.x: resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== -commander@^2.11.0, commander@^2.20.0, commander@~2.20.3: +commander@^2.11.0, commander@^2.19.0, commander@^2.20.0, commander@~2.20.3: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== @@ -2720,6 +2720,14 @@ concat-stream@^1.5.0: readable-stream "^2.2.2" typedarray "^0.0.6" +config-chain@^1.1.12: + version "1.1.12" + resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.12.tgz#0fde8d091200eb5e808caf25fe618c02f48e4efa" + integrity sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA== + dependencies: + ini "^1.3.4" + proto-list "~1.2.1" + confusing-browser-globals@^1.0.9: version "1.0.9" resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz#72bc13b483c0276801681871d4898516f8f54fdd" @@ -3480,6 +3488,16 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" +editorconfig@^0.15.3: + version "0.15.3" + resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.15.3.tgz#bef84c4e75fb8dcb0ce5cee8efd51c15999befc5" + integrity sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g== + dependencies: + commander "^2.19.0" + lru-cache "^4.1.5" + semver "^5.6.0" + sigmund "^1.0.1" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -4979,7 +4997,7 @@ inherits@2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= -ini@^1.3.5, ini@~1.3.0: +ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== @@ -5793,6 +5811,17 @@ jquery@x.*: resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.1.tgz#714f1f8d9dde4bdfa55764ba37ef214630d80ef2" integrity sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw== +js-beautify@^1.10.2: + version "1.10.2" + resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.10.2.tgz#88c9099cd6559402b124cfab18754936f8a7b178" + integrity sha512-ZtBYyNUYJIsBWERnQP0rPN9KjkrDfJcMjuVGcvXOUJrD1zmOGwhRwQ4msG+HJ+Ni/FA7+sRQEMYVzdTQDvnzvQ== + dependencies: + config-chain "^1.1.12" + editorconfig "^0.15.3" + glob "^7.1.3" + mkdirp "~0.5.1" + nopt "~4.0.1" + js-levenshtein@^1.1.3: version "1.1.6" resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" @@ -6207,6 +6236,14 @@ lower-case@^1.1.1: resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw= +lru-cache@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -6712,7 +6749,7 @@ node-releases@^1.1.29, node-releases@^1.1.38: dependencies: semver "^6.3.0" -nopt@^4.0.1: +nopt@^4.0.1, nopt@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= @@ -8183,6 +8220,11 @@ prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2: object-assign "^4.1.1" react-is "^16.8.1" +proto-list@~1.2.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" + integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= + proxy-addr@~2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.5.tgz#34cbd64a2d81f4b1fd21e76f9f06c8a45299ee34" @@ -8196,6 +8238,11 @@ prr@~1.0.1: resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= + psl@^1.1.24, psl@^1.1.28: version "1.4.0" resolved "https://registry.yarnpkg.com/psl/-/psl-1.4.0.tgz#5dd26156cdb69fa1fdb8ab1991667d3f80ced7c2" @@ -9222,6 +9269,11 @@ shellwords@^0.1.1: resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== +sigmund@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" + integrity sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA= + signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -10689,6 +10741,11 @@ xtend@^4.0.0, xtend@~4.0.1: resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= + yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" From 1d256e69717fab46987922932583e331766113fb Mon Sep 17 00:00:00 2001 From: Yuze Jiang Date: Sat, 23 Nov 2019 15:53:41 -0600 Subject: [PATCH 6/7] Add a few empty lines --- src/views/tickets/JSViewer.js | 5 +++++ src/views/tickets/Ticket.js | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/views/tickets/JSViewer.js b/src/views/tickets/JSViewer.js index 3171671..8c68f14 100644 --- a/src/views/tickets/JSViewer.js +++ b/src/views/tickets/JSViewer.js @@ -27,15 +27,19 @@ export default class CodeBlock extends Component { const artifacts = res.fileArtifacts.filter(artifact => artifact.filename.endsWith('.js') ); + const numberOfFiles = artifacts.count; + for (let i in artifacts) { const name = artifacts[i].filename; + if ( this.fileList.find(i => { return i.key === name; }) === undefined ) { const fileURL = `http://localhost:8080/api/tickets/${this.props.ticketID}/artifacts/${name}`; + fetch(fileURL, { method: 'GET', responseType: 'text', @@ -47,6 +51,7 @@ export default class CodeBlock extends Component { text: {name}, value: beautify(res), }); + if (this.fileList.count === numberOfFiles) { this.setState({ ready: true }); } diff --git a/src/views/tickets/Ticket.js b/src/views/tickets/Ticket.js index 4e3c075..ef555ee 100644 --- a/src/views/tickets/Ticket.js +++ b/src/views/tickets/Ticket.js @@ -17,10 +17,12 @@ export default class Ticket extends Component { }, currentCode: '', }; + this.refreshInterval = setInterval( this.refreshTicketState, REFRESH_EVERY_MS ); + this.refreshTicketState(); } From fa742a34eb8ecabbe650d0a2382a973e8aef0996 Mon Sep 17 00:00:00 2001 From: Rafael Barash Date: Sun, 24 Nov 2019 15:02:06 -0600 Subject: [PATCH 7/7] package-lock not updated --- package-lock.json | 121 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/package-lock.json b/package-lock.json index a781f33..08f3c28 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1654,6 +1654,11 @@ "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.2.tgz", "integrity": "sha1-ovuhsSLGmoXKoC0Q+ScMchlwmp0=" }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + }, "accepts": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", @@ -1663,6 +1668,11 @@ "negotiator": "0.6.2" } }, + "ace-builds": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/ace-builds/-/ace-builds-1.4.7.tgz", + "integrity": "sha512-gwQGVFewBopRLho08BfahyvRa9FlB43JUig5ItAKTYc9kJJsbA9QNz75p28QtQomoPQ9rJx82ymL21x4ZSZmdg==" + }, "acorn": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", @@ -3577,6 +3587,15 @@ "typedarray": "^0.0.6" } }, + "config-chain": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", + "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", + "requires": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, "confusing-browser-globals": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz", @@ -4242,6 +4261,11 @@ "debug": "^2.6.0" } }, + "diff-match-patch": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/diff-match-patch/-/diff-match-patch-1.0.4.tgz", + "integrity": "sha512-Uv3SW8bmH9nAtHKaKSanOQmj2DnlH65fUpcrMdfdaOxUG02QQ4YGZ8AE7kKOMisF7UqvOlGKVYWRvezdncW9lg==" + }, "diff-sequences": { "version": "24.9.0", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.9.0.tgz", @@ -4413,6 +4437,17 @@ "safer-buffer": "^2.1.0" } }, + "editorconfig": { + "version": "0.15.3", + "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz", + "integrity": "sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==", + "requires": { + "commander": "^2.19.0", + "lru-cache": "^4.1.5", + "semver": "^5.6.0", + "sigmund": "^1.0.1" + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -7795,6 +7830,18 @@ "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz", "integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==" }, + "js-beautify": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.10.2.tgz", + "integrity": "sha512-ZtBYyNUYJIsBWERnQP0rPN9KjkrDfJcMjuVGcvXOUJrD1zmOGwhRwQ4msG+HJ+Ni/FA7+sRQEMYVzdTQDvnzvQ==", + "requires": { + "config-chain": "^1.1.12", + "editorconfig": "^0.15.3", + "glob": "^7.1.3", + "mkdirp": "~0.5.1", + "nopt": "~4.0.1" + } + }, "js-levenshtein": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", @@ -8134,6 +8181,16 @@ "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=" }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" + }, + "lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=" + }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -8189,6 +8246,15 @@ "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=" }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, "make-dir": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", @@ -8697,6 +8763,15 @@ "semver": "^5.3.0" } }, + "nopt": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, "normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -9014,6 +9089,11 @@ "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=" }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" + }, "os-locale": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", @@ -9029,6 +9109,15 @@ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", @@ -10433,6 +10522,11 @@ "react-is": "^16.8.1" } }, + "proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=" + }, "proxy-addr": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", @@ -10447,6 +10541,11 @@ "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=" }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" + }, "psl": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz", @@ -10609,6 +10708,18 @@ "prop-types": "^15.6.2" } }, + "react-ace": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/react-ace/-/react-ace-8.0.0.tgz", + "integrity": "sha512-EvU14vXbZpAenb1ZVKdn8yTQs/shZ9RghFulHtt67bBXT6sjrNHcfOEXHYtSEmwMb6pQVVNNuulzzd8o+Uouig==", + "requires": { + "ace-builds": "^1.4.6", + "diff-match-patch": "^1.0.4", + "lodash.get": "^4.4.2", + "lodash.isequal": "^4.5.0", + "prop-types": "^15.7.2" + } + }, "react-app-polyfill": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-1.0.3.tgz", @@ -11737,6 +11848,11 @@ "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", "integrity": "sha1-1rkYHBpI05cyTISHHvvPxz/AZUs=" }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" + }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -13605,6 +13721,11 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", "integrity": "sha1-le+U+F7MgdAHwmThkKEg8KPIVms=" + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" } } }