Skip to content

Commit

Permalink
Merge pull request #58 from ResilientApp/SCM-23
Browse files Browse the repository at this point in the history
Scm 23
  • Loading branch information
aunshx authored Sep 27, 2024
2 parents f1eac51 + 8db39ac commit 029b002
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 66 deletions.
6 changes: 3 additions & 3 deletions build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/static/css/main.19935419.css",
"main.js": "/static/js/main.ebbcce2f.js",
"main.js": "/static/js/main.23016cec.js",
"static/js/1927.8bd9ca2b.chunk.js": "/static/js/1927.8bd9ca2b.chunk.js",
"static/js/7590.4eeecba0.chunk.js": "/static/js/7590.4eeecba0.chunk.js",
"static/js/6725.7c418f57.chunk.js": "/static/js/6725.7c418f57.chunk.js",
Expand Down Expand Up @@ -73,7 +73,7 @@
"static/media/defaultProfileImage.png": "/static/media/defaultProfileImage.6c9586e38b84a1d6a118.png",
"index.html": "/index.html",
"main.19935419.css.map": "/static/css/main.19935419.css.map",
"main.ebbcce2f.js.map": "/static/js/main.ebbcce2f.js.map",
"main.23016cec.js.map": "/static/js/main.23016cec.js.map",
"1927.8bd9ca2b.chunk.js.map": "/static/js/1927.8bd9ca2b.chunk.js.map",
"7590.4eeecba0.chunk.js.map": "/static/js/7590.4eeecba0.chunk.js.map",
"6725.7c418f57.chunk.js.map": "/static/js/6725.7c418f57.chunk.js.map",
Expand Down Expand Up @@ -145,6 +145,6 @@
},
"entrypoints": [
"static/css/main.19935419.css",
"static/js/main.ebbcce2f.js"
"static/js/main.23016cec.js"
]
}
2 changes: 1 addition & 1 deletion build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><meta name="msapplication-TileColor" content="#da532c"><meta name="theme-color" content="#ffffff"><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Visualizer for the ResilientDB Blockchain fabric"/><meta name="author" description="aunshx"/><link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css"/><title>ResView</title><script defer="defer" src="/static/js/main.ebbcce2f.js"></script><link href="/static/css/main.19935419.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script src="https://unpkg.com/aos@next/dist/aos.js"></script><script>AOS.init({delay:0,duration:600,offset:10})</script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><meta name="msapplication-TileColor" content="#da532c"><meta name="theme-color" content="#ffffff"><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Visualizer for the ResilientDB Blockchain fabric"/><meta name="author" description="aunshx"/><link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css"/><title>ResView</title><script defer="defer" src="/static/js/main.23016cec.js"></script><link href="/static/css/main.19935419.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script src="https://unpkg.com/aos@next/dist/aos.js"></script><script>AOS.init({delay:0,duration:600,offset:10})</script></body></html>
3 changes: 3 additions & 0 deletions build/static/js/main.23016cec.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/static/js/main.23016cec.js.map

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions build/static/js/main.ebbcce2f.js

This file was deleted.

