mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-21 23:43:15 +01:00
Merge branch 'main' into feature/clickableRunnerItem
This commit is contained in:
commit
2bab688206
@ -15,6 +15,7 @@
|
|||||||
| [正體中文](docs/contributing/contributing_zhtw.md)
|
| [正體中文](docs/contributing/contributing_zhtw.md)
|
||||||
| [日本語](docs/contributing/contributing_ja.md)
|
| [日本語](docs/contributing/contributing_ja.md)
|
||||||
| [हिंदी](docs/contributing/contributing_hi.md)
|
| [हिंदी](docs/contributing/contributing_hi.md)
|
||||||
|
| [Nederlands](docs/contributing/contributing_nl.md)
|
||||||
|
|
||||||
## Let's make Bruno better, together!!
|
## Let's make Bruno better, together!!
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ Bruno is being developed as a desktop app. You need to load the app by running t
|
|||||||
### Local Development
|
### Local Development
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# use nodejs 18 version
|
# use nodejs 20 version
|
||||||
nvm use
|
nvm use
|
||||||
|
|
||||||
# install deps
|
# install deps
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| **বাংলা**
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## আসুন ব্রুনোকে আরও ভালো করি, একসাথে!!
|
## আসুন ব্রুনোকে আরও ভালো করি, একসাথে!!
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| **简体中文**
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## 让我们一起改进 Bruno!
|
## 让我们一起改进 Bruno!
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| **Deutsch**
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## Lass uns Bruno noch besser machen, gemeinsam!!
|
## Lass uns Bruno noch besser machen, gemeinsam!!
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| **Español**
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## ¡Juntos, hagamos a Bruno mejor!
|
## ¡Juntos, hagamos a Bruno mejor!
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| **Français**
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## Ensemble, améliorons Bruno !
|
## Ensemble, améliorons Bruno !
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| **हिंदी**
|
|
||||||
|
|
||||||
## आइए मिलकर Bruno को बेहतर बनाएं !!
|
## आइए मिलकर Bruno को बेहतर बनाएं !!
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| **Italiano**
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## Insieme, miglioriamo Bruno!
|
## Insieme, miglioriamo Bruno!
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| **日本語**
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## 一緒に Bruno をよりよいものにしていきましょう!!
|
## 一緒に Bruno をよりよいものにしていきましょう!!
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| **한국어**
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## 함께 Bruno를 더 좋게 만들어요!!
|
## 함께 Bruno를 더 좋게 만들어요!!
|
||||||
|
|
||||||
|
82
docs/contributing/contributing_nl.md
Normal file
82
docs/contributing/contributing_nl.md
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
[English](../../contributing.md)
|
||||||
|
|
||||||
|
## Laten we Bruno samen beter maken !!
|
||||||
|
|
||||||
|
We zijn blij dat je Bruno wilt verbeteren. Hieronder staan de richtlijnen om Bruno op je computer op te zetten.
|
||||||
|
|
||||||
|
### Technologiestack
|
||||||
|
|
||||||
|
Bruno is gebouwd met Next.js en React. We gebruiken ook Electron om een desktopversie te leveren (die lokale collecties ondersteunt).
|
||||||
|
|
||||||
|
Bibliotheken die we gebruiken:
|
||||||
|
|
||||||
|
- CSS - Tailwind
|
||||||
|
- Code Editors - Codemirror
|
||||||
|
- State Management - Redux
|
||||||
|
- Iconen - Tabler Icons
|
||||||
|
- Formulieren - formik
|
||||||
|
- Schema Validatie - Yup
|
||||||
|
- Request Client - axios
|
||||||
|
- Bestandsysteem Watcher - chokidar
|
||||||
|
|
||||||
|
### Afhankelijkheden
|
||||||
|
|
||||||
|
Je hebt [Node v18.x of de nieuwste LTS-versie](https://nodejs.org/en/) en npm 8.x nodig. We gebruiken npm workspaces in het project.
|
||||||
|
|
||||||
|
## Ontwikkeling
|
||||||
|
|
||||||
|
Bruno wordt ontwikkeld als een desktop-app. Je moet de app laden door de Next.js app in één terminal te draaien en daarna de Electron app in een andere terminal te draaien.
|
||||||
|
|
||||||
|
### Lokale Ontwikkeling
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# gebruik voorgeschreven node versie
|
||||||
|
nvm use
|
||||||
|
|
||||||
|
# installeer afhankelijkheden
|
||||||
|
npm i --legacy-peer-deps
|
||||||
|
|
||||||
|
# build pakketten
|
||||||
|
npm run build:graphql-docs
|
||||||
|
npm run build:bruno-query
|
||||||
|
npm run build:bruno-common
|
||||||
|
|
||||||
|
# draai next app (terminal 1)
|
||||||
|
npm run dev:web
|
||||||
|
|
||||||
|
# draai electron app (terminal 2)
|
||||||
|
npm run dev:electron
|
||||||
|
```
|
||||||
|
|
||||||
|
### Problemen oplossen
|
||||||
|
|
||||||
|
Je kunt een `Unsupported platform`-fout tegenkomen wanneer je `npm install` uitvoert. Om dit te verhelpen, moet je `node_modules` en `package-lock.json` verwijderen en `npm install` uitvoeren. Dit zou alle benodigde afhankelijkheden moeten installeren om de app te draaien.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# Verwijder node_modules in subdirectories
|
||||||
|
find ./ -type d -name "node_modules" -print0 | while read -d $'\0' dir; do
|
||||||
|
rm -rf "$dir"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Verwijder package-lock in subdirectories
|
||||||
|
find . -type f -name "package-lock.json" -delete
|
||||||
|
```
|
||||||
|
|
||||||
|
### Testen
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# bruno-schema
|
||||||
|
npm test --workspace=packages/bruno-schema
|
||||||
|
|
||||||
|
# bruno-lang
|
||||||
|
npm test --workspace=packages/bruno-lang
|
||||||
|
```
|
||||||
|
|
||||||
|
### Pull Requests indienen
|
||||||
|
|
||||||
|
- Houd de PR's klein en gefocust op één ding
|
||||||
|
- Volg het formaat voor het aanmaken van branches
|
||||||
|
- feature/[feature naam]: Deze branch moet wijzigingen voor een specifieke functie bevatten
|
||||||
|
- Voorbeeld: feature/dark-mode
|
||||||
|
- bugfix/[bug naam]: Deze branch moet alleen bugfixes voor een specifieke bug bevatten
|
||||||
|
- Voorbeeld: bugfix/bug-1
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| **Polski**
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## Wspólnie uczynijmy Bruno lepszym !!
|
## Wspólnie uczynijmy Bruno lepszym !!
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| **Português (BR)**
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## Vamos tornar o Bruno melhor, juntos!!
|
## Vamos tornar o Bruno melhor, juntos!!
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| **Română**
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## Haideţi să îmbunătățim Bruno, împreună!!
|
## Haideţi să îmbunătățim Bruno, împreună!!
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| **Русский**
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## Давайте вместе сделаем Бруно лучше!!!
|
## Давайте вместе сделаем Бруно лучше!!!
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| **Türkçe**
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## Bruno'yu birlikte daha iyi hale getirelim!!!
|
## Bruno'yu birlikte daha iyi hale getirelim!!!
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| **Українська**
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| [正體中文](./contributing_zhtw.md)
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## Давайте зробимо Bruno краще, разом !!
|
## Давайте зробимо Bruno краще, разом !!
|
||||||
|
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
[English](../../contributing.md)
|
[English](../../contributing.md)
|
||||||
| [Українська](./contributing_ua.md)
|
|
||||||
| [Русский](./contributing_ru.md)
|
|
||||||
| [Türkçe](./contributing_tr.md)
|
|
||||||
| [Deutsch](./contributing_de.md)
|
|
||||||
| [Français](./contributing_fr.md)
|
|
||||||
| [Português (BR)](./contributing_pt_br.md)
|
|
||||||
| [한국어](./contributing_kr.md)
|
|
||||||
| [বাংলা](./contributing_bn.md)
|
|
||||||
| [Español](./contributing_es.md)
|
|
||||||
| [Italiano](./contributing_it.md)
|
|
||||||
| [Română](./contributing_ro.md)
|
|
||||||
| [Polski](./contributing_pl.md)
|
|
||||||
| [简体中文](./contributing_cn.md)
|
|
||||||
| **正體中文**
|
|
||||||
| [日本語](./contributing_ja.md)
|
|
||||||
| [हिंदी](./contributing_hi.md)
|
|
||||||
|
|
||||||
## 讓我們一起來讓 Bruno 變得更好!
|
## 讓我們一起來讓 Bruno 變得更好!
|
||||||
|
|
||||||
|
7
docs/publishing/publishin_nl.md
Normal file
7
docs/publishing/publishin_nl.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[English](../../publishing.md)
|
||||||
|
|
||||||
|
### Bruno publiceren naar een nieuwe pakketbeheerder
|
||||||
|
|
||||||
|
Hoewel onze code open source is en beschikbaar voor iedereen, verzoeken we je vriendelijk om contact met ons op te nemen voordat je publicatie overweegt op nieuwe pakketbeheerders. Als de maker van Bruno houd ik het handelsmerk `Bruno` voor dit project en wil ik het distributieproces beheren. Als je Bruno op een nieuwe pakketbeheerder wilt zien, dien dan een GitHub-issue in.
|
||||||
|
|
||||||
|
Hoewel de meerderheid van onze functies gratis en open source zijn (die REST en GraphQL API's dekken), streven we ernaar een harmonieuze balans te vinden tussen open-source principes en duurzaamheid - https://github.com/usebruno/bruno/discussions/269
|
@ -1,14 +1,4 @@
|
|||||||
[English](../../publishing.md)
|
[English](../../publishing.md)
|
||||||
| [Türkçe](./publishing_tr.md)
|
|
||||||
| [Deutsch](./publishing_de.md)
|
|
||||||
| [Français](./publishing_fr.md)
|
|
||||||
| [Português (BR)](./publishing_pt_br.md)
|
|
||||||
| **বাংলা**
|
|
||||||
| [Română](./publishing_ro.md)
|
|
||||||
| [Polski](./publishing_pl.md)
|
|
||||||
| [简体中文](./publishing_cn.md)
|
|
||||||
| [正體中文](./publishing_zhtw.md)
|
|
||||||
| [日本語](./publishing_ja.md)
|
|
||||||
|
|
||||||
### ব্রুনোকে নতুন প্যাকেজ ম্যানেজারে প্রকাশ করা
|
### ব্রুনোকে নতুন প্যাকেজ ম্যানেজারে প্রকাশ করা
|
||||||
|
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
[English](../../publishing.md)
|
[English](../../publishing.md)
|
||||||
| [Türkçe](./publishing_tr.md)
|
|
||||||
| [Deutsch](./publishing_de.md)
|
|
||||||
| [Français](./publishing_fr.md)
|
|
||||||
| [Português (BR)](./publishing_pt_br.md)
|
|
||||||
| [বাংলা](./publishing_bn.md)
|
|
||||||
| [Română](./publishing_ro.md)
|
|
||||||
| [Polski](./publishing_pl.md)
|
|
||||||
| **简体中文**
|
|
||||||
| [正體中文](./publishing_zhtw.md)
|
|
||||||
| [日本語](./publishing_ja.md)
|
|
||||||
|
|
||||||
### 将 Bruno 发布到新的包管理器
|
### 将 Bruno 发布到新的包管理器
|
||||||
|
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
[English](../../publishing.md)
|
[English](../../publishing.md)
|
||||||
| [Türkçe](./publishing_tr.md)
|
|
||||||
| **Deutsch**
|
|
||||||
| [Français](./publishing_fr.md)
|
|
||||||
| [Português (BR)](./publishing_pt_br.md)
|
|
||||||
| [বাংলা](./publishing_bn.md)
|
|
||||||
| [Română](./publishing_ro.md)
|
|
||||||
| [Polski](./publishing_pl.md)
|
|
||||||
| [简体中文](./publishing_cn.md)
|
|
||||||
| [正體中文](./publishing_zhtw.md)
|
|
||||||
| [日本語](./publishing_ja.md)
|
|
||||||
|
|
||||||
### Veröffentlichung von Bruno über neue Paket-Manager
|
### Veröffentlichung von Bruno über neue Paket-Manager
|
||||||
|
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
[English](../../publishing.md)
|
[English](../../publishing.md)
|
||||||
| [Türkçe](./publishing_tr.md)
|
|
||||||
| [Deutsch](./publishing_de.md)
|
|
||||||
| **Français**
|
|
||||||
| [Português (BR)](./publishing_pt_br.md)
|
|
||||||
| [বাংলা](./publishing_bn.md)
|
|
||||||
| [Română](./publishing_ro.md)
|
|
||||||
| [Polski](./publishing_pl.md)
|
|
||||||
| [简体中文](./publishing_cn.md)
|
|
||||||
| [正體中文](./publishing_zhtw.md)
|
|
||||||
| [日本語](./publishing_ja.md)
|
|
||||||
|
|
||||||
### Publier Bruno dans un nouveau gestionnaire de paquets
|
### Publier Bruno dans un nouveau gestionnaire de paquets
|
||||||
|
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
[English](../../publishing.md)
|
[English](../../publishing.md)
|
||||||
| [Türkçe](./publishing_tr.md)
|
|
||||||
| [Deutsch](./publishing_de.md)
|
|
||||||
| [Français](./publishing_fr.md)
|
|
||||||
| [Português (BR)](./publishing_pt_br.md)
|
|
||||||
| [বাংলা](./publishing_bn.md)
|
|
||||||
| [Română](./publishing_ro.md)
|
|
||||||
| [Polski](./publishing_pl.md)
|
|
||||||
| [简体中文](./publishing_cn.md)
|
|
||||||
| [正體中文](./publishing_zhtw.md)
|
|
||||||
| **日本語**
|
|
||||||
|
|
||||||
### Bruno を新しいパッケージマネージャに公開する場合の注意
|
### Bruno を新しいパッケージマネージャに公開する場合の注意
|
||||||
|
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
[English](../../publishing.md)
|
[English](../../publishing.md)
|
||||||
| [Türkçe](./publishing_tr.md)
|
|
||||||
| [Deutsch](./publishing_de.md)
|
|
||||||
| [Français](./publishing_fr.md)
|
|
||||||
| [Português (BR)](./publishing_pt_br.md)
|
|
||||||
| [বাংলা](./publishing_bn.md)
|
|
||||||
| [Română](./publishing_ro.md)
|
|
||||||
| **Polski**
|
|
||||||
| [简体中文](./publishing_cn.md)
|
|
||||||
| [正體中文](./publishing_zhtw.md)
|
|
||||||
| [日本語](./publishing_ja.md)
|
|
||||||
|
|
||||||
### Publikowanie Bruno w nowym menedżerze pakietów
|
### Publikowanie Bruno w nowym menedżerze pakietów
|
||||||
|
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
[English](../../publishing.md)
|
[English](../../publishing.md)
|
||||||
| [Türkçe](./publishing_tr.md)
|
|
||||||
| [Deutsch](./publishing_de.md)
|
|
||||||
| [Français](./publishing_fr.md)
|
|
||||||
| **Português (BR)**
|
|
||||||
| [বাংলা](./publishing_bn.md)
|
|
||||||
| [Română](./publishing_ro.md)
|
|
||||||
| [Polski](./publishing_pl.md)
|
|
||||||
| [简体中文](./publishing_cn.md)
|
|
||||||
| [正體中文](./publishing_zhtw.md)
|
|
||||||
| [日本語](./publishing_ja.md)
|
|
||||||
|
|
||||||
### Publicando Bruno em um novo gerenciador de pacotes
|
### Publicando Bruno em um novo gerenciador de pacotes
|
||||||
|
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
[English](../../publishing.md)
|
[English](../../publishing.md)
|
||||||
| [Türkçe](./publishing_tr.md)
|
|
||||||
| [Deutsch](./publishing_de.md)
|
|
||||||
| [Français](./publishing_fr.md)
|
|
||||||
| [Português (BR)](./publishing_pt_br.md)
|
|
||||||
| [বাংলা](./publishing_bn.md)
|
|
||||||
| **Română**
|
|
||||||
| [Polski](./publishing_pl.md)
|
|
||||||
| [简体中文](./publishing_cn.md)
|
|
||||||
| [正體中文](./publishing_zhtw.md)
|
|
||||||
| [日本語](./publishing_ja.md)
|
|
||||||
|
|
||||||
### Publicarea lui Bruno la un gestionar de pachete nou
|
### Publicarea lui Bruno la un gestionar de pachete nou
|
||||||
|
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
[English](../../publishing.md)
|
[English](../../publishing.md)
|
||||||
| **Türkçe**
|
|
||||||
| [Deutsch](./publishing_de.md)
|
|
||||||
| [Français](./publishing_fr.md)
|
|
||||||
| [Português (BR)](./publishing_pt_br.md)
|
|
||||||
| [বাংলা](./publishing_bn.md)
|
|
||||||
| [Română](./publishing_ro.md)
|
|
||||||
| [Polski](./publishing_pl.md)
|
|
||||||
| [简体中文](./publishing_cn.md)
|
|
||||||
| [正體中文](./publishing_zhtw.md)
|
|
||||||
| [日本語](./publishing_ja.md)
|
|
||||||
|
|
||||||
### Bruno'yu yeni bir paket yöneticisine yayınlama
|
### Bruno'yu yeni bir paket yöneticisine yayınlama
|
||||||
|
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
[English](../../publishing.md)
|
[English](../../publishing.md)
|
||||||
| [Türkçe](./publishing_tr.md)
|
|
||||||
| [Deutsch](./publishing_de.md)
|
|
||||||
| [Français](./publishing_fr.md)
|
|
||||||
| [Português (BR)](./publishing_pt_br.md)
|
|
||||||
| [বাংলা](./publishing_bn.md)
|
|
||||||
| [Română](./publishing_ro.md)
|
|
||||||
| [Polski](./publishing_pl.md)
|
|
||||||
| [简体中文](./publishing_cn.md)
|
|
||||||
| **正體中文**
|
|
||||||
| [日本語](./publishing_ja.md)
|
|
||||||
|
|
||||||
### 將 Bruno 發佈到新的套件管理器
|
### 將 Bruno 發佈到新的套件管理器
|
||||||
|
|
||||||
|
157
docs/readme/readme_nl.md
Normal file
157
docs/readme/readme_nl.md
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
<br />
|
||||||
|
<img src="../../assets/images/logo-transparent.png" width="80"/>
|
||||||
|
|
||||||
|
### Bruno - Open source IDE voor het verkennen en testen van API's.
|
||||||
|
|
||||||
|
[![GitHub version](https://badge.fury.io/gh/usebruno%2Fbruno.svg)](https://badge.fury.io/gh/usebruno%bruno)
|
||||||
|
[![CI](https://github.com/usebruno/bruno/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/usebruno/bruno/actions/workflows/tests.yml)
|
||||||
|
[![Commit Activity](https://img.shields.io/github/commit-activity/m/usebruno/bruno)](https://github.com/usebruno/bruno/pulse)
|
||||||
|
[![X](https://img.shields.io/twitter/follow/use_bruno?style=social&logo=x)](https://twitter.com/use_bruno)
|
||||||
|
[![Website](https://img.shields.io/badge/Website-Visit-blue)](https://www.usebruno.com)
|
||||||
|
[![Download](https://img.shields.io/badge/Download-Latest-brightgreen)](https://www.usebruno.com/downloads)
|
||||||
|
|
||||||
|
[English](../../readme.md) | [Українська](docs/readme/readme_ua.md) | [Русский](docs/readme/readme_ru.md) | [Türkçe](docs/readme/readme_tr.md) | [Deutsch](docs/readme/readme_de.md) | ** Nederlands ** | [Français](docs/readme/readme_fr.md) | [Português (BR)](docs/readme/readme_pt_br.md) | [한국어](docs/readme/readme_kr.md) | [বাংলা](docs/readme/readme_bn.md) | [Español](docs/readme/readme_es.md) | [Italiano](docs/readme/readme_it.md) | [Română](docs/readme/readme_ro.md) | [Polski](docs/readme/readme_pl.md) | [简体中文](docs/readme/readme_cn.md) | [正體中文](docs/readme/readme_zhtw.md) | [العربية](docs/readme/readme_ar.md) | [日本語](docs/readme/readme_ja.md)
|
||||||
|
|
||||||
|
Bruno is een nieuwe en innovatieve API-client, gericht op het revolutioneren van de status quo die wordt vertegenwoordigd door Postman en vergelijkbare tools.
|
||||||
|
|
||||||
|
Bruno slaat je collecties direct op in een map op je bestandssysteem. We gebruiken een platte tekst opmaaktaal, Bru, om informatie over API-verzoeken op te slaan.
|
||||||
|
|
||||||
|
Je kunt Git of elke versiebeheertool naar keuze gebruiken om samen te werken aan je API-collecties.
|
||||||
|
|
||||||
|
Bruno is uitsluitend offline. Er zijn geen plannen om ooit cloud-synchronisatie aan Bruno toe te voegen. We waarderen je gegevensprivacy en geloven dat deze op je apparaat moet blijven. Lees onze langetermijnvisie [hier](https://github.com/usebruno/bruno/discussions/269)
|
||||||
|
|
||||||
|
[Download Bruno](https://www.usebruno.com/downloads)
|
||||||
|
|
||||||
|
📢 Bekijk onze recente presentatie op de India FOSS 3.0 Conference [hier](https://www.youtube.com/watch?v=7bSMFpbcPiY)
|
||||||
|
|
||||||
|
![bruno](/assets/images/landing-2.png) <br /><br />
|
||||||
|
|
||||||
|
### Golden Edition ✨
|
||||||
|
|
||||||
|
De meeste van onze functies zijn gratis en open source.
|
||||||
|
We streven naar een harmonieuze balans tussen [open-source principes en duurzaamheid](https://github.com/usebruno/bruno/discussions/269).
|
||||||
|
|
||||||
|
Je kunt de [Golden Edition](https://www.usebruno.com/pricing) kopen voor een eenmalige betaling van **$19**! <br/>
|
||||||
|
|
||||||
|
### Installatie
|
||||||
|
|
||||||
|
Bruno is beschikbaar als binaire download [op onze website](https://www.usebruno.com/downloads) voor Mac, Windows en Linux.
|
||||||
|
|
||||||
|
Je kunt Bruno ook installeren via pakketbeheerders zoals Homebrew, Chocolatey, Scoop, Snap, Flatpak en Apt.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Op Mac via Homebrew
|
||||||
|
brew install bruno
|
||||||
|
|
||||||
|
# Op Windows via Chocolatey
|
||||||
|
choco install bruno
|
||||||
|
|
||||||
|
# Op Windows via Scoop
|
||||||
|
scoop bucket add extras
|
||||||
|
scoop install bruno
|
||||||
|
|
||||||
|
# Op Windows via winget
|
||||||
|
winget install Bruno.Bruno
|
||||||
|
|
||||||
|
# Op Linux via Snap
|
||||||
|
snap install bruno
|
||||||
|
|
||||||
|
# Op Linux via Flatpak
|
||||||
|
flatpak install com.usebruno.Bruno
|
||||||
|
|
||||||
|
# Op Linux via Apt
|
||||||
|
sudo mkdir -p /etc/apt/keyrings
|
||||||
|
sudo gpg --no-default-keyring --keyring /etc/apt/keyrings/bruno.gpg --keyserver keyserver.ubuntu.com --recv-keys 9FA6017ECABE0266
|
||||||
|
|
||||||
|
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/bruno.gpg] http://debian.usebruno.com/ bruno stable" | sudo tee /etc/apt/sources.list.d/bruno.list
|
||||||
|
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install bruno
|
||||||
|
```
|
||||||
|
|
||||||
|
### Draai op meerdere platformen 🖥️
|
||||||
|
|
||||||
|
![bruno](/assets/images/run-anywhere.png) <br /><br />
|
||||||
|
|
||||||
|
### Samenwerken via Git 👩💻🧑💻
|
||||||
|
|
||||||
|
Of elk versiebeheersysteem naar keuze
|
||||||
|
|
||||||
|
![bruno](/assets/images/version-control.png) <br /><br />
|
||||||
|
|
||||||
|
### Sponsors
|
||||||
|
|
||||||
|
#### Gouden Sponsors
|
||||||
|
|
||||||
|
<img src="../../assets/images/sponsors/samagata.png" width="150"/>
|
||||||
|
|
||||||
|
#### Zilveren Sponsors
|
||||||
|
|
||||||
|
<img src="../../assets/images/sponsors/commit-company.png" width="70"/>
|
||||||
|
|
||||||
|
#### Bronzen Sponsors
|
||||||
|
|
||||||
|
<a href="https://zuplo.link/bruno">
|
||||||
|
<img src="../../assets/images/sponsors/zuplo.png" width="120"/>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
### Belangrijke Links 📌
|
||||||
|
|
||||||
|
- [Onze Langetermijnvisie](https://github.com/usebruno/bruno/discussions/269)
|
||||||
|
- [Roadmap](https://github.com/usebruno/bruno/discussions/384)
|
||||||
|
- [Documentatie](https://docs.usebruno.com)
|
||||||
|
- [Stack Overflow](https://stackoverflow.com/questions/tagged/bruno)
|
||||||
|
- [Website](https://www.usebruno.com)
|
||||||
|
- [Prijzen](https://www.usebruno.com/pricing)
|
||||||
|
- [Download](https://www.usebruno.com/downloads)
|
||||||
|
- [GitHub Sponsors](https://github.com/sponsors/helloanoop)
|
||||||
|
|
||||||
|
### Showcase 🎥
|
||||||
|
|
||||||
|
- [Getuigenissen](https://github.com/usebruno/bruno/discussions/343)
|
||||||
|
- [Kenniscentrum](https://github.com/usebruno/bruno/discussions/386)
|
||||||
|
- [Scriptmania](https://github.com/usebruno/bruno/discussions/385)
|
||||||
|
|
||||||
|
### Ondersteuning ❤️
|
||||||
|
|
||||||
|
Als je Bruno leuk vindt en ons open-source werk wilt ondersteunen, overweeg dan om ons te sponsoren via [GitHub Sponsors](https://github.com/sponsors/helloanoop).
|
||||||
|
|
||||||
|
### Deel Getuigenissen 📣
|
||||||
|
|
||||||
|
Als Bruno je heeft geholpen op je werk en in je teams, deel dan je [getuigenissen op onze GitHub-discussie](https://github.com/usebruno/bruno/discussions/343).
|
||||||
|
|
||||||
|
|
||||||
|
### Blijf in contact 🌐
|
||||||
|
|
||||||
|
[𝕏 (Twitter)](https://twitter.com/use_bruno) <br />
|
||||||
|
[Website](https://www.usebruno.com) <br />
|
||||||
|
[Discord](https://discord.com/invite/KgcZUncpjq) <br />
|
||||||
|
[LinkedIn](https://www.linkedin.com/company/usebruno)
|
||||||
|
|
||||||
|
### Handelsmerk
|
||||||
|
|
||||||
|
**Naam**
|
||||||
|
|
||||||
|
`Bruno` is een handelsmerk in bezit van [Anoop M D](https://www.helloanoop.com/).
|
||||||
|
|
||||||
|
**Logo**
|
||||||
|
|
||||||
|
Het logo is afkomstig van [OpenMoji](https://openmoji.org/library/emoji-1F436/). Licentie: CC [BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)
|
||||||
|
|
||||||
|
### Bijdragen 👩💻🧑💻
|
||||||
|
|
||||||
|
Ik ben blij dat je Bruno wilt verbeteren. Bekijk de [bijdragegids](contributing.md).
|
||||||
|
|
||||||
|
Zelfs als je geen bijdragen via code kunt leveren, aarzel dan niet om bugs en functieverzoeken in te dienen die moeten worden geïmplementeerd om jouw gebruiksscenario op te lossen.
|
||||||
|
|
||||||
|
### Auteurs
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<a href="https://github.com/usebruno/bruno/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=usebruno/bruno" />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
### Licentie 📄
|
||||||
|
|
||||||
|
[MIT](../../license.md)
|
14237
package-lock.json
generated
14237
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -51,10 +51,6 @@
|
|||||||
"prepare": "husky install"
|
"prepare": "husky install"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"rollup":"3.29.4"
|
"rollup":"3.29.5"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"json-bigint": "^1.0.0",
|
|
||||||
"lossless-json": "^4.0.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
|
output: 'export',
|
||||||
reactStrictMode: false,
|
reactStrictMode: false,
|
||||||
publicRuntimeConfig: {
|
publicRuntimeConfig: {
|
||||||
CI: process.env.CI,
|
CI: process.env.CI,
|
||||||
@ -10,6 +11,12 @@ module.exports = {
|
|||||||
if (!isServer) {
|
if (!isServer) {
|
||||||
config.resolve.fallback.fs = false;
|
config.resolve.fallback.fs = false;
|
||||||
}
|
}
|
||||||
|
Object.defineProperty(config, 'devtool', {
|
||||||
|
get() {
|
||||||
|
return 'source-map';
|
||||||
|
},
|
||||||
|
set() {},
|
||||||
|
});
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cross-env ENV=dev next dev -p 3000",
|
"dev": "cross-env ENV=dev next dev -p 3000",
|
||||||
"build": "next build && next export",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
@ -13,27 +13,25 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource/inter": "^5.0.15",
|
"@fontsource/inter": "^5.0.15",
|
||||||
"@fortawesome/fontawesome-svg-core": "^1.2.36",
|
"@prantlf/jsonlint": "^16.0.0",
|
||||||
"@fortawesome/free-solid-svg-icons": "^5.15.4",
|
|
||||||
"@fortawesome/react-fontawesome": "^0.1.16",
|
|
||||||
"@reduxjs/toolkit": "^1.8.0",
|
"@reduxjs/toolkit": "^1.8.0",
|
||||||
"@tabler/icons": "^1.46.0",
|
"@tabler/icons": "^1.46.0",
|
||||||
"@tippyjs/react": "^4.2.6",
|
"@tippyjs/react": "^4.2.6",
|
||||||
"@usebruno/common": "0.1.0",
|
"@usebruno/common": "0.1.0",
|
||||||
"@usebruno/graphql-docs": "0.1.0",
|
"@usebruno/graphql-docs": "0.1.0",
|
||||||
"@usebruno/schema": "0.7.0",
|
"@usebruno/schema": "0.7.0",
|
||||||
"axios": "^1.5.1",
|
"axios": "1.7.5",
|
||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
"codemirror": "5.65.2",
|
"codemirror": "5.65.2",
|
||||||
"codemirror-graphql": "1.2.5",
|
"codemirror-graphql": "2.1.1",
|
||||||
"cookie": "^0.6.0",
|
"cookie": "0.7.1",
|
||||||
"escape-html": "^1.0.3",
|
"escape-html": "^1.0.3",
|
||||||
"file": "^0.2.2",
|
"file": "^0.2.2",
|
||||||
"file-dialog": "^0.0.8",
|
"file-dialog": "^0.0.8",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"formik": "^2.2.9",
|
"formik": "^2.2.9",
|
||||||
"github-markdown-css": "^5.2.0",
|
"github-markdown-css": "^5.2.0",
|
||||||
"graphiql": "^1.5.9",
|
"graphiql": "3.7.1",
|
||||||
"graphql": "^16.6.0",
|
"graphql": "^16.6.0",
|
||||||
"graphql-request": "^3.7.0",
|
"graphql-request": "^3.7.0",
|
||||||
"httpsnippet": "^3.0.6",
|
"httpsnippet": "^3.0.6",
|
||||||
@ -44,19 +42,18 @@
|
|||||||
"jshint": "^2.13.6",
|
"jshint": "^2.13.6",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
"jsonc-parser": "^3.2.1",
|
"jsonc-parser": "^3.2.1",
|
||||||
"jsonlint": "^1.6.3",
|
"jsonpath-plus": "10.1.0",
|
||||||
"jsonpath-plus": "^7.2.0",
|
|
||||||
"know-your-http-well": "^0.5.0",
|
"know-your-http-well": "^0.5.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"markdown-it": "^13.0.2",
|
"markdown-it": "^13.0.2",
|
||||||
"markdown-it-replace-link": "^1.2.0",
|
"markdown-it-replace-link": "^1.2.0",
|
||||||
"mousetrap": "^1.6.5",
|
"mousetrap": "^1.6.5",
|
||||||
"nanoid": "3.3.4",
|
"nanoid": "3.3.4",
|
||||||
"next": "12.3.3",
|
"next": "14.2.16",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
"pdfjs-dist": "^3.11.174",
|
"pdfjs-dist": "4.4.168",
|
||||||
"platform": "^1.3.6",
|
"platform": "^1.3.6",
|
||||||
"posthog-node": "^2.1.0",
|
"posthog-node": "4.2.1",
|
||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
"qs": "^6.11.0",
|
"qs": "^6.11.0",
|
||||||
"query-string": "^7.0.1",
|
"query-string": "^7.0.1",
|
||||||
@ -65,11 +62,10 @@
|
|||||||
"react-dnd": "^16.0.1",
|
"react-dnd": "^16.0.1",
|
||||||
"react-dnd-html5-backend": "^16.0.1",
|
"react-dnd-html5-backend": "^16.0.1",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
"react-github-btn": "^1.4.0",
|
|
||||||
"react-hot-toast": "^2.4.0",
|
"react-hot-toast": "^2.4.0",
|
||||||
"react-i18next": "^15.0.1",
|
"react-i18next": "^15.0.1",
|
||||||
"react-inspector": "^6.0.2",
|
"react-inspector": "^6.0.2",
|
||||||
"react-pdf": "^7.5.1",
|
"react-pdf": "9.1.1",
|
||||||
"react-redux": "^7.2.6",
|
"react-redux": "^7.2.6",
|
||||||
"react-tooltip": "^5.5.2",
|
"react-tooltip": "^5.5.2",
|
||||||
"sass": "^1.46.0",
|
"sass": "^1.46.0",
|
||||||
@ -87,15 +83,15 @@
|
|||||||
"@babel/preset-env": "^7.16.4",
|
"@babel/preset-env": "^7.16.4",
|
||||||
"@babel/preset-react": "^7.16.0",
|
"@babel/preset-react": "^7.16.0",
|
||||||
"@babel/runtime": "^7.16.3",
|
"@babel/runtime": "^7.16.3",
|
||||||
"autoprefixer": "^10.4.17",
|
"autoprefixer": "10.4.20",
|
||||||
"babel-loader": "^8.2.3",
|
"babel-loader": "^8.2.3",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"css-loader": "^6.5.1",
|
"css-loader": "7.1.2",
|
||||||
"file-loader": "^6.2.0",
|
"file-loader": "^6.2.0",
|
||||||
"html-loader": "^3.0.1",
|
"html-loader": "^3.0.1",
|
||||||
"html-webpack-plugin": "^5.5.0",
|
"html-webpack-plugin": "^5.5.0",
|
||||||
"mini-css-extract-plugin": "^2.4.5",
|
"mini-css-extract-plugin": "^2.4.5",
|
||||||
"postcss": "^8.4.35",
|
"postcss": "8.4.47",
|
||||||
"style-loader": "^3.3.1",
|
"style-loader": "^3.3.1",
|
||||||
"tailwindcss": "^3.4.1",
|
"tailwindcss": "^3.4.1",
|
||||||
"webpack": "^5.64.4",
|
"webpack": "^5.64.4",
|
||||||
|
@ -10,6 +10,15 @@ const StyledWrapper = styled.div`
|
|||||||
flex: 1 1 0;
|
flex: 1 1 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Removes the glow outline around the folded json */
|
||||||
|
.CodeMirror-foldmarker {
|
||||||
|
text-shadow: none;
|
||||||
|
color: ${(props) => props.theme.textLink};
|
||||||
|
background: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.CodeMirror-overlayscroll-horizontal div,
|
.CodeMirror-overlayscroll-horizontal div,
|
||||||
.CodeMirror-overlayscroll-vertical div {
|
.CodeMirror-overlayscroll-vertical div {
|
||||||
background: #d2d7db;
|
background: #d2d7db;
|
||||||
@ -69,6 +78,10 @@ const StyledWrapper = styled.div`
|
|||||||
.cm-variable-invalid {
|
.cm-variable-invalid {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.CodeMirror-search-hint {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default StyledWrapper;
|
export default StyledWrapper;
|
||||||
|
@ -10,7 +10,7 @@ import { isEqual, escapeRegExp } from 'lodash';
|
|||||||
import { getEnvironmentVariables } from 'utils/collections';
|
import { getEnvironmentVariables } from 'utils/collections';
|
||||||
import { defineCodeMirrorBrunoVariablesMode } from 'utils/common/codemirror';
|
import { defineCodeMirrorBrunoVariablesMode } from 'utils/common/codemirror';
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
import jsonlint from 'jsonlint';
|
import * as jsonlint from '@prantlf/jsonlint';
|
||||||
import { JSHINT } from 'jshint';
|
import { JSHINT } from 'jshint';
|
||||||
import stripJsonComments from 'strip-json-comments';
|
import stripJsonComments from 'strip-json-comments';
|
||||||
|
|
||||||
@ -55,6 +55,7 @@ if (!SERVER_RENDERED) {
|
|||||||
'req.setMaxRedirects(maxRedirects)',
|
'req.setMaxRedirects(maxRedirects)',
|
||||||
'req.getTimeout()',
|
'req.getTimeout()',
|
||||||
'req.setTimeout(timeout)',
|
'req.setTimeout(timeout)',
|
||||||
|
'req.getExecutionMode()',
|
||||||
'bru',
|
'bru',
|
||||||
'bru.cwd()',
|
'bru.cwd()',
|
||||||
'bru.getEnvName(key)',
|
'bru.getEnvName(key)',
|
||||||
@ -68,10 +69,13 @@ if (!SERVER_RENDERED) {
|
|||||||
'bru.getVar(key)',
|
'bru.getVar(key)',
|
||||||
'bru.setVar(key,value)',
|
'bru.setVar(key,value)',
|
||||||
'bru.deleteVar(key)',
|
'bru.deleteVar(key)',
|
||||||
|
'bru.deleteAllVars()',
|
||||||
'bru.setNextRequest(requestName)',
|
'bru.setNextRequest(requestName)',
|
||||||
'req.disableParsingResponseJson()',
|
'req.disableParsingResponseJson()',
|
||||||
'bru.getRequestVar(key)',
|
'bru.getRequestVar(key)',
|
||||||
'bru.sleep(ms)'
|
'bru.sleep(ms)',
|
||||||
|
'bru.getGlobalEnvVar(key)',
|
||||||
|
'bru.setGlobalEnvVar(key, value)'
|
||||||
];
|
];
|
||||||
CodeMirror.registerHelper('hint', 'brunoJS', (editor, options) => {
|
CodeMirror.registerHelper('hint', 'brunoJS', (editor, options) => {
|
||||||
const cursor = editor.getCursor();
|
const cursor = editor.getCursor();
|
||||||
@ -247,17 +251,20 @@ export default class CodeEditor extends React.Component {
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
let jsonlint = window.jsonlint.parser || window.jsonlint;
|
let jsonlint = window.jsonlint.parser || window.jsonlint;
|
||||||
jsonlint.parseError = function (str, hash) {
|
|
||||||
let loc = hash.loc;
|
|
||||||
found.push({
|
|
||||||
from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
|
|
||||||
to: CodeMirror.Pos(loc.last_line - 1, loc.last_column),
|
|
||||||
message: str
|
|
||||||
});
|
|
||||||
};
|
|
||||||
try {
|
try {
|
||||||
jsonlint.parse(stripJsonComments(text.replace(/(?<!"[^":{]*){{[^}]*}}(?![^"},]*")/g, '1')));
|
jsonlint.parse(stripJsonComments(text.replace(/(?<!"[^":{]*){{[^}]*}}(?![^"},]*")/g, '1')));
|
||||||
} catch (e) {}
|
} catch (error) {
|
||||||
|
const { message, location } = error;
|
||||||
|
const line = location?.start?.line;
|
||||||
|
const column = location?.start?.column;
|
||||||
|
if (line && column) {
|
||||||
|
found.push({
|
||||||
|
from: CodeMirror.Pos(line - 1, column),
|
||||||
|
to: CodeMirror.Pos(line - 1, column),
|
||||||
|
message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
return found;
|
return found;
|
||||||
});
|
});
|
||||||
if (editor) {
|
if (editor) {
|
||||||
@ -332,7 +339,7 @@ export default class CodeEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<StyledWrapper
|
<StyledWrapper
|
||||||
className="h-full w-full flex flex-col relative"
|
className="h-full w-full flex flex-col relative graphiql-container"
|
||||||
aria-label="Code Editor"
|
aria-label="Code Editor"
|
||||||
font={this.props.font}
|
font={this.props.font}
|
||||||
fontSize={this.props.fontSize}
|
fontSize={this.props.fontSize}
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const Wrapper = styled.div`
|
||||||
|
label {
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.single-line-editor-wrapper {
|
||||||
|
padding: 0.15rem 0.4rem;
|
||||||
|
border-radius: 3px;
|
||||||
|
border: solid 1px ${(props) => props.theme.input.border};
|
||||||
|
background-color: ${(props) => props.theme.input.bg};
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-placement-selector {
|
||||||
|
padding: 0.5rem 0px;
|
||||||
|
border-radius: 3px;
|
||||||
|
border: solid 1px ${(props) => props.theme.input.border};
|
||||||
|
background-color: ${(props) => props.theme.input.bg};
|
||||||
|
|
||||||
|
.dropdown {
|
||||||
|
width: fit-content;
|
||||||
|
|
||||||
|
div[data-tippy-root] {
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
.tippy-box {
|
||||||
|
width: fit-content;
|
||||||
|
max-width: none !important;
|
||||||
|
|
||||||
|
.tippy-content: {
|
||||||
|
width: fit-content;
|
||||||
|
max-width: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-type-label {
|
||||||
|
width: fit-content;
|
||||||
|
color: ${(props) => props.theme.colors.text.yellow};
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-item {
|
||||||
|
padding: 0.2rem 0.6rem !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.caret {
|
||||||
|
color: rgb(140, 140, 140);
|
||||||
|
fill: rgb(140 140 140);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default Wrapper;
|
@ -0,0 +1,109 @@
|
|||||||
|
import React, { useRef, forwardRef, useEffect } from 'react';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import get from 'lodash/get';
|
||||||
|
import { IconCaretDown } from '@tabler/icons';
|
||||||
|
import Dropdown from 'components/Dropdown';
|
||||||
|
import { useTheme } from 'providers/Theme';
|
||||||
|
import SingleLineEditor from 'components/SingleLineEditor';
|
||||||
|
import { updateCollectionAuth } from 'providers/ReduxStore/slices/collections';
|
||||||
|
import { saveCollectionRoot } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
import { humanizeRequestAPIKeyPlacement } from 'utils/collections';
|
||||||
|
|
||||||
|
const ApiKeyAuth = ({ collection }) => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const { storedTheme } = useTheme();
|
||||||
|
const dropdownTippyRef = useRef();
|
||||||
|
const onDropdownCreate = (ref) => (dropdownTippyRef.current = ref);
|
||||||
|
|
||||||
|
const apikeyAuth = get(collection, 'root.request.auth.apikey', {});
|
||||||
|
|
||||||
|
const handleSave = () => dispatch(saveCollectionRoot(collection.uid));
|
||||||
|
|
||||||
|
const Icon = forwardRef((props, ref) => {
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="flex items-center justify-end auth-type-label select-none">
|
||||||
|
{humanizeRequestAPIKeyPlacement(apikeyAuth?.placement)}
|
||||||
|
<IconCaretDown className="caret ml-1 mr-1" size={14} strokeWidth={2} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleAuthChange = (property, value) => {
|
||||||
|
dispatch(
|
||||||
|
updateCollectionAuth({
|
||||||
|
mode: 'apikey',
|
||||||
|
collectionUid: collection.uid,
|
||||||
|
content: {
|
||||||
|
...apikeyAuth,
|
||||||
|
[property]: value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
!apikeyAuth?.placement &&
|
||||||
|
dispatch(
|
||||||
|
updateCollectionAuth({
|
||||||
|
mode: 'apikey',
|
||||||
|
collectionUid: collection.uid,
|
||||||
|
content: {
|
||||||
|
placement: 'header'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}, [apikeyAuth]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledWrapper className="mt-2 w-full">
|
||||||
|
<label className="block font-medium mb-2">Key</label>
|
||||||
|
<div className="single-line-editor-wrapper mb-2">
|
||||||
|
<SingleLineEditor
|
||||||
|
value={apikeyAuth.key || ''}
|
||||||
|
theme={storedTheme}
|
||||||
|
onSave={handleSave}
|
||||||
|
onChange={(val) => handleAuthChange('key', val)}
|
||||||
|
collection={collection}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label className="block font-medium mb-2">Value</label>
|
||||||
|
<div className="single-line-editor-wrapper mb-2">
|
||||||
|
<SingleLineEditor
|
||||||
|
value={apikeyAuth.value || ''}
|
||||||
|
theme={storedTheme}
|
||||||
|
onSave={handleSave}
|
||||||
|
onChange={(val) => handleAuthChange('value', val)}
|
||||||
|
collection={collection}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label className="block font-medium mb-2">Add To</label>
|
||||||
|
<div className="inline-flex items-center cursor-pointer auth-placement-selector w-fit">
|
||||||
|
<Dropdown onCreate={onDropdownCreate} icon={<Icon />} placement="bottom-end">
|
||||||
|
<div
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={() => {
|
||||||
|
dropdownTippyRef.current.hide();
|
||||||
|
handleAuthChange('placement', 'header');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Header
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={() => {
|
||||||
|
dropdownTippyRef.current.hide();
|
||||||
|
handleAuthChange('placement', 'queryparams');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Query Params
|
||||||
|
</div>
|
||||||
|
</Dropdown>
|
||||||
|
</div>
|
||||||
|
</StyledWrapper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ApiKeyAuth;
|
@ -52,6 +52,15 @@ const AuthMode = ({ collection }) => {
|
|||||||
>
|
>
|
||||||
Basic Auth
|
Basic Auth
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={() => {
|
||||||
|
dropdownTippyRef.current.hide();
|
||||||
|
onModeChange('wsse');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
WSSE Auth
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@ -79,6 +88,15 @@ const AuthMode = ({ collection }) => {
|
|||||||
>
|
>
|
||||||
Oauth2
|
Oauth2
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={() => {
|
||||||
|
dropdownTippyRef.current.hide();
|
||||||
|
onModeChange('apikey');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
API Key
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const Wrapper = styled.div`
|
||||||
|
label {
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.single-line-editor-wrapper {
|
||||||
|
padding: 0.15rem 0.4rem;
|
||||||
|
border-radius: 3px;
|
||||||
|
border: solid 1px ${(props) => props.theme.input.border};
|
||||||
|
background-color: ${(props) => props.theme.input.bg};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default Wrapper;
|
@ -0,0 +1,71 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import get from 'lodash/get';
|
||||||
|
import { useTheme } from 'providers/Theme';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import SingleLineEditor from 'components/SingleLineEditor';
|
||||||
|
import { updateCollectionAuth } from 'providers/ReduxStore/slices/collections';
|
||||||
|
import { saveCollectionRoot } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
|
||||||
|
const WsseAuth = ({ collection }) => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const { storedTheme } = useTheme();
|
||||||
|
|
||||||
|
const wsseAuth = get(collection, 'root.request.auth.wsse', {});
|
||||||
|
|
||||||
|
const handleSave = () => dispatch(saveCollectionRoot(collection.uid));
|
||||||
|
|
||||||
|
const handleUserChange = (username) => {
|
||||||
|
dispatch(
|
||||||
|
updateCollectionAuth({
|
||||||
|
mode: 'wsse',
|
||||||
|
collectionUid: collection.uid,
|
||||||
|
content: {
|
||||||
|
username,
|
||||||
|
password: wsseAuth.password
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePasswordChange = (password) => {
|
||||||
|
dispatch(
|
||||||
|
updateCollectionAuth({
|
||||||
|
mode: 'wsse',
|
||||||
|
collectionUid: collection.uid,
|
||||||
|
content: {
|
||||||
|
username: wsseAuth.username,
|
||||||
|
password
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledWrapper className="mt-2 w-full">
|
||||||
|
<label className="block font-medium mb-2">Username</label>
|
||||||
|
<div className="single-line-editor-wrapper mb-2">
|
||||||
|
<SingleLineEditor
|
||||||
|
value={wsseAuth.username || ''}
|
||||||
|
theme={storedTheme}
|
||||||
|
onSave={handleSave}
|
||||||
|
onChange={(val) => handleUserChange(val)}
|
||||||
|
collection={collection}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label className="block font-medium mb-2">Password</label>
|
||||||
|
<div className="single-line-editor-wrapper">
|
||||||
|
<SingleLineEditor
|
||||||
|
value={wsseAuth.password || ''}
|
||||||
|
theme={storedTheme}
|
||||||
|
onSave={handleSave}
|
||||||
|
onChange={(val) => handlePasswordChange(val)}
|
||||||
|
collection={collection}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</StyledWrapper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default WsseAuth;
|
@ -6,6 +6,8 @@ import AwsV4Auth from './AwsV4Auth';
|
|||||||
import BearerAuth from './BearerAuth';
|
import BearerAuth from './BearerAuth';
|
||||||
import BasicAuth from './BasicAuth';
|
import BasicAuth from './BasicAuth';
|
||||||
import DigestAuth from './DigestAuth';
|
import DigestAuth from './DigestAuth';
|
||||||
|
import WsseAuth from './WsseAuth';
|
||||||
|
import ApiKeyAuth from './ApiKeyAuth/';
|
||||||
import { saveCollectionRoot } from 'providers/ReduxStore/slices/collections/actions';
|
import { saveCollectionRoot } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
import OAuth2 from './OAuth2';
|
import OAuth2 from './OAuth2';
|
||||||
@ -33,6 +35,12 @@ const Auth = ({ collection }) => {
|
|||||||
case 'oauth2': {
|
case 'oauth2': {
|
||||||
return <OAuth2 collection={collection} />;
|
return <OAuth2 collection={collection} />;
|
||||||
}
|
}
|
||||||
|
case 'wsse': {
|
||||||
|
return <WsseAuth collection={collection} />;
|
||||||
|
}
|
||||||
|
case 'apikey': {
|
||||||
|
return <ApiKeyAuth collection={collection} />;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -83,7 +83,6 @@ const VarsTable = ({ collection, vars, varType }) => {
|
|||||||
<td>
|
<td>
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<span>Value</span>
|
<span>Value</span>
|
||||||
<InfoTip text="You can write any valid JS Template Literal here" infotipId="request-var" />
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
) : (
|
) : (
|
||||||
|
@ -17,6 +17,15 @@ import Presets from './Presets';
|
|||||||
import Info from './Info';
|
import Info from './Info';
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
import Vars from './Vars/index';
|
import Vars from './Vars/index';
|
||||||
|
import DotIcon from 'components/Icons/Dot';
|
||||||
|
|
||||||
|
const ContentIndicator = () => {
|
||||||
|
return (
|
||||||
|
<sup className="ml-[.125rem] opacity-80 font-medium">
|
||||||
|
<DotIcon width="10"></DotIcon>
|
||||||
|
</sup>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const CollectionSettings = ({ collection }) => {
|
const CollectionSettings = ({ collection }) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@ -30,10 +39,23 @@ const CollectionSettings = ({ collection }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const proxyConfig = get(collection, 'brunoConfig.proxy', {});
|
const root = collection?.root;
|
||||||
|
const hasScripts = root?.request?.script?.res || root?.request?.script?.req;
|
||||||
|
const hasTests = root?.request?.tests;
|
||||||
|
const hasDocs = root?.docs;
|
||||||
|
|
||||||
|
const headers = get(collection, 'root.request.headers', []);
|
||||||
|
const activeHeadersCount = headers.filter((header) => header.enabled).length;
|
||||||
|
|
||||||
|
const requestVars = get(collection, 'root.request.vars.req', []);
|
||||||
|
const responseVars = get(collection, 'root.request.vars.res', []);
|
||||||
|
const activeVarsCount = requestVars.filter((v) => v.enabled).length + responseVars.filter((v) => v.enabled).length;
|
||||||
|
const auth = get(collection, 'root.request.auth', {}).mode;
|
||||||
|
|
||||||
|
const proxyConfig = get(collection, 'brunoConfig.proxy', {});
|
||||||
const clientCertConfig = get(collection, 'brunoConfig.clientCertificates.certs', []);
|
const clientCertConfig = get(collection, 'brunoConfig.clientCertificates.certs', []);
|
||||||
|
|
||||||
|
|
||||||
const onProxySettingsUpdate = (config) => {
|
const onProxySettingsUpdate = (config) => {
|
||||||
const brunoConfig = cloneDeep(collection.brunoConfig);
|
const brunoConfig = cloneDeep(collection.brunoConfig);
|
||||||
brunoConfig.proxy = config;
|
brunoConfig.proxy = config;
|
||||||
@ -126,30 +148,38 @@ const CollectionSettings = ({ collection }) => {
|
|||||||
<div className="flex flex-wrap items-center tabs" role="tablist">
|
<div className="flex flex-wrap items-center tabs" role="tablist">
|
||||||
<div className={getTabClassname('headers')} role="tab" onClick={() => setTab('headers')}>
|
<div className={getTabClassname('headers')} role="tab" onClick={() => setTab('headers')}>
|
||||||
Headers
|
Headers
|
||||||
|
{activeHeadersCount > 0 && <sup className="ml-1 font-medium">{activeHeadersCount}</sup>}
|
||||||
</div>
|
</div>
|
||||||
<div className={getTabClassname('vars')} role="tab" onClick={() => setTab('vars')}>
|
<div className={getTabClassname('vars')} role="tab" onClick={() => setTab('vars')}>
|
||||||
Vars
|
Vars
|
||||||
|
{activeVarsCount > 0 && <sup className="ml-1 font-medium">{activeVarsCount}</sup>}
|
||||||
</div>
|
</div>
|
||||||
<div className={getTabClassname('auth')} role="tab" onClick={() => setTab('auth')}>
|
<div className={getTabClassname('auth')} role="tab" onClick={() => setTab('auth')}>
|
||||||
Auth
|
Auth
|
||||||
|
{auth !== 'none' && <ContentIndicator />}
|
||||||
</div>
|
</div>
|
||||||
<div className={getTabClassname('script')} role="tab" onClick={() => setTab('script')}>
|
<div className={getTabClassname('script')} role="tab" onClick={() => setTab('script')}>
|
||||||
Script
|
Script
|
||||||
|
{hasScripts && <ContentIndicator />}
|
||||||
</div>
|
</div>
|
||||||
<div className={getTabClassname('tests')} role="tab" onClick={() => setTab('tests')}>
|
<div className={getTabClassname('tests')} role="tab" onClick={() => setTab('tests')}>
|
||||||
Tests
|
Tests
|
||||||
|
{hasTests && <ContentIndicator />}
|
||||||
</div>
|
</div>
|
||||||
<div className={getTabClassname('presets')} role="tab" onClick={() => setTab('presets')}>
|
<div className={getTabClassname('presets')} role="tab" onClick={() => setTab('presets')}>
|
||||||
Presets
|
Presets
|
||||||
</div>
|
</div>
|
||||||
<div className={getTabClassname('proxy')} role="tab" onClick={() => setTab('proxy')}>
|
<div className={getTabClassname('proxy')} role="tab" onClick={() => setTab('proxy')}>
|
||||||
Proxy
|
Proxy
|
||||||
|
{Object.keys(proxyConfig).length > 0 && <ContentIndicator />}
|
||||||
</div>
|
</div>
|
||||||
<div className={getTabClassname('clientCert')} role="tab" onClick={() => setTab('clientCert')}>
|
<div className={getTabClassname('clientCert')} role="tab" onClick={() => setTab('clientCert')}>
|
||||||
Client Certificates
|
Client Certificates
|
||||||
|
{clientCertConfig.length > 0 && <ContentIndicator />}
|
||||||
</div>
|
</div>
|
||||||
<div className={getTabClassname('docs')} role="tab" onClick={() => setTab('docs')}>
|
<div className={getTabClassname('docs')} role="tab" onClick={() => setTab('docs')}>
|
||||||
Docs
|
Docs
|
||||||
|
{hasDocs && <ContentIndicator />}
|
||||||
</div>
|
</div>
|
||||||
<div className={getTabClassname('info')} role="tab" onClick={() => setTab('info')}>
|
<div className={getTabClassname('info')} role="tab" onClick={() => setTab('info')}>
|
||||||
Info
|
Info
|
||||||
|
@ -36,6 +36,13 @@ const Wrapper = styled.div`
|
|||||||
padding: 0.35rem 0.6rem;
|
padding: 0.35rem 0.6rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
color: ${(props) => props.theme.colors.text.yellow} !important;
|
||||||
|
.icon {
|
||||||
|
color: ${(props) => props.theme.colors.text.yellow} !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
color: ${(props) => props.theme.dropdown.iconColor};
|
color: ${(props) => props.theme.dropdown.iconColor};
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@ import React from 'react';
|
|||||||
import Tippy from '@tippyjs/react';
|
import Tippy from '@tippyjs/react';
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
|
||||||
const Dropdown = ({ icon, children, onCreate, placement }) => {
|
const Dropdown = ({ icon, children, onCreate, placement, transparent }) => {
|
||||||
return (
|
return (
|
||||||
<StyledWrapper className="dropdown">
|
<StyledWrapper className="dropdown" transparent={transparent}>
|
||||||
<Tippy
|
<Tippy
|
||||||
content={children}
|
content={children}
|
||||||
placement={placement || 'bottom-end'}
|
placement={placement || 'bottom-end'}
|
||||||
|
@ -53,10 +53,11 @@ const EnvironmentSelector = ({ collection }) => {
|
|||||||
<StyledWrapper>
|
<StyledWrapper>
|
||||||
<div className="flex items-center cursor-pointer environment-selector">
|
<div className="flex items-center cursor-pointer environment-selector">
|
||||||
<Dropdown onCreate={onDropdownCreate} icon={<Icon />} placement="bottom-end">
|
<Dropdown onCreate={onDropdownCreate} icon={<Icon />} placement="bottom-end">
|
||||||
|
<div className="label-item font-medium">Collection Environments</div>
|
||||||
{environments && environments.length
|
{environments && environments.length
|
||||||
? environments.map((e) => (
|
? environments.map((e) => (
|
||||||
<div
|
<div
|
||||||
className="dropdown-item"
|
className={`dropdown-item ${e?.uid === activeEnvironmentUid ? 'active' : ''}`}
|
||||||
key={e.uid}
|
key={e.uid}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onSelect(e);
|
onSelect(e);
|
||||||
|
@ -44,7 +44,7 @@ const CopyEnvironment = ({ collection, environment, onClose }) => {
|
|||||||
return (
|
return (
|
||||||
<Portal>
|
<Portal>
|
||||||
<Modal size="sm" title={'Copy Environment'} confirmText="Copy" handleConfirm={onSubmit} handleCancel={onClose}>
|
<Modal size="sm" title={'Copy Environment'} confirmText="Copy" handleConfirm={onSubmit} handleCancel={onClose}>
|
||||||
<form className="bruno-form" onSubmit={formik.handleSubmit}>
|
<form className="bruno-form" onSubmit={e => e.preventDefault()}>
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="name" className="block font-semibold">
|
<label htmlFor="name" className="block font-semibold">
|
||||||
New Environment Name
|
New Environment Name
|
||||||
|
@ -50,7 +50,7 @@ const CreateEnvironment = ({ collection, onClose }) => {
|
|||||||
handleConfirm={onSubmit}
|
handleConfirm={onSubmit}
|
||||||
handleCancel={onClose}
|
handleCancel={onClose}
|
||||||
>
|
>
|
||||||
<form className="bruno-form" onSubmit={formik.handleSubmit}>
|
<form className="bruno-form" onSubmit={e => e.preventDefault()}>
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="name" className="block font-semibold">
|
<label htmlFor="name" className="block font-semibold">
|
||||||
Environment Name
|
Environment Name
|
||||||
|
@ -39,6 +39,11 @@ const Wrapper = styled.div`
|
|||||||
font-size: 0.8125rem;
|
font-size: 0.8125rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tooltip-mod {
|
||||||
|
font-size: 11px !important;
|
||||||
|
width: 150px !important;
|
||||||
|
}
|
||||||
|
|
||||||
input[type='text'] {
|
input[type='text'] {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: solid 1px transparent;
|
border: solid 1px transparent;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React, { useRef, useEffect } from 'react';
|
||||||
import { IconTrash } from '@tabler/icons';
|
import cloneDeep from 'lodash/cloneDeep';
|
||||||
|
import { IconTrash, IconAlertCircle } from '@tabler/icons';
|
||||||
import { useTheme } from 'providers/Theme';
|
import { useTheme } from 'providers/Theme';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import SingleLineEditor from 'components/SingleLineEditor';
|
import SingleLineEditor from 'components/SingleLineEditor';
|
||||||
@ -9,12 +10,13 @@ import { useFormik } from 'formik';
|
|||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
import { variableNameRegex } from 'utils/common/regex';
|
import { variableNameRegex } from 'utils/common/regex';
|
||||||
import { saveEnvironment } from 'providers/ReduxStore/slices/collections/actions';
|
import { saveEnvironment } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
import cloneDeep from 'lodash/cloneDeep';
|
|
||||||
import toast from 'react-hot-toast';
|
import toast from 'react-hot-toast';
|
||||||
|
import { Tooltip } from 'react-tooltip';
|
||||||
|
|
||||||
const EnvironmentVariables = ({ environment, collection, setIsModified, originalEnvironmentVariables }) => {
|
const EnvironmentVariables = ({ environment, collection, setIsModified, originalEnvironmentVariables }) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const { storedTheme } = useTheme();
|
const { storedTheme } = useTheme();
|
||||||
|
const addButtonRef = useRef(null);
|
||||||
|
|
||||||
const formik = useFormik({
|
const formik = useFormik({
|
||||||
enableReinitialize: true,
|
enableReinitialize: true,
|
||||||
@ -58,14 +60,15 @@ const EnvironmentVariables = ({ environment, collection, setIsModified, original
|
|||||||
|
|
||||||
const ErrorMessage = ({ name }) => {
|
const ErrorMessage = ({ name }) => {
|
||||||
const meta = formik.getFieldMeta(name);
|
const meta = formik.getFieldMeta(name);
|
||||||
if (!meta.error) {
|
const id = uuid();
|
||||||
|
if (!meta.error || !meta.touched) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<label htmlFor={name} className="text-red-500">
|
<span>
|
||||||
{meta.error}
|
<IconAlertCircle id={id} className="text-red-600 cursor-pointer " size={20} />
|
||||||
</label>
|
<Tooltip className="tooltip-mod" anchorId={id} html={meta.error || ''} />
|
||||||
|
</span>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -85,6 +88,14 @@ const EnvironmentVariables = ({ environment, collection, setIsModified, original
|
|||||||
formik.setValues(formik.values.filter((variable) => variable.uid !== id));
|
formik.setValues(formik.values.filter((variable) => variable.uid !== id));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (formik.dirty) {
|
||||||
|
// Smooth scrolling to the changed parameter is temporarily disabled
|
||||||
|
// due to UX issues when editing the first row in a long list of environment variables.
|
||||||
|
// addButtonRef.current?.scrollIntoView({ behavior: 'smooth' });
|
||||||
|
}
|
||||||
|
}, [formik.values, formik.dirty]);
|
||||||
|
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
formik.resetForm({ originalEnvironmentVariables });
|
formik.resetForm({ originalEnvironmentVariables });
|
||||||
};
|
};
|
||||||
@ -115,19 +126,21 @@ const EnvironmentVariables = ({ environment, collection, setIsModified, original
|
|||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<div className="flex items-center">
|
||||||
type="text"
|
<input
|
||||||
autoComplete="off"
|
type="text"
|
||||||
autoCorrect="off"
|
autoComplete="off"
|
||||||
autoCapitalize="off"
|
autoCorrect="off"
|
||||||
spellCheck="false"
|
autoCapitalize="off"
|
||||||
className="mousetrap"
|
spellCheck="false"
|
||||||
id={`${index}.name`}
|
className="mousetrap"
|
||||||
name={`${index}.name`}
|
id={`${index}.name`}
|
||||||
value={variable.name}
|
name={`${index}.name`}
|
||||||
onChange={formik.handleChange}
|
value={variable.name}
|
||||||
/>
|
onChange={formik.handleChange}
|
||||||
<ErrorMessage name={`${index}.name`} />
|
/>
|
||||||
|
<ErrorMessage name={`${index}.name`} />
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="flex flex-row flex-nowrap">
|
<td className="flex flex-row flex-nowrap">
|
||||||
<div className="overflow-hidden grow w-full relative">
|
<div className="overflow-hidden grow w-full relative">
|
||||||
@ -159,11 +172,15 @@ const EnvironmentVariables = ({ environment, collection, setIsModified, original
|
|||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
<div>
|
||||||
<div>
|
<button
|
||||||
<button className="btn-add-param text-link pr-2 py-3 mt-2 select-none" onClick={addVariable}>
|
ref={addButtonRef}
|
||||||
+ Add Variable
|
className="btn-add-param text-link pr-2 py-3 mt-2 select-none"
|
||||||
</button>
|
onClick={addVariable}
|
||||||
|
>
|
||||||
|
+ Add Variable
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
@ -22,6 +22,9 @@ const RenameEnvironment = ({ onClose, environment, collection }) => {
|
|||||||
.required('name is required')
|
.required('name is required')
|
||||||
}),
|
}),
|
||||||
onSubmit: (values) => {
|
onSubmit: (values) => {
|
||||||
|
if (values.name === environment.name) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
dispatch(renameEnvironment(values.name, environment.uid, collection.uid))
|
dispatch(renameEnvironment(values.name, environment.uid, collection.uid))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
toast.success('Environment renamed successfully');
|
toast.success('Environment renamed successfully');
|
||||||
@ -50,7 +53,7 @@ const RenameEnvironment = ({ onClose, environment, collection }) => {
|
|||||||
handleConfirm={onSubmit}
|
handleConfirm={onSubmit}
|
||||||
handleCancel={onClose}
|
handleCancel={onClose}
|
||||||
>
|
>
|
||||||
<form className="bruno-form" onSubmit={formik.handleSubmit}>
|
<form className="bruno-form" onSubmit={e => e.preventDefault()}>
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="name" className="block font-semibold">
|
<label htmlFor="name" className="block font-semibold">
|
||||||
Environment Name
|
Environment Name
|
||||||
|
@ -82,7 +82,6 @@ const VarsTable = ({ folder, collection, vars, varType }) => {
|
|||||||
<td>
|
<td>
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<span>Value</span>
|
<span>Value</span>
|
||||||
<InfoTip text="You can write any valid JS Template Literal here" infotipId="request-var" />
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
) : (
|
) : (
|
||||||
|
@ -7,6 +7,15 @@ import Script from './Script';
|
|||||||
import Tests from './Tests';
|
import Tests from './Tests';
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
import Vars from './Vars';
|
import Vars from './Vars';
|
||||||
|
import DotIcon from 'components/Icons/Dot';
|
||||||
|
|
||||||
|
const ContentIndicator = () => {
|
||||||
|
return (
|
||||||
|
<sup className="ml-[.125rem] opacity-80 font-medium">
|
||||||
|
<DotIcon width="10"></DotIcon>
|
||||||
|
</sup>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const FolderSettings = ({ collection, folder }) => {
|
const FolderSettings = ({ collection, folder }) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@ -16,6 +25,17 @@ const FolderSettings = ({ collection, folder }) => {
|
|||||||
tab = folderLevelSettingsSelectedTab[folder?.uid];
|
tab = folderLevelSettingsSelectedTab[folder?.uid];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const folderRoot = collection?.items.find((item) => item.uid === folder?.uid)?.root;
|
||||||
|
const hasScripts = folderRoot?.request?.script?.res || folderRoot?.request?.script?.req;
|
||||||
|
const hasTests = folderRoot?.request?.tests;
|
||||||
|
|
||||||
|
const headers = folderRoot?.request?.headers || [];
|
||||||
|
const activeHeadersCount = headers.filter((header) => header.enabled).length;
|
||||||
|
|
||||||
|
const requestVars = folderRoot?.request?.vars?.req || [];
|
||||||
|
const responseVars = folderRoot?.request?.vars?.res || [];
|
||||||
|
const activeVarsCount = requestVars.filter((v) => v.enabled).length + responseVars.filter((v) => v.enabled).length;
|
||||||
|
|
||||||
const setTab = (tab) => {
|
const setTab = (tab) => {
|
||||||
dispatch(
|
dispatch(
|
||||||
updatedFolderSettingsSelectedTab({
|
updatedFolderSettingsSelectedTab({
|
||||||
@ -55,15 +75,19 @@ const FolderSettings = ({ collection, folder }) => {
|
|||||||
<div className="flex flex-wrap items-center tabs" role="tablist">
|
<div className="flex flex-wrap items-center tabs" role="tablist">
|
||||||
<div className={getTabClassname('headers')} role="tab" onClick={() => setTab('headers')}>
|
<div className={getTabClassname('headers')} role="tab" onClick={() => setTab('headers')}>
|
||||||
Headers
|
Headers
|
||||||
|
{activeHeadersCount > 0 && <sup className="ml-1 font-medium">{activeHeadersCount}</sup>}
|
||||||
</div>
|
</div>
|
||||||
<div className={getTabClassname('script')} role="tab" onClick={() => setTab('script')}>
|
<div className={getTabClassname('script')} role="tab" onClick={() => setTab('script')}>
|
||||||
Script
|
Script
|
||||||
|
{hasScripts && <ContentIndicator />}
|
||||||
</div>
|
</div>
|
||||||
<div className={getTabClassname('test')} role="tab" onClick={() => setTab('test')}>
|
<div className={getTabClassname('test')} role="tab" onClick={() => setTab('test')}>
|
||||||
Test
|
Test
|
||||||
|
{hasTests && <ContentIndicator />}
|
||||||
</div>
|
</div>
|
||||||
<div className={getTabClassname('vars')} role="tab" onClick={() => setTab('vars')}>
|
<div className={getTabClassname('vars')} role="tab" onClick={() => setTab('vars')}>
|
||||||
Vars
|
Vars
|
||||||
|
{activeVarsCount > 0 && <sup className="ml-1 font-medium">{activeVarsCount}</sup>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<section className={`flex mt-4 h-full`}>{getTabPanel(tab)}</section>
|
<section className={`flex mt-4 h-full`}>{getTabPanel(tab)}</section>
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const Wrapper = styled.div`
|
||||||
|
.current-environment {
|
||||||
|
}
|
||||||
|
.environment-active {
|
||||||
|
padding: 0.3rem 0.4rem;
|
||||||
|
color: ${(props) => props.theme.colors.text.yellow};
|
||||||
|
border: solid 1px ${(props) => props.theme.colors.text.yellow} !important;
|
||||||
|
}
|
||||||
|
.environment-selector {
|
||||||
|
.active: {
|
||||||
|
color: ${(props) => props.theme.colors.text.yellow};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default Wrapper;
|
@ -0,0 +1,97 @@
|
|||||||
|
import React, { useRef, forwardRef, useState } from 'react';
|
||||||
|
import find from 'lodash/find';
|
||||||
|
import Dropdown from 'components/Dropdown';
|
||||||
|
import { IconSettings, IconWorld, IconDatabase, IconDatabaseOff, IconCheck } from '@tabler/icons';
|
||||||
|
import EnvironmentSettings from '../EnvironmentSettings';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
import { selectGlobalEnvironment } from 'providers/ReduxStore/slices/global-environments';
|
||||||
|
import ToolHint from 'components/ToolHint/index';
|
||||||
|
|
||||||
|
const EnvironmentSelector = () => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const dropdownTippyRef = useRef();
|
||||||
|
const globalEnvironments = useSelector((state) => state.globalEnvironments.globalEnvironments);
|
||||||
|
const activeGlobalEnvironmentUid = useSelector((state) => state.globalEnvironments.activeGlobalEnvironmentUid);
|
||||||
|
const [openSettingsModal, setOpenSettingsModal] = useState(false);
|
||||||
|
const activeEnvironment = activeGlobalEnvironmentUid ? find(globalEnvironments, (e) => e.uid === activeGlobalEnvironmentUid) : null;
|
||||||
|
|
||||||
|
const Icon = forwardRef((props, ref) => {
|
||||||
|
return (
|
||||||
|
<div ref={ref} className={`current-environment flex flex-row gap-1 rounded-xl text-xs cursor-pointer items-center justify-center select-none ${activeGlobalEnvironmentUid? 'environment-active': ''}`}>
|
||||||
|
<ToolHint text="Global Environments" toolhintId="GlobalEnvironmentsToolhintId" className='flex flex-row'>
|
||||||
|
<IconWorld className="globe" size={16} strokeWidth={1.5} />
|
||||||
|
{
|
||||||
|
activeEnvironment ? <div>{activeEnvironment?.name}</div> : null
|
||||||
|
}
|
||||||
|
</ToolHint>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleSettingsIconClick = () => {
|
||||||
|
setOpenSettingsModal(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleModalClose = () => {
|
||||||
|
setOpenSettingsModal(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDropdownCreate = (ref) => (dropdownTippyRef.current = ref);
|
||||||
|
|
||||||
|
const onSelect = (environment) => {
|
||||||
|
dispatch(selectGlobalEnvironment({ environmentUid: environment ? environment.uid : null }))
|
||||||
|
.then(() => {
|
||||||
|
if (environment) {
|
||||||
|
toast.success(`Environment changed to ${environment.name}`);
|
||||||
|
} else {
|
||||||
|
toast.success(`No Environments are active now`);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => console.log(err) && toast.error('An error occurred while selecting the environment'));
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledWrapper>
|
||||||
|
<div className="flex items-center cursor-pointer environment-selector mr-3">
|
||||||
|
<Dropdown onCreate={onDropdownCreate} icon={<Icon />} placement="bottom-end" transparent={true}>
|
||||||
|
<div className="label-item font-medium">Global Environments</div>
|
||||||
|
{globalEnvironments && globalEnvironments.length
|
||||||
|
? globalEnvironments.map((e) => (
|
||||||
|
<div
|
||||||
|
className={`dropdown-item ${e?.uid === activeGlobalEnvironmentUid ? 'active' : ''}`}
|
||||||
|
key={e.uid}
|
||||||
|
onClick={() => {
|
||||||
|
onSelect(e);
|
||||||
|
dropdownTippyRef.current.hide();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconDatabase size={18} strokeWidth={1.5} /> <span className="ml-2 break-all">{e.name}</span>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
: null}
|
||||||
|
<div
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={() => {
|
||||||
|
dropdownTippyRef.current.hide();
|
||||||
|
onSelect(null);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconDatabaseOff size={18} strokeWidth={1.5} />
|
||||||
|
<span className="ml-2">No Environment</span>
|
||||||
|
</div>
|
||||||
|
<div className="dropdown-item border-top" onClick={handleSettingsIconClick}>
|
||||||
|
<div className="pr-2 text-gray-600">
|
||||||
|
<IconSettings size={18} strokeWidth={1.5} />
|
||||||
|
</div>
|
||||||
|
<span>Configure</span>
|
||||||
|
</div>
|
||||||
|
</Dropdown>
|
||||||
|
</div>
|
||||||
|
{openSettingsModal && <EnvironmentSettings globalEnvironments={globalEnvironments} activeGlobalEnvironmentUid={activeGlobalEnvironmentUid} onClose={handleModalClose} />}
|
||||||
|
</StyledWrapper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default EnvironmentSelector;
|
@ -0,0 +1,78 @@
|
|||||||
|
import Modal from 'components/Modal/index';
|
||||||
|
import Portal from 'components/Portal/index';
|
||||||
|
import { useFormik } from 'formik';
|
||||||
|
import { copyGlobalEnvironment } from 'providers/ReduxStore/slices/global-environments';
|
||||||
|
import { useEffect, useRef } from 'react';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import * as Yup from 'yup';
|
||||||
|
|
||||||
|
const CopyEnvironment = ({ environment, onClose }) => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const inputRef = useRef();
|
||||||
|
const formik = useFormik({
|
||||||
|
enableReinitialize: true,
|
||||||
|
initialValues: {
|
||||||
|
name: environment.name + ' - Copy'
|
||||||
|
},
|
||||||
|
validationSchema: Yup.object({
|
||||||
|
name: Yup.string()
|
||||||
|
.min(1, 'must be at least 1 character')
|
||||||
|
.max(50, 'must be 50 characters or less')
|
||||||
|
.required('name is required')
|
||||||
|
}),
|
||||||
|
onSubmit: (values) => {
|
||||||
|
dispatch(copyGlobalEnvironment({ name: values.name, environmentUid: environment.uid }))
|
||||||
|
.then(() => {
|
||||||
|
toast.success('Global environment created!');
|
||||||
|
onClose();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
toast.error('An error occurred while created the environment');
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (inputRef && inputRef.current) {
|
||||||
|
inputRef.current.focus();
|
||||||
|
}
|
||||||
|
}, [inputRef]);
|
||||||
|
|
||||||
|
const onSubmit = () => {
|
||||||
|
formik.handleSubmit();
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Portal>
|
||||||
|
<Modal size="sm" title={'Copy Global Environment'} confirmText="Copy" handleConfirm={onSubmit} handleCancel={onClose}>
|
||||||
|
<form className="bruno-form" onSubmit={e => e.preventDefault()}>
|
||||||
|
<div>
|
||||||
|
<label htmlFor="name" className="block font-semibold">
|
||||||
|
New Environment Name
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
id="environment-name"
|
||||||
|
type="text"
|
||||||
|
name="name"
|
||||||
|
ref={inputRef}
|
||||||
|
className="block textbox mt-2 w-full"
|
||||||
|
autoComplete="off"
|
||||||
|
autoCorrect="off"
|
||||||
|
autoCapitalize="off"
|
||||||
|
spellCheck="false"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.name || ''}
|
||||||
|
/>
|
||||||
|
{formik.touched.name && formik.errors.name ? (
|
||||||
|
<div className="text-red-500">{formik.errors.name}</div>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</Modal>
|
||||||
|
</Portal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CopyEnvironment;
|
@ -0,0 +1,83 @@
|
|||||||
|
import React, { useEffect, useRef } from 'react';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
|
import { useFormik } from 'formik';
|
||||||
|
import * as Yup from 'yup';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import Portal from 'components/Portal';
|
||||||
|
import Modal from 'components/Modal';
|
||||||
|
import { addGlobalEnvironment } from 'providers/ReduxStore/slices/global-environments';
|
||||||
|
|
||||||
|
const CreateEnvironment = ({ onClose }) => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const inputRef = useRef();
|
||||||
|
const formik = useFormik({
|
||||||
|
enableReinitialize: true,
|
||||||
|
initialValues: {
|
||||||
|
name: ''
|
||||||
|
},
|
||||||
|
validationSchema: Yup.object({
|
||||||
|
name: Yup.string()
|
||||||
|
.min(1, 'must be at least 1 character')
|
||||||
|
.max(50, 'must be 50 characters or less')
|
||||||
|
.required('name is required')
|
||||||
|
}),
|
||||||
|
onSubmit: (values) => {
|
||||||
|
dispatch(addGlobalEnvironment({ name: values.name }))
|
||||||
|
.then(() => {
|
||||||
|
toast.success('Global environment created!');
|
||||||
|
onClose();
|
||||||
|
})
|
||||||
|
.catch(() => toast.error('An error occurred while creating the environment'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (inputRef && inputRef.current) {
|
||||||
|
inputRef.current.focus();
|
||||||
|
}
|
||||||
|
}, [inputRef]);
|
||||||
|
|
||||||
|
const onSubmit = () => {
|
||||||
|
formik.handleSubmit();
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Portal>
|
||||||
|
<Modal
|
||||||
|
size="sm"
|
||||||
|
title={'Create Global Environment'}
|
||||||
|
confirmText="Create"
|
||||||
|
handleConfirm={onSubmit}
|
||||||
|
handleCancel={onClose}
|
||||||
|
>
|
||||||
|
<form className="bruno-form" onSubmit={e => e.preventDefault()}>
|
||||||
|
<div>
|
||||||
|
<label htmlFor="name" className="block font-semibold">
|
||||||
|
Environment Name
|
||||||
|
</label>
|
||||||
|
<div className="flex items-center mt-2">
|
||||||
|
<input
|
||||||
|
id="environment-name"
|
||||||
|
type="text"
|
||||||
|
name="name"
|
||||||
|
ref={inputRef}
|
||||||
|
className="block textbox w-full"
|
||||||
|
autoComplete="off"
|
||||||
|
autoCorrect="off"
|
||||||
|
autoCapitalize="off"
|
||||||
|
spellCheck="false"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.name || ''}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{formik.touched.name && formik.errors.name ? (
|
||||||
|
<div className="text-red-500">{formik.errors.name}</div>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</Modal>
|
||||||
|
</Portal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CreateEnvironment;
|
@ -0,0 +1,15 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const Wrapper = styled.div`
|
||||||
|
button.submit {
|
||||||
|
color: white;
|
||||||
|
background-color: var(--color-background-danger) !important;
|
||||||
|
border: inherit !important;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border: inherit !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default Wrapper;
|
@ -0,0 +1,37 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Portal from 'components/Portal/index';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
|
import Modal from 'components/Modal/index';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
import { deleteGlobalEnvironment } from 'providers/ReduxStore/slices/global-environments';
|
||||||
|
|
||||||
|
const DeleteEnvironment = ({ onClose, environment }) => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const onConfirm = () => {
|
||||||
|
dispatch(deleteGlobalEnvironment({ environmentUid: environment.uid }))
|
||||||
|
.then(() => {
|
||||||
|
toast.success('Global Environment deleted successfully');
|
||||||
|
onClose();
|
||||||
|
})
|
||||||
|
.catch(() => toast.error('An error occurred while deleting the environment'));
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Portal>
|
||||||
|
<StyledWrapper>
|
||||||
|
<Modal
|
||||||
|
size="sm"
|
||||||
|
title={'Delete Global Environment'}
|
||||||
|
confirmText="Delete"
|
||||||
|
handleConfirm={onConfirm}
|
||||||
|
handleCancel={onClose}
|
||||||
|
>
|
||||||
|
Are you sure you want to delete <span className="font-semibold">{environment.name}</span> ?
|
||||||
|
</Modal>
|
||||||
|
</StyledWrapper>
|
||||||
|
</Portal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DeleteEnvironment;
|
@ -0,0 +1,42 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { IconAlertTriangle } from '@tabler/icons';
|
||||||
|
import Modal from 'components/Modal';
|
||||||
|
import { createPortal } from 'react-dom';
|
||||||
|
|
||||||
|
const ConfirmSwitchEnv = ({ onCancel }) => {
|
||||||
|
return createPortal(
|
||||||
|
<Modal
|
||||||
|
size="md"
|
||||||
|
title="Unsaved changes"
|
||||||
|
confirmText="Save and Close"
|
||||||
|
cancelText="Close without saving"
|
||||||
|
disableEscapeKey={true}
|
||||||
|
disableCloseOnOutsideClick={true}
|
||||||
|
closeModalFadeTimeout={150}
|
||||||
|
handleCancel={onCancel}
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
}}
|
||||||
|
hideFooter={true}
|
||||||
|
>
|
||||||
|
<div className="flex items-center font-normal">
|
||||||
|
<IconAlertTriangle size={32} strokeWidth={1.5} className="text-yellow-600" />
|
||||||
|
<h1 className="ml-2 text-lg font-semibold">Hold on..</h1>
|
||||||
|
</div>
|
||||||
|
<div className="font-normal mt-4">You have unsaved changes in this environment.</div>
|
||||||
|
|
||||||
|
<div className="flex justify-between mt-6">
|
||||||
|
<div>
|
||||||
|
<button className="btn btn-sm btn-danger" onClick={onCancel}>
|
||||||
|
Close
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div></div>
|
||||||
|
</div>
|
||||||
|
</Modal>,
|
||||||
|
document.body
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ConfirmSwitchEnv;
|
@ -0,0 +1,66 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const Wrapper = styled.div`
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-weight: 600;
|
||||||
|
table-layout: fixed;
|
||||||
|
|
||||||
|
thead,
|
||||||
|
td {
|
||||||
|
border: 1px solid ${(props) => props.theme.collection.environment.settings.gridBorder};
|
||||||
|
padding: 4px 10px;
|
||||||
|
|
||||||
|
&:nth-child(1),
|
||||||
|
&:nth-child(4) {
|
||||||
|
width: 70px;
|
||||||
|
}
|
||||||
|
&:nth-child(5) {
|
||||||
|
width: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(2) {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
thead {
|
||||||
|
color: ${(props) => props.theme.table.thead.color};
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
thead td {
|
||||||
|
padding: 6px 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-add-param {
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tooltip-mod {
|
||||||
|
font-size: 11px !important;
|
||||||
|
width: 150px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type='text'] {
|
||||||
|
width: 100%;
|
||||||
|
border: solid 1px transparent;
|
||||||
|
outline: none !important;
|
||||||
|
background-color: transparent;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: none !important;
|
||||||
|
border: solid 1px transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type='checkbox'] {
|
||||||
|
cursor: pointer;
|
||||||
|
position: relative;
|
||||||
|
top: 1px;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default Wrapper;
|
@ -0,0 +1,199 @@
|
|||||||
|
import React, { useRef, useEffect } from 'react';
|
||||||
|
import cloneDeep from 'lodash/cloneDeep';
|
||||||
|
import { IconTrash, IconAlertCircle } from '@tabler/icons';
|
||||||
|
import { useTheme } from 'providers/Theme';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import SingleLineEditor from 'components/SingleLineEditor';
|
||||||
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
import { uuid } from 'utils/common';
|
||||||
|
import { useFormik } from 'formik';
|
||||||
|
import * as Yup from 'yup';
|
||||||
|
import { variableNameRegex } from 'utils/common/regex';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
|
import { saveGlobalEnvironment } from 'providers/ReduxStore/slices/global-environments';
|
||||||
|
import { Tooltip } from 'react-tooltip';
|
||||||
|
|
||||||
|
const EnvironmentVariables = ({ environment, setIsModified, originalEnvironmentVariables }) => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const { storedTheme } = useTheme();
|
||||||
|
const addButtonRef = useRef(null);
|
||||||
|
|
||||||
|
const formik = useFormik({
|
||||||
|
enableReinitialize: true,
|
||||||
|
initialValues: environment.variables || [],
|
||||||
|
validationSchema: Yup.array().of(
|
||||||
|
Yup.object({
|
||||||
|
enabled: Yup.boolean(),
|
||||||
|
name: Yup.string()
|
||||||
|
.required('Name cannot be empty')
|
||||||
|
.matches(
|
||||||
|
variableNameRegex,
|
||||||
|
'Name contains invalid characters. Must only contain alphanumeric characters, "-", "_", "." and cannot start with a digit.'
|
||||||
|
)
|
||||||
|
.trim(),
|
||||||
|
secret: Yup.boolean(),
|
||||||
|
type: Yup.string(),
|
||||||
|
uid: Yup.string(),
|
||||||
|
value: Yup.string().trim().nullable()
|
||||||
|
})
|
||||||
|
),
|
||||||
|
onSubmit: (values) => {
|
||||||
|
if (!formik.dirty) {
|
||||||
|
toast.error('Nothing to save');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatch(saveGlobalEnvironment({ environmentUid: environment.uid, variables: cloneDeep(values) }))
|
||||||
|
.then(() => {
|
||||||
|
toast.success('Changes saved successfully');
|
||||||
|
formik.resetForm({ values });
|
||||||
|
setIsModified(false);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
toast.error('An error occurred while saving the changes')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Effect to track modifications.
|
||||||
|
React.useEffect(() => {
|
||||||
|
setIsModified(formik.dirty);
|
||||||
|
}, [formik.dirty]);
|
||||||
|
|
||||||
|
const ErrorMessage = ({ name }) => {
|
||||||
|
const meta = formik.getFieldMeta(name);
|
||||||
|
const id = uuid();
|
||||||
|
if (!meta.error || !meta.touched) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<span>
|
||||||
|
<IconAlertCircle id={id} className="text-red-600 cursor-pointer " size={20} />
|
||||||
|
<Tooltip className="tooltip-mod" anchorId={id} html={meta.error || ''} />
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const addVariable = () => {
|
||||||
|
const newVariable = {
|
||||||
|
uid: uuid(),
|
||||||
|
name: '',
|
||||||
|
value: '',
|
||||||
|
type: 'text',
|
||||||
|
secret: false,
|
||||||
|
enabled: true
|
||||||
|
};
|
||||||
|
formik.setFieldValue(formik.values.length, newVariable, false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleRemoveVar = (id) => {
|
||||||
|
formik.setValues(formik.values.filter((variable) => variable.uid !== id));
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (formik.dirty) {
|
||||||
|
// Smooth scrolling to the changed parameter is temporarily disabled
|
||||||
|
// due to UX issues when editing the first row in a long list of environment variables.
|
||||||
|
// addButtonRef.current?.scrollIntoView({ behavior: 'smooth' });
|
||||||
|
}
|
||||||
|
}, [formik.values, formik.dirty]);
|
||||||
|
|
||||||
|
const handleReset = () => {
|
||||||
|
formik.resetForm({ originalEnvironmentVariables });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledWrapper className="w-full mt-6 mb-6">
|
||||||
|
<div className="h-[50vh] overflow-y-auto w-full">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td className="text-center">Enabled</td>
|
||||||
|
<td>Name</td>
|
||||||
|
<td>Value</td>
|
||||||
|
<td className="text-center">Secret</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{formik.values.map((variable, index) => (
|
||||||
|
<tr key={variable.uid}>
|
||||||
|
<td className="text-center">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
className="mousetrap"
|
||||||
|
name={`${index}.enabled`}
|
||||||
|
checked={variable.enabled}
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div className="flex items-center">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
autoComplete="off"
|
||||||
|
autoCorrect="off"
|
||||||
|
autoCapitalize="off"
|
||||||
|
spellCheck="false"
|
||||||
|
className="mousetrap"
|
||||||
|
id={`${index}.name`}
|
||||||
|
name={`${index}.name`}
|
||||||
|
value={variable.name}
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
/>
|
||||||
|
<ErrorMessage name={`${index}.name`} />
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="flex flex-row flex-nowrap">
|
||||||
|
<div className="overflow-hidden grow w-full relative">
|
||||||
|
<SingleLineEditor
|
||||||
|
theme={storedTheme}
|
||||||
|
name={`${index}.value`}
|
||||||
|
value={variable.value}
|
||||||
|
isSecret={variable.secret}
|
||||||
|
onChange={(newValue) => formik.setFieldValue(`${index}.value`, newValue, true)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="text-center">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
className="mousetrap"
|
||||||
|
name={`${index}.secret`}
|
||||||
|
checked={variable.secret}
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button onClick={() => handleRemoveVar(variable.uid)}>
|
||||||
|
<IconTrash strokeWidth={1.5} size={20} />
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
ref={addButtonRef}
|
||||||
|
className="btn-add-param text-link pr-2 py-3 mt-2 select-none"
|
||||||
|
onClick={addVariable}
|
||||||
|
>
|
||||||
|
+ Add Variable
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button type="submit" className="submit btn btn-md btn-secondary mt-2" onClick={formik.handleSubmit}>
|
||||||
|
Save
|
||||||
|
</button>
|
||||||
|
<button type="submit" className="ml-2 px-1 submit btn btn-md btn-secondary mt-2" onClick={handleReset}>
|
||||||
|
Reset
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</StyledWrapper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default EnvironmentVariables;
|
@ -0,0 +1,46 @@
|
|||||||
|
import { IconCopy, IconDatabase, IconEdit, IconTrash } from '@tabler/icons';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import CopyEnvironment from '../../CopyEnvironment';
|
||||||
|
import DeleteEnvironment from '../../DeleteEnvironment';
|
||||||
|
import RenameEnvironment from '../../RenameEnvironment';
|
||||||
|
import EnvironmentVariables from './EnvironmentVariables';
|
||||||
|
|
||||||
|
const EnvironmentDetails = ({ environment, setIsModified }) => {
|
||||||
|
const [openEditModal, setOpenEditModal] = useState(false);
|
||||||
|
const [openDeleteModal, setOpenDeleteModal] = useState(false);
|
||||||
|
const [openCopyModal, setOpenCopyModal] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="px-6 flex-grow flex flex-col pt-6" style={{ maxWidth: '700px' }}>
|
||||||
|
{openEditModal && (
|
||||||
|
<RenameEnvironment onClose={() => setOpenEditModal(false)} environment={environment} />
|
||||||
|
)}
|
||||||
|
{openDeleteModal && (
|
||||||
|
<DeleteEnvironment
|
||||||
|
onClose={() => setOpenDeleteModal(false)}
|
||||||
|
environment={environment}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{openCopyModal && (
|
||||||
|
<CopyEnvironment onClose={() => setOpenCopyModal(false)} environment={environment} />
|
||||||
|
)}
|
||||||
|
<div className="flex">
|
||||||
|
<div className="flex flex-grow items-center">
|
||||||
|
<IconDatabase className="cursor-pointer" size={20} strokeWidth={1.5} />
|
||||||
|
<span className="ml-1 font-semibold break-all">{environment.name}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex gap-x-4 pl-4">
|
||||||
|
<IconEdit className="cursor-pointer" size={20} strokeWidth={1.5} onClick={() => setOpenEditModal(true)} />
|
||||||
|
<IconCopy className="cursor-pointer" size={20} strokeWidth={1.5} onClick={() => setOpenCopyModal(true)} />
|
||||||
|
<IconTrash className="cursor-pointer" size={20} strokeWidth={1.5} onClick={() => setOpenDeleteModal(true)} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<EnvironmentVariables environment={environment} setIsModified={setIsModified} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default EnvironmentDetails;
|
@ -0,0 +1,58 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const StyledWrapper = styled.div`
|
||||||
|
margin-inline: -1rem;
|
||||||
|
margin-block: -1.5rem;
|
||||||
|
|
||||||
|
background-color: ${(props) => props.theme.collection.environment.settings.bg};
|
||||||
|
|
||||||
|
.environments-sidebar {
|
||||||
|
background-color: ${(props) => props.theme.collection.environment.settings.sidebar.bg};
|
||||||
|
border-right: solid 1px ${(props) => props.theme.collection.environment.settings.sidebar.borderRight};
|
||||||
|
min-height: 400px;
|
||||||
|
height: 100%;
|
||||||
|
max-height: 85vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.environment-item {
|
||||||
|
min-width: 150px;
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border-left: solid 2px transparent;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
background-color: ${(props) => props.theme.collection.environment.settings.item.hoverBg};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.active {
|
||||||
|
background-color: ${(props) => props.theme.collection.environment.settings.item.active.bg} !important;
|
||||||
|
border-left: solid 2px ${(props) => props.theme.collection.environment.settings.item.border};
|
||||||
|
&:hover {
|
||||||
|
background-color: ${(props) => props.theme.collection.environment.settings.item.active.hoverBg} !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-create-environment,
|
||||||
|
.btn-import-environment {
|
||||||
|
padding: 8px 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
border-bottom: none;
|
||||||
|
color: ${(props) => props.theme.textLink};
|
||||||
|
|
||||||
|
span:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-import-environment {
|
||||||
|
color: ${(props) => props.theme.colors.text.muted};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default StyledWrapper;
|
@ -0,0 +1,149 @@
|
|||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import usePrevious from 'hooks/usePrevious';
|
||||||
|
import EnvironmentDetails from './EnvironmentDetails';
|
||||||
|
import CreateEnvironment from '../CreateEnvironment';
|
||||||
|
import { IconDownload, IconShieldLock } from '@tabler/icons';
|
||||||
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
import ConfirmSwitchEnv from './ConfirmSwitchEnv';
|
||||||
|
import ManageSecrets from 'components/Environments/EnvironmentSettings/ManageSecrets/index';
|
||||||
|
import ImportEnvironment from '../ImportEnvironment';
|
||||||
|
import { isEqual } from 'lodash';
|
||||||
|
|
||||||
|
const EnvironmentList = ({ environments, activeEnvironmentUid, selectedEnvironment, setSelectedEnvironment, isModified, setIsModified }) => {
|
||||||
|
const [openCreateModal, setOpenCreateModal] = useState(false);
|
||||||
|
const [openImportModal, setOpenImportModal] = useState(false);
|
||||||
|
const [openManageSecretsModal, setOpenManageSecretsModal] = useState(false);
|
||||||
|
|
||||||
|
const [switchEnvConfirmClose, setSwitchEnvConfirmClose] = useState(false);
|
||||||
|
const [originalEnvironmentVariables, setOriginalEnvironmentVariables] = useState([]);
|
||||||
|
|
||||||
|
const envUids = environments ? environments.map((env) => env.uid) : [];
|
||||||
|
const prevEnvUids = usePrevious(envUids);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!environments?.length) {
|
||||||
|
setSelectedEnvironment(null);
|
||||||
|
setOriginalEnvironmentVariables([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedEnvironment) {
|
||||||
|
const _selectedEnvironment = environments?.find(env => env?.uid === selectedEnvironment?.uid);
|
||||||
|
const hasSelectedEnvironmentChanged = !isEqual(selectedEnvironment, _selectedEnvironment);
|
||||||
|
if (hasSelectedEnvironmentChanged) {
|
||||||
|
setSelectedEnvironment(_selectedEnvironment);
|
||||||
|
}
|
||||||
|
setOriginalEnvironmentVariables(selectedEnvironment.variables);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const environment = environments?.find(env => env.uid === activeEnvironmentUid) || environments?.[0];
|
||||||
|
|
||||||
|
setSelectedEnvironment(environment);
|
||||||
|
setOriginalEnvironmentVariables(environment?.variables || []);
|
||||||
|
}, [environments, activeEnvironmentUid]);
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (prevEnvUids && prevEnvUids.length && envUids.length > prevEnvUids.length) {
|
||||||
|
const newEnv = environments.find((env) => !prevEnvUids.includes(env.uid));
|
||||||
|
if (newEnv) {
|
||||||
|
setSelectedEnvironment(newEnv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevEnvUids && prevEnvUids.length && envUids.length < prevEnvUids.length) {
|
||||||
|
setSelectedEnvironment(environments && environments.length ? environments[0] : null);
|
||||||
|
}
|
||||||
|
}, [envUids, environments, prevEnvUids]);
|
||||||
|
|
||||||
|
const handleEnvironmentClick = (env) => {
|
||||||
|
if (!isModified) {
|
||||||
|
setSelectedEnvironment(env);
|
||||||
|
} else {
|
||||||
|
setSwitchEnvConfirmClose(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!selectedEnvironment) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCreateEnvClick = () => {
|
||||||
|
if (!isModified) {
|
||||||
|
setOpenCreateModal(true);
|
||||||
|
} else {
|
||||||
|
setSwitchEnvConfirmClose(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleImportClick = () => {
|
||||||
|
if (!isModified) {
|
||||||
|
setOpenImportModal(true);
|
||||||
|
} else {
|
||||||
|
setSwitchEnvConfirmClose(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSecretsClick = () => {
|
||||||
|
setOpenManageSecretsModal(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleConfirmSwitch = (saveChanges) => {
|
||||||
|
if (!saveChanges) {
|
||||||
|
setSwitchEnvConfirmClose(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledWrapper>
|
||||||
|
{openCreateModal && <CreateEnvironment onClose={() => setOpenCreateModal(false)} />}
|
||||||
|
{openImportModal && <ImportEnvironment onClose={() => setOpenImportModal(false)} />}
|
||||||
|
{openManageSecretsModal && <ManageSecrets onClose={() => setOpenManageSecretsModal(false)} />}
|
||||||
|
|
||||||
|
<div className="flex">
|
||||||
|
<div>
|
||||||
|
{switchEnvConfirmClose && (
|
||||||
|
<div className="flex items-center justify-between tab-container px-1">
|
||||||
|
<ConfirmSwitchEnv onCancel={() => handleConfirmSwitch(false)} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="environments-sidebar flex flex-col">
|
||||||
|
{environments &&
|
||||||
|
environments.length &&
|
||||||
|
environments.map((env) => (
|
||||||
|
<div
|
||||||
|
key={env.uid}
|
||||||
|
className={selectedEnvironment.uid === env.uid ? 'environment-item active' : 'environment-item'}
|
||||||
|
onClick={() => handleEnvironmentClick(env)} // Use handleEnvironmentClick to handle clicks
|
||||||
|
>
|
||||||
|
<span className="break-all">{env.name}</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
<div className="btn-create-environment" onClick={() => handleCreateEnvClick()}>
|
||||||
|
+ <span>Create</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mt-auto btn-import-environment">
|
||||||
|
<div className="flex items-center" onClick={() => handleImportClick()}>
|
||||||
|
<IconDownload size={12} strokeWidth={2} />
|
||||||
|
<span className="label ml-1 text-xs">Import</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center mt-2" onClick={() => handleSecretsClick()}>
|
||||||
|
<IconShieldLock size={12} strokeWidth={2} />
|
||||||
|
<span className="label ml-1 text-xs">Managing Secrets</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<EnvironmentDetails
|
||||||
|
environment={selectedEnvironment}
|
||||||
|
setIsModified={setIsModified}
|
||||||
|
originalEnvironmentVariables={originalEnvironmentVariables}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</StyledWrapper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default EnvironmentList;
|
@ -0,0 +1,62 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Portal from 'components/Portal';
|
||||||
|
import Modal from 'components/Modal';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import importPostmanEnvironment from 'utils/importers/postman-environment';
|
||||||
|
import { toastError } from 'utils/common/error';
|
||||||
|
import { IconDatabaseImport } from '@tabler/icons';
|
||||||
|
import { addGlobalEnvironment } from 'providers/ReduxStore/slices/global-environments';
|
||||||
|
import { uuid } from 'utils/common/index';
|
||||||
|
|
||||||
|
const ImportEnvironment = ({ onClose }) => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const handleImportPostmanEnvironment = () => {
|
||||||
|
importPostmanEnvironment()
|
||||||
|
.then((environments) => {
|
||||||
|
environments
|
||||||
|
.filter((env) =>
|
||||||
|
env.name && env.name !== 'undefined'
|
||||||
|
? true
|
||||||
|
: () => {
|
||||||
|
toast.error('Failed to import environment: env has no name');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.map((environment) => {
|
||||||
|
let variables = environment?.variables?.map(v => ({
|
||||||
|
...v,
|
||||||
|
uid: uuid(),
|
||||||
|
type: 'text'
|
||||||
|
}));
|
||||||
|
dispatch(addGlobalEnvironment({ name: environment.name, variables }))
|
||||||
|
.then(() => {
|
||||||
|
toast.success('Global Environment imported successfully');
|
||||||
|
})
|
||||||
|
.catch(() => toast.error('An error occurred while importing the environment'));
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
onClose();
|
||||||
|
})
|
||||||
|
.catch((err) => toastError(err, 'Postman Import environment failed'));
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Portal>
|
||||||
|
<Modal size="sm" title="Import Global Environment" hideFooter={true} handleConfirm={onClose} handleCancel={onClose}>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={handleImportPostmanEnvironment}
|
||||||
|
className="flex justify-center flex-col items-center w-full dark:bg-zinc-700 rounded-lg border-2 border-dashed border-zinc-300 dark:border-zinc-400 p-12 text-center hover:border-zinc-400 focus:outline-none focus:ring-2 focus:ring-amber-500 focus:ring-offset-2"
|
||||||
|
>
|
||||||
|
<IconDatabaseImport size={64} />
|
||||||
|
<span className="mt-2 block text-sm font-semibold">Import your Postman environments</span>
|
||||||
|
</button>
|
||||||
|
</Modal>
|
||||||
|
</Portal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ImportEnvironment;
|
@ -0,0 +1,88 @@
|
|||||||
|
import React, { useEffect, useRef } from 'react';
|
||||||
|
import Portal from 'components/Portal/index';
|
||||||
|
import Modal from 'components/Modal/index';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
|
import { useFormik } from 'formik';
|
||||||
|
import { renameEnvironment } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
|
import * as Yup from 'yup';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import { renameGlobalEnvironment } from 'providers/ReduxStore/slices/global-environments';
|
||||||
|
|
||||||
|
const RenameEnvironment = ({ onClose, environment }) => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const inputRef = useRef();
|
||||||
|
const formik = useFormik({
|
||||||
|
enableReinitialize: true,
|
||||||
|
initialValues: {
|
||||||
|
name: environment.name
|
||||||
|
},
|
||||||
|
validationSchema: Yup.object({
|
||||||
|
name: Yup.string()
|
||||||
|
.min(1, 'must be at least 1 character')
|
||||||
|
.max(50, 'must be 50 characters or less')
|
||||||
|
.required('name is required')
|
||||||
|
}),
|
||||||
|
onSubmit: (values) => {
|
||||||
|
if (values.name === environment.name) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dispatch(renameGlobalEnvironment({ name: values.name, environmentUid: environment.uid }))
|
||||||
|
.then(() => {
|
||||||
|
toast.success('Environment renamed successfully');
|
||||||
|
onClose();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
toast.error('An error occurred while renaming the environment');
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (inputRef && inputRef.current) {
|
||||||
|
inputRef.current.focus();
|
||||||
|
}
|
||||||
|
}, [inputRef]);
|
||||||
|
|
||||||
|
const onSubmit = () => {
|
||||||
|
formik.handleSubmit();
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Portal>
|
||||||
|
<Modal
|
||||||
|
size="sm"
|
||||||
|
title={'Rename Environment'}
|
||||||
|
confirmText="Rename"
|
||||||
|
handleConfirm={onSubmit}
|
||||||
|
handleCancel={onClose}
|
||||||
|
>
|
||||||
|
<form className="bruno-form" onSubmit={e => e.preventDefault()}>
|
||||||
|
<div>
|
||||||
|
<label htmlFor="name" className="block font-semibold">
|
||||||
|
Environment Name
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
id="environment-name"
|
||||||
|
type="text"
|
||||||
|
name="name"
|
||||||
|
ref={inputRef}
|
||||||
|
className="block textbox mt-2 w-full"
|
||||||
|
autoComplete="off"
|
||||||
|
autoCorrect="off"
|
||||||
|
autoCapitalize="off"
|
||||||
|
spellCheck="false"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.name || ''}
|
||||||
|
/>
|
||||||
|
{formik.touched.name && formik.errors.name ? (
|
||||||
|
<div className="text-red-500">{formik.errors.name}</div>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</Modal>
|
||||||
|
</Portal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default RenameEnvironment;
|
@ -0,0 +1,13 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const StyledWrapper = styled.div`
|
||||||
|
button.btn-create-environment {
|
||||||
|
&:hover {
|
||||||
|
span {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default StyledWrapper;
|
@ -0,0 +1,78 @@
|
|||||||
|
import Modal from 'components/Modal/index';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
import CreateEnvironment from './CreateEnvironment';
|
||||||
|
import EnvironmentList from './EnvironmentList';
|
||||||
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
import { IconFileAlert } from '@tabler/icons';
|
||||||
|
import ImportEnvironment from './ImportEnvironment/index';
|
||||||
|
|
||||||
|
export const SharedButton = ({ children, className, onClick }) => {
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={onClick}
|
||||||
|
className={`rounded bg-transparent px-2.5 py-2 w-fit text-xs font-semibold text-zinc-900 dark:text-zinc-50 shadow-sm ring-1 ring-inset ring-zinc-300 dark:ring-zinc-500 hover:bg-gray-50 dark:hover:bg-zinc-700
|
||||||
|
${className}`}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const DefaultTab = ({ setTab }) => {
|
||||||
|
return (
|
||||||
|
<div className="text-center items-center flex flex-col">
|
||||||
|
<IconFileAlert size={64} strokeWidth={1} />
|
||||||
|
<span className="font-semibold mt-2">No Global Environments found</span>
|
||||||
|
<div className="flex items-center justify-center mt-6">
|
||||||
|
<SharedButton onClick={() => setTab('create')}>
|
||||||
|
<span>Create Global Environment</span>
|
||||||
|
</SharedButton>
|
||||||
|
|
||||||
|
<span className="mx-4">Or</span>
|
||||||
|
|
||||||
|
<SharedButton onClick={() => setTab('import')}>
|
||||||
|
<span>Import Environment</span>
|
||||||
|
</SharedButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const EnvironmentSettings = ({ globalEnvironments, activeGlobalEnvironmentUid, onClose }) => {
|
||||||
|
const [isModified, setIsModified] = useState(false);
|
||||||
|
const environments = globalEnvironments;
|
||||||
|
const [selectedEnvironment, setSelectedEnvironment] = useState(null);
|
||||||
|
const [tab, setTab] = useState('default');
|
||||||
|
if (!environments || !environments.length) {
|
||||||
|
return (
|
||||||
|
<StyledWrapper>
|
||||||
|
<Modal size="md" title="Global Environments" handleCancel={onClose} hideCancel={true} hideFooter={true}>
|
||||||
|
{tab === 'create' ? (
|
||||||
|
<CreateEnvironment onClose={() => setTab('default')} />
|
||||||
|
) : tab === 'import' ? (
|
||||||
|
<ImportEnvironment onClose={() => setTab('default')} />
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
<DefaultTab setTab={setTab} />
|
||||||
|
</Modal>
|
||||||
|
</StyledWrapper>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal size="lg" title="Global Environments" handleCancel={onClose} hideFooter={true}>
|
||||||
|
<EnvironmentList
|
||||||
|
environments={globalEnvironments}
|
||||||
|
activeEnvironmentUid={activeGlobalEnvironmentUid}
|
||||||
|
selectedEnvironment={selectedEnvironment}
|
||||||
|
setSelectedEnvironment={setSelectedEnvironment}
|
||||||
|
isModified={isModified}
|
||||||
|
setIsModified={setIsModified}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default EnvironmentSettings;
|
@ -2,6 +2,7 @@ import MarkdownIt from 'markdown-it';
|
|||||||
import * as MarkdownItReplaceLink from 'markdown-it-replace-link';
|
import * as MarkdownItReplaceLink from 'markdown-it-replace-link';
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { isValidUrl } from 'utils/url/index';
|
||||||
|
|
||||||
const Markdown = ({ collectionPath, onDoubleClick, content }) => {
|
const Markdown = ({ collectionPath, onDoubleClick, content }) => {
|
||||||
const markdownItOptions = {
|
const markdownItOptions = {
|
||||||
@ -15,7 +16,7 @@ const Markdown = ({ collectionPath, onDoubleClick, content }) => {
|
|||||||
if (target.tagName === 'A') {
|
if (target.tagName === 'A') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const href = target.getAttribute('href');
|
const href = target.getAttribute('href');
|
||||||
if (href) {
|
if (href && isValidUrl(href)) {
|
||||||
window.open(href, '_blank');
|
window.open(href, '_blank');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,9 @@ import React, { useEffect, useState, useRef } from 'react';
|
|||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
import useFocusTrap from 'hooks/useFocusTrap';
|
import useFocusTrap from 'hooks/useFocusTrap';
|
||||||
|
|
||||||
|
const ESC_KEY_CODE = 27;
|
||||||
|
const ENTER_KEY_CODE = 13;
|
||||||
|
|
||||||
const ModalHeader = ({ title, handleCancel, customHeader, hideClose }) => (
|
const ModalHeader = ({ title, handleCancel, customHeader, hideClose }) => (
|
||||||
<div className="bruno-modal-header">
|
<div className="bruno-modal-header">
|
||||||
{customHeader ? customHeader : <>{title ? <div className="bruno-modal-header-title">{title}</div> : null}</>}
|
{customHeader ? customHeader : <>{title ? <div className="bruno-modal-header-title">{title}</div> : null}</>}
|
||||||
@ -72,10 +75,19 @@ const Modal = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const modalRef = useRef(null);
|
const modalRef = useRef(null);
|
||||||
const [isClosing, setIsClosing] = useState(false);
|
const [isClosing, setIsClosing] = useState(false);
|
||||||
const escFunction = (event) => {
|
|
||||||
const escKeyCode = 27;
|
const handleKeydown = (event) => {
|
||||||
if (event.keyCode === escKeyCode) {
|
const { keyCode, shiftKey, ctrlKey, altKey, metaKey } = event;
|
||||||
closeModal({ type: 'esc' });
|
switch (keyCode) {
|
||||||
|
case ESC_KEY_CODE: {
|
||||||
|
if (disableEscapeKey) return;
|
||||||
|
return closeModal({ type: 'esc' });
|
||||||
|
}
|
||||||
|
case ENTER_KEY_CODE: {
|
||||||
|
if (!shiftKey && !ctrlKey && !altKey && !metaKey && handleConfirm) {
|
||||||
|
return handleConfirm();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -87,10 +99,9 @@ const Modal = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (disableEscapeKey) return;
|
document.addEventListener('keydown', handleKeydown, false);
|
||||||
document.addEventListener('keydown', escFunction, false);
|
|
||||||
return () => {
|
return () => {
|
||||||
document.removeEventListener('keydown', escFunction, false);
|
document.removeEventListener('keydown', handleKeydown);
|
||||||
};
|
};
|
||||||
}, [disableEscapeKey, document]);
|
}, [disableEscapeKey, document]);
|
||||||
|
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
import styled from 'styled-components';
|
|
||||||
|
|
||||||
const StyledWrapper = styled.div`
|
|
||||||
.collection-dropdown {
|
|
||||||
color: rgb(110 110 110);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tippy-box {
|
|
||||||
top: -0.5rem;
|
|
||||||
position: relative;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export default StyledWrapper;
|
|
@ -1,60 +0,0 @@
|
|||||||
import React, { useState, forwardRef, useRef } from 'react';
|
|
||||||
import Dropdown from '../Dropdown';
|
|
||||||
import { faCaretDown } from '@fortawesome/free-solid-svg-icons';
|
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
||||||
import { IconBox, IconSearch, IconDots } from '@tabler/icons';
|
|
||||||
import StyledWrapper from './StyledWrapper';
|
|
||||||
|
|
||||||
const Navbar = () => {
|
|
||||||
const [modalOpen, setModalOpen] = useState(false);
|
|
||||||
|
|
||||||
const menuDropdownTippyRef = useRef();
|
|
||||||
const onMenuDropdownCreate = (ref) => (menuDropdownTippyRef.current = ref);
|
|
||||||
const MenuIcon = forwardRef((props, ref) => {
|
|
||||||
return (
|
|
||||||
<div ref={ref} className="dropdown-icon cursor-pointer">
|
|
||||||
<IconDots size={22} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<StyledWrapper className="px-2 py-2 flex items-center">
|
|
||||||
<div>
|
|
||||||
<span className="ml-2">Collections</span>
|
|
||||||
{/* <FontAwesomeIcon className="ml-2" icon={faCaretDown} style={{fontSize: 13}}/> */}
|
|
||||||
</div>
|
|
||||||
<div className="collection-dropdown flex flex-grow items-center justify-end">
|
|
||||||
<Dropdown onCreate={onMenuDropdownCreate} icon={<MenuIcon />} placement="bottom-start">
|
|
||||||
<div
|
|
||||||
className="dropdown-item"
|
|
||||||
onClick={(e) => {
|
|
||||||
menuDropdownTippyRef.current.hide();
|
|
||||||
setModalOpen(true);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Create Collection
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className="dropdown-item"
|
|
||||||
onClick={(e) => {
|
|
||||||
menuDropdownTippyRef.current.hide();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Import Collection
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className="dropdown-item"
|
|
||||||
onClick={(e) => {
|
|
||||||
menuDropdownTippyRef.current.hide();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Settings
|
|
||||||
</div>
|
|
||||||
</Dropdown>
|
|
||||||
</div>
|
|
||||||
</StyledWrapper>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Navbar;
|
|
@ -93,10 +93,12 @@ const Notifications = () => {
|
|||||||
dispatch(fetchNotifications());
|
dispatch(fetchNotifications());
|
||||||
setShowNotificationsModal(true);
|
setShowNotificationsModal(true);
|
||||||
}}
|
}}
|
||||||
|
aria-label="Check all Notifications"
|
||||||
>
|
>
|
||||||
<ToolHint text="Notifications" toolhintId="Notifications" offset={8} >
|
<ToolHint text="Notifications" toolhintId="Notifications" offset={8}>
|
||||||
<IconBell
|
<IconBell
|
||||||
size={18}
|
size={18}
|
||||||
|
aria-hidden
|
||||||
strokeWidth={1.5}
|
strokeWidth={1.5}
|
||||||
className={`mr-2 ${unreadNotifications?.length > 0 ? 'bell' : ''}`}
|
className={`mr-2 ${unreadNotifications?.length > 0 ? 'bell' : ''}`}
|
||||||
/>
|
/>
|
||||||
@ -133,8 +135,9 @@ const Notifications = () => {
|
|||||||
{notifications?.slice(notificationsStartIndex, notificationsEndIndex)?.map((notification) => (
|
{notifications?.slice(notificationsStartIndex, notificationsEndIndex)?.map((notification) => (
|
||||||
<li
|
<li
|
||||||
key={notification.id}
|
key={notification.id}
|
||||||
className={`p-4 flex flex-col justify-center ${selectedNotification?.id == notification.id ? 'active' : notification.read ? 'read' : ''
|
className={`p-4 flex flex-col justify-center ${
|
||||||
}`}
|
selectedNotification?.id == notification.id ? 'active' : notification.read ? 'read' : ''
|
||||||
|
}`}
|
||||||
onClick={handleNotificationItemClick(notification)}
|
onClick={handleNotificationItemClick(notification)}
|
||||||
>
|
>
|
||||||
<div className="notification-title w-full">{notification?.title}</div>
|
<div className="notification-title w-full">{notification?.title}</div>
|
||||||
@ -144,8 +147,9 @@ const Notifications = () => {
|
|||||||
</ul>
|
</ul>
|
||||||
<div className="w-full pagination flex flex-row gap-4 justify-center p-2 items-center text-xs">
|
<div className="w-full pagination flex flex-row gap-4 justify-center p-2 items-center text-xs">
|
||||||
<button
|
<button
|
||||||
className={`pl-2 pr-2 py-3 select-none ${pageNumber <= 1 ? 'opacity-50' : 'text-link cursor-pointer hover:underline'
|
className={`pl-2 pr-2 py-3 select-none ${
|
||||||
}`}
|
pageNumber <= 1 ? 'opacity-50' : 'text-link cursor-pointer hover:underline'
|
||||||
|
}`}
|
||||||
onClick={handlePrev}
|
onClick={handlePrev}
|
||||||
>
|
>
|
||||||
{'Prev'}
|
{'Prev'}
|
||||||
@ -161,8 +165,9 @@ const Notifications = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
className={`pl-2 pr-2 py-3 select-none ${pageNumber == totalPages ? 'opacity-50' : 'text-link cursor-pointer hover:underline'
|
className={`pl-2 pr-2 py-3 select-none ${
|
||||||
}`}
|
pageNumber == totalPages ? 'opacity-50' : 'text-link cursor-pointer hover:underline'
|
||||||
|
}`}
|
||||||
onClick={handleNext}
|
onClick={handleNext}
|
||||||
>
|
>
|
||||||
{'Next'}
|
{'Next'}
|
||||||
|
@ -39,7 +39,7 @@ const Font = ({ close }) => {
|
|||||||
<StyledWrapper>
|
<StyledWrapper>
|
||||||
<div className="flex flex-row gap-2 w-full">
|
<div className="flex flex-row gap-2 w-full">
|
||||||
<div className="w-4/5">
|
<div className="w-4/5">
|
||||||
<label className="block font-medium">Code Editor Font</label>
|
<label className="block">Code Editor Font</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
className="block textbox mt-2 w-full"
|
className="block textbox mt-2 w-full"
|
||||||
@ -52,7 +52,7 @@ const Font = ({ close }) => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-1/5">
|
<div className="w-1/5">
|
||||||
<label className="block font-medium">Font Size</label>
|
<label className="block">Font Size</label>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
className="block textbox mt-2 w-full"
|
className="block textbox mt-2 w-full"
|
@ -0,0 +1,22 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Font from './Font/index';
|
||||||
|
import Theme from './Theme/index';
|
||||||
|
|
||||||
|
const Display = ({ close }) => {
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col my-2 gap-10 w-full">
|
||||||
|
<div className='w-full flex flex-col gap-2'>
|
||||||
|
<span>
|
||||||
|
Theme
|
||||||
|
</span>
|
||||||
|
<Theme close={close} />
|
||||||
|
</div>
|
||||||
|
<div className='h-[1px] bg-[#aaa5] w-full'></div>
|
||||||
|
<div className='w-fit flex flex-col gap-2'>
|
||||||
|
<Font close={close} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Display;
|
@ -100,7 +100,7 @@ const General = ({ close }) => {
|
|||||||
return (
|
return (
|
||||||
<StyledWrapper>
|
<StyledWrapper>
|
||||||
<form className="bruno-form" onSubmit={formik.handleSubmit}>
|
<form className="bruno-form" onSubmit={formik.handleSubmit}>
|
||||||
<div className="flex items-center mt-2">
|
<div className="flex items-center my-2">
|
||||||
<input
|
<input
|
||||||
id="sslVerification"
|
id="sslVerification"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const StyledWrapper = styled.div`
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
|
||||||
|
thead,
|
||||||
|
td {
|
||||||
|
border: 2px solid ${(props) => props.theme.table.border};
|
||||||
|
}
|
||||||
|
|
||||||
|
thead {
|
||||||
|
color: ${(props) => props.theme.table.thead.color};
|
||||||
|
font-size: 1rem;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding: 4px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
thead th {
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-container {
|
||||||
|
max-height: 400px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
.key-button {
|
||||||
|
display: inline-block;
|
||||||
|
color: ${(props) => props.theme.table.input.color};
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 1px 5px;
|
||||||
|
font-family: monospace;
|
||||||
|
margin-right: 8px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default StyledWrapper;
|
@ -0,0 +1,45 @@
|
|||||||
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
import React from 'react';
|
||||||
|
import { getKeyBindingsForOS } from 'providers/Hotkeys/keyMappings';
|
||||||
|
import { isMacOS } from 'utils/common/platform';
|
||||||
|
|
||||||
|
const Keybindings = ({ close }) => {
|
||||||
|
const keyMapping = getKeyBindingsForOS(isMacOS() ? 'mac' : 'windows');
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledWrapper className="w-full">
|
||||||
|
<div className="table-container">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Command</th>
|
||||||
|
<th>Keybinding</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{keyMapping ? (
|
||||||
|
Object.entries(keyMapping).map(([action, { name, keys }], index) => (
|
||||||
|
<tr key={index}>
|
||||||
|
<td>{name}</td>
|
||||||
|
<td>
|
||||||
|
{keys.split('+').map((key, i) => (
|
||||||
|
<div className="key-button" key={i}>
|
||||||
|
{key}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<tr>
|
||||||
|
<td colSpan="2">No key bindings available</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</StyledWrapper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Keybindings;
|
@ -113,7 +113,7 @@ const ProxySettings = ({ close }) => {
|
|||||||
return (
|
return (
|
||||||
<StyledWrapper>
|
<StyledWrapper>
|
||||||
<form className="bruno-form" onSubmit={formik.handleSubmit}>
|
<form className="bruno-form" onSubmit={formik.handleSubmit}>
|
||||||
<div className="mb-3 flex items-center">
|
<div className="mb-3 flex items-center mt-2">
|
||||||
<label className="settings-label" htmlFor="protocol">
|
<label className="settings-label" htmlFor="protocol">
|
||||||
Mode
|
Mode
|
||||||
</label>
|
</label>
|
||||||
|
@ -2,13 +2,12 @@ import styled from 'styled-components';
|
|||||||
|
|
||||||
const StyledWrapper = styled.div`
|
const StyledWrapper = styled.div`
|
||||||
div.tabs {
|
div.tabs {
|
||||||
margin-top: -0.5rem;
|
|
||||||
|
|
||||||
div.tab {
|
div.tab {
|
||||||
padding: 6px 0px;
|
width: 100%;
|
||||||
|
min-width: 120px;
|
||||||
|
padding: 7px 10px;
|
||||||
border: none;
|
border: none;
|
||||||
border-bottom: solid 2px transparent;
|
border-bottom: solid 2px transparent;
|
||||||
margin-right: 1.25rem;
|
|
||||||
color: var(--color-tab-inactive);
|
color: var(--color-tab-inactive);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
@ -22,8 +21,12 @@ const StyledWrapper = styled.div`
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
color: ${(props) => props.theme.tabs.active.color} !important;
|
color: ${(props) => props.theme.sidebar.color} !important;
|
||||||
border-bottom: solid 2px ${(props) => props.theme.tabs.active.border} !important;
|
background: ${(props) => props.theme.sidebar.collection.item.bg};
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: ${(props) => props.theme.sidebar.collection.item.bg} !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
import Modal from 'components/Modal/index';
|
import Modal from 'components/Modal/index';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
import Support from './Support';
|
import Support from './Support';
|
||||||
import General from './General';
|
import General from './General';
|
||||||
import Font from './Font';
|
|
||||||
import Theme from './Theme';
|
|
||||||
import Proxy from './ProxySettings';
|
import Proxy from './ProxySettings';
|
||||||
|
import Display from './Display';
|
||||||
|
import Keybindings from './Keybindings';
|
||||||
|
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
|
||||||
const Preferences = ({ onClose }) => {
|
const Preferences = ({ onClose }) => {
|
||||||
@ -27,41 +29,43 @@ const Preferences = ({ onClose }) => {
|
|||||||
return <Proxy close={onClose} />;
|
return <Proxy close={onClose} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'theme': {
|
case 'display': {
|
||||||
return <Theme close={onClose} />;
|
return <Display close={onClose} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'keybindings': {
|
||||||
|
return <Keybindings close={onClose} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'support': {
|
case 'support': {
|
||||||
return <Support />;
|
return <Support />;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'font': {
|
|
||||||
return <Font close={onClose} />;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledWrapper>
|
<StyledWrapper>
|
||||||
<Modal size="lg" title="Preferences" handleCancel={onClose} hideFooter={true}>
|
<Modal size="lg" title="Preferences" handleCancel={onClose} hideFooter={true}>
|
||||||
<div className="flex items-center px-2 tabs" role="tablist">
|
<div className='flex flex-row gap-2 mx-[-1rem] !my-[-1.5rem]'>
|
||||||
<div className={getTabClassname('general')} role="tab" onClick={() => setTab('general')}>
|
<div className="flex flex-col items-center tabs" role="tablist">
|
||||||
General
|
<div className={getTabClassname('general')} role="tab" onClick={() => setTab('general')}>
|
||||||
</div>
|
General
|
||||||
<div className={getTabClassname('theme')} role="tab" onClick={() => setTab('theme')}>
|
</div>
|
||||||
Theme
|
<div className={getTabClassname('display')} role="tab" onClick={() => setTab('display')}>
|
||||||
</div>
|
Display
|
||||||
<div className={getTabClassname('font')} role="tab" onClick={() => setTab('font')}>
|
</div>
|
||||||
Font
|
<div className={getTabClassname('proxy')} role="tab" onClick={() => setTab('proxy')}>
|
||||||
</div>
|
Proxy
|
||||||
<div className={getTabClassname('proxy')} role="tab" onClick={() => setTab('proxy')}>
|
</div>
|
||||||
Proxy
|
<div className={getTabClassname('keybindings')} role="tab" onClick={() => setTab('keybindings')}>
|
||||||
</div>
|
Keybindings
|
||||||
<div className={getTabClassname('support')} role="tab" onClick={() => setTab('support')}>
|
</div>
|
||||||
Support
|
<div className={getTabClassname('support')} role="tab" onClick={() => setTab('support')}>
|
||||||
|
Support
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<section className="flex flex-grow px-2 pt-2 pb-6 tab-panel">{getTabPanel(tab)}</section>
|
||||||
</div>
|
</div>
|
||||||
<section className="flex flex-grow px-2 mt-4 tab-panel">{getTabPanel(tab)}</section>
|
|
||||||
</Modal>
|
</Modal>
|
||||||
</StyledWrapper>
|
</StyledWrapper>
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useRef, useState, useCallback } from 'react';
|
import React, { useEffect, useRef, useState, useMemo } from 'react';
|
||||||
import { IconGripVertical, IconMinusVertical } from '@tabler/icons';
|
import { IconGripVertical, IconMinusVertical } from '@tabler/icons';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,17 +13,17 @@ import { IconGripVertical, IconMinusVertical } from '@tabler/icons';
|
|||||||
|
|
||||||
const ReorderTable = ({ children, updateReorderedItem }) => {
|
const ReorderTable = ({ children, updateReorderedItem }) => {
|
||||||
const tbodyRef = useRef();
|
const tbodyRef = useRef();
|
||||||
const [rowsOrder, setRowsOrder] = useState(React.Children.toArray(children));
|
|
||||||
const [hoveredRow, setHoveredRow] = useState(null);
|
const [hoveredRow, setHoveredRow] = useState(null);
|
||||||
const [dragStart, setDragStart] = useState(null);
|
const [dragStart, setDragStart] = useState(null);
|
||||||
|
|
||||||
|
const rowsOrder = useMemo(() => React.Children.toArray(children), [children]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* useEffect hook to update the rows order and handle row hover states
|
* useEffect hook to handle row hover states
|
||||||
*/
|
*/
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setRowsOrder(React.Children.toArray(children));
|
|
||||||
handleRowHover(null, false);
|
handleRowHover(null, false);
|
||||||
}, [children, dragStart]);
|
}, [children]);
|
||||||
|
|
||||||
const handleRowHover = (index, hoverstatus = true) => {
|
const handleRowHover = (index, hoverstatus = true) => {
|
||||||
setHoveredRow(hoverstatus ? index : null);
|
setHoveredRow(hoverstatus ? index : null);
|
||||||
@ -48,7 +48,6 @@ const ReorderTable = ({ children, updateReorderedItem }) => {
|
|||||||
const updatedRowsOrder = [...rowsOrder];
|
const updatedRowsOrder = [...rowsOrder];
|
||||||
const [movedRow] = updatedRowsOrder.splice(fromIndex, 1);
|
const [movedRow] = updatedRowsOrder.splice(fromIndex, 1);
|
||||||
updatedRowsOrder.splice(toIndex, 0, movedRow);
|
updatedRowsOrder.splice(toIndex, 0, movedRow);
|
||||||
setRowsOrder(updatedRowsOrder);
|
|
||||||
|
|
||||||
updateReorderedItem({
|
updateReorderedItem({
|
||||||
updateReorderedItem: updatedRowsOrder.map((row) => row.props['data-uid'])
|
updateReorderedItem: updatedRowsOrder.map((row) => row.props['data-uid'])
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const Wrapper = styled.div`
|
||||||
|
label {
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.single-line-editor-wrapper {
|
||||||
|
max-width: 400px;
|
||||||
|
padding: 0.15rem 0.4rem;
|
||||||
|
border-radius: 3px;
|
||||||
|
border: solid 1px ${(props) => props.theme.input.border};
|
||||||
|
background-color: ${(props) => props.theme.input.bg};
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-placement-selector {
|
||||||
|
padding: 0.5rem 0px;
|
||||||
|
border-radius: 3px;
|
||||||
|
border: solid 1px ${(props) => props.theme.input.border};
|
||||||
|
background-color: ${(props) => props.theme.input.bg};
|
||||||
|
|
||||||
|
.dropdown {
|
||||||
|
width: fit-content;
|
||||||
|
|
||||||
|
div[data-tippy-root] {
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
.tippy-box {
|
||||||
|
width: fit-content;
|
||||||
|
max-width: none !important;
|
||||||
|
|
||||||
|
.tippy-content: {
|
||||||
|
width: fit-content;
|
||||||
|
max-width: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-type-label {
|
||||||
|
width: fit-content;
|
||||||
|
color: ${(props) => props.theme.colors.text.yellow};
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-item {
|
||||||
|
padding: 0.2rem 0.6rem !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.caret {
|
||||||
|
color: rgb(140, 140, 140);
|
||||||
|
fill: rgb(140 140 140);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default Wrapper;
|
@ -0,0 +1,114 @@
|
|||||||
|
import React, { useRef, forwardRef, useEffect } from 'react';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import get from 'lodash/get';
|
||||||
|
import { IconCaretDown } from '@tabler/icons';
|
||||||
|
import Dropdown from 'components/Dropdown';
|
||||||
|
import { useTheme } from 'providers/Theme';
|
||||||
|
import SingleLineEditor from 'components/SingleLineEditor';
|
||||||
|
import { updateAuth } from 'providers/ReduxStore/slices/collections';
|
||||||
|
import { sendRequest, saveRequest } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
import { humanizeRequestAPIKeyPlacement } from 'utils/collections';
|
||||||
|
|
||||||
|
const ApiKeyAuth = ({ item, collection }) => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const { storedTheme } = useTheme();
|
||||||
|
const dropdownTippyRef = useRef();
|
||||||
|
const onDropdownCreate = (ref) => (dropdownTippyRef.current = ref);
|
||||||
|
|
||||||
|
const apikeyAuth = item.draft ? get(item, 'draft.request.auth.apikey', {}) : get(item, 'request.auth.apikey', {});
|
||||||
|
|
||||||
|
const handleRun = () => dispatch(sendRequest(item, collection.uid));
|
||||||
|
const handleSave = () => dispatch(saveRequest(item.uid, collection.uid));
|
||||||
|
|
||||||
|
const Icon = forwardRef((props, ref) => {
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="flex items-center justify-end auth-type-label select-none">
|
||||||
|
{humanizeRequestAPIKeyPlacement(apikeyAuth?.placement)}
|
||||||
|
<IconCaretDown className="caret ml-1 mr-1" size={14} strokeWidth={2} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleAuthChange = (property, value) => {
|
||||||
|
dispatch(
|
||||||
|
updateAuth({
|
||||||
|
mode: 'apikey',
|
||||||
|
collectionUid: collection.uid,
|
||||||
|
itemUid: item.uid,
|
||||||
|
content: {
|
||||||
|
...apikeyAuth,
|
||||||
|
[property]: value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
!apikeyAuth?.placement &&
|
||||||
|
dispatch(
|
||||||
|
updateAuth({
|
||||||
|
mode: 'apikey',
|
||||||
|
collectionUid: collection.uid,
|
||||||
|
itemUid: item.uid,
|
||||||
|
content: {
|
||||||
|
placement: 'header'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}, [apikeyAuth]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledWrapper className="mt-2 w-full">
|
||||||
|
<label className="block font-medium mb-2">Key</label>
|
||||||
|
<div className="single-line-editor-wrapper mb-2">
|
||||||
|
<SingleLineEditor
|
||||||
|
value={apikeyAuth.key || ''}
|
||||||
|
theme={storedTheme}
|
||||||
|
onSave={handleSave}
|
||||||
|
onChange={(val) => handleAuthChange('key', val)}
|
||||||
|
onRun={handleRun}
|
||||||
|
collection={collection}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label className="block font-medium mb-2">Value</label>
|
||||||
|
<div className="single-line-editor-wrapper mb-2">
|
||||||
|
<SingleLineEditor
|
||||||
|
value={apikeyAuth.value || ''}
|
||||||
|
theme={storedTheme}
|
||||||
|
onSave={handleSave}
|
||||||
|
onChange={(val) => handleAuthChange('value', val)}
|
||||||
|
onRun={handleRun}
|
||||||
|
collection={collection}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label className="block font-medium mb-2">Add To</label>
|
||||||
|
<div className="inline-flex items-center cursor-pointer auth-placement-selector w-fit">
|
||||||
|
<Dropdown onCreate={onDropdownCreate} icon={<Icon />} placement="bottom-end">
|
||||||
|
<div
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={() => {
|
||||||
|
dropdownTippyRef.current.hide();
|
||||||
|
handleAuthChange('placement', 'header');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Header
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={() => {
|
||||||
|
dropdownTippyRef.current.hide();
|
||||||
|
handleAuthChange('placement', 'queryparams');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Query Params
|
||||||
|
</div>
|
||||||
|
</Dropdown>
|
||||||
|
</div>
|
||||||
|
</StyledWrapper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ApiKeyAuth;
|
@ -30,7 +30,6 @@ const AuthMode = ({ item, collection }) => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledWrapper>
|
<StyledWrapper>
|
||||||
<div className="inline-flex items-center cursor-pointer auth-mode-selector">
|
<div className="inline-flex items-center cursor-pointer auth-mode-selector">
|
||||||
@ -80,6 +79,24 @@ const AuthMode = ({ item, collection }) => {
|
|||||||
>
|
>
|
||||||
OAuth 2.0
|
OAuth 2.0
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={() => {
|
||||||
|
dropdownTippyRef?.current?.hide();
|
||||||
|
onModeChange('wsse');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
WSSE Auth
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="dropdown-item"
|
||||||
|
onClick={() => {
|
||||||
|
dropdownTippyRef?.current?.hide();
|
||||||
|
onModeChange('apikey');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
API Key
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const Wrapper = styled.div`
|
||||||
|
label {
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.single-line-editor-wrapper {
|
||||||
|
max-width: 400px;
|
||||||
|
padding: 0.15rem 0.4rem;
|
||||||
|
border-radius: 3px;
|
||||||
|
border: solid 1px ${(props) => props.theme.input.border};
|
||||||
|
background-color: ${(props) => props.theme.input.bg};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default Wrapper;
|
@ -0,0 +1,76 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import get from 'lodash/get';
|
||||||
|
import { useTheme } from 'providers/Theme';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import SingleLineEditor from 'components/SingleLineEditor';
|
||||||
|
import { updateAuth } from 'providers/ReduxStore/slices/collections';
|
||||||
|
import { sendRequest, saveRequest } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
|
||||||
|
const WsseAuth = ({ item, collection }) => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const { storedTheme } = useTheme();
|
||||||
|
|
||||||
|
const wsseAuth = item.draft ? get(item, 'draft.request.auth.wsse', {}) : get(item, 'request.auth.wsse', {});
|
||||||
|
|
||||||
|
const handleRun = () => dispatch(sendRequest(item, collection.uid));
|
||||||
|
const handleSave = () => dispatch(saveRequest(item.uid, collection.uid));
|
||||||
|
|
||||||
|
const handleUserChange = (username) => {
|
||||||
|
dispatch(
|
||||||
|
updateAuth({
|
||||||
|
mode: 'wsse',
|
||||||
|
collectionUid: collection.uid,
|
||||||
|
itemUid: item.uid,
|
||||||
|
content: {
|
||||||
|
username,
|
||||||
|
password: wsseAuth.password
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePasswordChange = (password) => {
|
||||||
|
dispatch(
|
||||||
|
updateAuth({
|
||||||
|
mode: 'wsse',
|
||||||
|
collectionUid: collection.uid,
|
||||||
|
itemUid: item.uid,
|
||||||
|
content: {
|
||||||
|
username: wsseAuth.username,
|
||||||
|
password
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledWrapper className="mt-2 w-full">
|
||||||
|
<label className="block font-medium mb-2">Username</label>
|
||||||
|
<div className="single-line-editor-wrapper mb-2">
|
||||||
|
<SingleLineEditor
|
||||||
|
value={wsseAuth.username || ''}
|
||||||
|
theme={storedTheme}
|
||||||
|
onSave={handleSave}
|
||||||
|
onChange={(val) => handleUserChange(val)}
|
||||||
|
onRun={handleRun}
|
||||||
|
collection={collection}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label className="block font-medium mb-2">Password</label>
|
||||||
|
<div className="single-line-editor-wrapper">
|
||||||
|
<SingleLineEditor
|
||||||
|
value={wsseAuth.password || ''}
|
||||||
|
theme={storedTheme}
|
||||||
|
onSave={handleSave}
|
||||||
|
onChange={(val) => handlePasswordChange(val)}
|
||||||
|
onRun={handleRun}
|
||||||
|
collection={collection}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</StyledWrapper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default WsseAuth;
|
@ -5,6 +5,8 @@ import AwsV4Auth from './AwsV4Auth';
|
|||||||
import BearerAuth from './BearerAuth';
|
import BearerAuth from './BearerAuth';
|
||||||
import BasicAuth from './BasicAuth';
|
import BasicAuth from './BasicAuth';
|
||||||
import DigestAuth from './DigestAuth';
|
import DigestAuth from './DigestAuth';
|
||||||
|
import WsseAuth from './WsseAuth';
|
||||||
|
import ApiKeyAuth from './ApiKeyAuth';
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
import { humanizeRequestAuthMode } from 'utils/collections/index';
|
import { humanizeRequestAuthMode } from 'utils/collections/index';
|
||||||
import OAuth2 from './OAuth2/index';
|
import OAuth2 from './OAuth2/index';
|
||||||
@ -32,6 +34,12 @@ const Auth = ({ item, collection }) => {
|
|||||||
case 'oauth2': {
|
case 'oauth2': {
|
||||||
return <OAuth2 collection={collection} item={item} />;
|
return <OAuth2 collection={collection} item={item} />;
|
||||||
}
|
}
|
||||||
|
case 'wsse': {
|
||||||
|
return <WsseAuth collection={collection} item={item} />;
|
||||||
|
}
|
||||||
|
case 'apikey': {
|
||||||
|
return <ApiKeyAuth collection={collection} item={item} />;
|
||||||
|
}
|
||||||
case 'inherit': {
|
case 'inherit': {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-row w-full mt-2 gap-2">
|
<div className="flex flex-row w-full mt-2 gap-2">
|
||||||
|
@ -17,9 +17,11 @@ import { find, get } from 'lodash';
|
|||||||
import Documentation from 'components/Documentation/index';
|
import Documentation from 'components/Documentation/index';
|
||||||
|
|
||||||
const ContentIndicator = () => {
|
const ContentIndicator = () => {
|
||||||
return <sup className="ml-[.125rem] opacity-80 font-medium">
|
return (
|
||||||
<DotIcon width="10"></DotIcon>
|
<sup className="ml-[.125rem] opacity-80 font-medium">
|
||||||
</sup>
|
<DotIcon width="10"></DotIcon>
|
||||||
|
</sup>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const HttpRequestPane = ({ item, collection, leftPaneWidth }) => {
|
const HttpRequestPane = ({ item, collection, leftPaneWidth }) => {
|
||||||
@ -100,6 +102,7 @@ const HttpRequestPane = ({ item, collection, leftPaneWidth }) => {
|
|||||||
const docs = getPropertyFromDraftOrRequest('request.docs');
|
const docs = getPropertyFromDraftOrRequest('request.docs');
|
||||||
const requestVars = getPropertyFromDraftOrRequest('request.vars.req');
|
const requestVars = getPropertyFromDraftOrRequest('request.vars.req');
|
||||||
const responseVars = getPropertyFromDraftOrRequest('request.vars.res');
|
const responseVars = getPropertyFromDraftOrRequest('request.vars.res');
|
||||||
|
const auth = getPropertyFromDraftOrRequest('request.auth');
|
||||||
|
|
||||||
const activeParamsLength = params.filter((param) => param.enabled).length;
|
const activeParamsLength = params.filter((param) => param.enabled).length;
|
||||||
const activeHeadersLength = headers.filter((header) => header.enabled).length;
|
const activeHeadersLength = headers.filter((header) => header.enabled).length;
|
||||||
@ -125,6 +128,7 @@ const HttpRequestPane = ({ item, collection, leftPaneWidth }) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className={getTabClassname('auth')} role="tab" onClick={() => selectTab('auth')}>
|
<div className={getTabClassname('auth')} role="tab" onClick={() => selectTab('auth')}>
|
||||||
Auth
|
Auth
|
||||||
|
{auth.mode !== 'none' && <ContentIndicator />}
|
||||||
</div>
|
</div>
|
||||||
<div className={getTabClassname('vars')} role="tab" onClick={() => selectTab('vars')}>
|
<div className={getTabClassname('vars')} role="tab" onClick={() => selectTab('vars')}>
|
||||||
Vars
|
Vars
|
||||||
|
@ -50,6 +50,10 @@ const StyledWrapper = styled.div`
|
|||||||
.cm-variable-invalid {
|
.cm-variable-invalid {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.CodeMirror-search-hint {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default StyledWrapper;
|
export default StyledWrapper;
|
||||||
|
@ -209,7 +209,7 @@ export default class QueryEditor extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<StyledWrapper
|
<StyledWrapper
|
||||||
className="h-full w-full flex flex-col relative"
|
className="h-full w-full flex flex-col relative graphiql-container"
|
||||||
aria-label="Query Editor"
|
aria-label="Query Editor"
|
||||||
font={this.props.font}
|
font={this.props.font}
|
||||||
fontSize={this.props.fontSize}
|
fontSize={this.props.fontSize}
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { requestUrlChanged, updateRequestMethod } from 'providers/ReduxStore/slices/collections';
|
import { requestUrlChanged, updateRequestMethod } from 'providers/ReduxStore/slices/collections';
|
||||||
import { saveRequest } from 'providers/ReduxStore/slices/collections/actions';
|
import { saveRequest } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
import HttpMethodSelector from './HttpMethodSelector';
|
import HttpMethodSelector from './HttpMethodSelector';
|
||||||
import { useTheme } from 'providers/Theme';
|
import { useTheme } from 'providers/Theme';
|
||||||
import { IconDeviceFloppy, IconArrowRight } from '@tabler/icons';
|
import { IconDeviceFloppy, IconArrowRight, IconCode } from '@tabler/icons';
|
||||||
import SingleLineEditor from 'components/SingleLineEditor';
|
import SingleLineEditor from 'components/SingleLineEditor';
|
||||||
import { isMacOS } from 'utils/common/platform';
|
import { isMacOS } from 'utils/common/platform';
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
import GenerateCodeItem from 'components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/index';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
|
|
||||||
const QueryUrl = ({ item, collection, handleRun }) => {
|
const QueryUrl = ({ item, collection, handleRun }) => {
|
||||||
const { theme, storedTheme } = useTheme();
|
const { theme, storedTheme } = useTheme();
|
||||||
@ -17,8 +19,10 @@ const QueryUrl = ({ item, collection, handleRun }) => {
|
|||||||
const url = item.draft ? get(item, 'draft.request.url', '') : get(item, 'request.url', '');
|
const url = item.draft ? get(item, 'draft.request.url', '') : get(item, 'request.url', '');
|
||||||
const isMac = isMacOS();
|
const isMac = isMacOS();
|
||||||
const saveShortcut = isMac ? 'Cmd + S' : 'Ctrl + S';
|
const saveShortcut = isMac ? 'Cmd + S' : 'Ctrl + S';
|
||||||
|
const editorRef = useRef(null);
|
||||||
|
|
||||||
const [methodSelectorWidth, setMethodSelectorWidth] = useState(90);
|
const [methodSelectorWidth, setMethodSelectorWidth] = useState(90);
|
||||||
|
const [generateCodeItemModalOpen, setGenerateCodeItemModalOpen] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const el = document.querySelector('.method-selector-container');
|
const el = document.querySelector('.method-selector-container');
|
||||||
@ -26,22 +30,32 @@ const QueryUrl = ({ item, collection, handleRun }) => {
|
|||||||
}, [method]);
|
}, [method]);
|
||||||
|
|
||||||
const onSave = (finalValue) => {
|
const onSave = (finalValue) => {
|
||||||
dispatch(requestUrlChanged({
|
|
||||||
itemUid: item.uid,
|
|
||||||
collectionUid: collection.uid,
|
|
||||||
url: finalValue && typeof finalValue === 'string' ? finalValue.trim() : value
|
|
||||||
}));
|
|
||||||
dispatch(saveRequest(item.uid, collection.uid));
|
dispatch(saveRequest(item.uid, collection.uid));
|
||||||
};
|
};
|
||||||
|
|
||||||
const onUrlChange = (value) => {
|
const onUrlChange = (value) => {
|
||||||
|
if (!editorRef.current?.editor) return;
|
||||||
|
const editor = editorRef.current.editor;
|
||||||
|
const cursor = editor.getCursor();
|
||||||
|
|
||||||
|
const finalUrl = value?.trim() ?? value;
|
||||||
|
|
||||||
dispatch(
|
dispatch(
|
||||||
requestUrlChanged({
|
requestUrlChanged({
|
||||||
itemUid: item.uid,
|
itemUid: item.uid,
|
||||||
collectionUid: collection.uid,
|
collectionUid: collection.uid,
|
||||||
url: (value && typeof value === 'string') && value
|
url: finalUrl
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Restore cursor position only if URL was trimmed
|
||||||
|
if (finalUrl !== value) {
|
||||||
|
setTimeout(() => {
|
||||||
|
if (editor) {
|
||||||
|
editor.setCursor(cursor);
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onMethodSelect = (verb) => {
|
const onMethodSelect = (verb) => {
|
||||||
@ -54,6 +68,15 @@ const QueryUrl = ({ item, collection, handleRun }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleGenerateCode = (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (item.request.url !== '' || (item.draft?.request.url !== undefined && item.draft?.request.url !== '')) {
|
||||||
|
setGenerateCodeItemModalOpen(true);
|
||||||
|
} else {
|
||||||
|
toast.error('URL is required');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledWrapper className="flex items-center">
|
<StyledWrapper className="flex items-center">
|
||||||
<div className="flex items-center h-full method-selector-container">
|
<div className="flex items-center h-full method-selector-container">
|
||||||
@ -68,6 +91,7 @@ const QueryUrl = ({ item, collection, handleRun }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SingleLineEditor
|
<SingleLineEditor
|
||||||
|
ref={editorRef}
|
||||||
value={url}
|
value={url}
|
||||||
onSave={(finalValue) => onSave(finalValue)}
|
onSave={(finalValue) => onSave(finalValue)}
|
||||||
theme={storedTheme}
|
theme={storedTheme}
|
||||||
@ -78,6 +102,22 @@ const QueryUrl = ({ item, collection, handleRun }) => {
|
|||||||
item={item}
|
item={item}
|
||||||
/>
|
/>
|
||||||
<div className="flex items-center h-full mr-2 cursor-pointer" id="send-request" onClick={handleRun}>
|
<div className="flex items-center h-full mr-2 cursor-pointer" id="send-request" onClick={handleRun}>
|
||||||
|
<div
|
||||||
|
className="infotip mr-3"
|
||||||
|
onClick={(e) => {
|
||||||
|
handleGenerateCode(e);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconCode
|
||||||
|
color={theme.requestTabs.icon.color}
|
||||||
|
strokeWidth={1.5}
|
||||||
|
size={22}
|
||||||
|
className={'cursor-pointer'}
|
||||||
|
/>
|
||||||
|
<span className="infotiptext text-xs">
|
||||||
|
Generate Code
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
className="infotip mr-3"
|
className="infotip mr-3"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
@ -99,6 +139,9 @@ const QueryUrl = ({ item, collection, handleRun }) => {
|
|||||||
<IconArrowRight color={theme.requestTabPanel.url.icon} strokeWidth={1.5} size={22} />
|
<IconArrowRight color={theme.requestTabPanel.url.icon} strokeWidth={1.5} size={22} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{generateCodeItemModalOpen && (
|
||||||
|
<GenerateCodeItem collection={collection} item={item} onClose={() => setGenerateCodeItemModalOpen(false)} />
|
||||||
|
)}
|
||||||
</StyledWrapper>
|
</StyledWrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -9,7 +9,6 @@ import StyledWrapper from './StyledWrapper';
|
|||||||
import { updateRequestBody } from 'providers/ReduxStore/slices/collections/index';
|
import { updateRequestBody } from 'providers/ReduxStore/slices/collections/index';
|
||||||
import { toastError } from 'utils/common/error';
|
import { toastError } from 'utils/common/error';
|
||||||
import { format, applyEdits } from 'jsonc-parser';
|
import { format, applyEdits } from 'jsonc-parser';
|
||||||
import { parse, stringify } from 'lossless-json';
|
|
||||||
import xmlFormat from 'xml-formatter';
|
import xmlFormat from 'xml-formatter';
|
||||||
|
|
||||||
const RequestBodyMode = ({ item, collection }) => {
|
const RequestBodyMode = ({ item, collection }) => {
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
import styled from 'styled-components';
|
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
|
||||||
.folder-list {
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 5px;
|
|
||||||
|
|
||||||
.folder-name {
|
|
||||||
padding-block: 8px;
|
|
||||||
padding-inline: 12px;
|
|
||||||
cursor: pointer;
|
|
||||||
&:hover {
|
|
||||||
background-color: #e8e8e8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export default Wrapper;
|
|
@ -1,55 +0,0 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
|
||||||
import { faFolder } from '@fortawesome/free-solid-svg-icons';
|
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
||||||
import StyledWrapper from './StyledWrapper';
|
|
||||||
import Modal from 'components//Modal';
|
|
||||||
|
|
||||||
const SaveRequest = ({ items, onClose }) => {
|
|
||||||
const [showFolders, setShowFolders] = useState([]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setShowFolders(items || []);
|
|
||||||
}, [items]);
|
|
||||||
|
|
||||||
const handleFolderClick = (folder) => {
|
|
||||||
let subFolders = [];
|
|
||||||
if (folder.items && folder.items.length) {
|
|
||||||
for (let item of folder.items) {
|
|
||||||
if (item.items) {
|
|
||||||
subFolders.push(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (subFolders.length) {
|
|
||||||
setShowFolders(subFolders);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<StyledWrapper>
|
|
||||||
<Modal
|
|
||||||
size="md"
|
|
||||||
title="Save Request"
|
|
||||||
confirmText="Save"
|
|
||||||
cancelText="Cancel"
|
|
||||||
handleCancel={onClose}
|
|
||||||
handleConfirm={onClose}
|
|
||||||
>
|
|
||||||
<p className="mb-2">Select a folder to save request:</p>
|
|
||||||
<div className="folder-list">
|
|
||||||
{showFolders && showFolders.length
|
|
||||||
? showFolders.map((folder) => (
|
|
||||||
<div key={folder.uid} className="folder-name" onClick={() => handleFolderClick(folder)}>
|
|
||||||
<FontAwesomeIcon className="mr-3 text-gray-500" icon={faFolder} style={{ fontSize: 20 }} />
|
|
||||||
{folder.name}
|
|
||||||
</div>
|
|
||||||
))
|
|
||||||
: null}
|
|
||||||
</div>
|
|
||||||
</Modal>
|
|
||||||
</StyledWrapper>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default SaveRequest;
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user