Skip to content

Commit

Permalink
Release 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ganesan-Chandran committed Sep 17, 2022
1 parent 8d6f0d6 commit 77b9621
Show file tree
Hide file tree
Showing 22 changed files with 1,140 additions and 509 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to the "Fetch Client" extension will be documented in this file.

## v1.3.0 - September, 2022
### New Features
- Added the settings in the "Run All" Collection.
- Support for multiple iterations in "Run All" Collection.
- Can add delay between requests and iterations.
- Run the requests in sequential or parallel mode for multiple iterations.

### Bug Fixes

- import from Curl ([#5](https://github.com/Ganesan-Chandran/vscode-fetch-client/issues/5)).
- Not able to Duplicate the item in the folder.

## v1.2.0 - July, 2022
### New Features
- Support nested folder to the Collection.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ Fetch client provides the quick access of History, collection and Environment va
<br/>
<img src="https://github.com/Ganesan-Chandran/vscode-fetch-client/blob/main/images/run-all-menu.png?raw=true"/>
<img src="https://github.com/Ganesan-Chandran/vscode-fetch-client/blob/main/images/run-all.png?raw=true"/>
<img src="https://github.com/Ganesan-Chandran/vscode-fetch-client/blob/main/images/run-all-settings.png?raw=true"/>
</div>

<a name="managecookies"></a>
Expand Down
Binary file added images/run-all-settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/run-all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "fetch-client",
"displayName": "Fetch Client",
"description": "Rest API Client for VS Code which is used to test your API's within VS Code.",
"version": "1.2.0",
"version": "1.3.0",
"publisher": "GanesanChandran",
"author": {
"name": "Ganesan Chandran <https://ganesan-chandran.github.io/>"
Expand Down
8 changes: 4 additions & 4 deletions src/fetch-client-ui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import "./App.css";

const SideBar = React.lazy(() => import('./components/SideBar'));
const MainUI = React.lazy(() => import('./components/MainUI'));
const AddToCollection = React.lazy(() => import('./components/Collection/addTo'));
const CopyTo = React.lazy(() => import('./components/Collection/copyTo'));
const AddToCollection = React.lazy(() => import('./components/Collection/AddTo/addTo'));
const CopyTo = React.lazy(() => import('./components/Collection/CopyTo/copyTo'));
const Variables = React.lazy(() => import('./components/Variables'));
const AttachVariable = React.lazy(() => import('./components/Collection/attachVariable'));
const AttachVariable = React.lazy(() => import('./components/Collection/AttachVariable/attachVariable'));
const ManageCookies = React.lazy(() => import('./components/Cookies'));
const CollectionSettings = React.lazy(() => import('./components/Collection/Settings/CollectionSettings'));
const RunAll = React.lazy(() => import('./components/Collection/runAll'));
const RunAll = React.lazy(() => import('./components/Collection/RunAll/runAll'));
const ErrorLog = React.lazy(() => import('./components/ErrorLog/ErrorLog'));
const CurlUI = React.lazy(() => import('./components/Curl'));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { useEffect } from "react";
import { useState } from "react";
import { v4 as uuidv4 } from 'uuid';
import { requestTypes, responseTypes } from "../../../utils/configuration";
import { formatDate } from "../../../utils/helper";
import vscode from "../Common/vscodeAPI";
import { InitialSettings } from "../SideBar/redux/reducer";
import { ICollections, IFolder, IHistory } from "../SideBar/redux/types";
import { getMethodClassName } from "../SideBar/util";
import "./style.css";
import { requestTypes, responseTypes } from "../../../../utils/configuration";
import { formatDate } from "../../../../utils/helper";
import vscode from "../../Common/vscodeAPI";
import { InitialSettings } from "../../SideBar/redux/reducer";
import { ICollections, IFolder, IHistory } from "../../SideBar/redux/types";
import { getMethodClassName } from "../../SideBar/util";
import "../style.css";

const AddToCollection = () => {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useEffect } from "react";
import { useState } from "react";
import { requestTypes, responseTypes } from "../../../utils/configuration";
import vscode from "../Common/vscodeAPI";
import { IVariable } from "../SideBar/redux/types";
import "./style.css";
import { requestTypes, responseTypes } from "../../../../utils/configuration";
import vscode from "../../Common/vscodeAPI";
import { IVariable } from "../../SideBar/redux/types";
import "../style.css";

const AttachVariable = () => {
const [colName, setColName] = useState("");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useEffect } from "react";
import { useState } from "react";
import { v4 as uuidv4 } from 'uuid';
import { requestTypes, responseTypes } from "../../../utils/configuration";
import vscode from "../Common/vscodeAPI";
import { ICollections } from "../SideBar/redux/types";
import "./style.css";
import { requestTypes, responseTypes } from "../../../../utils/configuration";
import vscode from "../../Common/vscodeAPI";
import "../style.css";

const CopyTo = () => {

Expand Down
117 changes: 117 additions & 0 deletions src/fetch-client-ui/components/Collection/RunAll/helper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import { formatDate } from "../../../../utils/helper";
import { IRequestModel } from "../../RequestUI/redux/types";
import { FormatBytes, GetResponseTime } from "../../ResponseUI/OptionsPanel/OptionTab/util";
import { IReponseModel } from "../../ResponseUI/redux/types";
import { IVariable } from "../../SideBar/redux/types";

export function exportJson(
req: IRequestModel[],
selectedReq: boolean[],
res: IReponseModel[][],
sourceColName: string,
selectedVariable: IVariable,
totalIterations: number
): any {

let iteration: any[] = [];
for (let i = 0; i < totalIterations; i++) {
let iterationData: any[] = [];
req.forEach((item, index) => {
if (selectedReq[index]) {
iterationData.push({
request: {
id: item.id,
url: item.url,
name: item.name,
createdTime: item.createdTime,
method: item.method.toUpperCase(),
notes: item.notes
},
response: res[i] && res[i][index] ? {
status: res[i][index].response.status,
statusText: res[i][index].response.statusText,
duration: getResponseDuration(res, i, index),
size: getResponseSize(res, i, index)
} : "[]",
tests: res[i] && res[i][index] && res[i][index].testResults ? res[i][index].testResults.map((itm) => {
return {
testCase: itm.test,
actualValue: itm.actualValue,
result: itm.result
};
}) : "[]",
totalTests: res[i] && res[i][index] && res[i][index].testResults ? res[i][index].testResults.length : 0,
passedTests: res[i] && res[i][index] && res[i][index].testResults ? res[i][index].testResults.filter(re => re.result === true).length : 0,
failedTests: res[i] && res[i][index] && res[i][index].testResults ? res[i][index].testResults.filter(re => re.result === false).length : 0,
});
}
});

let totalRequests = selectedReq.filter(item => item === true).length;
let passedCount = passedRequestsCount(res[i]);

let iterationInfo = {
iteration: i + 1,
totalRequests: totalRequests,
passedRequests: passedCount,
failedRequests: totalRequests - passedCount,
iterationData: iterationData
};
iteration.push(iterationInfo);
}

let exportData = {
app: "Fetch Client",
collectionName: sourceColName,
version: "1.0",
exportedDate: formatDate(),
variableName: selectedVariable.name,
totalIterations: totalIterations,
iterations: iteration
};

return exportData;
}

export function exportCSV(
req: IRequestModel[],
selectedReq: boolean[],
res: IReponseModel[][],
sourceColName: string,
selectedVariable: IVariable,
totalIterations: number
): string {
let data = `app,Fetch Client\ncollectionName,${sourceColName}\nversion,1.0\nexportedDate,${formatDate()}\nvariableName,${selectedVariable.name}\ntotalIterations,${totalIterations}\n\n`;

for (let i = 0; i < totalIterations; i++) {
data = data + `iteration,${i + 1}\n`;
data = data + `Id,Url,Name,Method,Status,Status Text,Duration,Size,Total Tests,Total Passed,Total Failed\n`;
req.forEach((item, index) => {
if (selectedReq[index]) {
data = data + `${item.id},${item.url},${item.name},${item.method.toUpperCase()},${res[i] && res[i][index] ? res[i][index].response.status : ""},${res[i] && res[i][index] ? res[i][index].response.statusText : ""},${getResponseDuration(res, i, index)},${getResponseSize(res, i, index)},${res[i] && res[i][index] && res[i][index].testResults ? res[i][index].testResults.length : 0},${res[i] && res[i][index] && res[i][index].testResults ? res[i][index].testResults.filter(re => re.result === true).length : 0},${res[i] && res[i][index] && res[i][index].testResults ? res[i][index].testResults.filter(re => re.result === false).length : 0}\n`;
}
});
data = data + "\n";
}

return data;
}

function passedRequestsCount(res: IReponseModel[]) {
let count = 0;
for (let i = 0; i < res?.length; i++) {
if (res[i]?.response?.status >= 200 && res[i]?.response?.status < 205) {
count++;
}
}

return count;
}

function getResponseDuration(res: IReponseModel[][], selectedIteration: number, index: number) {
return res[selectedIteration] && res[selectedIteration][index] ? res[selectedIteration][index]?.response.isError ? "0 ms" : GetResponseTime(res[selectedIteration][index].response.duration) : "";
}

function getResponseSize(res: IReponseModel[][], selectedIteration: number, index: number) {
return res[selectedIteration] && res[selectedIteration][index] ? res[selectedIteration][index]?.response.size ? FormatBytes(parseInt(res[selectedIteration][index].response.size)) : "" : "";
}
Loading

0 comments on commit 77b9621

Please sign in to comment.