Skip to content

Commit

Permalink
Merge pull request #298 from couchbaselabs/DA#297-add-a-load-more-ico…
Browse files Browse the repository at this point in the history
…n-and-show-size-in-kb-in-query-result

Da#297 add a load more icon and show size in kb in query result
  • Loading branch information
AayushTyagi1 authored Sep 27, 2023
2 parents 04d0e4d + 264448b commit a37dcfd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions images/dark/load-more.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/light/load-more.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions src/model/PagerNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/
import * as vscode from "vscode";
import * as path from "path";
import CollectionNode from "./CollectionNode";
import { INode } from "../types/INode";

Expand All @@ -26,6 +27,22 @@ export class PagerNode implements INode {
public getTreeItem(): vscode.TreeItem {
return {
label: `Load more`,
iconPath: {
light: path.join(
__filename,
"..",
"..",
"images/light",
"load-more.svg"
),
dark: path.join(
__filename,
"..",
"..",
"images/dark",
"load-more.svg"
),
},
collapsibleState: vscode.TreeItemCollapsibleState.None,
command: {
command: "vscode-couchbase.loadMore",
Expand Down
3 changes: 2 additions & 1 deletion src/workbench/queryWorkbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,14 @@ export class QueryWorkbench {
const result = await connection.cluster?.query(query, queryOptions);
const end = Date.now();
const rtt = end - start;
const resultSize = result?.meta.metrics?.resultSize;
const queryStatusProps = {
queryStatus: result?.meta.status,
rtt: rtt.toString() + " MS",
elapsed: result?.meta.metrics?.elapsedTime.toString() + " MS",
executionTime: result?.meta.metrics?.executionTime + " MS",
numDocs: result?.meta.metrics?.resultCount.toString() + " docs",
size: result?.meta.metrics?.resultSize.toString() + " Bytes",
size: resultSize ? (resultSize > 1000 ? (resultSize / 1000).toFixed(2) + " KB" : resultSize + " Bytes") : ""
};
const explainPlan = JSON.stringify(result?.meta.profile.executionTimings);
await workbenchWebviewProvider.setQueryResult(
Expand Down

0 comments on commit a37dcfd

Please sign in to comment.