Skip to content

Commit

Permalink
use uris instead of buckets in replay selector
Browse files Browse the repository at this point in the history
  • Loading branch information
WBSemple committed Oct 17, 2024
1 parent 354b7ed commit d20c4f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions tools/ReplayAnalysis/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,15 @@ def search_s3():
boto3_session = boto3.Session()

if request.method == "GET":
bucket = request.args.get("uri")
bucket, data = list_replays(bucket, session=boto3_session)
uri = request.args.get("uri")
bucket, data = list_replays(uri, session=boto3_session)
if bucket is None:
if data is ClientError:
return jsonify({"success": False, "message": data.__str__()}), 403
else:
return jsonify({"success": False, "message": data.__str__()}), 404

return jsonify({"success": True, "bucket": bucket, "replays": data}), 201
return jsonify({"success": True, "uri": uri, "replays": data}), 201


@app.route("/submit_replays", methods=["GET", "POST"])
Expand Down
24 changes: 12 additions & 12 deletions tools/ReplayAnalysis/gui/src/pages/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const HomePage = () => {

const [resource, setResource] = useState('');
const [replays, setReplays] = useState([])
const [buckets, setBuckets] = useState([])
const [bucketLabels, setBucketLabels] = useState([])
const [bucketUris, setBucketUris] = useState([])
const [bucketUriLabels, setBucketUriLabels] = useState([])
const [searching, setSearching] = useState(false)
const [profiles, setProfiles] = useState([])
const [valid, setValid] = useState(true)
Expand All @@ -36,10 +36,10 @@ export const HomePage = () => {
if (!response.success) {
setValid(false)
} else {
if (!buckets.includes(response.bucket)) {
if (!bucketUris.includes(response.uri)) {
setReplays(replays => [...replays, ...response.replays]);
setBuckets(buckets => [...buckets, response.bucket]);
setBucketLabels(buckets => [...buckets, {label: response.bucket}]);
setBucketUris(uris => [...uris, response.uri]);
setBucketUriLabels(uris => [...uris, {label: response.uri}]);
}
}

Expand All @@ -63,13 +63,13 @@ export const HomePage = () => {
* @param {number} itemIndex Total data set of query frequency values.
*/
function removeBucket(itemIndex) {
let bucket = bucketLabels[itemIndex].label
setBucketLabels([...bucketLabels.slice(0, itemIndex),
...bucketLabels.slice(itemIndex + 1)]);
setBuckets([...buckets.slice(0, itemIndex),
...buckets.slice(itemIndex + 1)]);
let uri = bucketUriLabels[itemIndex].label
setBucketUriLabels([...bucketUriLabels.slice(0, itemIndex),
...bucketUriLabels.slice(itemIndex + 1)]);
setBucketUris([...bucketUris.slice(0, itemIndex),
...bucketUris.slice(itemIndex + 1)]);
let result = replays.filter((data) => {
return data.bucket.search(bucket) === -1;
return data.workload !== uri;
});
setReplays(result);
}
Expand Down Expand Up @@ -115,7 +115,7 @@ export const HomePage = () => {
onDismiss={({detail: {itemIndex}}) => {
removeBucket(itemIndex)
}}
items={bucketLabels}>
items={bucketUriLabels}>

</TokenGroup>

Expand Down

0 comments on commit d20c4f9

Please sign in to comment.