Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
feat: init bulk edit
liyasthomasd8881ba6a395
diff --git a/assets/scss/styles.scss b/assets/scss/styles.scssindex 686631a90..bb7215a74 100644--- a/assets/scss/styles.scss+++ b/assets/scss/styles.scss@@ -35,12 +35,14 @@@apply text-accentContrast;}-input::placeholder {+input::placeholder,+textarea::placeholder {@apply text-secondaryDark;@apply opacity-25;}-input {+input,+textarea {@apply text-secondaryDark;@apply font-medium;}diff --git a/components/http/Headers.vue b/components/http/Headers.vueindex 924a2fdd3..cd7f6cade 100644--- a/components/http/Headers.vue+++ b/components/http/Headers.vue@@ -28,28 +28,56 @@v-tippy="{ theme: 'tooltip' }":title="$t('action.clear_all')"svg="trash-2"+ :disabled="bulkMode"@click.native="clearContent"/>+ <ButtonSecondary+ v-tippy="{ theme: 'tooltip' }"+ :title="$t('state.bulk_mode')"+ svg="edit"+ :class="{ '!text-accent': bulkMode }"+ @click.native="bulkMode = !bulkMode"+ /><ButtonSecondaryv-tippy="{ theme: 'tooltip' }":title="$t('add.new')"svg="plus"+ :disabled="bulkMode"@click.native="addHeader"/></div></div>- <div- v-for="(header, index) in headers$"- :key="`header-${index}`"- class="divide-x divide-dividerLight border-b border-dividerLight flex"- >- <SmartAutoComplete- :placeholder="$t('count.header', { count: index + 1 })"- :source="commonHeaders"- :spellcheck="false"- :value="header.key"- autofocus- styles="+ <div v-if="bulkMode" class="flex">+ <textarea+ name="bulk-parameters"+ class="+ bg-transparent border-b+ border-dividerLight flex+ flex-1+ py-2+ px-4+ whitespace-pre+ resize-y+ overflow-auto+ "+ rows="10"+ :placeholder="$t('state.bulk_mode_placeholder')"+ v-focus+ ></textarea>+ </div>+ <div v-else>+ <div+ v-for="(header, index) in headers$"+ :key="`header-${index}`"+ class="divide-x divide-dividerLight border-b border-dividerLight flex"+ >+ <SmartAutoComplete+ :placeholder="$t('count.header', { count: index + 1 })"+ :source="commonHeaders"+ :spellcheck="false"+ :value="header.key"+ autofocus+ styles="bg-transparentflexflex-1@@ -57,104 +85,113 @@px-4truncate"- :class="{ '!flex flex-1': EXPERIMENTAL_URL_BAR_ENABLED }"- @input="- updateHeader(index, {- key: $event,- value: header.value,- active: header.active,- })- "- />- <SmartEnvInput- v-if="EXPERIMENTAL_URL_BAR_ENABLED"- v-model="header.value"- :placeholder="$t('count.value', { count: index + 1 })"- styles="+ :class="{ '!flex flex-1': EXPERIMENTAL_URL_BAR_ENABLED }"+ @input="+ updateHeader(index, {+ key: $event,+ value: header.value,+ active: header.active,+ })+ "+ />+ <SmartEnvInput+ v-if="EXPERIMENTAL_URL_BAR_ENABLED"+ v-model="header.value"+ :placeholder="$t('count.value', { count: index + 1 })"+ styles="bg-transparentflexflex-1py-1px-4"- @change="- updateHeader(index, {- key: header.key,- value: $event,- active: header.active,- })- "- />- <input- v-else- class="bg-transparent flex flex-1 py-2 px-4"- :placeholder="$t('count.value', { count: index + 1 })"- :name="'value' + index"- :value="header.value"- @change="- updateHeader(index, {- key: header.key,- value: $event.target.value,- active: header.active,- })- "- />- <span>- <ButtonSecondary- v-tippy="{ theme: 'tooltip' }"- :title="- header.hasOwnProperty('active')- ? header.active- ? $t('action.turn_off')- : $t('action.turn_on')- : $t('action.turn_off')- "- :svg="- header.hasOwnProperty('active')- ? header.active- ? 'check-circle'- : 'circle'- : 'check-circle'+ @change="+ updateHeader(index, {+ key: header.key,+ value: $event,+ active: header.active,+ })"- color="green"- @click.native="+ />+ <input+ v-else+ class="bg-transparent flex flex-1 py-2 px-4"+ :placeholder="$t('count.value', { count: index + 1 })"+ :name="'value' + index"+ :value="header.value"+ @change="updateHeader(index, {key: header.key,- value: header.value,- active: header.hasOwnProperty('active') ? !header.active : false,+ value: $event.target.value,+ active: header.active,})"/>- </span>- <span>+ <span>+ <ButtonSecondary+ v-tippy="{ theme: 'tooltip' }"+ :title="+ header.hasOwnProperty('active')+ ? header.active+ ? $t('action.turn_off')+ : $t('action.turn_on')+ : $t('action.turn_off')+ "+ :svg="+ header.hasOwnProperty('active')+ ? header.active+ ? 'check-circle'+ : 'circle'+ : 'check-circle'+ "+ color="green"+ @click.native="+ updateHeader(index, {+ key: header.key,+ value: header.value,+ active: header.hasOwnProperty('active')+ ? !header.active+ : false,+ })+ "+ />+ </span>+ <span>+ <ButtonSecondary+ v-tippy="{ theme: 'tooltip' }"+ :title="$t('action.remove')"+ svg="trash"+ color="red"+ @click.native="deleteHeader(index)"+ />+ </span>+ </div>+ <div+ v-if="headers$.length === 0"+ class="+ flex flex-col+ text-secondaryLight+ p-4+ items-center+ justify-center+ "+ >+ <span class="text-center pb-4">+ {{ $t("empty.headers") }}+ </span><ButtonSecondary- v-tippy="{ theme: 'tooltip' }"- :title="$t('action.remove')"- svg="trash"- color="red"- @click.native="deleteHeader(index)"+ filled+ :label="$t('add.new')"+ svg="plus"+ @click.native="addHeader"/>- </span>- </div>- <div- v-if="headers$.length === 0"- class="flex flex-col text-secondaryLight p-4 items-center justify-center"- >- <span class="text-center pb-4">- {{ $t("empty.headers") }}- </span>- <ButtonSecondary- filled- :label="$t('add.new')"- svg="plus"- @click.native="addHeader"- />+ </div></div></AppSection></template><script lang="ts">-import { defineComponent } from "@nuxtjs/composition-api"+import { defineComponent, ref } from "@nuxtjs/composition-api"import {restHeaders$,addRESTHeader,@@ -169,9 +206,11 @@ import { HoppRESTHeader } from "~/helpers/types/HoppRESTRequest"export default defineComponent({setup() {+ const bulkMode = ref(false)return {headers$: useReadonlyStream(restHeaders$, []),EXPERIMENTAL_URL_BAR_ENABLED: useSetting("EXPERIMENTAL_URL_BAR_ENABLED"),+ bulkMode,}},data() {diff --git a/components/http/Parameters.vue b/components/http/Parameters.vueindex 860847572..ae7cf096d 100644--- a/components/http/Parameters.vue+++ b/components/http/Parameters.vue@@ -28,144 +28,179 @@v-tippy="{ theme: 'tooltip' }":title="$t('action.clear_all')"svg="trash-2"+ :disabled="bulkMode"@click.native="clearContent"/>+ <ButtonSecondary+ v-tippy="{ theme: 'tooltip' }"+ :title="$t('state.bulk_mode')"+ svg="edit"+ :class="{ '!text-accent': bulkMode }"+ @click.native="bulkMode = !bulkMode"+ /><ButtonSecondaryv-tippy="{ theme: 'tooltip' }":title="$t('add.new')"svg="plus"+ :disabled="bulkMode"@click.native="addParam"/></div></div>- <div- v-for="(param, index) in params$"- :key="`param-${index}`"- class="divide-x divide-dividerLight border-b border-dividerLight flex"- >- <SmartEnvInput- v-if="EXPERIMENTAL_URL_BAR_ENABLED"- v-model="param.key"- :placeholder="$t('count.parameter', { count: index + 1 })"- styles="+ <div v-if="bulkMode" class="flex">+ <textarea+ name="bulk-parameters"+ class="+ bg-transparent+ border-b border-dividerLight+ flex flex-1+ py-2+ px-4+ whitespace-pre+ resize-y+ overflow-auto+ "+ rows="10"+ :placeholder="$t('state.bulk_mode_placeholder')"+ v-focus+ ></textarea>+ </div>+ <div v-else>+ <div+ v-for="(param, index) in params$"+ :key="`param-${index}`"+ class="divide-x divide-dividerLight border-b border-dividerLight flex"+ >+ <SmartEnvInput+ v-if="EXPERIMENTAL_URL_BAR_ENABLED"+ v-model="param.key"+ :placeholder="$t('count.parameter', { count: index + 1 })"+ styles="bg-transparentflexflex-1py-1px-4"- @change="- updateParam(index, {- key: $event,- value: param.value,- active: param.active,- })- "- />- <input- v-else- class="bg-transparent flex flex-1 py-2 px-4"- :placeholder="$t('count.parameter', { count: index + 1 })"- :name="'param' + index"- :value="param.key"- autofocus- @change="- updateParam(index, {- key: $event.target.value,- value: param.value,- active: param.active,- })- "- />- <SmartEnvInput- v-if="EXPERIMENTAL_URL_BAR_ENABLED"- v-model="param.value"- :placeholder="$t('count.value', { count: index + 1 })"- styles="+ @change="+ updateParam(index, {+ key: $event,+ value: param.value,+ active: param.active,+ })+ "+ />+ <input+ v-else+ class="bg-transparent flex flex-1 py-2 px-4"+ :placeholder="$t('count.parameter', { count: index + 1 })"+ :name="'param' + index"+ :value="param.key"+ autofocus+ @change="+ updateParam(index, {+ key: $event.target.value,+ value: param.value,+ active: param.active,+ })+ "+ />+ <SmartEnvInput+ v-if="EXPERIMENTAL_URL_BAR_ENABLED"+ v-model="param.value"+ :placeholder="$t('count.value', { count: index + 1 })"+ styles="bg-transparentflexflex-1py-1px-4"- @change="- updateParam(index, {- key: param.key,- value: $event,- active: param.active,- })- "- />- <input- v-else- class="bg-transparent flex flex-1 py-2 px-4"- :placeholder="$t('count.value', { count: index + 1 })"- :name="'value' + index"- :value="param.value"- @change="- updateParam(index, {- key: param.key,- value: $event.target.value,- active: param.active,- })- "- />- <span>- <ButtonSecondary- v-tippy="{ theme: 'tooltip' }"- :title="- param.hasOwnProperty('active')- ? param.active- ? $t('action.turn_off')- : $t('action.turn_on')- : $t('action.turn_off')- "- :svg="- param.hasOwnProperty('active')- ? param.active- ? 'check-circle'- : 'circle'- : 'check-circle'+ @change="+ updateParam(index, {+ key: param.key,+ value: $event,+ active: param.active,+ })"- color="green"- @click.native="+ />+ <input+ v-else+ class="bg-transparent flex flex-1 py-2 px-4"+ :placeholder="$t('count.value', { count: index + 1 })"+ :name="'value' + index"+ :value="param.value"+ @change="updateParam(index, {key: param.key,- value: param.value,- active: param.hasOwnProperty('active') ? !param.active : false,+ value: $event.target.value,+ active: param.active,})"/>- </span>- <span>+ <span>+ <ButtonSecondary+ v-tippy="{ theme: 'tooltip' }"+ :title="+ param.hasOwnProperty('active')+ ? param.active+ ? $t('action.turn_off')+ : $t('action.turn_on')+ : $t('action.turn_off')+ "+ :svg="+ param.hasOwnProperty('active')+ ? param.active+ ? 'check-circle'+ : 'circle'+ : 'check-circle'+ "+ color="green"+ @click.native="+ updateParam(index, {+ key: param.key,+ value: param.value,+ active: param.hasOwnProperty('active') ? !param.active : false,+ })+ "+ />+ </span>+ <span>+ <ButtonSecondary+ v-tippy="{ theme: 'tooltip' }"+ :title="$t('action.remove')"+ svg="trash"+ color="red"+ @click.native="deleteParam(index)"+ />+ </span>+ </div>+ <div+ v-if="params$.length === 0"+ class="+ flex flex-col+ text-secondaryLight+ p-4+ items-center+ justify-center+ "+ >+ <span class="text-center pb-4">+ {{ $t("empty.parameters") }}+ </span><ButtonSecondary- v-tippy="{ theme: 'tooltip' }"- :title="$t('action.remove')"- svg="trash"- color="red"- @click.native="deleteParam(index)"+ :label="$t('add.new')"+ svg="plus"+ filled+ @click.native="addParam"/>- </span>- </div>- <div- v-if="params$.length === 0"- class="flex flex-col text-secondaryLight p-4 items-center justify-center"- >- <span class="text-center pb-4">- {{ $t("empty.parameters") }}- </span>- <ButtonSecondary- :label="$t('add.new')"- svg="plus"- filled- @click.native="addParam"- />+ </div></div></AppSection></template><script lang="ts">-import { defineComponent } from "@nuxtjs/composition-api"+import { defineComponent, ref } from "@nuxtjs/composition-api"import { HoppRESTParam } from "~/helpers/types/HoppRESTRequest"import { useReadonlyStream } from "~/helpers/utils/composables"import {@@ -179,9 +214,11 @@ import { useSetting } from "~/newstore/settings"export default defineComponent({setup() {+ const bulkMode = ref(false)return {params$: useReadonlyStream(restParams$, []),EXPERIMENTAL_URL_BAR_ENABLED: useSetting("EXPERIMENTAL_URL_BAR_ENABLED"),+ bulkMode,}},watch: {diff --git a/locales/en.json b/locales/en.jsonindex f2aefd169..e2b1110ff 100644--- a/locales/en.json+++ b/locales/en.json@@ -403,6 +403,8 @@"url": "URL"},"state": {+ "bulk_mode": "Bulk edit",+ "bulk_mode_placeholder": "Entries are separated by newline\nKeys and values are separated by :","cleared": "Cleared","connected": "Connected","connected_to": "Connected to {name}",