fix: regression in bulk mode to key-value pair translation

This commit is contained in:
liyasthomas
2021-11-19 08:52:58 +05:30
parent fe7b236ad9
commit 1572ff9e67
4 changed files with 32 additions and 24 deletions

View File

@@ -129,7 +129,7 @@
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title="$t('action.clear_all')" :title="$t('action.clear_all')"
svg="trash-2" svg="trash-2"
@click.native="bulkMode ? clearBulkEditor() : clearContent()" @click.native="clearContent()"
/> />
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
@@ -335,7 +335,7 @@ watch(bulkHeaders, () => {
value: item.substring(item.indexOf(":") + 1).trim(), value: item.substring(item.indexOf(":") + 1).trim(),
active: !item.trim().startsWith("//"), active: !item.trim().startsWith("//"),
})) }))
setGQLHeaders(transformation) setGQLHeaders(transformation as GQLHeader[])
} catch (e) { } catch (e) {
$toast.error(`${t("error.something_went_wrong")}`, { $toast.error(`${t("error.something_went_wrong")}`, {
icon: "error_outline", icon: "error_outline",
@@ -392,12 +392,13 @@ const showSaveRequestModal = ref(false)
watch( watch(
headers, headers,
() => { () => {
if ( if (!bulkMode.value)
(headers.value[headers.value.length - 1]?.key !== "" || if (
headers.value[headers.value.length - 1]?.value !== "") && (headers.value[headers.value.length - 1]?.key !== "" ||
headers.value.length headers.value[headers.value.length - 1]?.value !== "") &&
) headers.value.length
addRequestHeader() )
addRequestHeader()
}, },
{ deep: true } { deep: true }
) )

View File

@@ -28,7 +28,7 @@
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title="$t('action.clear_all')" :title="$t('action.clear_all')"
svg="trash-2" svg="trash-2"
@click.native="bulkMode ? clearBulkEditor() : clearContent()" @click.native="clearContent()"
/> />
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
@@ -212,7 +212,7 @@ watch(bulkHeaders, () => {
value: item.substring(item.indexOf(":") + 1).trim(), value: item.substring(item.indexOf(":") + 1).trim(),
active: !item.trim().startsWith("//"), active: !item.trim().startsWith("//"),
})) }))
setRESTHeaders(transformation) setRESTHeaders(transformation as HoppRESTHeader[])
} catch (e) { } catch (e) {
$toast.error(`${t("error.something_went_wrong")}`, { $toast.error(`${t("error.something_went_wrong")}`, {
icon: "error_outline", icon: "error_outline",
@@ -226,12 +226,13 @@ const headers$ = useReadonlyStream(restHeaders$, [])
watch( watch(
headers$, headers$,
(newValue) => { (newValue) => {
if ( if (!bulkMode.value)
(newValue[newValue.length - 1]?.key !== "" || if (
newValue[newValue.length - 1]?.value !== "") && (newValue[newValue.length - 1]?.key !== "" ||
newValue.length newValue[newValue.length - 1]?.value !== "") &&
) newValue.length
addHeader() )
addHeader()
}, },
{ deep: true } { deep: true }
) )

View File

@@ -28,7 +28,7 @@
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title="$t('action.clear_all')" :title="$t('action.clear_all')"
svg="trash-2" svg="trash-2"
@click.native="bulkMode ? clearBulkEditor() : clearContent()" @click.native="clearContent()"
/> />
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
@@ -194,7 +194,7 @@ watch(bulkParams, () => {
value: item.substring(item.indexOf(":") + 1).trim(), value: item.substring(item.indexOf(":") + 1).trim(),
active: !item.trim().startsWith("//"), active: !item.trim().startsWith("//"),
})) }))
setRESTParams(transformation) setRESTParams(transformation as HoppRESTParam[])
} catch (e) { } catch (e) {
$toast.error(`${t("error.something_went_wrong")}`, { $toast.error(`${t("error.something_went_wrong")}`, {
icon: "error_outline", icon: "error_outline",
@@ -219,12 +219,13 @@ const params$ = useReadonlyStream(restParams$, [])
watch( watch(
params$, params$,
(newValue) => { (newValue) => {
if ( if (!bulkMode.value)
(newValue[newValue.length - 1]?.key !== "" || if (
newValue[newValue.length - 1]?.value !== "") && (newValue[newValue.length - 1]?.key !== "" ||
newValue.length newValue[newValue.length - 1]?.value !== "") &&
) newValue.length
addParam() )
addParam()
}, },
{ deep: true } { deep: true }
) )

View File

@@ -128,6 +128,11 @@ export const baseTheme = EditorView.theme({
".cm-scroller::-webkit-scrollbar": { ".cm-scroller::-webkit-scrollbar": {
display: "none", display: "none",
}, },
".cm-foldPlaceholder": {
backgroundColor: "var(--divider-light-color)",
color: "var(--secondary-dark-color)",
borderColor: "var(--divider-dark-color)",
},
}) })
const editorTypeColor = "var(--editor-type-color)" const editorTypeColor = "var(--editor-type-color)"