add and fix translations in ko.json (#2752)
This commit is contained in:
6
.github/workflows/codeql-analysis.yml
vendored
6
.github/workflows/codeql-analysis.yml
vendored
@@ -42,7 +42,7 @@ jobs:
|
|||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v2
|
||||||
with:
|
with:
|
||||||
# Run extended queries including queries using machine learning
|
# Run extended queries including queries using machine learning
|
||||||
queries: security-extended
|
queries: security-extended
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v1
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 https://git.io/JvXDl
|
||||||
@@ -69,4 +69,4 @@ jobs:
|
|||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v2
|
||||||
|
|||||||
6
.github/workflows/deploy-netlify.yml
vendored
6
.github/workflows/deploy-netlify.yml
vendored
@@ -12,15 +12,15 @@ jobs:
|
|||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Environment
|
||||||
|
run: mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env
|
||||||
|
|
||||||
- name: Setup and run pnpm install
|
- name: Setup and run pnpm install
|
||||||
uses: pnpm/action-setup@v2.2.2
|
uses: pnpm/action-setup@v2.2.2
|
||||||
with:
|
with:
|
||||||
version: 7
|
version: 7
|
||||||
run_install: true
|
run_install: true
|
||||||
|
|
||||||
- name: Setup Environment
|
|
||||||
run: mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env
|
|
||||||
|
|
||||||
- name: Build Site
|
- name: Build Site
|
||||||
env:
|
env:
|
||||||
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||||
|
|||||||
7
.github/workflows/deploy-prod.yml
vendored
7
.github/workflows/deploy-prod.yml
vendored
@@ -9,8 +9,11 @@ jobs:
|
|||||||
deploy_live_website:
|
deploy_live_website:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout Repository
|
||||||
- uses: FirebaseExtended/action-hosting-deploy@v0
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Deploy to Firebase (production)
|
||||||
|
uses: FirebaseExtended/action-hosting-deploy@v0
|
||||||
with:
|
with:
|
||||||
repoToken: '${{ secrets.GITHUB_TOKEN }}'
|
repoToken: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_POSTWOMAN_API }}'
|
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_POSTWOMAN_API }}'
|
||||||
|
|||||||
2
.github/workflows/deploy-staging-netlify.yml
vendored
2
.github/workflows/deploy-staging-netlify.yml
vendored
@@ -15,6 +15,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Setup and run pnpm install
|
- name: Setup and run pnpm install
|
||||||
uses: pnpm/action-setup@v2.2.2
|
uses: pnpm/action-setup@v2.2.2
|
||||||
|
env:
|
||||||
|
VITE_BACKEND_GQL_URL: ${{ secrets.STAGING_BACKEND_GQL_URL }}
|
||||||
with:
|
with:
|
||||||
version: 7
|
version: 7
|
||||||
run_install: true
|
run_install: true
|
||||||
|
|||||||
12
.github/workflows/tests.yml
vendored
12
.github/workflows/tests.yml
vendored
@@ -15,17 +15,23 @@ jobs:
|
|||||||
node-version: ["lts/*"]
|
node-version: ["lts/*"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout Repository
|
||||||
- uses: actions/setup-node@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Environment
|
||||||
|
run: mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env
|
||||||
|
|
||||||
- name: Setup and run pnpm install
|
- name: Setup and run pnpm install
|
||||||
uses: pnpm/action-setup@v2.2.2
|
uses: pnpm/action-setup@v2.2.2
|
||||||
with:
|
with:
|
||||||
version: 7
|
version: 7
|
||||||
run_install: true
|
run_install: true
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: pnpm
|
cache: pnpm
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: pnpm test
|
run: pnpm test
|
||||||
|
|||||||
@@ -17,11 +17,13 @@ COPY . .
|
|||||||
|
|
||||||
RUN npm install -g pnpm
|
RUN npm install -g pnpm
|
||||||
|
|
||||||
|
RUN mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env
|
||||||
|
|
||||||
RUN pnpm i --unsafe-perm=true
|
RUN pnpm i --unsafe-perm=true
|
||||||
|
|
||||||
ENV HOST 0.0.0.0
|
ENV HOST 0.0.0.0
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
RUN mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env
|
RUN pnpm run generate
|
||||||
|
|
||||||
CMD ["pnpm", "run", "start", "--host", "0.0.0.0"]
|
CMD ["pnpm", "run", "start"]
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ if there is no existing translation, you can create a new one by following these
|
|||||||
1. **[Fork the repository](https://github.com/hoppscotch/hoppscotch/fork).**
|
1. **[Fork the repository](https://github.com/hoppscotch/hoppscotch/fork).**
|
||||||
2. **Checkout the `i18n` branch for latest translations.**
|
2. **Checkout the `i18n` branch for latest translations.**
|
||||||
3. **Create a new branch for your translation with base branch `i18n`.**
|
3. **Create a new branch for your translation with base branch `i18n`.**
|
||||||
4. **Create target language file in the [`locales`](https://github.com/hoppscotch/hoppscotch/tree/main/packages/hoppscotch-app/locales) directory.**
|
4. **Create target language file in the [`/packages/hoppscotch-app/locales`](https://github.com/hoppscotch/hoppscotch/tree/main/packages/hoppscotch-app/locales) directory.**
|
||||||
5. **Copy the contents of the source file [`locales/en.json`](https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-app/locales/en.json) to the target language file.**
|
5. **Copy the contents of the source file [`/packages/hoppscotch-app/locales/en.json`](https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-app/locales/en.json) to the target language file.**
|
||||||
6. **Translate the strings in the target language file.**
|
6. **Translate the strings in the target language file.**
|
||||||
7. **Add your language entry to [`languages.json`](https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-app/languages.json).**
|
7. **Add your language entry to [`/packages/hoppscotch-app/languages.json`](https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-app/languages.json).**
|
||||||
8. **Save & commit changes.**
|
8. **Save & commit changes.**
|
||||||
9. **Send a pull request.**
|
9. **Send a pull request.**
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
},
|
},
|
||||||
"hosting": {
|
"hosting": {
|
||||||
"predeploy": [
|
"predeploy": [
|
||||||
"cd packages/hoppscotch-app && mv .env.example .env && cd ../.. && npm install -g pnpm && pnpm i && pnpm run generate"
|
"mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env && npm install -g pnpm && pnpm i && pnpm run generate"
|
||||||
],
|
],
|
||||||
"public": "packages/hoppscotch-app/dist",
|
"public": "packages/hoppscotch-app/dist",
|
||||||
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
|
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hoppscotch-app",
|
"name": "hoppscotch-app",
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"description": "Open source API development ecosystem",
|
"description": "Open source API development ecosystem",
|
||||||
"author": "Hoppscotch (support@hoppscotch.io)",
|
"author": "Hoppscotch (support@hoppscotch.io)",
|
||||||
"private": true,
|
"private": true,
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"dev": "pnpm -r do-dev",
|
"dev": "pnpm -r do-dev",
|
||||||
"generate": "pnpm -r do-build-prod",
|
"generate": "pnpm -r do-build-prod",
|
||||||
"start": "pnpm -r do-prod-start",
|
"start": "http-server packages/hoppscotch-app/dist -p 3000",
|
||||||
"lint": "pnpm -r do-lint",
|
"lint": "pnpm -r do-lint",
|
||||||
"typecheck": "pnpm -r do-typecheck",
|
"typecheck": "pnpm -r do-typecheck",
|
||||||
"lintfix": "pnpm -r do-lintfix",
|
"lintfix": "pnpm -r do-lintfix",
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^16.2.3",
|
"@commitlint/cli": "^16.2.3",
|
||||||
"@commitlint/config-conventional": "^16.2.1",
|
"@commitlint/config-conventional": "^16.2.1",
|
||||||
"@types/node": "^17.0.24"
|
"@types/node": "^17.0.24",
|
||||||
|
"http-server": "^14.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,9 @@ VITE_MESSAGING_SENDER_ID=421993993223
|
|||||||
VITE_APP_ID=1:421993993223:web:ec0baa8ee8c02ffa1fc6a2
|
VITE_APP_ID=1:421993993223:web:ec0baa8ee8c02ffa1fc6a2
|
||||||
VITE_MEASUREMENT_ID=G-BBJ3R80PJT
|
VITE_MEASUREMENT_ID=G-BBJ3R80PJT
|
||||||
|
|
||||||
# Base URL
|
# Base URLs
|
||||||
VITE_BASE_URL=https://hoppscotch.io
|
VITE_BASE_URL=https://hoppscotch.io
|
||||||
|
VITE_SHORTCODE_BASE_URL=https://hopp.sh
|
||||||
|
|
||||||
# Backend URLs
|
# Backend URLs
|
||||||
VITE_BACKEND_GQL_URL=https://api.hoppscotch.io/graphql
|
VITE_BACKEND_GQL_URL=https://api.hoppscotch.io/graphql
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ a {
|
|||||||
.cm-tooltip {
|
.cm-tooltip {
|
||||||
.tippy-box {
|
.tippy-box {
|
||||||
@apply fixed;
|
@apply fixed;
|
||||||
|
@apply inline-flex;
|
||||||
@apply -mt-6;
|
@apply -mt-6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,7 +135,8 @@ a {
|
|||||||
@apply rounded;
|
@apply rounded;
|
||||||
@apply truncate;
|
@apply truncate;
|
||||||
@apply shadow;
|
@apply shadow;
|
||||||
@apply leading-body;
|
@apply leading-normal;
|
||||||
|
@apply items-center;
|
||||||
font-size: 86%;
|
font-size: 86%;
|
||||||
|
|
||||||
kbd {
|
kbd {
|
||||||
@@ -152,6 +154,13 @@ a {
|
|||||||
.tippy-svg-arrow svg {
|
.tippy-svg-arrow svg {
|
||||||
@apply fill-tooltip;
|
@apply fill-tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.env-icon {
|
||||||
|
@apply inline-flex;
|
||||||
|
@apply items-center;
|
||||||
|
@apply mr-1;
|
||||||
|
@apply text-accentDark;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tippy-box[data-theme="popover"] {
|
.tippy-box[data-theme="popover"] {
|
||||||
@@ -163,7 +172,7 @@ a {
|
|||||||
@apply text-secondary text-body;
|
@apply text-secondary text-body;
|
||||||
@apply p-2;
|
@apply p-2;
|
||||||
@apply shadow-lg;
|
@apply shadow-lg;
|
||||||
@apply leading-body;
|
@apply leading-normal;
|
||||||
@apply border border-dividerDark;
|
@apply border border-dividerDark;
|
||||||
@apply focus: outline-none;
|
@apply focus: outline-none;
|
||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
@@ -455,6 +464,7 @@ pre.ace_editor {
|
|||||||
@apply px-1;
|
@apply px-1;
|
||||||
@apply border border-dividerDark;
|
@apply border border-dividerDark;
|
||||||
@apply shadow-sm;
|
@apply shadow-sm;
|
||||||
|
@apply <sm:hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.capitalize-first {
|
.capitalize-first {
|
||||||
@@ -469,6 +479,10 @@ details summary::-webkit-details-marker {
|
|||||||
@apply hidden;
|
@apply hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
details summary .indicator {
|
||||||
|
@apply transition;
|
||||||
|
}
|
||||||
|
|
||||||
details[open] summary .indicator {
|
details[open] summary .indicator {
|
||||||
@apply transform;
|
@apply transform;
|
||||||
@apply rotate-90;
|
@apply rotate-90;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
overwrite: true
|
overwrite: true
|
||||||
schema: https://api.hoppscotch.io/graphql
|
schema:
|
||||||
|
- ${VITE_BACKEND_GQL_URL}
|
||||||
generates:
|
generates:
|
||||||
src/helpers/backend/graphql.ts:
|
src/helpers/backend/graphql.ts:
|
||||||
documents: "src/**/*.graphql"
|
documents: "src/**/*.graphql"
|
||||||
|
|||||||
@@ -184,11 +184,13 @@
|
|||||||
"deleted": "Environment deletion",
|
"deleted": "Environment deletion",
|
||||||
"edit": "Edit Environment",
|
"edit": "Edit Environment",
|
||||||
"invalid_name": "Please provide a name for the environment",
|
"invalid_name": "Please provide a name for the environment",
|
||||||
|
"my_environments":"My Environments",
|
||||||
"nested_overflow": "nested environment variables are limited to 10 levels",
|
"nested_overflow": "nested environment variables are limited to 10 levels",
|
||||||
"new": "New Environment",
|
"new": "New Environment",
|
||||||
"no_environment": "No environment",
|
"no_environment": "No environment",
|
||||||
"no_environment_description": "No environments were selected. Choose what to do with the following variables.",
|
"no_environment_description": "No environments were selected. Choose what to do with the following variables.",
|
||||||
"select": "Select environment",
|
"select": "Select environment",
|
||||||
|
"team_environments": "Team Environments",
|
||||||
"title": "Environments",
|
"title": "Environments",
|
||||||
"updated": "Environment updated",
|
"updated": "Environment updated",
|
||||||
"variable_list": "Variable List"
|
"variable_list": "Variable List"
|
||||||
@@ -335,7 +337,8 @@
|
|||||||
"roles_description": "Roles are used to control access to the shared collections.",
|
"roles_description": "Roles are used to control access to the shared collections.",
|
||||||
"updated": "Profile updated",
|
"updated": "Profile updated",
|
||||||
"viewer": "Viewer",
|
"viewer": "Viewer",
|
||||||
"viewer_description": "Viewers can only view and use requests."
|
"viewer_description": "Viewers can only view and use requests.",
|
||||||
|
"default_hopp_displayname": "Unnamed User"
|
||||||
},
|
},
|
||||||
"remove": {
|
"remove": {
|
||||||
"star": "Remove star"
|
"star": "Remove star"
|
||||||
@@ -652,6 +655,11 @@
|
|||||||
"we_sent_invite_link": "We sent an invite link to all invitees!",
|
"we_sent_invite_link": "We sent an invite link to all invitees!",
|
||||||
"we_sent_invite_link_description": "Ask all invitees to check their inbox. Click on the link to join the team."
|
"we_sent_invite_link_description": "Ask all invitees to check their inbox. Click on the link to join the team."
|
||||||
},
|
},
|
||||||
|
"team_environment": {
|
||||||
|
"deleted": "Environment Deleted",
|
||||||
|
"duplicate": "Environment Duplicated",
|
||||||
|
"not_found": "Environment not found."
|
||||||
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"failed": "test failed",
|
"failed": "test failed",
|
||||||
"javascript_code": "JavaScript Code",
|
"javascript_code": "JavaScript Code",
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"action": {
|
"action": {
|
||||||
"autoscroll": "Autoscroll",
|
"autoscroll": "자동 스크롤",
|
||||||
"cancel": "취소",
|
"cancel": "취소",
|
||||||
"choose_file": "파일 선택",
|
"choose_file": "파일 선택",
|
||||||
"clear": "지우기",
|
"clear": "지우기",
|
||||||
"clear_all": "모두 지우기",
|
"clear_all": "모두 지우기",
|
||||||
"close": "Close",
|
"close": "닫기",
|
||||||
"connect": "연결",
|
"connect": "연결",
|
||||||
"copy": "복사",
|
"copy": "복사",
|
||||||
"delete": "삭제",
|
"delete": "삭제",
|
||||||
"disconnect": "연결 해제",
|
"disconnect": "연결 해제",
|
||||||
"dismiss": "닫기",
|
"dismiss": "닫기",
|
||||||
"dont_save": "Don't save",
|
"dont_save": "저장 안함",
|
||||||
"download_file": "파일 다운로드",
|
"download_file": "파일 다운로드",
|
||||||
"drag_to_reorder": "Drag to reorder",
|
"drag_to_reorder": "Drag to reorder",
|
||||||
"duplicate": "복제",
|
"duplicate": "복제",
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
"go_back": "돌아가기",
|
"go_back": "돌아가기",
|
||||||
"label": "이름",
|
"label": "이름",
|
||||||
"learn_more": "더 알아보기",
|
"learn_more": "더 알아보기",
|
||||||
"less": "Less",
|
"less": "접기",
|
||||||
"more": "더보기",
|
"more": "더보기",
|
||||||
"new": "추가",
|
"new": "추가",
|
||||||
"no": "아니요",
|
"no": "아니요",
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
"remove_request": "이 요청을 영구적으로 삭제하겠습니까?",
|
"remove_request": "이 요청을 영구적으로 삭제하겠습니까?",
|
||||||
"remove_team": "이 팀을 삭제하겠습니까?",
|
"remove_team": "이 팀을 삭제하겠습니까?",
|
||||||
"remove_telemetry": "진단 데이터를 보내지 않겠습니까?",
|
"remove_telemetry": "진단 데이터를 보내지 않겠습니까?",
|
||||||
"request_change": "Are you sure you want to discard current request, unsaved changes will be lost.",
|
"request_change": "현재 요청을 취소하시겠습니까? 저장되지 않은 변경사항은 삭제됩니다.",
|
||||||
"sync": "이 작업 공간을 동기화하겠습니까?"
|
"sync": "이 작업 공간을 동기화하겠습니까?"
|
||||||
},
|
},
|
||||||
"count": {
|
"count": {
|
||||||
@@ -210,7 +210,7 @@
|
|||||||
"network_fail": "요청을 보낼 수 없습니다.",
|
"network_fail": "요청을 보낼 수 없습니다.",
|
||||||
"no_duration": "소요 시간 없음",
|
"no_duration": "소요 시간 없음",
|
||||||
"no_results_found": "No matches found",
|
"no_results_found": "No matches found",
|
||||||
"page_not_found": "This page could not be found",
|
"page_not_found": "해당 페이지를 찾을 수 없습니다.",
|
||||||
"script_fail": "사전 요청 스크립트를 실행할 수 없습니다.",
|
"script_fail": "사전 요청 스크립트를 실행할 수 없습니다.",
|
||||||
"something_went_wrong": "문제가 발생했습니다.",
|
"something_went_wrong": "문제가 발생했습니다.",
|
||||||
"test_script_fail": "테스트 스크립트를 실행할 수 없습니다."
|
"test_script_fail": "테스트 스크립트를 실행할 수 없습니다."
|
||||||
@@ -276,12 +276,12 @@
|
|||||||
"from_postman_description": "Postman 모음집을 가져옵니다.",
|
"from_postman_description": "Postman 모음집을 가져옵니다.",
|
||||||
"from_url": "URL에서 가져오기",
|
"from_url": "URL에서 가져오기",
|
||||||
"gist_url": "Gist URL 입력",
|
"gist_url": "Gist URL 입력",
|
||||||
"import_from_url_invalid_fetch": "Couldn't get data from the url",
|
"import_from_url_invalid_fetch": "URL에서 데이터를 가져올 수 없습니다.",
|
||||||
"import_from_url_invalid_file_format": "Error while importing collections",
|
"import_from_url_invalid_file_format": "모음집을 가져오는데 실패하였습니다.",
|
||||||
"import_from_url_invalid_type": "Unsupported type. accepted values are 'hoppscotch', 'openapi', 'postman', 'insomnia'",
|
"import_from_url_invalid_type": "지원되지 않는 타입입니다. 지원되는 타입은 'hoppscotch', 'openapi', 'postman', 'insomnia' 입니다.",
|
||||||
"import_from_url_success": "Collections Imported",
|
"import_from_url_success": "모음집을 성공적으로 가져왔습니다.",
|
||||||
"json_description": "호프스카치 모음집 JSON 파일을 가져옵니다.",
|
"json_description": "호프스카치 모음집 JSON 파일을 가져옵니다.",
|
||||||
"title": "가저오기"
|
"title": "가져오기"
|
||||||
},
|
},
|
||||||
"layout": {
|
"layout": {
|
||||||
"collapse_collection": "Collapse or Expand Collections",
|
"collapse_collection": "Collapse or Expand Collections",
|
||||||
@@ -295,7 +295,7 @@
|
|||||||
"collections": "모음집",
|
"collections": "모음집",
|
||||||
"confirm": "확인",
|
"confirm": "확인",
|
||||||
"edit_request": "요청 수정",
|
"edit_request": "요청 수정",
|
||||||
"import_export": "가저오기 / 내보내기"
|
"import_export": "가져오기 / 내보내기"
|
||||||
},
|
},
|
||||||
"mqtt": {
|
"mqtt": {
|
||||||
"communication": "통신",
|
"communication": "통신",
|
||||||
@@ -360,9 +360,9 @@
|
|||||||
"invalid_name": "요청 이름을 바르게 입력하세요.",
|
"invalid_name": "요청 이름을 바르게 입력하세요.",
|
||||||
"method": "메서드",
|
"method": "메서드",
|
||||||
"name": "요청 이름",
|
"name": "요청 이름",
|
||||||
"new": "New Request",
|
"new": "새로운 요청",
|
||||||
"override": "Override",
|
"override": "덮어쓰기",
|
||||||
"override_help": "Set <kbd>Content-Type</kbd> in Headers",
|
"override_help": "헤더에 <kbd>Content-Type</kbd>를 설정해주세요.",
|
||||||
"overriden": "Overridden",
|
"overriden": "Overridden",
|
||||||
"parameter_list": "쿼리 파라미터 목록",
|
"parameter_list": "쿼리 파라미터 목록",
|
||||||
"parameters": "파라미터",
|
"parameters": "파라미터",
|
||||||
@@ -381,7 +381,7 @@
|
|||||||
"type": "요청 유형",
|
"type": "요청 유형",
|
||||||
"url": "URL",
|
"url": "URL",
|
||||||
"variables": "변수",
|
"variables": "변수",
|
||||||
"view_my_links": "View my links"
|
"view_my_links": "내 링크 보기"
|
||||||
},
|
},
|
||||||
"response": {
|
"response": {
|
||||||
"body": "응답 본문",
|
"body": "응답 본문",
|
||||||
@@ -517,7 +517,7 @@
|
|||||||
},
|
},
|
||||||
"show": {
|
"show": {
|
||||||
"code": "코드 표시",
|
"code": "코드 표시",
|
||||||
"collection": "Expand Collection Panel",
|
"collection": "모음집 보기",
|
||||||
"more": "자세히 보기",
|
"more": "자세히 보기",
|
||||||
"sidebar": "사이드바 표시"
|
"sidebar": "사이드바 표시"
|
||||||
},
|
},
|
||||||
@@ -541,9 +541,9 @@
|
|||||||
"connected": "연결됨",
|
"connected": "연결됨",
|
||||||
"connected_to": "{name}에 연결됨",
|
"connected_to": "{name}에 연결됨",
|
||||||
"connecting_to": "{name}에 연결 중...",
|
"connecting_to": "{name}에 연결 중...",
|
||||||
"connection_error": "Failed to connect",
|
"connection_error": "연결 실패",
|
||||||
"connection_failed": "Connection failed",
|
"connection_failed": "연결 실패",
|
||||||
"connection_lost": "Connection lost",
|
"connection_lost": "연결 끊김",
|
||||||
"copied_to_clipboard": "클립보드에 복사됨",
|
"copied_to_clipboard": "클립보드에 복사됨",
|
||||||
"deleted": "삭제됨",
|
"deleted": "삭제됨",
|
||||||
"deprecated": "더 이상 사용되지 않음",
|
"deprecated": "더 이상 사용되지 않음",
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
{
|
{
|
||||||
"name": "hoppscotch-app",
|
"name": "hoppscotch-app",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "pnpm exec npm-run-all -p -l dev:*",
|
"dev": "pnpm exec npm-run-all -p -l dev:*",
|
||||||
"dev:vite": "vite",
|
"dev:vite": "vite",
|
||||||
"dev:gql-codegen": "graphql-codegen --config gql-codegen.yml --watch",
|
"dev:gql-codegen": "graphql-codegen --require dotenv/config --config gql-codegen.yml --watch",
|
||||||
"build": "node --max_old_space_size=16384 ./node_modules/vite/bin/vite.js build",
|
"build": "node --max_old_space_size=16384 ./node_modules/vite/bin/vite.js build",
|
||||||
"lint": "eslint src --ext .ts,.js,.vue --ignore-path .gitignore .",
|
"lint": "eslint src --ext .ts,.js,.vue --ignore-path .gitignore .",
|
||||||
"prod-lint": "cross-env HOPP_LINT_FOR_PROD=true pnpm run lint",
|
"prod-lint": "cross-env HOPP_LINT_FOR_PROD=true pnpm run lint",
|
||||||
"lintfix": "eslint --fix src --ext .ts,.js,.vue --ignore-path .gitignore .",
|
"lintfix": "eslint --fix src --ext .ts,.js,.vue --ignore-path .gitignore .",
|
||||||
"generate": "pnpm run build",
|
"generate": "pnpm run build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"gql-codegen": "graphql-codegen --config gql-codegen.yml",
|
"gql-codegen": "graphql-codegen --require dotenv/config --config gql-codegen.yml",
|
||||||
"postinstall": "pnpm run gql-codegen",
|
"postinstall": "pnpm run gql-codegen",
|
||||||
"do-dev": "pnpm run dev",
|
"do-dev": "pnpm run dev",
|
||||||
"do-build-prod": "pnpm run build",
|
"do-build-prod": "pnpm run build",
|
||||||
"do-prod-start": "pnpm run preview",
|
|
||||||
"do-lint": "pnpm run prod-lint",
|
"do-lint": "pnpm run prod-lint",
|
||||||
"do-typecheck": "pnpm run lint",
|
"do-typecheck": "pnpm run lint",
|
||||||
"do-lintfix": "pnpm run lintfix"
|
"do-lintfix": "pnpm run lintfix"
|
||||||
|
|||||||
10
packages/hoppscotch-app/src/components.d.ts
vendored
10
packages/hoppscotch-app/src/components.d.ts
vendored
@@ -55,9 +55,14 @@ declare module '@vue/runtime-core' {
|
|||||||
CollectionsTeamsFolder: typeof import('./components/collections/teams/Folder.vue')['default']
|
CollectionsTeamsFolder: typeof import('./components/collections/teams/Folder.vue')['default']
|
||||||
CollectionsTeamsRequest: typeof import('./components/collections/teams/Request.vue')['default']
|
CollectionsTeamsRequest: typeof import('./components/collections/teams/Request.vue')['default']
|
||||||
Environments: typeof import('./components/environments/index.vue')['default']
|
Environments: typeof import('./components/environments/index.vue')['default']
|
||||||
EnvironmentsDetails: typeof import('./components/environments/Details.vue')['default']
|
EnvironmentsChooseType: typeof import('./components/environments/ChooseType.vue')['default']
|
||||||
EnvironmentsEnvironment: typeof import('./components/environments/Environment.vue')['default']
|
|
||||||
EnvironmentsImportExport: typeof import('./components/environments/ImportExport.vue')['default']
|
EnvironmentsImportExport: typeof import('./components/environments/ImportExport.vue')['default']
|
||||||
|
EnvironmentsMy: typeof import('./components/environments/my/index.vue')['default']
|
||||||
|
EnvironmentsMyDetails: typeof import('./components/environments/my/Details.vue')['default']
|
||||||
|
EnvironmentsMyEnvironment: typeof import('./components/environments/my/Environment.vue')['default']
|
||||||
|
EnvironmentsTeams: typeof import('./components/environments/teams/index.vue')['default']
|
||||||
|
EnvironmentsTeamsDetails: typeof import('./components/environments/teams/Details.vue')['default']
|
||||||
|
EnvironmentsTeamsEnvironment: typeof import('./components/environments/teams/Environment.vue')['default']
|
||||||
FirebaseLogin: typeof import('./components/firebase/Login.vue')['default']
|
FirebaseLogin: typeof import('./components/firebase/Login.vue')['default']
|
||||||
FirebaseLogout: typeof import('./components/firebase/Logout.vue')['default']
|
FirebaseLogout: typeof import('./components/firebase/Logout.vue')['default']
|
||||||
GraphqlAuthorization: typeof import('./components/graphql/Authorization.vue')['default']
|
GraphqlAuthorization: typeof import('./components/graphql/Authorization.vue')['default']
|
||||||
@@ -102,6 +107,7 @@ declare module '@vue/runtime-core' {
|
|||||||
IconLucideLoader: typeof import('~icons/lucide/loader')['default']
|
IconLucideLoader: typeof import('~icons/lucide/loader')['default']
|
||||||
IconLucideMinus: typeof import('~icons/lucide/minus')['default']
|
IconLucideMinus: typeof import('~icons/lucide/minus')['default']
|
||||||
IconLucideSearch: typeof import('~icons/lucide/search')['default']
|
IconLucideSearch: typeof import('~icons/lucide/search')['default']
|
||||||
|
IconLucideUser: typeof import('~icons/lucide/user')['default']
|
||||||
IconLucideUsers: typeof import('~icons/lucide/users')['default']
|
IconLucideUsers: typeof import('~icons/lucide/users')['default']
|
||||||
LensesHeadersRenderer: typeof import('./components/lenses/HeadersRenderer.vue')['default']
|
LensesHeadersRenderer: typeof import('./components/lenses/HeadersRenderer.vue')['default']
|
||||||
LensesHeadersRendererEntry: typeof import('./components/lenses/HeadersRendererEntry.vue')['default']
|
LensesHeadersRendererEntry: typeof import('./components/lenses/HeadersRendererEntry.vue')['default']
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
interactive
|
interactive
|
||||||
trigger="click"
|
trigger="click"
|
||||||
theme="popover"
|
theme="popover"
|
||||||
:on-shown="() => tippyActions.focus()"
|
:on-shown="() => tippyActions!.focus()"
|
||||||
>
|
>
|
||||||
<ButtonSecondary
|
<ButtonSecondary
|
||||||
:icon="IconHelpCircle"
|
:icon="IconHelpCircle"
|
||||||
@@ -221,6 +221,8 @@ import { useSetting } from "@composables/settings"
|
|||||||
import { useI18n } from "@composables/i18n"
|
import { useI18n } from "@composables/i18n"
|
||||||
import { useReadonlyStream } from "@composables/stream"
|
import { useReadonlyStream } from "@composables/stream"
|
||||||
import { currentUser$ } from "~/helpers/fb/auth"
|
import { currentUser$ } from "~/helpers/fb/auth"
|
||||||
|
import { TippyComponent } from "vue-tippy"
|
||||||
|
import SmartItem from "@components/smart/Item.vue"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
const showShortcuts = ref(false)
|
const showShortcuts = ref(false)
|
||||||
@@ -277,8 +279,8 @@ const showDeveloperOptionModal = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Template refs
|
// Template refs
|
||||||
const tippyActions = ref<any | null>(null)
|
const tippyActions = ref<TippyComponent | null>(null)
|
||||||
const documentation = ref<any | null>(null)
|
const documentation = ref<typeof SmartItem | null>(null)
|
||||||
const shortcuts = ref<any | null>(null)
|
const shortcuts = ref<typeof SmartItem | null>(null)
|
||||||
const chat = ref<any | null>(null)
|
const chat = ref<typeof SmartItem | null>(null)
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -71,8 +71,15 @@
|
|||||||
theme: 'tooltip',
|
theme: 'tooltip',
|
||||||
}"
|
}"
|
||||||
:url="currentUser.photoURL"
|
:url="currentUser.photoURL"
|
||||||
:alt="currentUser.displayName"
|
:alt="
|
||||||
:title="currentUser.displayName"
|
currentUser.displayName ||
|
||||||
|
t('profile.default_hopp_displayname')
|
||||||
|
"
|
||||||
|
:title="
|
||||||
|
currentUser.displayName ||
|
||||||
|
currentUser.email ||
|
||||||
|
t('profile.default_hopp_displayname')
|
||||||
|
"
|
||||||
indicator
|
indicator
|
||||||
:indicator-styles="
|
:indicator-styles="
|
||||||
network.isOnline ? 'bg-green-500' : 'bg-red-500'
|
network.isOnline ? 'bg-green-500' : 'bg-red-500'
|
||||||
@@ -81,8 +88,12 @@
|
|||||||
<ProfilePicture
|
<ProfilePicture
|
||||||
v-else
|
v-else
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
:title="currentUser.displayName"
|
:title="
|
||||||
:initial="currentUser.displayName"
|
currentUser.displayName ||
|
||||||
|
currentUser.email ||
|
||||||
|
t('profile.default_hopp_displayname')
|
||||||
|
"
|
||||||
|
:initial="currentUser.displayName || currentUser.email"
|
||||||
indicator
|
indicator
|
||||||
:indicator-styles="
|
:indicator-styles="
|
||||||
network.isOnline ? 'bg-green-500' : 'bg-red-500'
|
network.isOnline ? 'bg-green-500' : 'bg-red-500'
|
||||||
@@ -91,7 +102,10 @@
|
|||||||
<template #content="{ hide }">
|
<template #content="{ hide }">
|
||||||
<div class="flex flex-col px-2 text-tiny">
|
<div class="flex flex-col px-2 text-tiny">
|
||||||
<span class="inline-flex font-semibold truncate">
|
<span class="inline-flex font-semibold truncate">
|
||||||
{{ currentUser.displayName }}
|
{{
|
||||||
|
currentUser.displayName ||
|
||||||
|
t("profile.default_hopp_displayname")
|
||||||
|
}}
|
||||||
</span>
|
</span>
|
||||||
<span class="inline-flex truncate text-secondaryLight">
|
<span class="inline-flex truncate text-secondaryLight">
|
||||||
{{ currentUser.email }}
|
{{ currentUser.email }}
|
||||||
@@ -142,7 +156,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, reactive, ref } from "vue"
|
import { computed, reactive, ref } from "vue"
|
||||||
import IconUser from "~icons/lucide/user"
|
import IconUser from "~icons/lucide/user"
|
||||||
import IconSettings from "~icons/lucide/settings"
|
import IconSettings from "~icons/lucide/settings"
|
||||||
import IconDownload from "~icons/lucide/download"
|
import IconDownload from "~icons/lucide/download"
|
||||||
@@ -153,16 +167,12 @@ import IconUserPlus from "~icons/lucide/user-plus"
|
|||||||
import { breakpointsTailwind, useBreakpoints, useNetwork } from "@vueuse/core"
|
import { breakpointsTailwind, useBreakpoints, useNetwork } from "@vueuse/core"
|
||||||
import { pwaDefferedPrompt, installPWA } from "@modules/pwa"
|
import { pwaDefferedPrompt, installPWA } from "@modules/pwa"
|
||||||
import { probableUser$ } from "@helpers/fb/auth"
|
import { probableUser$ } from "@helpers/fb/auth"
|
||||||
import { getLocalConfig, setLocalConfig } from "~/newstore/localpersistence"
|
|
||||||
import { useI18n } from "@composables/i18n"
|
import { useI18n } from "@composables/i18n"
|
||||||
import { useToast } from "@composables/toast"
|
|
||||||
import { useReadonlyStream } from "@composables/stream"
|
import { useReadonlyStream } from "@composables/stream"
|
||||||
import { invokeAction } from "@helpers/actions"
|
import { invokeAction } from "@helpers/actions"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
|
||||||
const toast = useToast()
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Once the PWA code is initialized, this holds a method
|
* Once the PWA code is initialized, this holds a method
|
||||||
* that can be called to show the user the installation
|
* that can be called to show the user the installation
|
||||||
@@ -181,32 +191,6 @@ const network = reactive(useNetwork())
|
|||||||
|
|
||||||
const currentUser = useReadonlyStream(probableUser$, null)
|
const currentUser = useReadonlyStream(probableUser$, null)
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
const cookiesAllowed = getLocalConfig("cookiesAllowed") === "yes"
|
|
||||||
if (!cookiesAllowed) {
|
|
||||||
toast.show(`${t("app.we_use_cookies")}`, {
|
|
||||||
duration: 0,
|
|
||||||
action: [
|
|
||||||
{
|
|
||||||
text: `${t("action.learn_more")}`,
|
|
||||||
onClick: (_, toastObject) => {
|
|
||||||
setLocalConfig("cookiesAllowed", "yes")
|
|
||||||
toastObject.goAway(0)
|
|
||||||
window.open("https://docs.hoppscotch.io/privacy", "_blank")?.focus()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: `${t("action.dismiss")}`,
|
|
||||||
onClick: (_, toastObject) => {
|
|
||||||
setLocalConfig("cookiesAllowed", "yes")
|
|
||||||
toastObject.goAway(0)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Template refs
|
// Template refs
|
||||||
const tippyActions = ref<any | null>(null)
|
const tippyActions = ref<any | null>(null)
|
||||||
const profile = ref<any | null>(null)
|
const profile = ref<any | null>(null)
|
||||||
|
|||||||
@@ -11,22 +11,19 @@
|
|||||||
<Pane
|
<Pane
|
||||||
:size="PANE_MAIN_SIZE"
|
:size="PANE_MAIN_SIZE"
|
||||||
min-size="65"
|
min-size="65"
|
||||||
class="hide-scrollbar !overflow-auto flex flex-col"
|
class="flex flex-col !overflow-auto"
|
||||||
>
|
>
|
||||||
<Splitpanes
|
<Splitpanes
|
||||||
class="smart-splitter"
|
class="smart-splitter"
|
||||||
:horizontal="COLUMN_LAYOUT"
|
:horizontal="COLUMN_LAYOUT"
|
||||||
@resize="setPaneEvent($event, 'horizontal')"
|
@resize="setPaneEvent($event, 'horizontal')"
|
||||||
>
|
>
|
||||||
<Pane
|
<Pane :size="PANE_MAIN_TOP_SIZE" class="flex flex-col !overflow-auto">
|
||||||
:size="PANE_MAIN_TOP_SIZE"
|
|
||||||
class="hide-scrollbar !overflow-auto flex flex-col"
|
|
||||||
>
|
|
||||||
<slot name="primary" />
|
<slot name="primary" />
|
||||||
</Pane>
|
</Pane>
|
||||||
<Pane
|
<Pane
|
||||||
:size="PANE_MAIN_BOTTOM_SIZE"
|
:size="PANE_MAIN_BOTTOM_SIZE"
|
||||||
class="flex flex-col hide-scrollbar !overflow-auto"
|
class="flex flex-col !overflow-auto"
|
||||||
>
|
>
|
||||||
<slot name="secondary" />
|
<slot name="secondary" />
|
||||||
</Pane>
|
</Pane>
|
||||||
@@ -36,7 +33,7 @@
|
|||||||
v-if="SIDEBAR && hasSidebar"
|
v-if="SIDEBAR && hasSidebar"
|
||||||
:size="PANE_SIDEBAR_SIZE"
|
:size="PANE_SIDEBAR_SIZE"
|
||||||
min-size="20"
|
min-size="20"
|
||||||
class="!overflow-auto flex flex-col bg-primaryContrast"
|
class="flex flex-col !overflow-auto bg-primaryContrast"
|
||||||
>
|
>
|
||||||
<slot name="sidebar" />
|
<slot name="sidebar" />
|
||||||
</Pane>
|
</Pane>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
open
|
open
|
||||||
>
|
>
|
||||||
<summary
|
<summary
|
||||||
class="flex items-center flex-1 min-w-0 px-6 py-4 font-semibold transition cursor-pointer focus:outline-none text-secondaryLight hover:text-secondaryDark"
|
class="flex items-center flex-1 min-w-0 px-6 py-4 font-semibold cursor-pointer transition focus:outline-none text-secondaryLight hover:text-secondaryDark"
|
||||||
>
|
>
|
||||||
<icon-lucide-chevron-right class="mr-2 indicator" />
|
<icon-lucide-chevron-right class="mr-2 indicator" />
|
||||||
<span
|
<span
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
open
|
open
|
||||||
>
|
>
|
||||||
<summary
|
<summary
|
||||||
class="flex items-center flex-1 min-w-0 px-6 py-4 font-semibold transition cursor-pointer focus:outline-none text-secondaryLight hover:text-secondaryDark"
|
class="flex items-center flex-1 min-w-0 px-6 py-4 font-semibold cursor-pointer transition focus:outline-none text-secondaryLight hover:text-secondaryDark"
|
||||||
>
|
>
|
||||||
<icon-lucide-chevron-right class="mr-2 indicator" />
|
<icon-lucide-chevron-right class="mr-2 indicator" />
|
||||||
<span
|
<span
|
||||||
|
|||||||
@@ -41,11 +41,11 @@
|
|||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
{{ label }}
|
{{ label }}
|
||||||
<div v-if="shortcut.length" class="ml-2 <sm:hidden">
|
<div v-if="shortcut.length" class="<sm:hidden">
|
||||||
<kbd
|
<kbd
|
||||||
v-for="(key, index) in shortcut"
|
v-for="(key, index) in shortcut"
|
||||||
:key="`key-${index}`"
|
:key="`key-${index}`"
|
||||||
class="shortcut-key !bg-accentLight"
|
class="shortcut-key !bg-accentDark !border-accentLight"
|
||||||
>
|
>
|
||||||
{{ key }}
|
{{ key }}
|
||||||
</kbd>
|
</kbd>
|
||||||
|
|||||||
@@ -42,11 +42,11 @@
|
|||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
{{ label }}
|
{{ label }}
|
||||||
<div v-if="shortcut.length" class="ml-2 <sm:hidden">
|
<div v-if="shortcut.length" class="<sm:hidden">
|
||||||
<kbd
|
<kbd
|
||||||
v-for="(key, index) in shortcut"
|
v-for="(key, index) in shortcut"
|
||||||
:key="`key-${index}`"
|
:key="`key-${index}`"
|
||||||
class="shortcut-key"
|
class="shortcut-key !bg-inherit"
|
||||||
>
|
>
|
||||||
{{ key }}
|
{{ key }}
|
||||||
</kbd>
|
</kbd>
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
:info-icon="
|
:info-icon="
|
||||||
team.id === collectionsType.selectedTeam?.id
|
team.id === collectionsType.selectedTeam?.id
|
||||||
? IconDone
|
? IconDone
|
||||||
: null
|
: undefined
|
||||||
"
|
"
|
||||||
:active-info-icon="
|
:active-info-icon="
|
||||||
team.id === collectionsType.selectedTeam?.id
|
team.id === collectionsType.selectedTeam?.id
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
@drop="dragging = false"
|
@drop="dragging = false"
|
||||||
@dragleave="dragging = false"
|
@dragleave="dragging = false"
|
||||||
@dragend="dragging = false"
|
@dragend="dragging = false"
|
||||||
@contextmenu.prevent="options.tippy.show()"
|
@contextmenu.prevent="options!.tippy.show()"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="flex items-center justify-center px-4 cursor-pointer"
|
class="flex items-center justify-center px-4 cursor-pointer"
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
interactive
|
interactive
|
||||||
trigger="click"
|
trigger="click"
|
||||||
theme="popover"
|
theme="popover"
|
||||||
:on-shown="() => tippyActions.focus()"
|
:on-shown="() => tippyActions!.focus()"
|
||||||
>
|
>
|
||||||
<ButtonSecondary
|
<ButtonSecondary
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
@@ -74,11 +74,11 @@
|
|||||||
ref="tippyActions"
|
ref="tippyActions"
|
||||||
class="flex flex-col focus:outline-none"
|
class="flex flex-col focus:outline-none"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
@keyup.r="requestAction.$el.click()"
|
@keyup.r="requestAction!.$el.click()"
|
||||||
@keyup.n="folderAction.$el.click()"
|
@keyup.n="folderAction!.$el.click()"
|
||||||
@keyup.e="edit.$el.click()"
|
@keyup.e="edit!.$el.click()"
|
||||||
@keyup.delete="deleteAction.$el.click()"
|
@keyup.delete="deleteAction!.$el.click()"
|
||||||
@keyup.x="exportAction.$el.click()"
|
@keyup.x="exportAction!.$el.click()"
|
||||||
@keyup.escape="hide()"
|
@keyup.escape="hide()"
|
||||||
>
|
>
|
||||||
<SmartItem
|
<SmartItem
|
||||||
@@ -246,6 +246,8 @@ import { moveRESTTeamRequest } from "~/helpers/backend/mutations/TeamRequest"
|
|||||||
import { useColorMode } from "@composables/theming"
|
import { useColorMode } from "@composables/theming"
|
||||||
import { useI18n } from "@composables/i18n"
|
import { useI18n } from "@composables/i18n"
|
||||||
import { useToast } from "@composables/toast"
|
import { useToast } from "@composables/toast"
|
||||||
|
import { TippyComponent } from "vue-tippy"
|
||||||
|
import SmartItem from "@components/smart/Item.vue"
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
@@ -275,13 +277,13 @@ export default defineComponent({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
// Template refs
|
// Template refs
|
||||||
tippyActions: ref<any | null>(null),
|
tippyActions: ref<TippyComponent | null>(null),
|
||||||
options: ref<any | null>(null),
|
options: ref<TippyComponent | null>(null),
|
||||||
requestAction: ref<any | null>(null),
|
requestAction: ref<typeof SmartItem | null>(null),
|
||||||
folderAction: ref<any | null>(null),
|
folderAction: ref<typeof SmartItem | null>(null),
|
||||||
edit: ref<any | null>(null),
|
edit: ref<typeof SmartItem | null>(null),
|
||||||
deleteAction: ref<any | null>(null),
|
deleteAction: ref<typeof SmartItem | null>(null),
|
||||||
exportAction: ref<any | null>(null),
|
exportAction: ref<typeof SmartItem | null>(null),
|
||||||
exportLoading: ref<boolean>(false),
|
exportLoading: ref<boolean>(false),
|
||||||
t,
|
t,
|
||||||
toast: useToast(),
|
toast: useToast(),
|
||||||
@@ -332,7 +334,7 @@ export default defineComponent({
|
|||||||
this.toast.error(this.t("error.something_went_wrong").toString())
|
this.toast.error(this.t("error.something_went_wrong").toString())
|
||||||
console.log(result.left)
|
console.log(result.left)
|
||||||
this.exportLoading = false
|
this.exportLoading = false
|
||||||
this.options.tippy().hide()
|
this.options!.tippy.hide()
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -358,7 +360,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
this.exportLoading = false
|
this.exportLoading = false
|
||||||
|
|
||||||
this.options.tippy().hide()
|
this.options!.tippy.hide()
|
||||||
},
|
},
|
||||||
editRequest(event: any) {
|
editRequest(event: any) {
|
||||||
this.$emit("edit-request", event)
|
this.$emit("edit-request", event)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
@drop="dragging = false"
|
@drop="dragging = false"
|
||||||
@dragleave="dragging = false"
|
@dragleave="dragging = false"
|
||||||
@dragend="dragging = false"
|
@dragend="dragging = false"
|
||||||
@contextmenu.prevent="options.tippy.show()"
|
@contextmenu.prevent="options!.tippy.show()"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="flex items-center justify-center px-4 cursor-pointer"
|
class="flex items-center justify-center px-4 cursor-pointer"
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
interactive
|
interactive
|
||||||
trigger="click"
|
trigger="click"
|
||||||
theme="popover"
|
theme="popover"
|
||||||
:on-shown="() => tippyActions.focus()"
|
:on-shown="() => tippyActions!.focus()"
|
||||||
>
|
>
|
||||||
<ButtonSecondary
|
<ButtonSecondary
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
@@ -64,11 +64,11 @@
|
|||||||
ref="tippyActions"
|
ref="tippyActions"
|
||||||
class="flex flex-col focus:outline-none"
|
class="flex flex-col focus:outline-none"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
@keyup.r="requestAction.$el.click()"
|
@keyup.r="requestAction!.$el.click()"
|
||||||
@keyup.n="folderAction.$el.click()"
|
@keyup.n="folderAction!.$el.click()"
|
||||||
@keyup.e="edit.$el.click()"
|
@keyup.e="edit!.$el.click()"
|
||||||
@keyup.delete="deleteAction.$el.click()"
|
@keyup.delete="deleteAction!.$el.click()"
|
||||||
@keyup.x="exportAction.$el.click()"
|
@keyup.x="exportAction!.$el.click()"
|
||||||
@keyup.escape="hide()"
|
@keyup.escape="hide()"
|
||||||
>
|
>
|
||||||
<SmartItem
|
<SmartItem
|
||||||
@@ -233,6 +233,8 @@ import { moveRESTTeamRequest } from "~/helpers/backend/mutations/TeamRequest"
|
|||||||
import { useI18n } from "@composables/i18n"
|
import { useI18n } from "@composables/i18n"
|
||||||
import { useToast } from "@composables/toast"
|
import { useToast } from "@composables/toast"
|
||||||
import { useColorMode } from "@composables/theming"
|
import { useColorMode } from "@composables/theming"
|
||||||
|
import { TippyComponent } from "vue-tippy"
|
||||||
|
import SmartItem from "@components/smart/Item.vue"
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "Folder",
|
name: "Folder",
|
||||||
@@ -262,13 +264,13 @@ export default defineComponent({
|
|||||||
setup() {
|
setup() {
|
||||||
return {
|
return {
|
||||||
// Template refs
|
// Template refs
|
||||||
tippyActions: ref<any | null>(null),
|
tippyActions: ref<TippyComponent | null>(null),
|
||||||
options: ref<any | null>(null),
|
options: ref<TippyComponent | null>(null),
|
||||||
requestAction: ref<any | null>(null),
|
requestAction: ref<typeof SmartItem | null>(null),
|
||||||
folderAction: ref<any | null>(null),
|
folderAction: ref<typeof SmartItem | null>(null),
|
||||||
edit: ref<any | null>(null),
|
edit: ref<typeof SmartItem | null>(null),
|
||||||
deleteAction: ref<any | null>(null),
|
deleteAction: ref<typeof SmartItem | null>(null),
|
||||||
exportAction: ref<any | null>(null),
|
exportAction: ref<typeof SmartItem | null>(null),
|
||||||
exportLoading: ref<boolean>(false),
|
exportLoading: ref<boolean>(false),
|
||||||
toast: useToast(),
|
toast: useToast(),
|
||||||
t: useI18n(),
|
t: useI18n(),
|
||||||
@@ -317,7 +319,7 @@ export default defineComponent({
|
|||||||
this.toast.error(this.t("error.something_went_wrong").toString())
|
this.toast.error(this.t("error.something_went_wrong").toString())
|
||||||
console.log(result.left)
|
console.log(result.left)
|
||||||
this.exportLoading = false
|
this.exportLoading = false
|
||||||
this.options.tippy().hide()
|
this.options!.tippy.hide()
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -343,7 +345,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
this.exportLoading = false
|
this.exportLoading = false
|
||||||
|
|
||||||
this.options.tippy().hide()
|
this.options!.tippy.hide()
|
||||||
},
|
},
|
||||||
toggleShowChildren() {
|
toggleShowChildren() {
|
||||||
if (this.$props.saveRequest)
|
if (this.$props.saveRequest)
|
||||||
|
|||||||
@@ -0,0 +1,151 @@
|
|||||||
|
<template>
|
||||||
|
<div v-show="show">
|
||||||
|
<SmartTabs
|
||||||
|
:id="'environments_tab'"
|
||||||
|
v-model="selectedEnvironmentTab"
|
||||||
|
render-inactive-tabs
|
||||||
|
>
|
||||||
|
<SmartTab
|
||||||
|
:id="'my-environments'"
|
||||||
|
:label="`${t('environment.my_environments')}`"
|
||||||
|
/>
|
||||||
|
<SmartTab
|
||||||
|
v-if="currentUser"
|
||||||
|
:id="'team-environments'"
|
||||||
|
:label="`${t('environment.team_environments')}`"
|
||||||
|
>
|
||||||
|
<SmartIntersection @intersecting="onTeamSelectIntersect">
|
||||||
|
<tippy
|
||||||
|
interactive
|
||||||
|
trigger="click"
|
||||||
|
theme="popover"
|
||||||
|
placement="bottom"
|
||||||
|
:on-shown="() => tippyActions.focus()"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
|
:title="`${t('collection.select_team')}`"
|
||||||
|
class="bg-transparent border-t border-dividerLight select-wrapper"
|
||||||
|
>
|
||||||
|
<ButtonSecondary
|
||||||
|
v-if="environmentType.selectedTeam"
|
||||||
|
:icon="IconUsers"
|
||||||
|
:label="environmentType.selectedTeam.name"
|
||||||
|
class="flex-1 !justify-start pr-8 rounded-none"
|
||||||
|
/>
|
||||||
|
<ButtonSecondary
|
||||||
|
v-else
|
||||||
|
:label="`${t('collection.select_team')}`"
|
||||||
|
class="flex-1 !justify-start pr-8 rounded-none"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
<template #content="{ hide }">
|
||||||
|
<div
|
||||||
|
ref="tippyActions"
|
||||||
|
class="flex flex-col focus:outline-none"
|
||||||
|
tabindex="0"
|
||||||
|
@keyup.escape="hide()"
|
||||||
|
>
|
||||||
|
<SmartItem
|
||||||
|
v-for="(team, index) in myTeams"
|
||||||
|
:key="`team-${index}`"
|
||||||
|
:label="team.name"
|
||||||
|
:info-icon="
|
||||||
|
team.id === environmentType.selectedTeam?.id
|
||||||
|
? IconDone
|
||||||
|
: undefined
|
||||||
|
"
|
||||||
|
:active-info-icon="
|
||||||
|
team.id === environmentType.selectedTeam?.id
|
||||||
|
"
|
||||||
|
:icon="IconUsers"
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
updateSelectedTeam(team)
|
||||||
|
hide()
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</tippy>
|
||||||
|
</SmartIntersection>
|
||||||
|
</SmartTab>
|
||||||
|
</SmartTabs>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch } from "vue"
|
||||||
|
import { Team } from "~/helpers/backend/graphql"
|
||||||
|
import { onLoggedIn } from "@composables/auth"
|
||||||
|
import { currentUserInfo$ } from "~/helpers/teams/BackendUserInfo"
|
||||||
|
import TeamListAdapter from "~/helpers/teams/TeamListAdapter"
|
||||||
|
import { useReadonlyStream } from "@composables/stream"
|
||||||
|
import { useLocalState } from "~/newstore/localstate"
|
||||||
|
import { useI18n } from "@composables/i18n"
|
||||||
|
import IconDone from "~icons/lucide/check"
|
||||||
|
import IconUsers from "~icons/lucide/users"
|
||||||
|
|
||||||
|
const t = useI18n()
|
||||||
|
|
||||||
|
type SelectedTeam = Team | undefined
|
||||||
|
|
||||||
|
type EnvironmentTabs = "my-environments" | "team-environments"
|
||||||
|
|
||||||
|
// Template refs
|
||||||
|
const tippyActions = ref<any | null>(null)
|
||||||
|
const selectedEnvironmentTab = ref<EnvironmentTabs>("my-environments")
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
show: boolean
|
||||||
|
environmentType: {
|
||||||
|
type: "my-environments" | "team-environments"
|
||||||
|
selectedTeam: SelectedTeam
|
||||||
|
}
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: "update-environment-type", tabID: EnvironmentTabs): void
|
||||||
|
(e: "update-selected-team", team: SelectedTeam): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const currentUser = useReadonlyStream(currentUserInfo$, null)
|
||||||
|
|
||||||
|
const adapter = new TeamListAdapter(true)
|
||||||
|
const myTeams = useReadonlyStream(adapter.teamList$, null)
|
||||||
|
const REMEMBERED_TEAM_ID = useLocalState("REMEMBERED_TEAM_ID")
|
||||||
|
let teamListFetched = false
|
||||||
|
|
||||||
|
watch(myTeams, (teams) => {
|
||||||
|
if (teams && !teamListFetched) {
|
||||||
|
teamListFetched = true
|
||||||
|
if (REMEMBERED_TEAM_ID.value && currentUser.value) {
|
||||||
|
const team = teams.find((t) => t.id === REMEMBERED_TEAM_ID.value)
|
||||||
|
if (team) updateSelectedTeam(team)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onLoggedIn(() => {
|
||||||
|
adapter.initialize()
|
||||||
|
})
|
||||||
|
|
||||||
|
const onTeamSelectIntersect = () => {
|
||||||
|
// Load team data as soon as intersection
|
||||||
|
adapter.fetchList()
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateEnvironmentType = (tabID: EnvironmentTabs) => {
|
||||||
|
emit("update-environment-type", tabID)
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateSelectedTeam = (team: SelectedTeam) => {
|
||||||
|
REMEMBERED_TEAM_ID.value = team?.id
|
||||||
|
emit("update-selected-team", team)
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(selectedEnvironmentTab, (newValue: EnvironmentTabs) => {
|
||||||
|
updateEnvironmentType(newValue)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
interactive
|
interactive
|
||||||
trigger="click"
|
trigger="click"
|
||||||
theme="popover"
|
theme="popover"
|
||||||
:on-shown="() => tippyActions.focus()"
|
:on-shown="() => tippyActions!.focus()"
|
||||||
>
|
>
|
||||||
<ButtonSecondary
|
<ButtonSecondary
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
@@ -70,7 +70,11 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #body>
|
<template #body>
|
||||||
<div class="flex flex-col space-y-2">
|
<div v-if="loading" class="flex flex-col items-center justify-center p-4">
|
||||||
|
<SmartSpinner class="my-4" />
|
||||||
|
<span class="text-secondaryLight">{{ t("state.loading") }}</span>
|
||||||
|
</div>
|
||||||
|
<div v-else class="flex flex-col space-y-2">
|
||||||
<SmartItem
|
<SmartItem
|
||||||
:icon="IconFolderPlus"
|
:icon="IconFolderPlus"
|
||||||
:label="t('import.from_json')"
|
:label="t('import.from_json')"
|
||||||
@@ -112,10 +116,19 @@ import {
|
|||||||
environments$,
|
environments$,
|
||||||
replaceEnvironments,
|
replaceEnvironments,
|
||||||
appendEnvironments,
|
appendEnvironments,
|
||||||
|
getSelectedEnvironmentType,
|
||||||
} from "~/newstore/environments"
|
} from "~/newstore/environments"
|
||||||
|
import { TeamEnvironment } from "~/helpers/teams/TeamEnvironment"
|
||||||
|
import * as TE from "fp-ts/TaskEither"
|
||||||
|
import { pipe } from "fp-ts/function"
|
||||||
|
import { createTeamEnvironment } from "~/helpers/backend/mutations/TeamEnvironment"
|
||||||
|
import { GQLError } from "~/helpers/backend/GQLClient"
|
||||||
|
import { TippyComponent } from "vue-tippy"
|
||||||
|
|
||||||
defineProps<{
|
const props = defineProps<{
|
||||||
show: boolean
|
show: boolean
|
||||||
|
teamEnvironments?: TeamEnvironment[]
|
||||||
|
teamId?: string | undefined
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
@@ -124,15 +137,38 @@ const emit = defineEmits<{
|
|||||||
|
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
const environments = useReadonlyStream(environments$, [])
|
|
||||||
|
const loading = ref(false)
|
||||||
|
|
||||||
|
const myEnvironments = useReadonlyStream(environments$, [])
|
||||||
const currentUser = useReadonlyStream(currentUser$, null)
|
const currentUser = useReadonlyStream(currentUser$, null)
|
||||||
|
|
||||||
|
const selectedEnvType = getSelectedEnvironmentType()
|
||||||
|
|
||||||
|
const currentSelectedEnvionmentType = computed(() => {
|
||||||
|
if (selectedEnvType === "MY_ENV" || props.teamEnvironments === undefined) {
|
||||||
|
return "MY_ENV"
|
||||||
|
} else {
|
||||||
|
return "TEAM_ENV"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// Template refs
|
// Template refs
|
||||||
const tippyActions = ref<any | null>(null)
|
const tippyActions = ref<TippyComponent | null>(null)
|
||||||
const inputChooseFileToImportFrom = ref<HTMLInputElement>()
|
const inputChooseFileToImportFrom = ref<HTMLInputElement>()
|
||||||
|
|
||||||
const environmentJson = computed(() => {
|
const environmentJson = computed(() => {
|
||||||
return JSON.stringify(environments.value, null, 2)
|
if (
|
||||||
|
currentSelectedEnvionmentType.value === "TEAM_ENV" &&
|
||||||
|
props.teamEnvironments !== undefined
|
||||||
|
) {
|
||||||
|
const teamEnvironments = props.teamEnvironments.map(
|
||||||
|
(x) => x.environment as Environment
|
||||||
|
)
|
||||||
|
return JSON.stringify(teamEnvironments, null, 2)
|
||||||
|
} else {
|
||||||
|
return JSON.stringify(myEnvironments.value, null, 2)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const createEnvironmentGist = async () => {
|
const createEnvironmentGist = async () => {
|
||||||
@@ -196,8 +232,13 @@ const readEnvironmentGist = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const environments = JSON.parse(Object.values(files)[0].content)
|
const environments = JSON.parse(Object.values(files)[0].content)
|
||||||
|
|
||||||
|
if (currentSelectedEnvionmentType.value === "MY_ENV") {
|
||||||
replaceEnvironments(environments)
|
replaceEnvironments(environments)
|
||||||
fileImported()
|
fileImported()
|
||||||
|
} else {
|
||||||
|
importToTeams(environments)
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
failedImport()
|
failedImport()
|
||||||
console.error(e)
|
console.error(e)
|
||||||
@@ -213,6 +254,34 @@ const openDialogChooseFileToImportFrom = () => {
|
|||||||
inputChooseFileToImportFrom.value.click()
|
inputChooseFileToImportFrom.value.click()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const importToTeams = async (content: Environment[]) => {
|
||||||
|
loading.value = true
|
||||||
|
for (const [i, env] of content.entries()) {
|
||||||
|
if (i === content.length - 1) {
|
||||||
|
loading.value = false
|
||||||
|
hideModal()
|
||||||
|
fileImported()
|
||||||
|
} else {
|
||||||
|
await pipe(
|
||||||
|
createTeamEnvironment(
|
||||||
|
JSON.stringify(env.variables),
|
||||||
|
props.teamId as string,
|
||||||
|
env.name
|
||||||
|
),
|
||||||
|
TE.match(
|
||||||
|
(err: GQLError<string>) => {
|
||||||
|
console.error(err)
|
||||||
|
toast.error(`${getErrorMessage(err)}`)
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
// wait for all the environments to be created then fire the toast
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const importFromJSON = () => {
|
const importFromJSON = () => {
|
||||||
if (!inputChooseFileToImportFrom.value) return
|
if (!inputChooseFileToImportFrom.value) return
|
||||||
|
|
||||||
@@ -235,6 +304,7 @@ const importFromJSON = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const environments = JSON.parse(content)
|
const environments = JSON.parse(content)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
environments._postman_variable_scope === "environment" ||
|
environments._postman_variable_scope === "environment" ||
|
||||||
environments._postman_variable_scope === "globals"
|
environments._postman_variable_scope === "globals"
|
||||||
@@ -256,8 +326,12 @@ const importFromJSON = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const importFromHoppscotch = (environments: Environment[]) => {
|
const importFromHoppscotch = (environments: Environment[]) => {
|
||||||
|
if (currentSelectedEnvionmentType.value === "MY_ENV") {
|
||||||
appendEnvironments(environments)
|
appendEnvironments(environments)
|
||||||
fileImported()
|
fileImported()
|
||||||
|
} else {
|
||||||
|
importToTeams(environments)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const importFromPostman = ({
|
const importFromPostman = ({
|
||||||
@@ -290,4 +364,17 @@ const exportJSON = () => {
|
|||||||
URL.revokeObjectURL(url)
|
URL.revokeObjectURL(url)
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getErrorMessage = (err: GQLError<string>) => {
|
||||||
|
if (err.type === "network_error") {
|
||||||
|
return t("error.network_error")
|
||||||
|
} else {
|
||||||
|
switch (err.error) {
|
||||||
|
case "team_environment/not_found":
|
||||||
|
return t("team_environment.not_found")
|
||||||
|
default:
|
||||||
|
return t("error.something_went_wrong")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -2,19 +2,23 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="sticky top-0 z-10 flex flex-col rounded-t bg-primary">
|
<div class="sticky top-0 z-10 flex flex-col rounded-t bg-primary">
|
||||||
<tippy
|
<tippy
|
||||||
|
v-if="environmentType.type === 'my-environments'"
|
||||||
interactive
|
interactive
|
||||||
trigger="click"
|
trigger="click"
|
||||||
theme="popover"
|
theme="popover"
|
||||||
:on-shown="() => tippyActions.focus()"
|
arrow
|
||||||
|
:on-shown="() => tippyActions!.focus()"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
:title="`${t('environment.select')}`"
|
:title="`${t('environment.select')}`"
|
||||||
class="flex-1 bg-transparent border-b border-dividerLight select-wrapper"
|
class="bg-transparent border-b border-dividerLight select-wrapper"
|
||||||
>
|
>
|
||||||
<ButtonSecondary
|
<ButtonSecondary
|
||||||
v-if="selectedEnvironmentIndex !== -1"
|
v-if="
|
||||||
:label="environments[selectedEnvironmentIndex].name"
|
selectedEnv.type === 'MY_ENV' && selectedEnv.index !== undefined
|
||||||
|
"
|
||||||
|
:label="myEnvironments[selectedEnv.index].name"
|
||||||
class="flex-1 !justify-start pr-8 rounded-none"
|
class="flex-1 !justify-start pr-8 rounded-none"
|
||||||
/>
|
/>
|
||||||
<ButtonSecondary
|
<ButtonSecondary
|
||||||
@@ -26,31 +30,36 @@
|
|||||||
<template #content="{ hide }">
|
<template #content="{ hide }">
|
||||||
<div
|
<div
|
||||||
ref="tippyActions"
|
ref="tippyActions"
|
||||||
|
role="menu"
|
||||||
class="flex flex-col focus:outline-none"
|
class="flex flex-col focus:outline-none"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
@keyup.escape="hide()"
|
@keyup.escape="hide()"
|
||||||
>
|
>
|
||||||
<SmartItem
|
<SmartItem
|
||||||
:label="`${t('environment.no_environment')}`"
|
:label="`${t('environment.no_environment')}`"
|
||||||
:info-icon="selectedEnvironmentIndex === -1 ? IconDone : null"
|
:info-icon="
|
||||||
:active-info-icon="selectedEnvironmentIndex === -1"
|
selectedEnvironmentIndex.type !== 'MY_ENV'
|
||||||
|
? IconCheck
|
||||||
|
: undefined
|
||||||
|
"
|
||||||
|
:active-info-icon="selectedEnvironmentIndex.type !== 'MY_ENV'"
|
||||||
@click="
|
@click="
|
||||||
() => {
|
() => {
|
||||||
selectedEnvironmentIndex = -1
|
selectedEnvironmentIndex = { type: 'NO_ENV_SELECTED' }
|
||||||
hide()
|
hide()
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<hr v-if="environments.length > 0" />
|
<hr v-if="myEnvironments.length > 0" />
|
||||||
<SmartItem
|
<SmartItem
|
||||||
v-for="(gen, index) in environments"
|
v-for="(gen, index) in myEnvironments"
|
||||||
:key="`gen-${index}`"
|
:key="`gen-${index}`"
|
||||||
:label="gen.name"
|
:label="gen.name"
|
||||||
:info-icon="index === selectedEnvironmentIndex ? IconDone : null"
|
:info-icon="index === selectedEnv.index ? IconCheck : undefined"
|
||||||
:active-info-icon="index === selectedEnvironmentIndex"
|
:active-info-icon="index === selectedEnv.index"
|
||||||
@click="
|
@click="
|
||||||
() => {
|
() => {
|
||||||
selectedEnvironmentIndex = index
|
selectedEnvironmentIndex = { type: 'MY_ENV', index: index }
|
||||||
hide()
|
hide()
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
@@ -58,140 +67,258 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</tippy>
|
</tippy>
|
||||||
<div class="flex justify-between flex-1 border-b border-dividerLight">
|
<tippy v-else interactive trigger="click" theme="popover" arrow>
|
||||||
<ButtonSecondary
|
<span
|
||||||
:icon="IconPlus"
|
|
||||||
:label="`${t('action.new')}`"
|
|
||||||
class="!rounded-none"
|
|
||||||
@click="displayModalAdd(true)"
|
|
||||||
/>
|
|
||||||
<div class="flex">
|
|
||||||
<ButtonSecondary
|
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
to="https://docs.hoppscotch.io/features/environments"
|
:title="`${t('environment.select')}`"
|
||||||
blank
|
class="bg-transparent border-b border-dividerLight select-wrapper"
|
||||||
:title="t('app.wiki')"
|
>
|
||||||
:icon="IconHelpCircle"
|
<ButtonSecondary
|
||||||
|
v-if="selectedEnv.name"
|
||||||
|
:label="selectedEnv.name"
|
||||||
|
class="flex-1 !justify-start pr-8 rounded-none"
|
||||||
/>
|
/>
|
||||||
<ButtonSecondary
|
<ButtonSecondary
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-else
|
||||||
:icon="IconArchive"
|
:label="`${t('environment.select')}`"
|
||||||
:title="t('modal.import_export')"
|
class="flex-1 !justify-start pr-8 rounded-none"
|
||||||
@click="displayModalImportExport(true)"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</span>
|
||||||
</div>
|
<template #content="{ hide }">
|
||||||
</div>
|
<div
|
||||||
<div class="flex flex-col">
|
class="flex flex-col"
|
||||||
<EnvironmentsEnvironment
|
role="menu"
|
||||||
environment-index="Global"
|
tabindex="0"
|
||||||
:environment="globalEnvironment"
|
@keyup.escape="hide()"
|
||||||
class="border-b border-dashed border-dividerLight"
|
>
|
||||||
@edit-environment="editEnvironment('Global')"
|
<SmartItem
|
||||||
|
:label="`${t('environment.no_environment')}`"
|
||||||
|
:info-icon="
|
||||||
|
selectedEnvironmentIndex.type !== 'TEAM_ENV'
|
||||||
|
? IconCheck
|
||||||
|
: undefined
|
||||||
|
"
|
||||||
|
:active-info-icon="selectedEnvironmentIndex.type !== 'TEAM_ENV'"
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
selectedEnvironmentIndex = { type: 'NO_ENV_SELECTED' }
|
||||||
|
hide()
|
||||||
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<EnvironmentsEnvironment
|
<div
|
||||||
v-for="(environment, index) in environments"
|
v-if="loading"
|
||||||
:key="`environment-${index}`"
|
class="flex flex-col items-center justify-center p-4"
|
||||||
:environment-index="index"
|
>
|
||||||
:environment="environment"
|
<SmartSpinner class="my-4" />
|
||||||
@edit-environment="editEnvironment(index)"
|
<span class="text-secondaryLight">{{ t("state.loading") }}</span>
|
||||||
|
</div>
|
||||||
|
<hr v-if="teamEnvironmentList.length > 0" />
|
||||||
|
<div
|
||||||
|
v-if="environmentType.selectedTeam !== undefined"
|
||||||
|
class="flex flex-col"
|
||||||
|
>
|
||||||
|
<SmartItem
|
||||||
|
v-for="(gen, index) in teamEnvironmentList"
|
||||||
|
:key="`gen-team-${index}`"
|
||||||
|
:label="gen.environment.name"
|
||||||
|
:info-icon="
|
||||||
|
gen.id === selectedEnv.teamEnvID ? IconCheck : undefined
|
||||||
|
"
|
||||||
|
:active-info-icon="gen.id === selectedEnv.teamEnvID"
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
selectedEnvironmentIndex = {
|
||||||
|
type: 'TEAM_ENV',
|
||||||
|
teamEnvID: gen.id,
|
||||||
|
teamID: gen.teamID,
|
||||||
|
environment: gen.environment,
|
||||||
|
}
|
||||||
|
hide()
|
||||||
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="environments.length === 0"
|
v-if="!loading && adapterError"
|
||||||
class="flex flex-col items-center justify-center p-4 text-secondaryLight"
|
class="flex flex-col items-center py-4"
|
||||||
>
|
>
|
||||||
<img
|
<i class="mb-4 material-icons">help_outline</i>
|
||||||
:src="`/images/states/${colorMode.value}/blockchain.svg`"
|
{{ getErrorMessage(adapterError) }}
|
||||||
loading="lazy"
|
</div>
|
||||||
class="inline-flex flex-col object-contain object-center w-16 h-16 my-4"
|
</div>
|
||||||
:alt="`${t('empty.environments')}`"
|
</template>
|
||||||
/>
|
</tippy>
|
||||||
<span class="pb-4 text-center">
|
<EnvironmentsChooseType
|
||||||
{{ t("empty.environments") }}
|
:environment-type="environmentType"
|
||||||
</span>
|
:show="showTeamEnvironment"
|
||||||
<ButtonSecondary
|
@update-environment-type="updateEnvironmentType"
|
||||||
:label="`${t('add.new')}`"
|
@update-selected-team="updateSelectedTeam"
|
||||||
filled
|
|
||||||
class="mb-4"
|
|
||||||
outline
|
|
||||||
@click="displayModalAdd(true)"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<EnvironmentsDetails
|
<EnvironmentsMy v-if="environmentType.type === 'my-environments'" />
|
||||||
:show="showModalDetails"
|
<EnvironmentsTeams
|
||||||
:action="action"
|
v-else
|
||||||
:editing-environment-index="editingEnvironmentIndex"
|
:team="environmentType.selectedTeam"
|
||||||
@hide-modal="displayModalEdit(false)"
|
:team-environments="teamEnvironmentList"
|
||||||
/>
|
:loading="loading"
|
||||||
<EnvironmentsImportExport
|
:adapter-error="adapterError"
|
||||||
:show="showModalImportExport"
|
|
||||||
@hide-modal="displayModalImportExport(false)"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import IconDone from "~icons/lucide/check"
|
import { computed, ref, watch } from "vue"
|
||||||
import IconPlus from "~icons/lucide/plus"
|
import { isEqual } from "lodash-es"
|
||||||
import IconHelpCircle from "~icons/lucide/help-circle"
|
import { currentUser$ } from "~/helpers/fb/auth"
|
||||||
import IconArchive from "~icons/lucide/archive"
|
import { Team } from "~/helpers/backend/graphql"
|
||||||
import { computed, ref } from "vue"
|
|
||||||
import { useReadonlyStream, useStream } from "@composables/stream"
|
import { useReadonlyStream, useStream } from "@composables/stream"
|
||||||
import { useI18n } from "@composables/i18n"
|
import { useI18n } from "~/composables/i18n"
|
||||||
import { useColorMode } from "@composables/theming"
|
|
||||||
import {
|
import {
|
||||||
environments$,
|
environments$,
|
||||||
setCurrentEnvironment,
|
selectedEnvironmentIndex$,
|
||||||
selectedEnvIndex$,
|
setSelectedEnvironmentIndex,
|
||||||
globalEnv$,
|
|
||||||
} from "~/newstore/environments"
|
} from "~/newstore/environments"
|
||||||
|
import TeamEnvironmentAdapter from "~/helpers/teams/TeamEnvironmentAdapter"
|
||||||
|
import { GQLError } from "~/helpers/backend/GQLClient"
|
||||||
|
import IconCheck from "~icons/lucide/check"
|
||||||
|
import { TippyComponent } from "vue-tippy"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
|
||||||
const colorMode = useColorMode()
|
type EnvironmentType = "my-environments" | "team-environments"
|
||||||
|
|
||||||
const globalEnv = useReadonlyStream(globalEnv$, [])
|
type SelectedTeam = Team | undefined
|
||||||
|
|
||||||
const globalEnvironment = computed(() => ({
|
type EnvironmentsChooseType = {
|
||||||
name: "Global",
|
type: EnvironmentType
|
||||||
variables: globalEnv.value,
|
selectedTeam: SelectedTeam
|
||||||
}))
|
}
|
||||||
|
|
||||||
const environments = useReadonlyStream(environments$, [])
|
const environmentType = ref<EnvironmentsChooseType>({
|
||||||
|
type: "my-environments",
|
||||||
|
selectedTeam: undefined,
|
||||||
|
})
|
||||||
|
|
||||||
const selectedEnvironmentIndex = useStream(
|
const currentUser = useReadonlyStream(currentUser$, null)
|
||||||
selectedEnvIndex$,
|
|
||||||
-1,
|
const showTeamEnvironment = computed(() => {
|
||||||
setCurrentEnvironment
|
if (currentUser.value == null) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
const updateSelectedTeam = (newSelectedTeam: SelectedTeam) => {
|
||||||
|
environmentType.value.selectedTeam = newSelectedTeam
|
||||||
|
}
|
||||||
|
const updateEnvironmentType = (newEnvironmentType: EnvironmentType) => {
|
||||||
|
environmentType.value.type = newEnvironmentType
|
||||||
|
}
|
||||||
|
|
||||||
|
const adapter = new TeamEnvironmentAdapter(undefined)
|
||||||
|
const adapterLoading = useReadonlyStream(adapter.loading$, false)
|
||||||
|
const adapterError = useReadonlyStream(adapter.error$, null)
|
||||||
|
const teamEnvironmentList = useReadonlyStream(adapter.teamEnvironmentList$, [])
|
||||||
|
|
||||||
|
const loading = computed(
|
||||||
|
() => adapterLoading.value && teamEnvironmentList.value.length === 0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => environmentType.value.selectedTeam?.id,
|
||||||
|
(newTeamID) => {
|
||||||
|
adapter.changeTeamID(newTeamID)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const myEnvironments = useReadonlyStream(environments$, [])
|
||||||
|
|
||||||
|
const selectedEnvironmentIndex = useStream(
|
||||||
|
selectedEnvironmentIndex$,
|
||||||
|
{ type: "NO_ENV_SELECTED" },
|
||||||
|
setSelectedEnvironmentIndex
|
||||||
|
)
|
||||||
|
|
||||||
|
/* Checking if there are any changes in the selected team environment when there are any updates
|
||||||
|
in the selected team environment list */
|
||||||
|
watch(
|
||||||
|
() => teamEnvironmentList.value,
|
||||||
|
(newTeamEnvironmentList) => {
|
||||||
|
if (
|
||||||
|
newTeamEnvironmentList.length > 0 &&
|
||||||
|
selectedEnvironmentIndex.value.type === "TEAM_ENV"
|
||||||
|
) {
|
||||||
|
const selectedEnv = newTeamEnvironmentList.find(
|
||||||
|
(env) =>
|
||||||
|
env.id ===
|
||||||
|
(selectedEnvironmentIndex.value.type === "TEAM_ENV" &&
|
||||||
|
selectedEnvironmentIndex.value.teamEnvID)
|
||||||
|
)
|
||||||
|
|
||||||
|
if (selectedEnv) {
|
||||||
|
// Checking if the currently selected environment is still the same after the new list is loaded
|
||||||
|
const isChange = !isEqual(
|
||||||
|
selectedEnvironmentIndex.value.environment,
|
||||||
|
selectedEnv.environment
|
||||||
|
)
|
||||||
|
|
||||||
|
if (isChange) {
|
||||||
|
selectedEnvironmentIndex.value = {
|
||||||
|
type: "TEAM_ENV",
|
||||||
|
teamEnvID: selectedEnv.id,
|
||||||
|
teamID: selectedEnv.teamID,
|
||||||
|
environment: selectedEnv.environment,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
const selectedEnv = computed(() => {
|
||||||
|
if (selectedEnvironmentIndex.value.type === "MY_ENV") {
|
||||||
|
return {
|
||||||
|
type: "MY_ENV",
|
||||||
|
index: selectedEnvironmentIndex.value.index,
|
||||||
|
}
|
||||||
|
} else if (selectedEnvironmentIndex.value.type === "TEAM_ENV") {
|
||||||
|
const teamEnv = teamEnvironmentList.value.find(
|
||||||
|
(env) =>
|
||||||
|
env.id ===
|
||||||
|
(selectedEnvironmentIndex.value.type === "TEAM_ENV" &&
|
||||||
|
selectedEnvironmentIndex.value.teamEnvID)
|
||||||
|
)
|
||||||
|
if (teamEnv) {
|
||||||
|
return {
|
||||||
|
type: "TEAM_ENV",
|
||||||
|
name: teamEnv.environment.name,
|
||||||
|
teamEnvID: selectedEnvironmentIndex.value.teamEnvID,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
selectedEnvironmentIndex.value = { type: "NO_ENV_SELECTED" }
|
||||||
|
return { type: "NO_ENV_SELECTED" }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
selectedEnvironmentIndex.value = { type: "NO_ENV_SELECTED" }
|
||||||
|
return { type: "NO_ENV_SELECTED" }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const getErrorMessage = (err: GQLError<string>) => {
|
||||||
|
if (err.type === "network_error") {
|
||||||
|
return t("error.network_error")
|
||||||
|
} else {
|
||||||
|
switch (err.error) {
|
||||||
|
case "team_environment/not_found":
|
||||||
|
return t("team_environment.not_found")
|
||||||
|
default:
|
||||||
|
return t("error.something_went_wrong")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Template refs
|
// Template refs
|
||||||
const tippyActions = ref<any | null>(null)
|
const tippyActions = ref<TippyComponent | null>(null)
|
||||||
const showModalImportExport = ref(false)
|
|
||||||
const showModalDetails = ref(false)
|
|
||||||
const action = ref<"new" | "edit">("edit")
|
|
||||||
const editingEnvironmentIndex = ref<number | "Global" | null>(null)
|
|
||||||
|
|
||||||
const displayModalAdd = (shouldDisplay: boolean) => {
|
|
||||||
action.value = "new"
|
|
||||||
showModalDetails.value = shouldDisplay
|
|
||||||
}
|
|
||||||
const displayModalEdit = (shouldDisplay: boolean) => {
|
|
||||||
action.value = "edit"
|
|
||||||
showModalDetails.value = shouldDisplay
|
|
||||||
|
|
||||||
if (!shouldDisplay) resetSelectedData()
|
|
||||||
}
|
|
||||||
const displayModalImportExport = (shouldDisplay: boolean) => {
|
|
||||||
showModalImportExport.value = shouldDisplay
|
|
||||||
}
|
|
||||||
const editEnvironment = (environmentIndex: number | "Global") => {
|
|
||||||
editingEnvironmentIndex.value = environmentIndex
|
|
||||||
action.value = "edit"
|
|
||||||
displayModalEdit(true)
|
|
||||||
}
|
|
||||||
const resetSelectedData = () => {
|
|
||||||
editingEnvironmentIndex.value = null
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -104,15 +104,9 @@
|
|||||||
<span class="flex space-x-2">
|
<span class="flex space-x-2">
|
||||||
<ButtonPrimary
|
<ButtonPrimary
|
||||||
:label="`${t('action.save')}`"
|
:label="`${t('action.save')}`"
|
||||||
outline
|
|
||||||
@click="saveEnvironment"
|
@click="saveEnvironment"
|
||||||
/>
|
/>
|
||||||
<ButtonSecondary
|
<ButtonSecondary :label="`${t('action.cancel')}`" @click="hideModal" />
|
||||||
:label="`${t('action.cancel')}`"
|
|
||||||
outline
|
|
||||||
filled
|
|
||||||
@click="hideModal"
|
|
||||||
/>
|
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</SmartModal>
|
</SmartModal>
|
||||||
@@ -120,7 +114,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import IconTrash2 from "~icons/lucide/trash-2"
|
import IconTrash2 from "~icons/lucide/trash-2"
|
||||||
import IconCheck from "~icons/lucide/check"
|
import IconDone from "~icons/lucide/check"
|
||||||
import IconPlus from "~icons/lucide/plus"
|
import IconPlus from "~icons/lucide/plus"
|
||||||
import IconTrash from "~icons/lucide/trash"
|
import IconTrash from "~icons/lucide/trash"
|
||||||
import { clone } from "lodash-es"
|
import { clone } from "lodash-es"
|
||||||
@@ -137,8 +131,8 @@ import {
|
|||||||
getEnvironment,
|
getEnvironment,
|
||||||
getGlobalVariables,
|
getGlobalVariables,
|
||||||
globalEnv$,
|
globalEnv$,
|
||||||
setCurrentEnvironment,
|
|
||||||
setGlobalEnvVariables,
|
setGlobalEnvVariables,
|
||||||
|
setSelectedEnvironmentIndex,
|
||||||
updateEnvironment,
|
updateEnvironment,
|
||||||
} from "~/newstore/environments"
|
} from "~/newstore/environments"
|
||||||
import { useI18n } from "@composables/i18n"
|
import { useI18n } from "@composables/i18n"
|
||||||
@@ -184,7 +178,7 @@ const vars = ref<EnvironmentVariable[]>([
|
|||||||
{ id: idTicker.value++, env: { key: "", value: "" } },
|
{ id: idTicker.value++, env: { key: "", value: "" } },
|
||||||
])
|
])
|
||||||
|
|
||||||
const clearIcon = refAutoReset<typeof IconTrash2 | typeof IconCheck>(
|
const clearIcon = refAutoReset<typeof IconTrash2 | typeof IconDone>(
|
||||||
IconTrash2,
|
IconTrash2,
|
||||||
1000
|
1000
|
||||||
)
|
)
|
||||||
@@ -203,7 +197,10 @@ const workingEnv = computed(() => {
|
|||||||
variables: props.envVars(),
|
variables: props.envVars(),
|
||||||
}
|
}
|
||||||
} else if (props.editingEnvironmentIndex !== null) {
|
} else if (props.editingEnvironmentIndex !== null) {
|
||||||
return getEnvironment(props.editingEnvironmentIndex)
|
return getEnvironment({
|
||||||
|
type: "MY_ENV",
|
||||||
|
index: props.editingEnvironmentIndex,
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -229,10 +226,10 @@ const liveEnvs = computed(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (props.editingEnvironmentIndex === "Global") {
|
if (props.editingEnvironmentIndex === "Global") {
|
||||||
return [...vars.value.map((x) => ({ ...x, source: name.value! }))]
|
return [...vars.value.map((x) => ({ ...x.env, source: name.value! }))]
|
||||||
} else {
|
} else {
|
||||||
return [
|
return [
|
||||||
...vars.value.map((x) => ({ ...x, source: name.value! })),
|
...vars.value.map((x) => ({ ...x.env, source: name.value! })),
|
||||||
...globalVars.value.map((x) => ({ ...x, source: "Global" })),
|
...globalVars.value.map((x) => ({ ...x, source: "Global" })),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -255,16 +252,8 @@ watch(
|
|||||||
)
|
)
|
||||||
|
|
||||||
const clearContent = () => {
|
const clearContent = () => {
|
||||||
vars.value = [
|
vars.value = []
|
||||||
{
|
clearIcon.value = IconDone
|
||||||
id: idTicker.value++,
|
|
||||||
env: {
|
|
||||||
key: "",
|
|
||||||
value: "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
clearIcon.value = IconCheck
|
|
||||||
toast.success(`${t("state.cleared")}`)
|
toast.success(`${t("state.cleared")}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +296,10 @@ const saveEnvironment = () => {
|
|||||||
// Creating a new environment
|
// Creating a new environment
|
||||||
createEnvironment(name.value)
|
createEnvironment(name.value)
|
||||||
updateEnvironment(envList.value.length - 1, environmentUpdated)
|
updateEnvironment(envList.value.length - 1, environmentUpdated)
|
||||||
setCurrentEnvironment(envList.value.length - 1)
|
setSelectedEnvironmentIndex({
|
||||||
|
type: "MY_ENV",
|
||||||
|
index: envList.value.length - 1,
|
||||||
|
})
|
||||||
toast.success(`${t("environment.created")}`)
|
toast.success(`${t("environment.created")}`)
|
||||||
} else if (props.editingEnvironmentIndex === "Global") {
|
} else if (props.editingEnvironmentIndex === "Global") {
|
||||||
// Editing the Global environment
|
// Editing the Global environment
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="flex items-stretch group"
|
class="flex items-stretch group"
|
||||||
@contextmenu.prevent="options.tippy.show()"
|
@contextmenu.prevent="options!.tippy.show()"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="flex items-center justify-center px-4 cursor-pointer"
|
class="flex items-center justify-center px-4 cursor-pointer"
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
interactive
|
interactive
|
||||||
trigger="click"
|
trigger="click"
|
||||||
theme="popover"
|
theme="popover"
|
||||||
:on-shown="() => tippyActions.focus()"
|
:on-shown="() => tippyActions!.focus()"
|
||||||
>
|
>
|
||||||
<ButtonSecondary
|
<ButtonSecondary
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
@@ -35,10 +35,13 @@
|
|||||||
ref="tippyActions"
|
ref="tippyActions"
|
||||||
class="flex flex-col focus:outline-none"
|
class="flex flex-col focus:outline-none"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
@keyup.e="edit.$el.click()"
|
role="menu"
|
||||||
@keyup.d="duplicate.$el.click()"
|
@keyup.e="edit!.$el.click()"
|
||||||
|
@keyup.d="duplicate!.$el.click()"
|
||||||
@keyup.delete="
|
@keyup.delete="
|
||||||
!(environmentIndex === 'Global') ? deleteAction.$el.click() : null
|
!(environmentIndex === 'Global')
|
||||||
|
? deleteAction!.$el.click()
|
||||||
|
: null
|
||||||
"
|
"
|
||||||
@keyup.escape="hide()"
|
@keyup.escape="hide()"
|
||||||
>
|
>
|
||||||
@@ -110,6 +113,8 @@ import {
|
|||||||
} from "~/newstore/environments"
|
} from "~/newstore/environments"
|
||||||
import { useI18n } from "@composables/i18n"
|
import { useI18n } from "@composables/i18n"
|
||||||
import { useToast } from "@composables/toast"
|
import { useToast } from "@composables/toast"
|
||||||
|
import { TippyComponent } from "vue-tippy"
|
||||||
|
import SmartItem from "@components/smart/Item.vue"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
@@ -125,12 +130,11 @@ const emit = defineEmits<{
|
|||||||
|
|
||||||
const confirmRemove = ref(false)
|
const confirmRemove = ref(false)
|
||||||
|
|
||||||
// Template refs
|
const tippyActions = ref<TippyComponent | null>(null)
|
||||||
const tippyActions = ref<any | null>(null)
|
const options = ref<TippyComponent | null>(null)
|
||||||
const options = ref<any | null>(null)
|
const edit = ref<typeof SmartItem | null>(null)
|
||||||
const edit = ref<any | null>(null)
|
const duplicate = ref<typeof SmartItem | null>(null)
|
||||||
const duplicate = ref<any | null>(null)
|
const deleteAction = ref<typeof SmartItem | null>(null)
|
||||||
const deleteAction = ref<any | null>(null)
|
|
||||||
|
|
||||||
const removeEnvironment = () => {
|
const removeEnvironment = () => {
|
||||||
if (props.environmentIndex === null) return
|
if (props.environmentIndex === null) return
|
||||||
121
packages/hoppscotch-app/src/components/environments/my/index.vue
Normal file
121
packages/hoppscotch-app/src/components/environments/my/index.vue
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="flex justify-between flex-1 border-b border-dividerLight">
|
||||||
|
<ButtonSecondary
|
||||||
|
:icon="IconPlus"
|
||||||
|
:label="`${t('action.new')}`"
|
||||||
|
class="!rounded-none"
|
||||||
|
@click="displayModalAdd(true)"
|
||||||
|
/>
|
||||||
|
<div class="flex">
|
||||||
|
<ButtonSecondary
|
||||||
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
|
to="https://docs.hoppscotch.io/features/environments"
|
||||||
|
blank
|
||||||
|
:title="t('app.wiki')"
|
||||||
|
:icon="IconHelpCircle"
|
||||||
|
/>
|
||||||
|
<ButtonSecondary
|
||||||
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
|
:icon="IconArchive"
|
||||||
|
:title="t('modal.import_export')"
|
||||||
|
@click="displayModalImportExport(true)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<EnvironmentsMyEnvironment
|
||||||
|
environment-index="Global"
|
||||||
|
:environment="globalEnvironment"
|
||||||
|
class="border-b border-dashed border-dividerLight"
|
||||||
|
@edit-environment="editEnvironment('Global')"
|
||||||
|
/>
|
||||||
|
<EnvironmentsMyEnvironment
|
||||||
|
v-for="(environment, index) in environments"
|
||||||
|
:key="`environment-${index}`"
|
||||||
|
:environment-index="index"
|
||||||
|
:environment="environment"
|
||||||
|
@edit-environment="editEnvironment(index)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="environments.length === 0"
|
||||||
|
class="flex flex-col items-center justify-center p-4 text-secondaryLight"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
:src="`/images/states/${colorMode.value}/blockchain.svg`"
|
||||||
|
loading="lazy"
|
||||||
|
class="inline-flex flex-col object-contain object-center w-16 h-16 my-4"
|
||||||
|
:alt="`${t('empty.environments')}`"
|
||||||
|
/>
|
||||||
|
<span class="pb-4 text-center">
|
||||||
|
{{ t("empty.environments") }}
|
||||||
|
</span>
|
||||||
|
<ButtonSecondary
|
||||||
|
:label="`${t('add.new')}`"
|
||||||
|
filled
|
||||||
|
class="mb-4"
|
||||||
|
@click="displayModalAdd(true)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<EnvironmentsMyDetails
|
||||||
|
:show="showModalDetails"
|
||||||
|
:action="action"
|
||||||
|
:editing-environment-index="editingEnvironmentIndex"
|
||||||
|
@hide-modal="displayModalEdit(false)"
|
||||||
|
/>
|
||||||
|
<EnvironmentsImportExport
|
||||||
|
:show="showModalImportExport"
|
||||||
|
@hide-modal="displayModalImportExport(false)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref } from "vue"
|
||||||
|
import { environments$, globalEnv$ } from "~/newstore/environments"
|
||||||
|
import { useColorMode } from "~/composables/theming"
|
||||||
|
import { useReadonlyStream } from "@composables/stream"
|
||||||
|
import { useI18n } from "~/composables/i18n"
|
||||||
|
import IconArchive from "~icons/lucide/archive"
|
||||||
|
import IconPlus from "~icons/lucide/plus"
|
||||||
|
import IconHelpCircle from "~icons/lucide/help-circle"
|
||||||
|
|
||||||
|
const t = useI18n()
|
||||||
|
const colorMode = useColorMode()
|
||||||
|
|
||||||
|
const globalEnv = useReadonlyStream(globalEnv$, [])
|
||||||
|
|
||||||
|
const globalEnvironment = computed(() => ({
|
||||||
|
name: "Global",
|
||||||
|
variables: globalEnv.value,
|
||||||
|
}))
|
||||||
|
|
||||||
|
const environments = useReadonlyStream(environments$, [])
|
||||||
|
|
||||||
|
const showModalImportExport = ref(false)
|
||||||
|
const showModalDetails = ref(false)
|
||||||
|
const action = ref<"new" | "edit">("edit")
|
||||||
|
const editingEnvironmentIndex = ref<number | "Global" | null>(null)
|
||||||
|
|
||||||
|
const displayModalAdd = (shouldDisplay: boolean) => {
|
||||||
|
action.value = "new"
|
||||||
|
showModalDetails.value = shouldDisplay
|
||||||
|
}
|
||||||
|
const displayModalEdit = (shouldDisplay: boolean) => {
|
||||||
|
action.value = "edit"
|
||||||
|
showModalDetails.value = shouldDisplay
|
||||||
|
|
||||||
|
if (!shouldDisplay) resetSelectedData()
|
||||||
|
}
|
||||||
|
const displayModalImportExport = (shouldDisplay: boolean) => {
|
||||||
|
showModalImportExport.value = shouldDisplay
|
||||||
|
}
|
||||||
|
const editEnvironment = (environmentIndex: number | "Global") => {
|
||||||
|
editingEnvironmentIndex.value = environmentIndex
|
||||||
|
action.value = "edit"
|
||||||
|
displayModalEdit(true)
|
||||||
|
}
|
||||||
|
const resetSelectedData = () => {
|
||||||
|
editingEnvironmentIndex.value = null
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,340 @@
|
|||||||
|
<template>
|
||||||
|
<SmartModal
|
||||||
|
v-if="show"
|
||||||
|
dialog
|
||||||
|
:title="t(`environment.${action}`)"
|
||||||
|
@close="hideModal"
|
||||||
|
>
|
||||||
|
<template #body>
|
||||||
|
<div class="flex flex-col px-2">
|
||||||
|
<div class="relative flex">
|
||||||
|
<input
|
||||||
|
id="selectLabelEnvEdit"
|
||||||
|
v-model="name"
|
||||||
|
v-focus
|
||||||
|
class="input floating-input"
|
||||||
|
:class="isViewer && 'opacity-25'"
|
||||||
|
placeholder=""
|
||||||
|
type="text"
|
||||||
|
autocomplete="off"
|
||||||
|
:disabled="isViewer"
|
||||||
|
@keyup.enter="saveEnvironment"
|
||||||
|
/>
|
||||||
|
<label for="selectLabelEnvEdit">
|
||||||
|
{{ t("action.label") }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center justify-between flex-1">
|
||||||
|
<label for="variableList" class="p-4">
|
||||||
|
{{ t("environment.variable_list") }}
|
||||||
|
</label>
|
||||||
|
<div v-if="!isViewer" class="flex">
|
||||||
|
<ButtonSecondary
|
||||||
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
|
:title="t('action.clear_all')"
|
||||||
|
:icon="clearIcon"
|
||||||
|
@click="clearContent()"
|
||||||
|
/>
|
||||||
|
<ButtonSecondary
|
||||||
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
|
:icon="IconPlus"
|
||||||
|
:title="t('add.new')"
|
||||||
|
@click="addEnvironmentVariable"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="evnExpandError"
|
||||||
|
class="w-full px-4 py-2 mb-2 overflow-auto font-mono text-red-400 whitespace-normal rounded bg-primaryLight"
|
||||||
|
>
|
||||||
|
{{ t("environment.nested_overflow") }}
|
||||||
|
</div>
|
||||||
|
<div class="border rounded divide-y divide-dividerLight border-divider">
|
||||||
|
<div
|
||||||
|
v-for="({ id, env }, index) in vars"
|
||||||
|
:key="`variable-${id}-${index}`"
|
||||||
|
class="flex divide-x divide-dividerLight"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
v-model="env.key"
|
||||||
|
class="flex flex-1 px-4 py-2 bg-transparent"
|
||||||
|
:class="isViewer && 'opacity-25'"
|
||||||
|
:placeholder="`${t('count.variable', { count: index + 1 })}`"
|
||||||
|
:name="'param' + index"
|
||||||
|
:disabled="isViewer"
|
||||||
|
/>
|
||||||
|
<SmartEnvInput
|
||||||
|
v-model="env.value"
|
||||||
|
:placeholder="`${t('count.value', { count: index + 1 })}`"
|
||||||
|
:envs="liveEnvs"
|
||||||
|
:name="'value' + index"
|
||||||
|
:readonly="isViewer"
|
||||||
|
/>
|
||||||
|
<div v-if="!isViewer" class="flex">
|
||||||
|
<ButtonSecondary
|
||||||
|
id="variable"
|
||||||
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
|
:title="t('action.remove')"
|
||||||
|
:icon="IconTrash"
|
||||||
|
color="red"
|
||||||
|
@click="removeEnvironmentVariable(index)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="vars.length === 0"
|
||||||
|
class="flex flex-col items-center justify-center p-4 text-secondaryLight"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
:src="`/images/states/${colorMode.value}/blockchain.svg`"
|
||||||
|
loading="lazy"
|
||||||
|
class="inline-flex flex-col object-contain object-center w-16 h-16 my-4"
|
||||||
|
:alt="`${t('empty.environments')}`"
|
||||||
|
/>
|
||||||
|
<span class="pb-4 text-center">
|
||||||
|
{{ t("empty.environments") }}
|
||||||
|
</span>
|
||||||
|
<ButtonSecondary
|
||||||
|
v-if="isViewer"
|
||||||
|
disabled
|
||||||
|
:label="`${t('add.new')}`"
|
||||||
|
filled
|
||||||
|
class="mb-4"
|
||||||
|
/>
|
||||||
|
<ButtonSecondary
|
||||||
|
v-else
|
||||||
|
:label="`${t('add.new')}`"
|
||||||
|
filled
|
||||||
|
class="mb-4"
|
||||||
|
@click="addEnvironmentVariable"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-if="!isViewer" #footer>
|
||||||
|
<span class="flex space-x-2">
|
||||||
|
<ButtonPrimary
|
||||||
|
:label="`${t('action.save')}`"
|
||||||
|
:loading="isLoading"
|
||||||
|
@click="saveEnvironment"
|
||||||
|
/>
|
||||||
|
<ButtonSecondary :label="`${t('action.cancel')}`" @click="hideModal" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</SmartModal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref, watch } from "vue"
|
||||||
|
import * as E from "fp-ts/Either"
|
||||||
|
import * as A from "fp-ts/Array"
|
||||||
|
import * as O from "fp-ts/Option"
|
||||||
|
import * as TE from "fp-ts/TaskEither"
|
||||||
|
import { flow, pipe } from "fp-ts/function"
|
||||||
|
import { parseTemplateStringE } from "@hoppscotch/data"
|
||||||
|
import { refAutoReset } from "@vueuse/core"
|
||||||
|
import { clone } from "lodash-es"
|
||||||
|
import { useToast } from "@composables/toast"
|
||||||
|
import { useI18n } from "~/composables/i18n"
|
||||||
|
import {
|
||||||
|
createTeamEnvironment,
|
||||||
|
updateTeamEnvironment,
|
||||||
|
} from "~/helpers/backend/mutations/TeamEnvironment"
|
||||||
|
import { GQLError } from "~/helpers/backend/GQLClient"
|
||||||
|
import { TeamEnvironment } from "~/helpers/teams/TeamEnvironment"
|
||||||
|
import { useColorMode } from "~/composables/theming"
|
||||||
|
import IconTrash from "~icons/lucide/trash"
|
||||||
|
import IconTrash2 from "~icons/lucide/trash-2"
|
||||||
|
import IconDone from "~icons/lucide/check"
|
||||||
|
import IconPlus from "~icons/lucide/plus"
|
||||||
|
|
||||||
|
type EnvironmentVariable = {
|
||||||
|
id: number
|
||||||
|
env: {
|
||||||
|
key: string
|
||||||
|
value: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const t = useI18n()
|
||||||
|
const toast = useToast()
|
||||||
|
const colorMode = useColorMode()
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
show: boolean
|
||||||
|
action: "edit" | "new"
|
||||||
|
editingEnvironment: TeamEnvironment | null
|
||||||
|
editingTeamId: string | undefined
|
||||||
|
isViewer: boolean
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
show: false,
|
||||||
|
action: "edit",
|
||||||
|
editingEnvironment: null,
|
||||||
|
editingTeamId: "",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: "hide-modal"): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const idTicker = ref(0)
|
||||||
|
|
||||||
|
const name = ref<string | null>(null)
|
||||||
|
const vars = ref<EnvironmentVariable[]>([
|
||||||
|
{ id: idTicker.value++, env: { key: "", value: "" } },
|
||||||
|
])
|
||||||
|
|
||||||
|
const clearIcon = refAutoReset<typeof IconTrash2 | typeof IconDone>(
|
||||||
|
IconTrash2,
|
||||||
|
1000
|
||||||
|
)
|
||||||
|
|
||||||
|
const evnExpandError = computed(() => {
|
||||||
|
const variables = pipe(
|
||||||
|
vars.value,
|
||||||
|
A.map((e) => e.env)
|
||||||
|
)
|
||||||
|
|
||||||
|
return pipe(
|
||||||
|
variables,
|
||||||
|
A.exists(({ value }) => E.isLeft(parseTemplateStringE(value, variables)))
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
const liveEnvs = computed(() => {
|
||||||
|
if (evnExpandError.value) {
|
||||||
|
return []
|
||||||
|
} else {
|
||||||
|
return [...vars.value.map((x) => ({ ...x.env, source: name.value! }))]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.show,
|
||||||
|
(show) => {
|
||||||
|
if (show) {
|
||||||
|
if (props.editingEnvironment === null) {
|
||||||
|
name.value = null
|
||||||
|
vars.value = []
|
||||||
|
} else {
|
||||||
|
name.value = props.editingEnvironment.environment.name ?? null
|
||||||
|
vars.value = pipe(
|
||||||
|
props.editingEnvironment.environment.variables ?? [],
|
||||||
|
A.map((e: { key: string; value: string }) => ({
|
||||||
|
id: idTicker.value++,
|
||||||
|
env: clone(e),
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const clearContent = () => {
|
||||||
|
vars.value = []
|
||||||
|
clearIcon.value = IconDone
|
||||||
|
toast.success(`${t("state.cleared")}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const addEnvironmentVariable = () => {
|
||||||
|
vars.value.push({
|
||||||
|
id: idTicker.value++,
|
||||||
|
env: {
|
||||||
|
key: "",
|
||||||
|
value: "",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const removeEnvironmentVariable = (index: number) => {
|
||||||
|
vars.value.splice(index, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
const isLoading = ref(false)
|
||||||
|
|
||||||
|
const saveEnvironment = async () => {
|
||||||
|
isLoading.value = true
|
||||||
|
|
||||||
|
if (!name.value) {
|
||||||
|
toast.error(`${t("environment.invalid_name")}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const filterdVariables = pipe(
|
||||||
|
vars.value,
|
||||||
|
A.filterMap(
|
||||||
|
flow(
|
||||||
|
O.fromPredicate((e) => e.env.key !== ""),
|
||||||
|
O.map((e) => e.env)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if (props.action === "new") {
|
||||||
|
await pipe(
|
||||||
|
createTeamEnvironment(
|
||||||
|
JSON.stringify(filterdVariables),
|
||||||
|
props.editingTeamId,
|
||||||
|
name.value
|
||||||
|
),
|
||||||
|
TE.match(
|
||||||
|
(err: GQLError<string>) => {
|
||||||
|
console.error(err)
|
||||||
|
toast.error(`${getErrorMessage(err)}`)
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
hideModal()
|
||||||
|
toast.success(`${t("environment.created")}`)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)()
|
||||||
|
} else {
|
||||||
|
if (!props.editingEnvironment) {
|
||||||
|
console.error("No Environment Found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
await pipe(
|
||||||
|
updateTeamEnvironment(
|
||||||
|
JSON.stringify(filterdVariables),
|
||||||
|
props.editingEnvironment.id,
|
||||||
|
name.value
|
||||||
|
),
|
||||||
|
TE.match(
|
||||||
|
(err: GQLError<string>) => {
|
||||||
|
console.error(err)
|
||||||
|
toast.error(`${getErrorMessage(err)}`)
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
hideModal()
|
||||||
|
toast.success(`${t("environment.updated")}`)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)()
|
||||||
|
}
|
||||||
|
|
||||||
|
isLoading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const hideModal = () => {
|
||||||
|
name.value = null
|
||||||
|
emit("hide-modal")
|
||||||
|
}
|
||||||
|
|
||||||
|
const getErrorMessage = (err: GQLError<string>) => {
|
||||||
|
if (err.type === "network_error") {
|
||||||
|
return t("error.network_error")
|
||||||
|
} else {
|
||||||
|
switch (err.error) {
|
||||||
|
case "team_environment/not_found":
|
||||||
|
return t("team_environment.not_found")
|
||||||
|
default:
|
||||||
|
return t("error.something_went_wrong")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="flex items-stretch group"
|
||||||
|
@contextmenu.prevent="options!.tippy.show()"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="flex items-center justify-center px-4 cursor-pointer"
|
||||||
|
@click="emit('edit-environment')"
|
||||||
|
>
|
||||||
|
<icon-lucide-layers class="svg-icons" />
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="flex flex-1 min-w-0 py-2 pr-2 cursor-pointer transition group-hover:text-secondaryDark"
|
||||||
|
@click="emit('edit-environment')"
|
||||||
|
>
|
||||||
|
<span class="truncate">
|
||||||
|
{{ environment.environment.name }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
<tippy
|
||||||
|
v-if="!isViewer"
|
||||||
|
ref="options"
|
||||||
|
interactive
|
||||||
|
trigger="click"
|
||||||
|
theme="popover"
|
||||||
|
arrow
|
||||||
|
:on-shown="() => tippyActions!.focus()"
|
||||||
|
>
|
||||||
|
<ButtonSecondary
|
||||||
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
|
:title="t('action.more')"
|
||||||
|
:icon="IconMoreVertical"
|
||||||
|
/>
|
||||||
|
<template #content="{ hide }">
|
||||||
|
<div
|
||||||
|
ref="tippyActions"
|
||||||
|
class="flex flex-col focus:outline-none"
|
||||||
|
tabindex="0"
|
||||||
|
role="menu"
|
||||||
|
@keyup.e="edit!.$el.click()"
|
||||||
|
@keyup.d="duplicate!.$el.click()"
|
||||||
|
@keyup.delete="deleteAction!.$el.click()"
|
||||||
|
@keyup.escape="options!.tippy().hide()"
|
||||||
|
>
|
||||||
|
<SmartItem
|
||||||
|
ref="edit"
|
||||||
|
:icon="IconEdit"
|
||||||
|
:label="`${t('action.edit')}`"
|
||||||
|
:shortcut="['E']"
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
emit('edit-environment')
|
||||||
|
hide()
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
<SmartItem
|
||||||
|
ref="duplicate"
|
||||||
|
:icon="IconCopy"
|
||||||
|
:label="`${t('action.duplicate')}`"
|
||||||
|
:shortcut="['D']"
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
duplicateEnvironments()
|
||||||
|
hide()
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
<SmartItem
|
||||||
|
ref="deleteAction"
|
||||||
|
:icon="IconTrash2"
|
||||||
|
:label="`${t('action.delete')}`"
|
||||||
|
:shortcut="['⌫']"
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
confirmRemove = true
|
||||||
|
hide()
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</tippy>
|
||||||
|
</span>
|
||||||
|
<SmartConfirmModal
|
||||||
|
:show="confirmRemove"
|
||||||
|
:title="`${t('confirm.remove_environment')}`"
|
||||||
|
@hide-modal="confirmRemove = false"
|
||||||
|
@resolve="removeEnvironment"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue"
|
||||||
|
import { pipe } from "fp-ts/function"
|
||||||
|
import * as TE from "fp-ts/TaskEither"
|
||||||
|
import { useToast } from "@composables/toast"
|
||||||
|
import { useI18n } from "~/composables/i18n"
|
||||||
|
import {
|
||||||
|
deleteTeamEnvironment,
|
||||||
|
createDuplicateEnvironment as duplicateEnvironment,
|
||||||
|
} from "~/helpers/backend/mutations/TeamEnvironment"
|
||||||
|
import { GQLError } from "~/helpers/backend/GQLClient"
|
||||||
|
import { TeamEnvironment } from "~/helpers/teams/TeamEnvironment"
|
||||||
|
import IconEdit from "~icons/lucide/edit"
|
||||||
|
import IconCopy from "~icons/lucide/copy"
|
||||||
|
import IconTrash2 from "~icons/lucide/trash-2"
|
||||||
|
import IconMoreVertical from "~icons/lucide/more-vertical"
|
||||||
|
import { TippyComponent } from "vue-tippy"
|
||||||
|
import SmartItem from "@components/smart/Item.vue"
|
||||||
|
|
||||||
|
const t = useI18n()
|
||||||
|
const toast = useToast()
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
environment: TeamEnvironment
|
||||||
|
isViewer: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: "edit-environment"): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const confirmRemove = ref(false)
|
||||||
|
|
||||||
|
const tippyActions = ref<TippyComponent | null>(null)
|
||||||
|
const options = ref<TippyComponent | null>(null)
|
||||||
|
const edit = ref<typeof SmartItem | null>(null)
|
||||||
|
const duplicate = ref<typeof SmartItem | null>(null)
|
||||||
|
const deleteAction = ref<typeof SmartItem | null>(null)
|
||||||
|
|
||||||
|
const removeEnvironment = () => {
|
||||||
|
pipe(
|
||||||
|
deleteTeamEnvironment(props.environment.id),
|
||||||
|
TE.match(
|
||||||
|
(err: GQLError<string>) => {
|
||||||
|
console.error(err)
|
||||||
|
toast.error(`${getErrorMessage(err)}`)
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
toast.success(`${t("team_environment.deleted")}`)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)()
|
||||||
|
}
|
||||||
|
|
||||||
|
const duplicateEnvironments = () => {
|
||||||
|
pipe(
|
||||||
|
duplicateEnvironment(props.environment.id),
|
||||||
|
TE.match(
|
||||||
|
(err: GQLError<string>) => {
|
||||||
|
console.error(err)
|
||||||
|
toast.error(`${getErrorMessage(err)}`)
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
toast.success(`${t("team_environment.duplicate")}`)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)()
|
||||||
|
}
|
||||||
|
|
||||||
|
const getErrorMessage = (err: GQLError<string>) => {
|
||||||
|
if (err.type === "network_error") {
|
||||||
|
return t("error.network_error")
|
||||||
|
} else {
|
||||||
|
switch (err.error) {
|
||||||
|
case "team_environment/not_found":
|
||||||
|
return t("team_environment.not_found")
|
||||||
|
default:
|
||||||
|
return t("error.something_went_wrong")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="flex justify-between flex-1 border-y border-dividerLight">
|
||||||
|
<ButtonSecondary
|
||||||
|
v-if="team === undefined || team.myRole === 'VIEWER'"
|
||||||
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
|
disabled
|
||||||
|
class="!rounded-none"
|
||||||
|
:icon="IconPlus"
|
||||||
|
:title="t('team.no_access')"
|
||||||
|
:label="t('action.new')"
|
||||||
|
/>
|
||||||
|
<ButtonSecondary
|
||||||
|
v-else
|
||||||
|
:icon="IconPlus"
|
||||||
|
:label="`${t('action.new')}`"
|
||||||
|
class="!rounded-none"
|
||||||
|
@click="displayModalAdd(true)"
|
||||||
|
/>
|
||||||
|
<div class="flex">
|
||||||
|
<ButtonSecondary
|
||||||
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
|
to="https://docs.hoppscotch.io/features/environments"
|
||||||
|
blank
|
||||||
|
:title="t('app.wiki')"
|
||||||
|
:icon="IconHelpCircle"
|
||||||
|
/>
|
||||||
|
<ButtonSecondary
|
||||||
|
v-if="team !== undefined && team.myRole === 'VIEWER'"
|
||||||
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
|
disabled
|
||||||
|
:icon="IconArchive"
|
||||||
|
:title="t('modal.import_export')"
|
||||||
|
/>
|
||||||
|
<ButtonSecondary
|
||||||
|
v-else
|
||||||
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
|
:icon="IconArchive"
|
||||||
|
:title="t('modal.import_export')"
|
||||||
|
@click="displayModalImportExport(true)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="!loading && teamEnvironments.length === 0 && !adapterError"
|
||||||
|
class="flex flex-col items-center justify-center p-4 text-secondaryLight"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
:src="`/images/states/${colorMode.value}/blockchain.svg`"
|
||||||
|
loading="lazy"
|
||||||
|
class="inline-flex flex-col object-contain object-center w-16 h-16 my-4"
|
||||||
|
:alt="`${t('empty.environments')}`"
|
||||||
|
/>
|
||||||
|
<span class="pb-4 text-center">
|
||||||
|
{{ t("empty.environments") }}
|
||||||
|
</span>
|
||||||
|
<ButtonSecondary
|
||||||
|
v-if="team === undefined || team.myRole === 'VIEWER'"
|
||||||
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
|
disabled
|
||||||
|
filled
|
||||||
|
class="mb-4"
|
||||||
|
:icon="IconPlus"
|
||||||
|
:title="t('team.no_access')"
|
||||||
|
:label="t('action.new')"
|
||||||
|
/>
|
||||||
|
<ButtonSecondary
|
||||||
|
v-else
|
||||||
|
:label="`${t('add.new')}`"
|
||||||
|
filled
|
||||||
|
class="mb-4"
|
||||||
|
@click="displayModalAdd(true)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="!loading">
|
||||||
|
<EnvironmentsTeamsEnvironment
|
||||||
|
v-for="(environment, index) in JSON.parse(
|
||||||
|
JSON.stringify(teamEnvironments)
|
||||||
|
)"
|
||||||
|
:key="`environment-${index}`"
|
||||||
|
:environment="environment"
|
||||||
|
:is-viewer="team?.myRole === 'VIEWER'"
|
||||||
|
@edit-environment="editEnvironment(environment)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div v-if="loading" class="flex flex-col items-center justify-center p-4">
|
||||||
|
<SmartSpinner class="my-4" />
|
||||||
|
<span class="text-secondaryLight">{{ t("state.loading") }}</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="!loading && adapterError"
|
||||||
|
class="flex flex-col items-center py-4"
|
||||||
|
>
|
||||||
|
<i class="mb-4 material-icons">help_outline</i>
|
||||||
|
{{ getErrorMessage(adapterError) }}
|
||||||
|
</div>
|
||||||
|
<EnvironmentsTeamsDetails
|
||||||
|
:show="showModalDetails"
|
||||||
|
:action="action"
|
||||||
|
:editing-environment="editingEnvironment"
|
||||||
|
:editing-team-id="team?.id"
|
||||||
|
:is-viewer="team?.myRole === 'VIEWER'"
|
||||||
|
@hide-modal="displayModalEdit(false)"
|
||||||
|
/>
|
||||||
|
<EnvironmentsImportExport
|
||||||
|
:show="showModalImportExport"
|
||||||
|
:team-environments="teamEnvironments"
|
||||||
|
:team-id="team?.id"
|
||||||
|
@hide-modal="displayModalImportExport(false)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue"
|
||||||
|
import { GQLError } from "~/helpers/backend/GQLClient"
|
||||||
|
import { TeamEnvironment } from "~/helpers/teams/TeamEnvironment"
|
||||||
|
import { useI18n } from "~/composables/i18n"
|
||||||
|
import { useColorMode } from "~/composables/theming"
|
||||||
|
import IconPlus from "~icons/lucide/plus"
|
||||||
|
import IconArchive from "~icons/lucide/archive"
|
||||||
|
import IconHelpCircle from "~icons/lucide/help-circle"
|
||||||
|
import { Team } from "~/helpers/backend/graphql"
|
||||||
|
|
||||||
|
const t = useI18n()
|
||||||
|
|
||||||
|
const colorMode = useColorMode()
|
||||||
|
|
||||||
|
type SelectedTeam = Team | undefined
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
team: SelectedTeam
|
||||||
|
teamEnvironments: TeamEnvironment[]
|
||||||
|
adapterError: GQLError<string> | null
|
||||||
|
loading: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const showModalImportExport = ref(false)
|
||||||
|
const showModalDetails = ref(false)
|
||||||
|
const action = ref<"new" | "edit">("edit")
|
||||||
|
const editingEnvironment = ref<TeamEnvironment | null>(null)
|
||||||
|
|
||||||
|
const displayModalAdd = (shouldDisplay: boolean) => {
|
||||||
|
action.value = "new"
|
||||||
|
showModalDetails.value = shouldDisplay
|
||||||
|
}
|
||||||
|
const displayModalEdit = (shouldDisplay: boolean) => {
|
||||||
|
action.value = "edit"
|
||||||
|
showModalDetails.value = shouldDisplay
|
||||||
|
|
||||||
|
if (!shouldDisplay) resetSelectedData()
|
||||||
|
}
|
||||||
|
const displayModalImportExport = (shouldDisplay: boolean) => {
|
||||||
|
showModalImportExport.value = shouldDisplay
|
||||||
|
}
|
||||||
|
const editEnvironment = (environment: TeamEnvironment | null) => {
|
||||||
|
editingEnvironment.value = environment
|
||||||
|
action.value = "edit"
|
||||||
|
displayModalEdit(true)
|
||||||
|
}
|
||||||
|
const resetSelectedData = () => {
|
||||||
|
editingEnvironment.value = null
|
||||||
|
}
|
||||||
|
|
||||||
|
const getErrorMessage = (err: GQLError<string>) => {
|
||||||
|
if (err.type === "network_error") {
|
||||||
|
return t("error.network_error")
|
||||||
|
} else {
|
||||||
|
switch (err.error) {
|
||||||
|
case "team_environment/not_found":
|
||||||
|
return t("team_environment.not_found")
|
||||||
|
default:
|
||||||
|
return t("error.something_went_wrong")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -129,7 +129,6 @@ import {
|
|||||||
setProviderInfo,
|
setProviderInfo,
|
||||||
currentUser$,
|
currentUser$,
|
||||||
signInWithEmail,
|
signInWithEmail,
|
||||||
linkWithFBCredential,
|
|
||||||
linkWithFBCredentialFromAuthError,
|
linkWithFBCredentialFromAuthError,
|
||||||
getGithubCredentialFromResult,
|
getGithubCredentialFromResult,
|
||||||
} from "~/helpers/fb/auth"
|
} from "~/helpers/fb/auth"
|
||||||
@@ -191,33 +190,12 @@ export default defineComponent({
|
|||||||
this.showLoginSuccess()
|
this.showLoginSuccess()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
// An error happened.
|
/*
|
||||||
if (
|
A auth/account-exists-with-different-credential Firebase error wont happen between Google and any other providers
|
||||||
(e as any).code === "auth/account-exists-with-different-credential"
|
Seems Google account overwrites accounts of other providers https://github.com/firebase/firebase-android-sdk/issues/25
|
||||||
) {
|
*/
|
||||||
// Step 2.
|
|
||||||
// User's email already exists.
|
|
||||||
// The pending Google credential.
|
|
||||||
const pendingCred = (e as any).credential
|
|
||||||
this.toast.info(`${this.t("auth.account_exists")}`, {
|
|
||||||
duration: 0,
|
|
||||||
closeOnSwipe: false,
|
|
||||||
action: {
|
|
||||||
text: `${this.t("action.yes")}`,
|
|
||||||
onClick: async (_, toastObject) => {
|
|
||||||
const { user } = await signInUserWithGithub()
|
|
||||||
await linkWithFBCredential(user, pendingCred)
|
|
||||||
|
|
||||||
this.showLoginSuccess()
|
|
||||||
|
|
||||||
toastObject.goAway(0)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.toast.error(`${this.t("error.something_went_wrong")}`)
|
this.toast.error(`${this.t("error.something_went_wrong")}`)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
this.signingInWithGoogle = false
|
this.signingInWithGoogle = false
|
||||||
},
|
},
|
||||||
@@ -228,27 +206,22 @@ export default defineComponent({
|
|||||||
const result = await signInUserWithGithub()
|
const result = await signInUserWithGithub()
|
||||||
const credential = getGithubCredentialFromResult(result)!
|
const credential = getGithubCredentialFromResult(result)!
|
||||||
const token = credential.accessToken
|
const token = credential.accessToken
|
||||||
|
|
||||||
setProviderInfo(result.providerId!, token!)
|
setProviderInfo(result.providerId!, token!)
|
||||||
|
|
||||||
this.showLoginSuccess()
|
this.showLoginSuccess()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
// An error happened.
|
// This user's email is already present in Firebase but with other providers, namely Google or Microsoft
|
||||||
if (
|
if (
|
||||||
(e as any).code === "auth/account-exists-with-different-credential"
|
(e as any).code === "auth/account-exists-with-different-credential"
|
||||||
) {
|
) {
|
||||||
// Step 2.
|
|
||||||
// User's email already exists.
|
|
||||||
this.toast.info(`${this.t("auth.account_exists")}`, {
|
this.toast.info(`${this.t("auth.account_exists")}`, {
|
||||||
duration: 0,
|
duration: 0,
|
||||||
closeOnSwipe: false,
|
closeOnSwipe: false,
|
||||||
action: {
|
action: {
|
||||||
text: `${this.t("action.yes")}`,
|
text: `${this.t("action.yes")}`,
|
||||||
onClick: async (_, toastObject) => {
|
onClick: async (_, toastObject) => {
|
||||||
const { user } = await signInUserWithGoogle()
|
await linkWithFBCredentialFromAuthError(e)
|
||||||
await linkWithFBCredentialFromAuthError(user, e)
|
|
||||||
|
|
||||||
this.showLoginSuccess()
|
this.showLoginSuccess()
|
||||||
|
|
||||||
toastObject.goAway(0)
|
toastObject.goAway(0)
|
||||||
@@ -270,33 +243,16 @@ export default defineComponent({
|
|||||||
this.showLoginSuccess()
|
this.showLoginSuccess()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
// An error happened.
|
/*
|
||||||
if (
|
A auth/account-exists-with-different-credential Firebase error wont happen between MS with Google or Github
|
||||||
(e as any).code === "auth/account-exists-with-different-credential"
|
If a Github account exists and user then logs in with MS email we get a "Something went wrong toast" and console errors and MS replaces GH as only provider.
|
||||||
) {
|
The error messages are as follows:
|
||||||
// Step 2.
|
FirebaseError: Firebase: Error (auth/popup-closed-by-user).
|
||||||
// User's email already exists.
|
@firebase/auth: Auth (9.6.11): INTERNAL ASSERTION FAILED: Pending promise was never set
|
||||||
// The pending Microsoft credential.
|
They may be related to https://github.com/firebase/firebaseui-web/issues/947
|
||||||
const pendingCred = (e as any).credential
|
*/
|
||||||
this.toast.info(`${this.t("auth.account_exists")}`, {
|
|
||||||
duration: 0,
|
|
||||||
closeOnSwipe: false,
|
|
||||||
action: {
|
|
||||||
text: `${this.t("action.yes")}`,
|
|
||||||
onClick: async (_, toastObject) => {
|
|
||||||
const { user } = await signInUserWithGithub()
|
|
||||||
await linkWithFBCredential(user, pendingCred)
|
|
||||||
|
|
||||||
this.showLoginSuccess()
|
|
||||||
|
|
||||||
toastObject.goAway(0)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.toast.error(`${this.t("error.something_went_wrong")}`)
|
this.toast.error(`${this.t("error.something_went_wrong")}`)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
this.signingInWithMicrosoft = false
|
this.signingInWithMicrosoft = false
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
/>
|
/>
|
||||||
</summary>
|
</summary>
|
||||||
<component
|
<component
|
||||||
:is="page == 'rest' ? HistoryRestCard : HistoryGraphqlCard"
|
:is="page === 'rest' ? HistoryRestCard : HistoryGraphqlCard"
|
||||||
v-for="(entry, index) in filteredHistoryGroup"
|
v-for="(entry, index) in filteredHistoryGroup"
|
||||||
:id="index"
|
:id="index"
|
||||||
:key="`entry-${index}`"
|
:key="`entry-${index}`"
|
||||||
@@ -122,7 +122,7 @@ import {
|
|||||||
isEqualHoppRESTRequest,
|
isEqualHoppRESTRequest,
|
||||||
safelyExtractRESTRequest,
|
safelyExtractRESTRequest,
|
||||||
} from "@hoppscotch/data"
|
} from "@hoppscotch/data"
|
||||||
import { groupBy } from "lodash-es"
|
import { groupBy, escapeRegExp } from "lodash-es"
|
||||||
import { useTimeAgo } from "@vueuse/core"
|
import { useTimeAgo } from "@vueuse/core"
|
||||||
import { pipe } from "fp-ts/function"
|
import { pipe } from "fp-ts/function"
|
||||||
import * as A from "fp-ts/Array"
|
import * as A from "fp-ts/Array"
|
||||||
@@ -213,7 +213,10 @@ const filteredHistory = computed(() =>
|
|||||||
return (
|
return (
|
||||||
!!input.updatedOn &&
|
!!input.updatedOn &&
|
||||||
(filterText.value.length === 0 ||
|
(filterText.value.length === 0 ||
|
||||||
deepCheckForRegex(input, new RegExp(filterText.value, "gi")))
|
deepCheckForRegex(
|
||||||
|
input,
|
||||||
|
new RegExp(escapeRegExp(filterText.value), "gi")
|
||||||
|
))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ watch(
|
|||||||
workingParams.value,
|
workingParams.value,
|
||||||
A.filterMap(
|
A.filterMap(
|
||||||
flow(
|
flow(
|
||||||
O.fromPredicate((e) => e.entry.key !== ""),
|
O.fromPredicate((e) => e.entry.key !== "" || e.entry.isFile),
|
||||||
O.map((e) => e.entry)
|
O.map((e) => e.entry)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -271,7 +271,7 @@ watch(workingParams, (newWorkingParams) => {
|
|||||||
newWorkingParams,
|
newWorkingParams,
|
||||||
A.filterMap(
|
A.filterMap(
|
||||||
flow(
|
flow(
|
||||||
O.fromPredicate((e) => e.entry.key !== ""),
|
O.fromPredicate((e) => e.entry.key !== "" || e.entry.isFile),
|
||||||
O.map((e) => e.entry)
|
O.map((e) => e.entry)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -452,17 +452,20 @@ const copyRequest = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const copyShareLink = (shareLink: string) => {
|
const copyShareLink = (shareLink: string) => {
|
||||||
|
const link = `${
|
||||||
|
import.meta.env.VITE_SHORTCODE_BASE_URL ?? "https://hopp.sh"
|
||||||
|
}/r${shareLink}`
|
||||||
if (navigator.share) {
|
if (navigator.share) {
|
||||||
const time = new Date().toLocaleTimeString()
|
const time = new Date().toLocaleTimeString()
|
||||||
const date = new Date().toLocaleDateString()
|
const date = new Date().toLocaleDateString()
|
||||||
navigator.share({
|
navigator.share({
|
||||||
title: "Hoppscotch",
|
title: "Hoppscotch",
|
||||||
text: `Hoppscotch • Open source API development ecosystem at ${time} on ${date}`,
|
text: `Hoppscotch • Open source API development ecosystem at ${time} on ${date}`,
|
||||||
url: `https://hopp.sh/r${shareLink}`,
|
url: link,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
copyLinkIcon.value = IconCheck
|
copyLinkIcon.value = IconCheck
|
||||||
copyToClipboard(`https://hopp.sh/r${shareLink}`)
|
copyToClipboard(link)
|
||||||
toast.success(`${t("state.copied_to_clipboard")}`)
|
toast.success(`${t("state.copied_to_clipboard")}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,7 +194,7 @@
|
|||||||
class="my-4"
|
class="my-4"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<EnvironmentsDetails
|
<EnvironmentsMyDetails
|
||||||
:show="showModalDetails"
|
:show="showModalDetails"
|
||||||
action="new"
|
action="new"
|
||||||
:env-vars="getAdditionVars"
|
:env-vars="getAdditionVars"
|
||||||
@@ -210,9 +210,9 @@ import { useReadonlyStream, useStream } from "@composables/stream"
|
|||||||
import { useI18n } from "@composables/i18n"
|
import { useI18n } from "@composables/i18n"
|
||||||
import {
|
import {
|
||||||
globalEnv$,
|
globalEnv$,
|
||||||
selectedEnvIndex$,
|
selectedEnvironmentIndex$,
|
||||||
setCurrentEnvironment,
|
|
||||||
setGlobalEnvVariables,
|
setGlobalEnvVariables,
|
||||||
|
setSelectedEnvironmentIndex,
|
||||||
} from "~/newstore/environments"
|
} from "~/newstore/environments"
|
||||||
import { restTestResults$, setRESTTestResults } from "~/newstore/RESTSession"
|
import { restTestResults$, setRESTTestResults } from "~/newstore/RESTSession"
|
||||||
import { HoppTestResult } from "~/helpers/types/HoppTestResult"
|
import { HoppTestResult } from "~/helpers/types/HoppTestResult"
|
||||||
@@ -263,9 +263,9 @@ const haveEnvVariables = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const selectedEnvironmentIndex = useStream(
|
const selectedEnvironmentIndex = useStream(
|
||||||
selectedEnvIndex$,
|
selectedEnvironmentIndex$,
|
||||||
-1,
|
{ type: "NO_ENV_SELECTED" },
|
||||||
setCurrentEnvironment
|
setSelectedEnvironmentIndex
|
||||||
)
|
)
|
||||||
|
|
||||||
const globalEnvVars = useReadonlyStream(globalEnv$, []) as Ref<
|
const globalEnvVars = useReadonlyStream(globalEnv$, []) as Ref<
|
||||||
@@ -275,7 +275,9 @@ const globalEnvVars = useReadonlyStream(globalEnv$, []) as Ref<
|
|||||||
}>
|
}>
|
||||||
>
|
>
|
||||||
|
|
||||||
const noEnvSelected = computed(() => selectedEnvironmentIndex.value === -1)
|
const noEnvSelected = computed(
|
||||||
|
() => selectedEnvironmentIndex.value.type === "NO_ENV_SELECTED"
|
||||||
|
)
|
||||||
|
|
||||||
const globalHasAdditions = computed(() => {
|
const globalHasAdditions = computed(() => {
|
||||||
if (!testResults.value?.envDiff.selected.additions) return false
|
if (!testResults.value?.envDiff.selected.additions) return false
|
||||||
|
|||||||
@@ -16,9 +16,13 @@
|
|||||||
v-else
|
v-else
|
||||||
class="absolute flex items-center justify-center object-cover object-center transition bg-primaryDark text-accentContrast"
|
class="absolute flex items-center justify-center object-cover object-center transition bg-primaryDark text-accentContrast"
|
||||||
:class="[`rounded-${rounded}`, `w-${size} h-${size}`]"
|
:class="[`rounded-${rounded}`, `w-${size} h-${size}`]"
|
||||||
:style="`background-color: ${toHex(initial)}`"
|
:style="`background-color: ${initial ? toHex(initial) : '#480000'}`"
|
||||||
>
|
>
|
||||||
|
<template v-if="initial && initial.charAt(0).toUpperCase()">
|
||||||
{{ initial.charAt(0).toUpperCase() }}
|
{{ initial.charAt(0).toUpperCase() }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<icon-lucide-user v-else></icon-lucide-user>
|
||||||
</div>
|
</div>
|
||||||
<span
|
<span
|
||||||
v-if="indicator"
|
v-if="indicator"
|
||||||
@@ -30,7 +34,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from "vue"
|
import { defineComponent, PropType } from "vue"
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
@@ -59,7 +63,7 @@ export default defineComponent({
|
|||||||
default: "5",
|
default: "5",
|
||||||
},
|
},
|
||||||
initial: {
|
initial: {
|
||||||
type: String,
|
type: String as PropType<string | undefined | null>,
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<ButtonSecondary
|
<ButtonSecondary
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
:title="t('action.open_workspace')"
|
:title="t('action.open_workspace')"
|
||||||
:to="`https://hopp.sh/r/${shortcode.id}`"
|
:to="`${shortcodeBaseURL}/r/${shortcode.id}`"
|
||||||
blank
|
blank
|
||||||
:icon="IconExternalLink"
|
:icon="IconExternalLink"
|
||||||
class="px-3 text-accent hover:text-accent"
|
class="px-3 text-accent hover:text-accent"
|
||||||
@@ -105,8 +105,11 @@ const requestLabelColor = computed(() =>
|
|||||||
|
|
||||||
const dateStamp = computed(() => shortDateTime(props.shortcode.createdOn))
|
const dateStamp = computed(() => shortDateTime(props.shortcode.createdOn))
|
||||||
|
|
||||||
|
const shortcodeBaseURL =
|
||||||
|
import.meta.env.VITE_SHORTCODE_BASE_URL ?? "https://hopp.sh"
|
||||||
|
|
||||||
const copyShortcode = (codeID: string) => {
|
const copyShortcode = (codeID: string) => {
|
||||||
copyToClipboard(`https://hopp.sh/r/${codeID}`)
|
copyToClipboard(`${shortcodeBaseURL}/r/${codeID}`)
|
||||||
toast.success(`${t("state.copied_to_clipboard")}`)
|
toast.success(`${t("state.copied_to_clipboard")}`)
|
||||||
copyIconRefs.value = IconCheck
|
copyIconRefs.value = IconCheck
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@
|
|||||||
interactive
|
interactive
|
||||||
trigger="click"
|
trigger="click"
|
||||||
theme="popover"
|
theme="popover"
|
||||||
:on-shown="() => tippyActions.focus()"
|
:on-shown="() => tippyActions![index].focus()"
|
||||||
>
|
>
|
||||||
<span class="select-wrapper">
|
<span class="select-wrapper">
|
||||||
<input
|
<input
|
||||||
@@ -364,6 +364,7 @@ import IconMailCheck from "~icons/lucide/mail-check"
|
|||||||
import IconCircleDot from "~icons/lucide/circle-dot"
|
import IconCircleDot from "~icons/lucide/circle-dot"
|
||||||
import IconCircle from "~icons/lucide/circle"
|
import IconCircle from "~icons/lucide/circle"
|
||||||
import IconArrowLeft from "~icons/lucide/arrow-left"
|
import IconArrowLeft from "~icons/lucide/arrow-left"
|
||||||
|
import { TippyComponent } from "vue-tippy"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
|
||||||
@@ -372,7 +373,7 @@ const toast = useToast()
|
|||||||
const colorMode = useColorMode()
|
const colorMode = useColorMode()
|
||||||
|
|
||||||
// Template refs
|
// Template refs
|
||||||
const tippyActions = ref<any | null>(null)
|
const tippyActions = ref<TippyComponent[] | null>(null)
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
show: Boolean,
|
show: Boolean,
|
||||||
|
|||||||
@@ -32,7 +32,11 @@
|
|||||||
v-for="(member, index) in team.teamMembers"
|
v-for="(member, index) in team.teamMembers"
|
||||||
:key="`member-${index}`"
|
:key="`member-${index}`"
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
:title="member.user.displayName"
|
:title="
|
||||||
|
member.user.displayName ||
|
||||||
|
member.user.email ||
|
||||||
|
t('default_hopp_displayName')
|
||||||
|
"
|
||||||
class="inline-flex"
|
class="inline-flex"
|
||||||
>
|
>
|
||||||
<ProfilePicture
|
<ProfilePicture
|
||||||
@@ -43,7 +47,7 @@
|
|||||||
/>
|
/>
|
||||||
<ProfilePicture
|
<ProfilePicture
|
||||||
v-else
|
v-else
|
||||||
:initial="member.user.displayName"
|
:initial="member.user.displayName || member.user.email"
|
||||||
class="ring-primary ring-2"
|
class="ring-primary ring-2"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -193,6 +197,7 @@ const props = defineProps<{
|
|||||||
user: {
|
user: {
|
||||||
displayName: string
|
displayName: string
|
||||||
photoURL: string | null
|
photoURL: string | null
|
||||||
|
email: string | null
|
||||||
}
|
}
|
||||||
}>
|
}>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { HoppRESTResponse } from "./types/HoppRESTResponse"
|
|||||||
import { createRESTNetworkRequestStream } from "./network"
|
import { createRESTNetworkRequestStream } from "./network"
|
||||||
import { HoppTestData, HoppTestResult } from "./types/HoppTestResult"
|
import { HoppTestData, HoppTestResult } from "./types/HoppTestResult"
|
||||||
import { isJSONContentType } from "./utils/contenttypes"
|
import { isJSONContentType } from "./utils/contenttypes"
|
||||||
|
import { updateTeamEnvironment } from "./backend/mutations/TeamEnvironment"
|
||||||
import { getRESTRequest, setRESTTestResults } from "~/newstore/RESTSession"
|
import { getRESTRequest, setRESTTestResults } from "~/newstore/RESTSession"
|
||||||
import {
|
import {
|
||||||
environmentsStore,
|
environmentsStore,
|
||||||
@@ -96,17 +97,35 @@ export const runRESTRequest$ = (): TaskEither<
|
|||||||
|
|
||||||
setGlobalEnvVariables(runResult.right.envs.global)
|
setGlobalEnvVariables(runResult.right.envs.global)
|
||||||
|
|
||||||
if (environmentsStore.value.currentEnvironmentIndex !== -1) {
|
if (
|
||||||
const env = getEnvironment(
|
environmentsStore.value.selectedEnvironmentIndex.type ===
|
||||||
environmentsStore.value.currentEnvironmentIndex
|
"MY_ENV"
|
||||||
)
|
) {
|
||||||
|
const env = getEnvironment({
|
||||||
|
type: "MY_ENV",
|
||||||
|
index: environmentsStore.value.selectedEnvironmentIndex.index,
|
||||||
|
})
|
||||||
updateEnvironment(
|
updateEnvironment(
|
||||||
environmentsStore.value.currentEnvironmentIndex,
|
environmentsStore.value.selectedEnvironmentIndex.index,
|
||||||
{
|
{
|
||||||
name: env.name,
|
name: env.name,
|
||||||
variables: runResult.right.envs.selected,
|
variables: runResult.right.envs.selected,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
} else if (
|
||||||
|
environmentsStore.value.selectedEnvironmentIndex.type ===
|
||||||
|
"TEAM_ENV"
|
||||||
|
) {
|
||||||
|
const env = getEnvironment({
|
||||||
|
type: "TEAM_ENV",
|
||||||
|
})
|
||||||
|
pipe(
|
||||||
|
updateTeamEnvironment(
|
||||||
|
JSON.stringify(runResult.right.envs.selected),
|
||||||
|
environmentsStore.value.selectedEnvironmentIndex.teamEnvID,
|
||||||
|
env.name
|
||||||
|
)
|
||||||
|
)()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setRESTTestResults({
|
setRESTTestResults({
|
||||||
@@ -188,7 +207,7 @@ function translateToSandboxTestResults(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const globals = cloneDeep(getGlobalVariables())
|
const globals = cloneDeep(getGlobalVariables())
|
||||||
const env = cloneDeep(getCurrentEnvironment())
|
const env = getCurrentEnvironment()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
description: "",
|
description: "",
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
mutation CreateDuplicateEnvironment($id: ID!){
|
||||||
|
createDuplicateEnvironment (id: $id ){
|
||||||
|
id
|
||||||
|
teamID
|
||||||
|
name
|
||||||
|
variables
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
mutation CreateTeamEnvironment($variables: String!,$teamID: ID!,$name: String!){
|
||||||
|
createTeamEnvironment( variables: $variables ,teamID: $teamID ,name: $name){
|
||||||
|
variables
|
||||||
|
name
|
||||||
|
teamID
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
mutation DeleteTeamEnvironment($id: ID!){
|
||||||
|
deleteTeamEnvironment (id: $id )
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
mutation UpdateTeamEnvironment($variables: String!,$id: ID!,$name: String!){
|
||||||
|
updateTeamEnvironment( variables: $variables ,id: $id ,name: $name){
|
||||||
|
variables
|
||||||
|
name
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ query GetInviteDetails($inviteID: ID!) {
|
|||||||
creator {
|
creator {
|
||||||
uid
|
uid
|
||||||
displayName
|
displayName
|
||||||
|
email
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
query GetTeamEnvironments($teamID: ID!){
|
||||||
|
team(teamID: $teamID){
|
||||||
|
teamEnvironments{
|
||||||
|
id
|
||||||
|
name
|
||||||
|
variables
|
||||||
|
teamID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
subscription TeamEnvironmentCreated ($teamID: ID!) {
|
||||||
|
teamEnvironmentCreated(teamID: $teamID) {
|
||||||
|
id
|
||||||
|
teamID
|
||||||
|
name
|
||||||
|
variables
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
subscription TeamEnvironmentDeleted ($teamID: ID!) {
|
||||||
|
teamEnvironmentDeleted(teamID: $teamID) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
subscription TeamEnvironmentUpdated ($teamID: ID!) {
|
||||||
|
teamEnvironmentUpdated(teamID: $teamID) {
|
||||||
|
id
|
||||||
|
teamID
|
||||||
|
name
|
||||||
|
variables
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
import { runMutation } from "../GQLClient"
|
||||||
|
import {
|
||||||
|
CreateDuplicateEnvironmentDocument,
|
||||||
|
CreateDuplicateEnvironmentMutation,
|
||||||
|
CreateDuplicateEnvironmentMutationVariables,
|
||||||
|
CreateTeamEnvironmentDocument,
|
||||||
|
CreateTeamEnvironmentMutation,
|
||||||
|
CreateTeamEnvironmentMutationVariables,
|
||||||
|
DeleteTeamEnvironmentDocument,
|
||||||
|
DeleteTeamEnvironmentMutation,
|
||||||
|
DeleteTeamEnvironmentMutationVariables,
|
||||||
|
UpdateTeamEnvironmentDocument,
|
||||||
|
UpdateTeamEnvironmentMutation,
|
||||||
|
UpdateTeamEnvironmentMutationVariables,
|
||||||
|
} from "../graphql"
|
||||||
|
|
||||||
|
type DeleteTeamEnvironmentError = "team_environment/not_found"
|
||||||
|
|
||||||
|
type UpdateTeamEnvironmentError = "team_environment/not_found"
|
||||||
|
|
||||||
|
type DuplicateTeamEnvironmentError = "team_environment/not_found"
|
||||||
|
|
||||||
|
export const createTeamEnvironment = (
|
||||||
|
variables: string,
|
||||||
|
teamID: string,
|
||||||
|
name: string
|
||||||
|
) =>
|
||||||
|
runMutation<
|
||||||
|
CreateTeamEnvironmentMutation,
|
||||||
|
CreateTeamEnvironmentMutationVariables,
|
||||||
|
""
|
||||||
|
>(CreateTeamEnvironmentDocument, {
|
||||||
|
variables,
|
||||||
|
teamID,
|
||||||
|
name,
|
||||||
|
})
|
||||||
|
|
||||||
|
export const deleteTeamEnvironment = (id: string) =>
|
||||||
|
runMutation<
|
||||||
|
DeleteTeamEnvironmentMutation,
|
||||||
|
DeleteTeamEnvironmentMutationVariables,
|
||||||
|
DeleteTeamEnvironmentError
|
||||||
|
>(DeleteTeamEnvironmentDocument, {
|
||||||
|
id,
|
||||||
|
})
|
||||||
|
|
||||||
|
export const updateTeamEnvironment = (
|
||||||
|
variables: string,
|
||||||
|
id: string,
|
||||||
|
name: string
|
||||||
|
) =>
|
||||||
|
runMutation<
|
||||||
|
UpdateTeamEnvironmentMutation,
|
||||||
|
UpdateTeamEnvironmentMutationVariables,
|
||||||
|
UpdateTeamEnvironmentError
|
||||||
|
>(UpdateTeamEnvironmentDocument, {
|
||||||
|
variables,
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
})
|
||||||
|
|
||||||
|
export const createDuplicateEnvironment = (id: string) =>
|
||||||
|
runMutation<
|
||||||
|
CreateDuplicateEnvironmentMutation,
|
||||||
|
CreateDuplicateEnvironmentMutationVariables,
|
||||||
|
DuplicateTeamEnvironmentError
|
||||||
|
>(CreateDuplicateEnvironmentDocument, {
|
||||||
|
id,
|
||||||
|
})
|
||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
AggregateEnvironment,
|
AggregateEnvironment,
|
||||||
aggregateEnvs$,
|
aggregateEnvs$,
|
||||||
getAggregateEnvs,
|
getAggregateEnvs,
|
||||||
|
getSelectedEnvironmentType,
|
||||||
} from "~/newstore/environments"
|
} from "~/newstore/environments"
|
||||||
|
|
||||||
const HOPP_ENVIRONMENT_REGEX = /(<<[a-zA-Z0-9-_]+>>)/g
|
const HOPP_ENVIRONMENT_REGEX = /(<<[a-zA-Z0-9-_]+>>)/g
|
||||||
@@ -73,6 +74,11 @@ const cursorTooltipField = (aggregateEnvs: AggregateEnvironment[]) =>
|
|||||||
|
|
||||||
const finalEnv = E.isLeft(result) ? "error" : result.right
|
const finalEnv = E.isLeft(result) ? "error" : result.right
|
||||||
|
|
||||||
|
const selectedEnvType = getSelectedEnvironmentType()
|
||||||
|
|
||||||
|
const envTypeIcon = `<i class="inline-flex items-center pr-2 mr-2 -my-1 text-base border-r material-icons border-secondary">${
|
||||||
|
selectedEnvType === "TEAM_ENV" ? "people" : "person"
|
||||||
|
}</i>`
|
||||||
return {
|
return {
|
||||||
pos: start,
|
pos: start,
|
||||||
end: to,
|
end: to,
|
||||||
@@ -81,11 +87,15 @@ const cursorTooltipField = (aggregateEnvs: AggregateEnvironment[]) =>
|
|||||||
create() {
|
create() {
|
||||||
const dom = document.createElement("span")
|
const dom = document.createElement("span")
|
||||||
const kbd = document.createElement("kbd")
|
const kbd = document.createElement("kbd")
|
||||||
|
const icon = document.createElement("span")
|
||||||
|
icon.innerHTML = envTypeIcon
|
||||||
kbd.textContent = finalEnv
|
kbd.textContent = finalEnv
|
||||||
|
dom.appendChild(icon)
|
||||||
dom.appendChild(document.createTextNode(`${envName} `))
|
dom.appendChild(document.createTextNode(`${envName} `))
|
||||||
dom.appendChild(kbd)
|
dom.appendChild(kbd)
|
||||||
dom.className = "tippy-box"
|
dom.className = "tippy-box"
|
||||||
dom.dataset.theme = "tooltip"
|
dom.dataset.theme = "tooltip"
|
||||||
|
icon.className = "env-icon"
|
||||||
return { dom }
|
return { dom }
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,19 +237,30 @@ export async function linkWithFBCredential(
|
|||||||
/**
|
/**
|
||||||
* Links account with another account given in a auth/account-exists-with-different-credential error
|
* Links account with another account given in a auth/account-exists-with-different-credential error
|
||||||
*
|
*
|
||||||
* @param user - User who has the errors
|
|
||||||
*
|
|
||||||
* @param error - Error caught after trying to login
|
* @param error - Error caught after trying to login
|
||||||
*
|
*
|
||||||
* @returns Promise of UserCredential
|
* @returns Promise of UserCredential
|
||||||
*/
|
*/
|
||||||
export async function linkWithFBCredentialFromAuthError(
|
export async function linkWithFBCredentialFromAuthError(error: unknown) {
|
||||||
user: User,
|
// credential is not null since this function is called after an auth/account-exists-with-different-credential error, ie credentials actually exist
|
||||||
error: unknown
|
|
||||||
) {
|
|
||||||
// Marked as not null since this function is supposed to be called after an auth/account-exists-with-different-credential error, ie credentials actually exist
|
|
||||||
const credentials = OAuthProvider.credentialFromError(error as AuthError)!
|
const credentials = OAuthProvider.credentialFromError(error as AuthError)!
|
||||||
return await linkWithCredential(user, credentials)
|
|
||||||
|
const otherLinkedProviders = (
|
||||||
|
await getSignInMethodsForEmail((error as AuthError).customData.email!)
|
||||||
|
).filter((providerId) => credentials.providerId !== providerId)
|
||||||
|
|
||||||
|
let user: User | null = null
|
||||||
|
|
||||||
|
if (otherLinkedProviders.indexOf("google.com") >= -1) {
|
||||||
|
user = (await signInUserWithGoogle()).user
|
||||||
|
} else if (otherLinkedProviders.indexOf("github.com") >= -1) {
|
||||||
|
user = (await signInUserWithGithub()).user
|
||||||
|
} else if (otherLinkedProviders.indexOf("microsoft.com") >= -1) {
|
||||||
|
user = (await signInUserWithMicrosoft()).user
|
||||||
|
}
|
||||||
|
|
||||||
|
// user is not null since going through each provider will return a user
|
||||||
|
return await linkWithCredential(user!, credentials)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
10
packages/hoppscotch-app/src/helpers/teams/TeamEnvironment.ts
Normal file
10
packages/hoppscotch-app/src/helpers/teams/TeamEnvironment.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { Environment } from "@hoppscotch/data"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines how a Team Environment is represented in the TeamEnvironmentAdapter
|
||||||
|
*/
|
||||||
|
export interface TeamEnvironment {
|
||||||
|
id: string
|
||||||
|
teamID: string
|
||||||
|
environment: Environment
|
||||||
|
}
|
||||||
@@ -0,0 +1,238 @@
|
|||||||
|
import * as E from "fp-ts/Either"
|
||||||
|
import { BehaviorSubject, Subscription } from "rxjs"
|
||||||
|
import { Subscription as WSubscription } from "wonka"
|
||||||
|
import { pipe } from "fp-ts/function"
|
||||||
|
import { GQLError, runGQLQuery, runGQLSubscription } from "../backend/GQLClient"
|
||||||
|
import {
|
||||||
|
GetTeamEnvironmentsDocument,
|
||||||
|
TeamEnvironmentCreatedDocument,
|
||||||
|
TeamEnvironmentDeletedDocument,
|
||||||
|
TeamEnvironmentUpdatedDocument,
|
||||||
|
} from "../backend/graphql"
|
||||||
|
import { TeamEnvironment } from "./TeamEnvironment"
|
||||||
|
|
||||||
|
export default class TeamEnvironmentAdapter {
|
||||||
|
error$: BehaviorSubject<GQLError<string> | null>
|
||||||
|
loading$: BehaviorSubject<boolean>
|
||||||
|
teamEnvironmentList$: BehaviorSubject<TeamEnvironment[]>
|
||||||
|
|
||||||
|
private isDispose: boolean
|
||||||
|
|
||||||
|
private teamEnvironmentCreated$: Subscription | null
|
||||||
|
private teamEnvironmentUpdated$: Subscription | null
|
||||||
|
private teamEnvironmentDeleted$: Subscription | null
|
||||||
|
|
||||||
|
private teamEnvironmentCreatedSub: WSubscription | null
|
||||||
|
private teamEnvironmentUpdatedSub: WSubscription | null
|
||||||
|
private teamEnvironmentDeletedSub: WSubscription | null
|
||||||
|
|
||||||
|
constructor(private teamID: string | undefined) {
|
||||||
|
this.error$ = new BehaviorSubject<GQLError<string> | null>(null)
|
||||||
|
this.loading$ = new BehaviorSubject<boolean>(false)
|
||||||
|
this.teamEnvironmentList$ = new BehaviorSubject<TeamEnvironment[]>([])
|
||||||
|
this.isDispose = true
|
||||||
|
|
||||||
|
this.teamEnvironmentCreated$ = null
|
||||||
|
this.teamEnvironmentDeleted$ = null
|
||||||
|
this.teamEnvironmentUpdated$ = null
|
||||||
|
this.teamEnvironmentCreatedSub = null
|
||||||
|
this.teamEnvironmentDeletedSub = null
|
||||||
|
this.teamEnvironmentUpdatedSub = null
|
||||||
|
|
||||||
|
if (teamID) this.initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
unsubscribeSubscriptions() {
|
||||||
|
this.teamEnvironmentCreated$?.unsubscribe()
|
||||||
|
this.teamEnvironmentDeleted$?.unsubscribe()
|
||||||
|
this.teamEnvironmentUpdated$?.unsubscribe()
|
||||||
|
this.teamEnvironmentCreatedSub?.unsubscribe()
|
||||||
|
this.teamEnvironmentDeletedSub?.unsubscribe()
|
||||||
|
this.teamEnvironmentUpdatedSub?.unsubscribe()
|
||||||
|
}
|
||||||
|
|
||||||
|
changeTeamID(newTeamID: string | undefined) {
|
||||||
|
this.teamID = newTeamID
|
||||||
|
this.teamEnvironmentList$.next([])
|
||||||
|
this.loading$.next(false)
|
||||||
|
|
||||||
|
this.unsubscribeSubscriptions()
|
||||||
|
|
||||||
|
if (this.teamID) this.initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
async initialize() {
|
||||||
|
if (!this.isDispose) throw new Error(`Adapter is already initialized`)
|
||||||
|
|
||||||
|
await this.fetchList()
|
||||||
|
this.registerSubscriptions()
|
||||||
|
}
|
||||||
|
|
||||||
|
public dispose() {
|
||||||
|
if (this.isDispose) throw new Error(`Adapter has been disposed`)
|
||||||
|
|
||||||
|
this.isDispose = true
|
||||||
|
this.unsubscribeSubscriptions()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fetchList() {
|
||||||
|
if (this.teamID === undefined) throw new Error("Team ID is null")
|
||||||
|
|
||||||
|
this.loading$.next(true)
|
||||||
|
|
||||||
|
const results: TeamEnvironment[] = []
|
||||||
|
|
||||||
|
const result = await runGQLQuery({
|
||||||
|
query: GetTeamEnvironmentsDocument,
|
||||||
|
variables: {
|
||||||
|
teamID: this.teamID,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if (E.isLeft(result)) {
|
||||||
|
this.error$.next(result.left)
|
||||||
|
this.loading$.next(false)
|
||||||
|
console.error(result.left)
|
||||||
|
throw new Error(`Failed fetching team environments: ${result.left}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.right.team !== undefined && result.right.team !== null) {
|
||||||
|
results.push(
|
||||||
|
...result.right.team.teamEnvironments.map(
|
||||||
|
(x) =>
|
||||||
|
<TeamEnvironment>{
|
||||||
|
id: x.id,
|
||||||
|
teamID: x.teamID,
|
||||||
|
environment: {
|
||||||
|
name: x.name,
|
||||||
|
variables: JSON.parse(x.variables),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.teamEnvironmentList$.next(results)
|
||||||
|
|
||||||
|
this.loading$.next(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
private createNewTeamEnvironment(newEnvironment: TeamEnvironment) {
|
||||||
|
const teamEnvironments = this.teamEnvironmentList$.value
|
||||||
|
|
||||||
|
teamEnvironments.push(newEnvironment)
|
||||||
|
|
||||||
|
this.teamEnvironmentList$.next(teamEnvironments)
|
||||||
|
}
|
||||||
|
|
||||||
|
private deleteTeamEnvironment(envId: string) {
|
||||||
|
const teamEnvironments = this.teamEnvironmentList$.value.filter(
|
||||||
|
({ id }) => id !== envId
|
||||||
|
)
|
||||||
|
|
||||||
|
this.teamEnvironmentList$.next(teamEnvironments)
|
||||||
|
}
|
||||||
|
|
||||||
|
private updateTeamEnvironment(updatedEnvironment: TeamEnvironment) {
|
||||||
|
const teamEnvironments = this.teamEnvironmentList$.value
|
||||||
|
|
||||||
|
const environmentFound = teamEnvironments.find(
|
||||||
|
({ id }) => id === updatedEnvironment.id
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!environmentFound) return
|
||||||
|
|
||||||
|
Object.assign(environmentFound, updatedEnvironment)
|
||||||
|
|
||||||
|
this.teamEnvironmentList$.next(teamEnvironments)
|
||||||
|
}
|
||||||
|
|
||||||
|
private registerSubscriptions() {
|
||||||
|
if (this.teamID === undefined) return
|
||||||
|
const [teamEnvironmentCreated$, teamEnvironmentCreatedSub] =
|
||||||
|
runGQLSubscription({
|
||||||
|
query: TeamEnvironmentCreatedDocument,
|
||||||
|
variables: {
|
||||||
|
teamID: this.teamID,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
this.teamEnvironmentCreatedSub = teamEnvironmentCreatedSub
|
||||||
|
|
||||||
|
this.teamEnvironmentCreated$ = teamEnvironmentCreated$.subscribe(
|
||||||
|
(result) => {
|
||||||
|
if (E.isLeft(result)) {
|
||||||
|
console.error(result.left)
|
||||||
|
throw new Error(`Team Environment Create Error ${result.left}`)
|
||||||
|
}
|
||||||
|
this.createNewTeamEnvironment(
|
||||||
|
pipe(
|
||||||
|
result.right.teamEnvironmentCreated,
|
||||||
|
(x) =>
|
||||||
|
<TeamEnvironment>{
|
||||||
|
id: x.id,
|
||||||
|
teamID: x.teamID,
|
||||||
|
environment: {
|
||||||
|
name: x.name,
|
||||||
|
variables: JSON.parse(x.variables),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const [teamEnvironmentDeleted$, teamEnvironmentDeletedSub] =
|
||||||
|
runGQLSubscription({
|
||||||
|
query: TeamEnvironmentDeletedDocument,
|
||||||
|
variables: {
|
||||||
|
teamID: this.teamID,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
this.teamEnvironmentDeletedSub = teamEnvironmentDeletedSub
|
||||||
|
|
||||||
|
this.teamEnvironmentDeleted$ = teamEnvironmentDeleted$.subscribe(
|
||||||
|
(result) => {
|
||||||
|
if (E.isLeft(result)) {
|
||||||
|
console.error(result.left)
|
||||||
|
throw new Error(`Team Environment Delete Error ${result.left}`)
|
||||||
|
}
|
||||||
|
this.deleteTeamEnvironment(result.right.teamEnvironmentDeleted.id)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const [teamEnvironmentUpdated$, teamEnvironmentUpdatedSub] =
|
||||||
|
runGQLSubscription({
|
||||||
|
query: TeamEnvironmentUpdatedDocument,
|
||||||
|
variables: {
|
||||||
|
teamID: this.teamID,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
this.teamEnvironmentUpdatedSub = teamEnvironmentUpdatedSub
|
||||||
|
|
||||||
|
this.teamEnvironmentUpdated$ = teamEnvironmentUpdated$.subscribe(
|
||||||
|
(result) => {
|
||||||
|
if (E.isLeft(result)) {
|
||||||
|
console.error(result.left)
|
||||||
|
throw new Error(`Team Environment Update Error ${result.left}`)
|
||||||
|
}
|
||||||
|
this.updateTeamEnvironment(
|
||||||
|
pipe(
|
||||||
|
result.right.teamEnvironmentUpdated,
|
||||||
|
(x) =>
|
||||||
|
<TeamEnvironment>{
|
||||||
|
id: x.id,
|
||||||
|
teamID: x.teamID,
|
||||||
|
environment: {
|
||||||
|
name: x.name,
|
||||||
|
variables: JSON.parse(x.variables),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -254,7 +254,7 @@ function getFinalBodyFromRequest(
|
|||||||
if (request.body.contentType === "multipart/form-data") {
|
if (request.body.contentType === "multipart/form-data") {
|
||||||
return pipe(
|
return pipe(
|
||||||
request.body.body,
|
request.body.body,
|
||||||
A.filter((x) => x.key !== "" && x.active), // Remove empty keys
|
A.filter((x) => (x.key !== "" || x.isFile) && x.active), // Remove empty keys
|
||||||
|
|
||||||
// Sort files down
|
// Sort files down
|
||||||
arraySort((a, b) => {
|
arraySort((a, b) => {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onBeforeMount, ref, watch } from "vue"
|
import { computed, onBeforeMount, onMounted, ref, watch } from "vue"
|
||||||
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"
|
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"
|
||||||
import { Splitpanes, Pane } from "splitpanes"
|
import { Splitpanes, Pane } from "splitpanes"
|
||||||
import "splitpanes/dist/splitpanes.css"
|
import "splitpanes/dist/splitpanes.css"
|
||||||
@@ -66,6 +66,9 @@ import { useSetting } from "@composables/settings"
|
|||||||
import { defineActionHandler } from "~/helpers/actions"
|
import { defineActionHandler } from "~/helpers/actions"
|
||||||
import { hookKeybindingsListener } from "~/helpers/keybindings"
|
import { hookKeybindingsListener } from "~/helpers/keybindings"
|
||||||
import { applySetting } from "~/newstore/settings"
|
import { applySetting } from "~/newstore/settings"
|
||||||
|
import { getLocalConfig, setLocalConfig } from "~/newstore/localpersistence"
|
||||||
|
import { useToast } from "~/composables/toast"
|
||||||
|
import { useI18n } from "~/composables/i18n"
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
@@ -81,6 +84,9 @@ const columnLayout = useSetting("COLUMN_LAYOUT")
|
|||||||
const breakpoints = useBreakpoints(breakpointsTailwind)
|
const breakpoints = useBreakpoints(breakpointsTailwind)
|
||||||
const mdAndLarger = breakpoints.greater("md")
|
const mdAndLarger = breakpoints.greater("md")
|
||||||
|
|
||||||
|
const toast = useToast()
|
||||||
|
const t = useI18n()
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
if (!mdAndLarger.value) {
|
if (!mdAndLarger.value) {
|
||||||
rightSidebar.value = false
|
rightSidebar.value = false
|
||||||
@@ -88,6 +94,32 @@ onBeforeMount(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const cookiesAllowed = getLocalConfig("cookiesAllowed") === "yes"
|
||||||
|
if (!cookiesAllowed) {
|
||||||
|
toast.show(`${t("app.we_use_cookies")}`, {
|
||||||
|
duration: 0,
|
||||||
|
action: [
|
||||||
|
{
|
||||||
|
text: `${t("action.learn_more")}`,
|
||||||
|
onClick: (_, toastObject) => {
|
||||||
|
setLocalConfig("cookiesAllowed", "yes")
|
||||||
|
toastObject.goAway(0)
|
||||||
|
window.open("https://docs.hoppscotch.io/privacy", "_blank")?.focus()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: `${t("action.dismiss")}`,
|
||||||
|
onClick: (_, toastObject) => {
|
||||||
|
setLocalConfig("cookiesAllowed", "yes")
|
||||||
|
toastObject.goAway(0)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
watch(mdAndLarger, () => {
|
watch(mdAndLarger, () => {
|
||||||
if (mdAndLarger.value) rightSidebar.value = true
|
if (mdAndLarger.value) rightSidebar.value = true
|
||||||
else {
|
else {
|
||||||
@@ -96,14 +128,6 @@ watch(mdAndLarger, () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
defineActionHandler("modals.search.toggle", () => {
|
|
||||||
showSearch.value = !showSearch.value
|
|
||||||
})
|
|
||||||
|
|
||||||
defineActionHandler("modals.support.toggle", () => {
|
|
||||||
showSupport.value = !showSupport.value
|
|
||||||
})
|
|
||||||
|
|
||||||
const spacerClass = computed(() => {
|
const spacerClass = computed(() => {
|
||||||
if (fontSize.value === "small" && expandNavigation.value)
|
if (fontSize.value === "small" && expandNavigation.value)
|
||||||
return "spacer-small"
|
return "spacer-small"
|
||||||
@@ -122,6 +146,14 @@ const spacerClass = computed(() => {
|
|||||||
return ""
|
return ""
|
||||||
})
|
})
|
||||||
|
|
||||||
|
defineActionHandler("modals.search.toggle", () => {
|
||||||
|
showSearch.value = !showSearch.value
|
||||||
|
})
|
||||||
|
|
||||||
|
defineActionHandler("modals.support.toggle", () => {
|
||||||
|
showSupport.value = !showSupport.value
|
||||||
|
})
|
||||||
|
|
||||||
defineActionHandler("navigation.jump.rest", () => {
|
defineActionHandler("navigation.jump.rest", () => {
|
||||||
router.push({ path: "/" })
|
router.push({ path: "/" })
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,6 +6,16 @@ import DispatchingStore, {
|
|||||||
defineDispatchers,
|
defineDispatchers,
|
||||||
} from "~/newstore/DispatchingStore"
|
} from "~/newstore/DispatchingStore"
|
||||||
|
|
||||||
|
type SelectedEnvironmentIndex =
|
||||||
|
| { type: "NO_ENV_SELECTED" }
|
||||||
|
| { type: "MY_ENV"; index: number }
|
||||||
|
| {
|
||||||
|
type: "TEAM_ENV"
|
||||||
|
teamID: string
|
||||||
|
teamEnvID: string
|
||||||
|
environment: Environment
|
||||||
|
}
|
||||||
|
|
||||||
const defaultEnvironmentsState = {
|
const defaultEnvironmentsState = {
|
||||||
environments: [
|
environments: [
|
||||||
{
|
{
|
||||||
@@ -16,27 +26,22 @@ const defaultEnvironmentsState = {
|
|||||||
|
|
||||||
globals: [] as Environment["variables"],
|
globals: [] as Environment["variables"],
|
||||||
|
|
||||||
// Current environment index specifies the index
|
selectedEnvironmentIndex: {
|
||||||
// -1 means no environments are selected
|
type: "NO_ENV_SELECTED",
|
||||||
currentEnvironmentIndex: -1,
|
} as SelectedEnvironmentIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
type EnvironmentStore = typeof defaultEnvironmentsState
|
type EnvironmentStore = typeof defaultEnvironmentsState
|
||||||
|
|
||||||
const dispatchers = defineDispatchers({
|
const dispatchers = defineDispatchers({
|
||||||
setCurrentEnviromentIndex(
|
setSelectedEnvironmentIndex(
|
||||||
{ environments }: EnvironmentStore,
|
_: EnvironmentStore,
|
||||||
{ newIndex }: { newIndex: number }
|
{
|
||||||
|
selectedEnvironmentIndex,
|
||||||
|
}: { selectedEnvironmentIndex: SelectedEnvironmentIndex }
|
||||||
) {
|
) {
|
||||||
if (newIndex >= environments.length || newIndex <= -2) {
|
|
||||||
// console.log(
|
|
||||||
// `Ignoring possibly invalid current environment index assignment (value: ${newIndex})`
|
|
||||||
// )
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentEnvironmentIndex: newIndex,
|
selectedEnvironmentIndex,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
appendEnvironments(
|
appendEnvironments(
|
||||||
@@ -90,22 +95,36 @@ const dispatchers = defineDispatchers({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
deleteEnvironment(
|
deleteEnvironment(
|
||||||
{ environments, currentEnvironmentIndex }: EnvironmentStore,
|
{
|
||||||
|
environments,
|
||||||
|
// currentEnvironmentIndex,
|
||||||
|
selectedEnvironmentIndex,
|
||||||
|
}: EnvironmentStore,
|
||||||
{ envIndex }: { envIndex: number }
|
{ envIndex }: { envIndex: number }
|
||||||
) {
|
) {
|
||||||
let newCurrEnvIndex = currentEnvironmentIndex
|
let newCurrEnvIndex = selectedEnvironmentIndex
|
||||||
|
|
||||||
// Scenario 1: Currently Selected Env is removed -> Set currently selected to none
|
// Scenario 1: Currently Selected Env is removed -> Set currently selected to none
|
||||||
if (envIndex === currentEnvironmentIndex) newCurrEnvIndex = -1
|
if (
|
||||||
|
selectedEnvironmentIndex.type === "MY_ENV" &&
|
||||||
|
envIndex === selectedEnvironmentIndex.index
|
||||||
|
)
|
||||||
|
newCurrEnvIndex = { type: "NO_ENV_SELECTED" }
|
||||||
|
|
||||||
// Scenario 2: Currently Selected Env Index > Deletion Index -> Current Selection Index Shifts One Position to the left -> Correct Env Index by moving back 1 index
|
// Scenario 2: Currently Selected Env Index > Deletion Index -> Current Selection Index Shifts One Position to the left -> Correct Env Index by moving back 1 index
|
||||||
if (envIndex < currentEnvironmentIndex)
|
if (
|
||||||
newCurrEnvIndex = currentEnvironmentIndex - 1
|
selectedEnvironmentIndex.type === "MY_ENV" &&
|
||||||
|
envIndex < selectedEnvironmentIndex.index
|
||||||
|
)
|
||||||
|
newCurrEnvIndex = {
|
||||||
|
type: "MY_ENV",
|
||||||
|
index: selectedEnvironmentIndex.index - 1,
|
||||||
|
}
|
||||||
|
|
||||||
// Scenario 3: Currently Selected Env Index < Deletion Index -> No change happens at selection position -> Noop
|
// Scenario 3: Currently Selected Env Index < Deletion Index -> No change happens at selection position -> Noop
|
||||||
return {
|
return {
|
||||||
environments: environments.filter((_, index) => index !== envIndex),
|
environments: environments.filter((_, index) => index !== envIndex),
|
||||||
currentEnvironmentIndex: newCurrEnvIndex,
|
selectedEnvironmentIndex: newCurrEnvIndex,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
renameEnvironment(
|
renameEnvironment(
|
||||||
@@ -263,22 +282,23 @@ export const globalEnv$ = environmentsStore.subject$.pipe(
|
|||||||
distinctUntilChanged()
|
distinctUntilChanged()
|
||||||
)
|
)
|
||||||
|
|
||||||
export const selectedEnvIndex$ = environmentsStore.subject$.pipe(
|
export const selectedEnvironmentIndex$ = environmentsStore.subject$.pipe(
|
||||||
pluck("currentEnvironmentIndex"),
|
pluck("selectedEnvironmentIndex"),
|
||||||
distinctUntilChanged()
|
distinctUntilChanged()
|
||||||
)
|
)
|
||||||
|
|
||||||
export const currentEnvironment$ = environmentsStore.subject$.pipe(
|
export const currentEnvironment$ = environmentsStore.subject$.pipe(
|
||||||
map(({ currentEnvironmentIndex, environments }) => {
|
map(({ environments, selectedEnvironmentIndex }) => {
|
||||||
if (currentEnvironmentIndex === -1) {
|
if (selectedEnvironmentIndex.type === "NO_ENV_SELECTED") {
|
||||||
const env: Environment = {
|
const env: Environment = {
|
||||||
name: "No environment",
|
name: "No environment",
|
||||||
variables: [],
|
variables: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
} else if (selectedEnvironmentIndex.type === "MY_ENV") {
|
||||||
|
return environments[selectedEnvironmentIndex.index]
|
||||||
} else {
|
} else {
|
||||||
return environments[currentEnvironmentIndex]
|
return selectedEnvironmentIndex.environment
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@@ -336,23 +356,35 @@ export function getAggregateEnvs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getCurrentEnvironment(): Environment {
|
export function getCurrentEnvironment(): Environment {
|
||||||
if (environmentsStore.value.currentEnvironmentIndex === -1) {
|
if (
|
||||||
|
environmentsStore.value.selectedEnvironmentIndex.type === "NO_ENV_SELECTED"
|
||||||
|
) {
|
||||||
return {
|
return {
|
||||||
name: "No environment",
|
name: "No environment",
|
||||||
variables: [],
|
variables: [],
|
||||||
}
|
}
|
||||||
}
|
} else if (
|
||||||
|
environmentsStore.value.selectedEnvironmentIndex.type === "MY_ENV"
|
||||||
|
) {
|
||||||
return environmentsStore.value.environments[
|
return environmentsStore.value.environments[
|
||||||
environmentsStore.value.currentEnvironmentIndex
|
environmentsStore.value.selectedEnvironmentIndex.index
|
||||||
]
|
]
|
||||||
|
} else {
|
||||||
|
return environmentsStore.value.selectedEnvironmentIndex.environment
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setCurrentEnvironment(newEnvIndex: number) {
|
export function getSelectedEnvironmentType() {
|
||||||
|
return environmentsStore.value.selectedEnvironmentIndex.type
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setSelectedEnvironmentIndex(
|
||||||
|
selectedEnvironmentIndex: SelectedEnvironmentIndex
|
||||||
|
) {
|
||||||
environmentsStore.dispatch({
|
environmentsStore.dispatch({
|
||||||
dispatcher: "setCurrentEnviromentIndex",
|
dispatcher: "setSelectedEnvironmentIndex",
|
||||||
payload: {
|
payload: {
|
||||||
newIndex: newEnvIndex,
|
selectedEnvironmentIndex,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -539,6 +571,23 @@ export function updateEnvironmentVariable(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getEnvironment(index: number) {
|
type SelectedEnv =
|
||||||
return environmentsStore.value.environments[index]
|
| { type: "NO_ENV_SELECTED" }
|
||||||
|
| { type: "MY_ENV"; index: number }
|
||||||
|
| { type: "TEAM_ENV" }
|
||||||
|
|
||||||
|
export function getEnvironment(selectedEnv: SelectedEnv) {
|
||||||
|
if (selectedEnv.type === "MY_ENV") {
|
||||||
|
return environmentsStore.value.environments[selectedEnv.index]
|
||||||
|
} else if (
|
||||||
|
selectedEnv.type === "TEAM_ENV" &&
|
||||||
|
environmentsStore.value.selectedEnvironmentIndex.type === "TEAM_ENV"
|
||||||
|
) {
|
||||||
|
return environmentsStore.value.selectedEnvironmentIndex.environment
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
name: "N0_ENV",
|
||||||
|
variables: [],
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ import {
|
|||||||
addGlobalEnvVariable,
|
addGlobalEnvVariable,
|
||||||
setGlobalEnvVariables,
|
setGlobalEnvVariables,
|
||||||
globalEnv$,
|
globalEnv$,
|
||||||
selectedEnvIndex$,
|
setSelectedEnvironmentIndex,
|
||||||
setCurrentEnvironment,
|
selectedEnvironmentIndex$,
|
||||||
} from "./environments"
|
} from "./environments"
|
||||||
import {
|
import {
|
||||||
getDefaultRESTRequest,
|
getDefaultRESTRequest,
|
||||||
@@ -224,11 +224,24 @@ function setupSelectedEnvPersistence() {
|
|||||||
),
|
),
|
||||||
O.getOrElse(() => -1) // If all the above conditions pass, we are good, else set default value (-1)
|
O.getOrElse(() => -1) // If all the above conditions pass, we are good, else set default value (-1)
|
||||||
)
|
)
|
||||||
|
// Check if current environment index is -1 ie. no environment is selected
|
||||||
|
if (selectedEnvIndex === -1) {
|
||||||
|
setSelectedEnvironmentIndex({
|
||||||
|
type: "NO_ENV_SELECTED",
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
setSelectedEnvironmentIndex({
|
||||||
|
type: "MY_ENV",
|
||||||
|
index: selectedEnvIndex,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
setCurrentEnvironment(selectedEnvIndex)
|
selectedEnvironmentIndex$.subscribe((envIndex) => {
|
||||||
|
if (envIndex.type === "MY_ENV") {
|
||||||
selectedEnvIndex$.subscribe((index) => {
|
window.localStorage.setItem("selectedEnvIndex", envIndex.index.toString())
|
||||||
window.localStorage.setItem("selectedEnvIndex", index.toString())
|
} else {
|
||||||
|
window.localStorage.setItem("selectedEnvIndex", "-1")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,8 @@
|
|||||||
{{
|
{{
|
||||||
t("team.invited_to_team", {
|
t("team.invited_to_team", {
|
||||||
owner:
|
owner:
|
||||||
inviteDetails.data.right.teamInvitation.creator.displayName,
|
inviteDetails.data.right.teamInvitation.creator.displayName ??
|
||||||
|
inviteDetails.data.right.teamInvitation.creator.email,
|
||||||
team: inviteDetails.data.right.teamInvitation.team.name,
|
team: inviteDetails.data.right.teamInvitation.team.name,
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -37,21 +37,26 @@
|
|||||||
<ProfilePicture
|
<ProfilePicture
|
||||||
v-if="currentUser.photoURL"
|
v-if="currentUser.photoURL"
|
||||||
:url="currentUser.photoURL"
|
:url="currentUser.photoURL"
|
||||||
:alt="currentUser.displayName"
|
:alt="
|
||||||
|
currentUser.displayName || t('profile.default_displayname')
|
||||||
|
"
|
||||||
class="ring-primary ring-4"
|
class="ring-primary ring-4"
|
||||||
size="16"
|
size="16"
|
||||||
rounded="lg"
|
rounded="lg"
|
||||||
/>
|
/>
|
||||||
<ProfilePicture
|
<ProfilePicture
|
||||||
v-else
|
v-else
|
||||||
:initial="currentUser.displayName"
|
:initial="currentUser.displayName || currentUser.email"
|
||||||
rounded="lg"
|
rounded="lg"
|
||||||
size="16"
|
size="16"
|
||||||
class="ring-primary ring-4"
|
class="ring-primary ring-4"
|
||||||
/>
|
/>
|
||||||
<div class="ml-4">
|
<div class="ml-4">
|
||||||
<label class="heading">
|
<label class="heading">
|
||||||
{{ currentUser.displayName || t("state.nothing_found") }}
|
{{
|
||||||
|
currentUser.displayName ||
|
||||||
|
t("profile.default_hopp_displayname")
|
||||||
|
}}
|
||||||
</label>
|
</label>
|
||||||
<p class="flex items-center text-secondaryLight">
|
<p class="flex items-center text-secondaryLight">
|
||||||
{{ currentUser.email }}
|
{{ currentUser.email }}
|
||||||
|
|||||||
1
packages/hoppscotch-app/src/vite-envs.d.ts
vendored
1
packages/hoppscotch-app/src/vite-envs.d.ts
vendored
@@ -16,6 +16,7 @@ interface ImportMetaEnv {
|
|||||||
readonly VITE_MEASUREMENT_ID: string
|
readonly VITE_MEASUREMENT_ID: string
|
||||||
|
|
||||||
readonly VITE_BASE_URL: string
|
readonly VITE_BASE_URL: string
|
||||||
|
readonly VITE_SHORTCODE_BASE_URL: string
|
||||||
|
|
||||||
readonly VITE_BACKEND_GQL_URL: string
|
readonly VITE_BACKEND_GQL_URL: string
|
||||||
readonly VITE_BACKEND_WS_URL: string
|
readonly VITE_BACKEND_WS_URL: string
|
||||||
|
|||||||
136
pnpm-lock.yaml
generated
136
pnpm-lock.yaml
generated
@@ -7,6 +7,7 @@ importers:
|
|||||||
'@commitlint/cli': ^16.2.3
|
'@commitlint/cli': ^16.2.3
|
||||||
'@commitlint/config-conventional': ^16.2.1
|
'@commitlint/config-conventional': ^16.2.1
|
||||||
'@types/node': ^17.0.24
|
'@types/node': ^17.0.24
|
||||||
|
http-server: ^14.1.1
|
||||||
husky: ^7.0.4
|
husky: ^7.0.4
|
||||||
lint-staged: ^12.3.8
|
lint-staged: ^12.3.8
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -16,6 +17,7 @@ importers:
|
|||||||
'@commitlint/cli': 16.3.0
|
'@commitlint/cli': 16.3.0
|
||||||
'@commitlint/config-conventional': 16.2.4
|
'@commitlint/config-conventional': 16.2.4
|
||||||
'@types/node': 17.0.45
|
'@types/node': 17.0.45
|
||||||
|
http-server: 14.1.1
|
||||||
|
|
||||||
packages/codemirror-lang-graphql:
|
packages/codemirror-lang-graphql:
|
||||||
specifiers:
|
specifiers:
|
||||||
@@ -4992,6 +4994,12 @@ packages:
|
|||||||
resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==}
|
resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
|
/async/2.6.4:
|
||||||
|
resolution: {integrity: sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==}
|
||||||
|
dependencies:
|
||||||
|
lodash: 4.17.21
|
||||||
|
dev: true
|
||||||
|
|
||||||
/async/3.2.4:
|
/async/3.2.4:
|
||||||
resolution: {integrity: sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==}
|
resolution: {integrity: sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==}
|
||||||
dev: true
|
dev: true
|
||||||
@@ -5191,6 +5199,13 @@ packages:
|
|||||||
/base64-js/1.5.1:
|
/base64-js/1.5.1:
|
||||||
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
|
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
|
||||||
|
|
||||||
|
/basic-auth/2.0.1:
|
||||||
|
resolution: {integrity: sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==}
|
||||||
|
engines: {node: '>= 0.8'}
|
||||||
|
dependencies:
|
||||||
|
safe-buffer: 5.1.2
|
||||||
|
dev: true
|
||||||
|
|
||||||
/binary-extensions/2.2.0:
|
/binary-extensions/2.2.0:
|
||||||
resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==}
|
resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
@@ -5689,6 +5704,11 @@ packages:
|
|||||||
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
|
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/corser/2.0.1:
|
||||||
|
resolution: {integrity: sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ==}
|
||||||
|
engines: {node: '>= 0.4.0'}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/cosmiconfig-toml-loader/1.0.0:
|
/cosmiconfig-toml-loader/1.0.0:
|
||||||
resolution: {integrity: sha512-H/2gurFWVi7xXvCyvsWRLCMekl4tITJcX0QEsDMpzxtuxDyM59xLatYNg4s/k9AA/HdtCYfj2su8mgA0GSDLDA==}
|
resolution: {integrity: sha512-H/2gurFWVi7xXvCyvsWRLCMekl4tITJcX0QEsDMpzxtuxDyM59xLatYNg4s/k9AA/HdtCYfj2su8mgA0GSDLDA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -5858,6 +5878,17 @@ packages:
|
|||||||
ms: 2.0.0
|
ms: 2.0.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/debug/3.2.7:
|
||||||
|
resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
|
||||||
|
peerDependencies:
|
||||||
|
supports-color: '*'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
supports-color:
|
||||||
|
optional: true
|
||||||
|
dependencies:
|
||||||
|
ms: 2.1.3
|
||||||
|
dev: true
|
||||||
|
|
||||||
/debug/4.3.3_supports-color@8.1.1:
|
/debug/4.3.3_supports-color@8.1.1:
|
||||||
resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==}
|
resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==}
|
||||||
engines: {node: '>=6.0'}
|
engines: {node: '>=6.0'}
|
||||||
@@ -6967,6 +6998,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==}
|
resolution: {integrity: sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/eventemitter3/4.0.7:
|
||||||
|
resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/events/3.3.0:
|
/events/3.3.0:
|
||||||
resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==}
|
resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==}
|
||||||
engines: {node: '>=0.8.x'}
|
engines: {node: '>=0.8.x'}
|
||||||
@@ -7683,6 +7718,13 @@ packages:
|
|||||||
whatwg-encoding: 1.0.5
|
whatwg-encoding: 1.0.5
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/html-encoding-sniffer/3.0.0:
|
||||||
|
resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
whatwg-encoding: 2.0.0
|
||||||
|
dev: true
|
||||||
|
|
||||||
/html-escaper/2.0.2:
|
/html-escaper/2.0.2:
|
||||||
resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}
|
resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}
|
||||||
dev: true
|
dev: true
|
||||||
@@ -7713,10 +7755,44 @@ packages:
|
|||||||
- supports-color
|
- supports-color
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/http-proxy/1.18.1:
|
||||||
|
resolution: {integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==}
|
||||||
|
engines: {node: '>=8.0.0'}
|
||||||
|
dependencies:
|
||||||
|
eventemitter3: 4.0.7
|
||||||
|
follow-redirects: 1.15.1
|
||||||
|
requires-port: 1.0.0
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- debug
|
||||||
|
dev: true
|
||||||
|
|
||||||
/http-reasons/0.1.0:
|
/http-reasons/0.1.0:
|
||||||
resolution: {integrity: sha512-P6kYh0lKZ+y29T2Gqz+RlC9WBLhKe8kDmcJ+A+611jFfxdPsbMRQ5aNmFRM3lENqFkK+HTTL+tlQviAiv0AbLQ==}
|
resolution: {integrity: sha512-P6kYh0lKZ+y29T2Gqz+RlC9WBLhKe8kDmcJ+A+611jFfxdPsbMRQ5aNmFRM3lENqFkK+HTTL+tlQviAiv0AbLQ==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/http-server/14.1.1:
|
||||||
|
resolution: {integrity: sha512-+cbxadF40UXd9T01zUHgA+rlo2Bg1Srer4+B4NwIHdaGxAGGv59nYRnGGDJ9LBk7alpS0US+J+bLLdQOOkJq4A==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
hasBin: true
|
||||||
|
dependencies:
|
||||||
|
basic-auth: 2.0.1
|
||||||
|
chalk: 4.1.2
|
||||||
|
corser: 2.0.1
|
||||||
|
he: 1.2.0
|
||||||
|
html-encoding-sniffer: 3.0.0
|
||||||
|
http-proxy: 1.18.1
|
||||||
|
mime: 1.6.0
|
||||||
|
minimist: 1.2.6
|
||||||
|
opener: 1.5.2
|
||||||
|
portfinder: 1.0.32
|
||||||
|
secure-compare: 3.0.1
|
||||||
|
union: 0.5.0
|
||||||
|
url-join: 4.0.1
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- debug
|
||||||
|
- supports-color
|
||||||
|
dev: true
|
||||||
|
|
||||||
/https-proxy-agent/5.0.1:
|
/https-proxy-agent/5.0.1:
|
||||||
resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==}
|
resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==}
|
||||||
engines: {node: '>= 6'}
|
engines: {node: '>= 6'}
|
||||||
@@ -7767,7 +7843,6 @@ packages:
|
|||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
dependencies:
|
dependencies:
|
||||||
safer-buffer: 2.1.2
|
safer-buffer: 2.1.2
|
||||||
dev: false
|
|
||||||
|
|
||||||
/idb/7.0.1:
|
/idb/7.0.1:
|
||||||
resolution: {integrity: sha512-UUxlE7vGWK5RfB/fDwEGgRf84DY/ieqNha6msMV99UsEMQhJ1RwbCd8AYBj3QMgnE3VZnfQvm4oKVCJTYlqIgg==}
|
resolution: {integrity: sha512-UUxlE7vGWK5RfB/fDwEGgRf84DY/ieqNha6msMV99UsEMQhJ1RwbCd8AYBj3QMgnE3VZnfQvm4oKVCJTYlqIgg==}
|
||||||
@@ -9342,6 +9417,12 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
mime-db: 1.52.0
|
mime-db: 1.52.0
|
||||||
|
|
||||||
|
/mime/1.6.0:
|
||||||
|
resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==}
|
||||||
|
engines: {node: '>=4'}
|
||||||
|
hasBin: true
|
||||||
|
dev: true
|
||||||
|
|
||||||
/mimic-fn/2.1.0:
|
/mimic-fn/2.1.0:
|
||||||
resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==}
|
resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
@@ -9378,6 +9459,10 @@ packages:
|
|||||||
kind-of: 6.0.3
|
kind-of: 6.0.3
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/minimist/1.2.6:
|
||||||
|
resolution: {integrity: sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/mkdirp-promise/1.1.0:
|
/mkdirp-promise/1.1.0:
|
||||||
resolution: {integrity: sha512-xzB0UZFcW1UGS2xkXeDh39jzTP282lb3Vwp4QzCQYmkTn4ysaV5dBdbkOXmhkcE1TQlZebQlgTceaWvDr3oFgw==}
|
resolution: {integrity: sha512-xzB0UZFcW1UGS2xkXeDh39jzTP282lb3Vwp4QzCQYmkTn4ysaV5dBdbkOXmhkcE1TQlZebQlgTceaWvDr3oFgw==}
|
||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
@@ -9386,6 +9471,13 @@ packages:
|
|||||||
mkdirp: '>=0.5.0'
|
mkdirp: '>=0.5.0'
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/mkdirp/0.5.6:
|
||||||
|
resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==}
|
||||||
|
hasBin: true
|
||||||
|
dependencies:
|
||||||
|
minimist: 1.2.6
|
||||||
|
dev: true
|
||||||
|
|
||||||
/mkdirp/1.0.4:
|
/mkdirp/1.0.4:
|
||||||
resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==}
|
resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
@@ -9630,6 +9722,11 @@ packages:
|
|||||||
/openapi-types/12.0.0:
|
/openapi-types/12.0.0:
|
||||||
resolution: {integrity: sha512-6Wd9k8nmGQHgCbehZCP6wwWcfXcvinhybUTBatuhjRsCxUIujuYFZc9QnGeae75CyHASewBtxs0HX/qwREReUw==}
|
resolution: {integrity: sha512-6Wd9k8nmGQHgCbehZCP6wwWcfXcvinhybUTBatuhjRsCxUIujuYFZc9QnGeae75CyHASewBtxs0HX/qwREReUw==}
|
||||||
|
|
||||||
|
/opener/1.5.2:
|
||||||
|
resolution: {integrity: sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==}
|
||||||
|
hasBin: true
|
||||||
|
dev: true
|
||||||
|
|
||||||
/optionator/0.8.3:
|
/optionator/0.8.3:
|
||||||
resolution: {integrity: sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==}
|
resolution: {integrity: sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==}
|
||||||
engines: {node: '>= 0.8.0'}
|
engines: {node: '>= 0.8.0'}
|
||||||
@@ -9905,6 +10002,17 @@ packages:
|
|||||||
find-up: 4.1.0
|
find-up: 4.1.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/portfinder/1.0.32:
|
||||||
|
resolution: {integrity: sha512-on2ZJVVDXRADWE6jnQaX0ioEylzgBpQk8r55NE4wjXW1ZxO+BgDlY6DXwj20i0V8eB4SenDQ00WEaxfiIQPcxg==}
|
||||||
|
engines: {node: '>= 0.12.0'}
|
||||||
|
dependencies:
|
||||||
|
async: 2.6.4
|
||||||
|
debug: 3.2.7
|
||||||
|
mkdirp: 0.5.6
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
dev: true
|
||||||
|
|
||||||
/postcss-load-config/3.1.4:
|
/postcss-load-config/3.1.4:
|
||||||
resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==}
|
resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
@@ -10296,6 +10404,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==}
|
resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/requires-port/1.0.0:
|
||||||
|
resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/resolve-cwd/3.0.0:
|
/resolve-cwd/3.0.0:
|
||||||
resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==}
|
resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
@@ -10524,6 +10636,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-MuCAyrGZcTLfQoH2XoBlQ8C6bzwN88XT/0slOGz0pn8+gIP85BOAfYa44ZXQUTOwRwPU0QvgU+V+OSajl/59Xg==}
|
resolution: {integrity: sha512-MuCAyrGZcTLfQoH2XoBlQ8C6bzwN88XT/0slOGz0pn8+gIP85BOAfYa44ZXQUTOwRwPU0QvgU+V+OSajl/59Xg==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/secure-compare/3.0.1:
|
||||||
|
resolution: {integrity: sha512-AckIIV90rPDcBcglUwXPF3kg0P0qmPsPXAj6BBEENQE1p5yA1xfmDJzfi1Tappj37Pv2mVbKpL3Z1T+Nn7k1Qw==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/selenium-webdriver/4.1.2:
|
/selenium-webdriver/4.1.2:
|
||||||
resolution: {integrity: sha512-e4Ap8vQvhipgBB8Ry9zBiKGkU6kHKyNnWiavGGLKkrdW81Zv7NVMtFOL/j3yX0G8QScM7XIXijKssNd4EUxSOw==}
|
resolution: {integrity: sha512-e4Ap8vQvhipgBB8Ry9zBiKGkU6kHKyNnWiavGGLKkrdW81Zv7NVMtFOL/j3yX0G8QScM7XIXijKssNd4EUxSOw==}
|
||||||
engines: {node: '>= 10.15.0'}
|
engines: {node: '>= 10.15.0'}
|
||||||
@@ -11587,6 +11703,13 @@ packages:
|
|||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/union/0.5.0:
|
||||||
|
resolution: {integrity: sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==}
|
||||||
|
engines: {node: '>= 0.8.0'}
|
||||||
|
dependencies:
|
||||||
|
qs: 6.11.0
|
||||||
|
dev: true
|
||||||
|
|
||||||
/unique-string/2.0.0:
|
/unique-string/2.0.0:
|
||||||
resolution: {integrity: sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==}
|
resolution: {integrity: sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
@@ -11751,6 +11874,10 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
punycode: 2.1.1
|
punycode: 2.1.1
|
||||||
|
|
||||||
|
/url-join/4.0.1:
|
||||||
|
resolution: {integrity: sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/url/0.11.0:
|
/url/0.11.0:
|
||||||
resolution: {integrity: sha512-kbailJa29QrtXnxgq+DdCEGlbTeYM2eJUxsz6vjZavrCYPMIFHMKQmSKYAIuUK2i7hgPm28a8piX5NTUtM/LKQ==}
|
resolution: {integrity: sha512-kbailJa29QrtXnxgq+DdCEGlbTeYM2eJUxsz6vjZavrCYPMIFHMKQmSKYAIuUK2i7hgPm28a8piX5NTUtM/LKQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -12259,6 +12386,13 @@ packages:
|
|||||||
iconv-lite: 0.4.24
|
iconv-lite: 0.4.24
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/whatwg-encoding/2.0.0:
|
||||||
|
resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
iconv-lite: 0.6.3
|
||||||
|
dev: true
|
||||||
|
|
||||||
/whatwg-fetch/2.0.4:
|
/whatwg-fetch/2.0.4:
|
||||||
resolution: {integrity: sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==}
|
resolution: {integrity: sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|||||||
Reference in New Issue
Block a user