1 change: 0 additions & 1 deletion build/static/js/main.ebbcce2f.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const PreSynthApp = () => {

return (
<>
{isMobile ? (
{false ? (
<OnlyDesktop />
) : (
<Router>
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Pages/Team/Ancilliary/Data/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
export const currentTeam = [
{
name: "Aunsh Bandivadekar",
title: "Architect & Developer",
title: "Dev",
socials: [
"https://instagram.com/aunsh___",
"https://linkedin.com/in/aunsh",
Expand All @@ -13,7 +13,7 @@ export const currentTeam = [
},
{
name: "Saipranav Kotamreddy",
title: "Architect & Developer",
title: "Dev",
socials: {
ig: "https://instagram.com/aunsh___",
linkedIn: "https://instagram.com/in/aunsh",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ export const generateConnections = (
points.prePrepare.start.push(points.request.end[0].points[i])
}

for (let i = 1; i < yCoords.length; i++) {
yCoordToReplicas = {
...yCoordToReplicas,
[yCoords[i]]: i,
};
}

for (const element of points.prePrepare.start) points.prePrepare.end.push([]);

for (let i = 0; i < points.prePrepare.start.length; i++) {
Expand All @@ -100,13 +107,6 @@ export const generateConnections = (
}
}

for (let i = 1; i < yCoords.length; i++) {
yCoordToReplicas = {
...yCoordToReplicas,
[yCoords[i]]: i,
};
}

// PREPARE OBJECT
let xVal = points.prePrepare.end[0][0].points.x;
let currentPreparePoints = new Set();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,23 @@ export const truncData = (data, currentTransaction) => {

if (filteredData[currentTransaction]) {
const currentTransactionEntry = entries.find(([key]) => key == currentTransaction);

selectedEntries.push(currentTransactionEntry);
const remainingEntries = entries.filter(([key]) => key != currentTransaction);
selectedEntries = selectedEntries.concat(remainingEntries.sort(() => Math.random() - 0.5).slice(0, 9));

const remainingEntries = entries
.filter(([key]) => key != currentTransaction)
.sort(([keyA], [keyB]) => parseInt(keyA) - parseInt(keyB))
.slice(0, 9);

selectedEntries = selectedEntries.concat(remainingEntries);
} else {
selectedEntries = entries.sort(() => Math.random() - 0.5).slice(0, 10);
selectedEntries = entries
.sort(([keyA], [keyB]) => parseInt(keyA) - parseInt(keyB))
.slice(0, 10);
}

const result = {};
selectedEntries.forEach(([key, value]) => {
result[key] = value;
});
return result;
};


};
12 changes: 6 additions & 6 deletions src/Components/Pages/Visualizer/Ancilliary/Data/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export const ccData = [

// !!!! DO NOT DELETE THE BELOW DUMMY DATA
export const dummyData = {
17: {
'-1': {
1: {
commit_message_timestamps: [
1701956096777352000, 1701956096782048300, 1701956096786494200,
Expand Down Expand Up @@ -390,7 +390,7 @@ export const dummyData = {
reply_time: 1702001829630,
},
},
18: {
'-2': {
1: {
commit_message_timestamps: [
1701956096777352000, 1701956096782048300, 1701956096786494200,
Expand Down Expand Up @@ -483,7 +483,7 @@ export const dummyData = {
reply_time: 1702001829630,
},
},
19: {
'-3': {
1: {
commit_message_timestamps: [
1701956096777352000, 1701956096782048300, 1701956096786494200,
Expand Down Expand Up @@ -576,7 +576,7 @@ export const dummyData = {
reply_time: 1702001829630,
},
},
20: {
'-4': {
1: {
commit_message_timestamps: [
1701956096777352000, 1701956096782048300, 1701956096786494200,
Expand Down Expand Up @@ -669,7 +669,7 @@ export const dummyData = {
// reply_time: 1702001829630,
// },
},
21: {
'-5': {
// 1: {
// commit_message_timestamps: [
// 1701956096777352000, 1701956096782048300, 1701956096786494200,
Expand Down Expand Up @@ -762,7 +762,7 @@ export const dummyData = {
reply_time: 1702001829630,
},
},
22: {
'-6': {
1: {
commit_message_timestamps: [
1701956096777352000, 1701956096782048300, 1701956096786494200,
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Pages/Visualizer/Graphs/PBFT/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ const Pbft = () => {
points.prePrepare.start.length > 0 && points.prePrepare.start.map((start, index) =>
points.prePrepare.end[index].map((end, i) => {
return (
end.flag && connectionRender([start, end.points], points.prePrepare.color, pointColorMode, TRANSDURATION_NP, i * 1 + PREPREPARE_BUFFER_NP, lineGen, lineSVG, 'prepare')
end.flag && connectionRender([start, end.points], points.prePrepare.color, pointColorMode, TRANSDURATION_NP, i * 1 + PREPREPARE_BUFFER_NP, lineGen, lineSVG, 'prePrepare')
);
})
);
Expand Down
82 changes: 51 additions & 31 deletions src/Components/Pages/Visualizer/Table/Components/SmallTable.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import classNames from 'classnames';
import React, { useContext } from 'react';
import React, { useContext, useState } from 'react';
import { DATA_TABLE_NO_PRIMARY_EXISTS } from '../../../../../Constants';
import { VizDataHistoryContext } from '../../../../../Context/visualizer';
import { truncatedDummyData } from '../../Ancilliary/Data/data';
import { Tooltip } from '@mui/material';

const TABLE_HEADERS = [
'Sr #',
Expand Down Expand Up @@ -31,49 +32,68 @@ const TableValues = ({ srNo, transaction, loading }) => {

const { changeCurrentTransaction, currentTransaction } = useContext(VizDataHistoryContext)

const [open, setOpen] = useState(false);

const handleClose = () => {
if(transactionNumber < 0) setOpen(false);
};

const handleOpen = () => {
if(transactionNumber < 0) setOpen(true);
};

const changeTransaction = (value) => {
changeCurrentTransaction(value)
}

return (
<tr
className={classNames({
'dark:bg-gray-700 bg-gray-400': transactionNumber == currentTransaction && !loading,
'cursor-pointer dark:hover:bg-gray-700 hover:bg-gray-400': !loading,
'cursor-not-allowed': loading
})}
onClick={() => !loading && changeTransaction(transactionNumber ?? 17)}
<Tooltip
arrow
placement="left"
open={open}
onClose={handleClose}
onOpen={handleOpen}
title='SYNTHETIC DATA'
>
<CellValues
value={srNo}
loading={loading}
transaction={transaction}
primaryDoesNotExist={transaction.primary}
/>
{Object.keys(transaction).length > 0 &&
Object.keys(transaction).map((value, idx) => {
if (value !== 'replicaDetails') {
return (
<CellValues
value={transaction[value]}
loading={loading}
primaryDoesNotExist={transaction.primary}
key={idx}
/>
);
}
return null;
})
}
</tr>

<tr
className={classNames({
'dark:bg-gray-700 bg-gray-400': transactionNumber == currentTransaction && !loading,
'cursor-pointer dark:hover:bg-gray-700 hover:bg-gray-400': !loading,
'cursor-not-allowed': loading
})}
onClick={() => !loading && changeTransaction(transactionNumber ?? -1)}
>
<CellValues
value={srNo}
loading={loading}
transaction={transaction}
primaryDoesNotExist={transaction.primary}
/>
{Object.keys(transaction).length > 0 &&
Object.keys(transaction).map((value, idx) => {
if (value !== 'replicaDetails') {
return (
<CellValues
value={transaction[value]}
loading={loading}
primaryDoesNotExist={transaction.primary}
key={idx}
/>
);
}
return null;
})
}
</tr>
</Tooltip>
);
}



const SmallTable = () => {
const { loading, truncatedData } = useContext(VizDataHistoryContext)


return (
<table className="text-sm text-center rtl:text-right dark:text-gray-300 text-gray-700 h-full w-full">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Analytics = () => {
</div>
<div className="grid grid-cols-2 flex-items-center-justify-center w-full">
<div className="border-r-2p border-solid border-gray-700 dark:border-gray-50 flex items-center justify-center">
<AnalyticsItem title={'Avg. Faultiness'} value={`${totalPercentFaulty * 100}%`} />
<AnalyticsItem title={'Avg. Faultiness'} value={`${(totalPercentFaulty * 100).toFixed(2)}%`} />
</div>
<div className="flex items-center justify-center">
<AnalyticsItem title={'No Primary'} value={noPrimaryCount} />
Expand Down
4 changes: 2 additions & 2 deletions src/Context/visualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { computeTableData, computeTransInfo, truncData } from "../Components/Pag
export const VizDataHistoryContext = createContext({
messageHistory: {},
changeMessageHistory: (newHistory) => { },
currentTransaction: 17,
currentTransaction: -1,
changeCurrentTransaction: (transactionNumber) => { },
replicaStatus: [false, false, false, false],
primaryIndexVal: -1,
Expand All @@ -20,7 +20,7 @@ export const VizDataHistoryContext = createContext({
export const VizDataHistoryProvider = ({ children }) => {
const { Provider } = VizDataHistoryContext;
const [messageHistory, setMessageHistory] = useState(dummyData);
const [currentTransaction, setCurrentTransaction] = useState(17);
const [currentTransaction, setCurrentTransaction] = useState(-1);
const [replicaStatus, setReplicaStatus] = useState([false, false, false, false])
const [primaryIndexVal, setPrimaryIndexVal] = useState(-1)
const [data, setData] = useState({});
Expand Down

0 comments on commit 029b002

Please sign in to comment.