Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryAPI Logging Features + UI/UX changes #388

Merged
merged 9 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"lint": "next lint"
},
"dependencies": {
"@apollo/client": "^3.8.7",
"@graphiql/plugin-code-exporter": "0.3.5",
"@graphiql/plugin-explorer": "0.3.5",
"@monaco-editor/react": "^4.1.3",
Expand All @@ -25,7 +26,8 @@
"eslint": "8.34.0",
"eslint-config-next": "13.1.6",
"graphiql": "3.0.6",
"graphql": "^16.6.0",
"graphql": "^16.8.1",
"gridjs": "6.0.6",
"near-api-js": "1.1.0",
"near-social-bridge": "^1.4.1",
"next": "13.1.6",
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/components/Editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ const Editor = ({
height: "85vh",
}}
>
{!indexerDetails.code && (
<Alert className="px-3 pt-3" variant="danger">
Indexer Function could not be found. Are you sure this indexer exists?
</Alert>
)}
{indexerDetails.code && <>
<EditorButtons
handleFormating={handleFormating}
handleCodeGen={handleCodeGen}
Expand Down Expand Up @@ -455,6 +461,7 @@ const Editor = ({
handleEditorMount={handleEditorMount}
/>
</div>
</>}
</div>
);
};
Expand Down
110 changes: 66 additions & 44 deletions frontend/src/components/Editor/EditorButtons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import {
TrashFill,
XCircle,
NodePlus,
Code
Code,
FileText,
} from "react-bootstrap-icons";
import { BlockPicker } from "./BlockPicker";
import { IndexerDetailsContext } from '../../contexts/IndexerDetailsContext';
Expand Down Expand Up @@ -49,7 +50,9 @@ const EditorButtons = ({
debugMode,
isCreateNewIndexer,
indexerNameField,
setIndexerNameField
setIndexerNameField,
setShowLogsView,
showLogsView,
} = useContext(IndexerDetailsContext);

const removeHeight = (index) => {
Expand All @@ -69,7 +72,6 @@ const EditorButtons = ({
>
<Row className="w-100">
<Col style={{ display: "flex", justifyContent: "start", flexDirection: "column" }}>

<Breadcrumb className="flex">
<Breadcrumb.Item className="flex align-center " href="#">
{accountId}
Expand Down Expand Up @@ -107,7 +109,7 @@ const EditorButtons = ({
)}
</Col>
<Col
style={{ display: "flex", justifyContent: "end", height: "40px" }}
style={{ display: "flex", justifyContent: "end", flexDirection: "column", alignItems: "flex-end" }}
>
<ButtonGroup
className="inline-block"
Expand Down Expand Up @@ -144,47 +146,22 @@ const EditorButtons = ({
</>
)}

<OverlayTrigger
placement="bottom"
overlay={<Tooltip>Reset Changes To Code</Tooltip>}
>
<Button
size="sm"
className="flex align-center"
variant="secondary"
onClick={() => setShowResetCodeModel(true)}
>
<ArrowCounterclockwise size={22} />
</Button>
</OverlayTrigger>

<OverlayTrigger
placement="bottom"
overlay={<Tooltip>Format Code</Tooltip>}
>
<Button
size="sm"
variant="secondary"
className="flex align-center"
onClick={() => handleFormating()}
>
<Justify style={{ paddingRight: "2px" }} size={24} />
</Button>
</OverlayTrigger>

<OverlayTrigger
placement="bottom"
overlay={<Tooltip>Generate Types</Tooltip>}
>
<Button
size="sm"
variant="secondary"
className="flex align-center"
onClick={() => handleCodeGen()}
{!isCreateNewIndexer && (
<OverlayTrigger
placement="bottom"
overlay={<Tooltip>Open Logs</Tooltip>}
>
<Code style={{ paddingRight: "2px" }} size={24} />
</Button>
</OverlayTrigger>
<Button
size="sm"
variant="secondary"
className="flex align-center"
onClick={() => setShowLogsView(true)}
>
<FileText style={{ paddingRight: "2px" }} size={24} />
Show Logs
</Button>
</OverlayTrigger>
)}
{(!isUserIndexer && !isCreateNewIndexer) ? (
<OverlayTrigger
placement="bottom"
Expand Down Expand Up @@ -213,6 +190,51 @@ const EditorButtons = ({
</OverlayTrigger>
)}
</ButtonGroup>
<Row
style={{ display: "flex", justifyContent: "center", width: "60%", padding: "5px" }}
>
<ButtonGroup>
<OverlayTrigger
placement="bottom"
overlay={<Tooltip>Reset Changes To Code</Tooltip>}
>
<Button
size="sm"
className="flex align-center"
variant="secondary"
onClick={() => setShowResetCodeModel(true)}
>
<ArrowCounterclockwise size={22} />
</Button>
</OverlayTrigger>
<OverlayTrigger
placement="bottom"
overlay={<Tooltip>Format Code</Tooltip>}
>
<Button
size="sm"
variant="secondary"
className="flex align-center"
onClick={() => handleFormating()}
>
<Justify style={{ paddingRight: "2px" }} size={24} />
</Button>
</OverlayTrigger>
<OverlayTrigger
placement="bottom"
overlay={<Tooltip>Generate Types</Tooltip>}
>
<Button
size="sm"
variant="secondary"
className="flex align-center"
onClick={() => handleCodeGen()}
>
<Code style={{ paddingRight: "2px" }} size={24} />
</Button>
</OverlayTrigger>
</ButtonGroup>
</Row>
</Col>
</Row>
{debugMode && heights.length > 0 && (
Expand Down
Loading