feat: revamp graphql sidebar ui

This commit is contained in:
liyasthomas
2021-07-08 23:42:15 +05:30
parent f1ef403c83
commit c6490818d0
21 changed files with 708 additions and 620 deletions

View File

@@ -187,6 +187,23 @@ select {
} }
} }
.select-wrapper {
@apply relative;
@apply w-full;
&::after {
@apply inline-block;
@apply absolute;
@apply pointer-events-none;
@apply font-icon;
@apply text-secondaryLight;
@apply top-3;
@apply right-3;
content: "\e313";
}
}
input[type="checkbox"] { input[type="checkbox"] {
@apply hidden; @apply hidden;

View File

@@ -12,39 +12,41 @@
:label="'Team Collections'" :label="'Team Collections'"
> >
<SmartIntersection @intersecting="onTeamSelectIntersect"> <SmartIntersection @intersecting="onTeamSelectIntersect">
<select <div class="select-wrapper">
id="team" <select
type="text" id="team"
autofocus type="text"
class=" autofocus
flex class="
w-full flex
px-4 w-full
text-xs px-4
py-2 text-xs
focus:outline-none py-3
border-b border-dividerLight focus:outline-none
bg-primary border-b border-dividerLight
" bg-primaryLight
@change="updateSelectedTeam(myTeams[$event.target.value])" "
> @change="updateSelectedTeam(myTeams[$event.target.value])"
<option
:key="undefined"
:value="undefined"
hidden
disabled
selected
> >
Select team <option
</option> :key="undefined"
<option :value="undefined"
v-for="(team, index) in myTeams" hidden
:key="index" disabled
:value="index" selected
> >
{{ team.name }} Select team
</option> </option>
</select> <option
v-for="(team, index) in myTeams"
:key="index"
:value="index"
>
{{ team.name }}
</option>
</select>
</div>
</SmartIntersection> </SmartIntersection>
</SmartTab> </SmartTab>
</SmartTabs> </SmartTabs>

View File

@@ -1,7 +1,7 @@
<template> <template>
<div> <div class="flex flex-col" :class="[{ 'bg-primaryLight': dragging }]">
<div <div
:class="[{ 'bg-primaryDark': dragging }]" class="flex items-center group"
@dragover.prevent @dragover.prevent
@drop.prevent="dropEvent" @drop.prevent="dropEvent"
@dragover="dragging = true" @dragover="dragging = true"
@@ -9,134 +9,145 @@
@dragleave="dragging = false" @dragleave="dragging = false"
@dragend="dragging = false" @dragend="dragging = false"
> >
<span
class="
flex
justify-center
items-center
text-xs
w-10
truncate
cursor-pointer
"
@click="toggleShowChildren()"
>
<i class="material-icons" :class="{ 'text-green-400': isSelected }">
{{ getCollectionIcon }}
</i>
</span>
<span
class="
py-3
cursor-pointer
pr-2
flex flex-1
min-w-0
text-xs
group-hover:text-secondaryDark
transition
"
@click="toggleShowChildren()"
>
<span class="truncate"> {{ collection.name }} </span>
</span>
<ButtonSecondary <ButtonSecondary
:label="collection.name" v-tippy="{ theme: 'tooltip' }"
@click.native="toggleShowChildren" icon="create_new_folder"
:title="$t('new_folder')"
class="group-hover:inline-flex hidden"
@click.native="
$emit('add-folder', {
path: `${collectionIndex}`,
})
"
/> />
<i v-show="!showChildren && !isFiltered" class="material-icons" <tippy
>arrow_right</i ref="options"
interactive
tabindex="-1"
trigger="click"
theme="popover"
arrow
> >
<i v-show="showChildren || isFiltered" class="material-icons" <template #trigger>
>arrow_drop_down</i <ButtonSecondary
> v-tippy="{ theme: 'tooltip' }"
<i v-if="isSelected" class="mx-3 text-green-400 material-icons" :title="$t('more')"
>check_circle</i icon="more_vert"
> />
<i v-else class="material-icons">folder</i> </template>
<div> <SmartItem
<ButtonSecondary icon="create_new_folder"
v-if="doc" :label="$t('new_folder')"
v-tippy="{ theme: 'tooltip' }" @click.native="
:title="$t('import')" $emit('add-folder', {
icon="topic" path: `${collectionIndex}`,
@click.native="$emit('select-collection')" })
$refs.options.tippy().hide()
"
/> />
<tippy <SmartItem
ref="options" icon="create"
interactive :label="$t('edit')"
tabindex="-1" @click.native="
trigger="click" $emit('edit-collection')
theme="popover" $refs.options.tippy().hide()
arrow "
> />
<template #trigger> <SmartItem
<ButtonSecondary icon="delete"
v-tippy="{ theme: 'tooltip' }" :label="$t('delete')"
:title="$t('more')" @click.native="
icon="more_vert" confirmRemove = true
/> $refs.options.tippy().hide()
</template> "
<SmartItem />
icon="create_new_folder" </tippy>
:label="$t('new_folder')"
@click.native="
$emit('add-folder', {
path: `${collectionIndex}`,
})
$refs.options.tippy().hide()
"
/>
<SmartItem
icon="create"
:label="$t('edit')"
@click.native="
$emit('edit-collection')
$refs.options.tippy().hide()
"
/>
<SmartItem
icon="delete"
:label="$t('delete')"
@click.native="
confirmRemove = true
$refs.options.tippy().hide()
"
/>
</tippy>
</div>
</div> </div>
<div v-show="showChildren || isFiltered"> <div v-show="showChildren || isFiltered">
<ul class="flex-col"> <CollectionsGraphqlFolder
<li v-for="(folder, index) in collection.folders"
v-for="(folder, index) in collection.folders" :key="folder.name"
:key="folder.name" class="ml-5 border-l border-dividerLight"
class="ml-5 border-l border-dividerLight" :picked="picked"
> :saving-mode="savingMode"
<CollectionsGraphqlFolder :folder="folder"
:picked="picked" :folder-index="index"
:saving-mode="savingMode" :folder-path="`${collectionIndex}/${index}`"
:folder="folder" :collection-index="collectionIndex"
:folder-index="index" :doc="doc"
:folder-path="`${collectionIndex}/${index}`" :is-filtered="isFiltered"
:collection-index="collectionIndex" @add-folder="$emit('add-folder', $event)"
:doc="doc" @edit-folder="$emit('edit-folder', $event)"
:is-filtered="isFiltered" @edit-request="$emit('edit-request', $event)"
@add-folder="$emit('add-folder', $event)" @select="$emit('select', $event)"
@edit-folder="$emit('edit-folder', $event)" />
@edit-request="$emit('edit-request', $event)" <CollectionsGraphqlRequest
@select="$emit('select', $event)" v-for="(request, index) in collection.requests"
/> :key="index"
</li> class="ml-5 border-l border-dividerLight"
</ul> :picked="picked"
<ul class="flex-col"> :saving-mode="savingMode"
<li :request="request"
v-for="(request, index) in collection.requests" :collection-index="collectionIndex"
:key="index" :folder-index="-1"
class="ml-5 border-l border-dividerLight" :folder-name="collection.name"
> :folder-path="`${collectionIndex}`"
<CollectionsGraphqlRequest :request-index="index"
:picked="picked" :doc="doc"
:saving-mode="savingMode" @edit-request="$emit('edit-request', $event)"
:request="request" @select="$emit('select', $event)"
:collection-index="collectionIndex" />
:folder-index="-1" <div
:folder-name="collection.name" v-if="
:folder-path="`${collectionIndex}`" collection.folders.length === 0 && collection.requests.length === 0
:request-index="index" "
:doc="doc" class="
@edit-request="$emit('edit-request', $event)" flex
@select="$emit('select', $event)" items-center
/> text-secondaryLight
</li> flex-col
</ul> p-4
<ul> justify-center
<li ml-5
v-if=" border-l border-dividerLight
collection.folders.length === 0 && collection.requests.length === 0 "
" >
class=" <i class="material-icons opacity-50 pb-2">folder_open</i>
ml-5 <span class="text-xs">
border-l border-dividerLight {{ $t("collection_empty") }}
ml-5 </span>
border-l border-dividerLight </div>
"
>
<p>
<i class="material-icons">not_interested</i>
{{ $t("collection_empty") }}
</p>
</li>
</ul>
</div> </div>
<SmartConfirmModal <SmartConfirmModal
:show="confirmRemove" :show="confirmRemove"
@@ -180,6 +191,12 @@ export default Vue.extend({
this.picked.collectionIndex === this.collectionIndex this.picked.collectionIndex === this.collectionIndex
) )
}, },
getCollectionIcon() {
if (this.isSelected) return "check_circle"
else if (!this.showChildren && !this.isFiltered) return "arrow_right"
else if (this.showChildren || this.isFiltered) return "arrow_drop_down"
else return "folder"
},
}, },
methods: { methods: {
pick() { pick() {

View File

@@ -1,7 +1,7 @@
<template> <template>
<div> <div class="flex flex-col" :class="[{ 'bg-primaryLight': dragging }]">
<div <div
:class="[{ 'bg-primaryDark': dragging }]" class="flex items-center group"
@dragover.prevent @dragover.prevent
@drop.prevent="dropEvent" @drop.prevent="dropEvent"
@dragover="dragging = true" @dragover="dragging = true"
@@ -9,20 +9,46 @@
@dragleave="dragging = false" @dragleave="dragging = false"
@dragend="dragging = false" @dragend="dragging = false"
> >
<div> <span
<ButtonSecondary @click.native="toggleShowChildren" /> class="
<i v-show="!showChildren && !isFiltered" class="material-icons" flex
>arrow_right</i justify-center
> items-center
<i v-show="showChildren || isFiltered" class="material-icons" text-xs
>arrow_drop_down</i w-10
> truncate
<i v-if="isSelected" class="mx-3 text-green-400 material-icons" cursor-pointer
>check_circle</i "
> @click="toggleShowChildren()"
<i v-else class="material-icons">folder_open</i> >
<span>{{ folder.name }}</span> <i class="material-icons" :class="{ 'text-green-400': isSelected }">
</div> {{ getCollectionIcon }}
</i>
</span>
<span
class="
py-3
cursor-pointer
pr-2
flex flex-1
min-w-0
text-xs
group-hover:text-secondaryDark
transition
"
@click="toggleShowChildren()"
>
<span class="truncate">
{{ folder.name ? folder.name : folder.title }}
</span>
</span>
<ButtonSecondary
v-tippy="{ theme: 'tooltip' }"
icon="create_new_folder"
:title="$t('new_folder')"
class="group-hover:inline-flex hidden"
@click.native="$emit('add-folder', { folder, path: folderPath })"
/>
<tippy <tippy
ref="options" ref="options"
interactive interactive
@@ -48,7 +74,7 @@
/> />
<SmartItem <SmartItem
icon="edit" icon="edit"
:labeel="$t('edit')" :label="$t('edit')"
@click.native=" @click.native="
$emit('edit-folder', { folder, folderPath }) $emit('edit-folder', { folder, folderPath })
$refs.options.tippy().hide() $refs.options.tippy().hide()
@@ -65,71 +91,62 @@
</tippy> </tippy>
</div> </div>
<div v-show="showChildren || isFiltered"> <div v-show="showChildren || isFiltered">
<ul class="flex-col"> <CollectionsGraphqlFolder
<li v-for="(subFolder, subFolderIndex) in folder.folders"
v-for="(subFolder, subFolderIndex) in folder.folders" :key="subFolder.name"
:key="subFolder.name" class="ml-5 border-l border-dividerLight"
class="ml-5 border-l border-dividerLight" :picked="picked"
> :saving-mode="savingMode"
<CollectionsGraphqlFolder :folder="subFolder"
:picked="picked" :folder-index="subFolderIndex"
:saving-mode="savingMode" :folder-path="`${folderPath}/${subFolderIndex}`"
:folder="subFolder" :collection-index="collectionIndex"
:folder-index="subFolderIndex" :doc="doc"
:folder-path="`${folderPath}/${subFolderIndex}`" :is-filtered="isFiltered"
:collection-index="collectionIndex" @add-folder="$emit('add-folder', $event)"
:doc="doc" @edit-folder="$emit('edit-folder', $event)"
:is-filtered="isFiltered" @edit-request="$emit('edit-request', $event)"
@add-folder="$emit('add-folder', $event)" @select="$emit('select', $event)"
@edit-folder="$emit('edit-folder', $event)" />
@edit-request="$emit('edit-request', $event)" <CollectionsGraphqlRequest
@select="$emit('select', $event)" v-for="(request, index) in folder.requests"
/> :key="index"
</li> class="ml-5 border-l border-dividerLight"
</ul> :picked="picked"
<ul class="flex-col"> :saving-mode="savingMode"
<li :request="request"
v-for="(request, index) in folder.requests" :collection-index="collectionIndex"
:key="index" :folder-index="folderIndex"
class="ml-5 border-l border-dividerLight" :folder-path="folderPath"
> :folder-name="folder.name"
<CollectionsGraphqlRequest :request-index="index"
:picked="picked" :doc="doc"
:saving-mode="savingMode" @edit-request="$emit('edit-request', $event)"
:request="request" @select="$emit('select', $event)"
:collection-index="collectionIndex" />
:folder-index="folderIndex" <div
:folder-path="folderPath"
:folder-name="folder.name"
:request-index="index"
:doc="doc"
@edit-request="$emit('edit-request', $event)"
@select="$emit('select', $event)"
/>
</li>
</ul>
<ul
v-if=" v-if="
folder.folders && folder.folders &&
folder.folders.length === 0 && folder.folders.length === 0 &&
folder.requests && folder.requests &&
folder.requests.length === 0 folder.requests.length === 0
" "
class="
flex
items-center
text-secondaryLight
flex-col
p-4
justify-center
ml-5
border-l border-dividerLight
"
> >
<li <i class="material-icons opacity-50 pb-2">folder_open</i>
class=" <span class="text-xs">
ml-5 {{ $t("folder_empty") }}
border-l border-dividerLight </span>
ml-5 </div>
border-l border-dividerLight
"
>
<p>
<i class="material-icons">not_interested</i>
{{ $t("folder_empty") }}
</p>
</li>
</ul>
</div> </div>
<SmartConfirmModal <SmartConfirmModal
:show="confirmRemove" :show="confirmRemove"
@@ -172,6 +189,12 @@ export default Vue.extend({
this.picked.folderPath === this.folderPath this.picked.folderPath === this.folderPath
) )
}, },
getCollectionIcon() {
if (this.isSelected) return "check_circle"
else if (!this.showChildren && !this.isFiltered) return "arrow_right"
else if (this.showChildren || this.isFiltered) return "arrow_drop_down"
else return "folder"
},
}, },
methods: { methods: {
pick() { pick() {

View File

@@ -1,21 +1,46 @@
<template> <template>
<div> <div class="flex flex-col" :class="[{ 'bg-primaryLight': dragging }]">
<div <div
:class="[{ 'bg-primaryDark': dragging }]" class="flex items-center group"
draggable="true" draggable="true"
@dragstart="dragStart" @dragstart="dragStart"
@dragover.stop @dragover.stop
@dragleave="dragging = false" @dragleave="dragging = false"
@dragend="dragging = false" @dragend="dragging = false"
> >
<div> <span
<ButtonSecondary class="
:class="{ 'mx-3 text-green-400': isSelected }" font-mono font-bold
:icon="isSelected ? 'check_circle' : 'description'" flex
:label="request.name" justify-center
@click.native="!doc ? selectRequest() : {}" items-center
/> text-xs
</div> w-12
mx-2
truncate
cursor-pointer
"
@click="!doc ? selectRequest() : {}"
>
<i class="material-icons" :class="{ 'text-green-400': isSelected }">
{{ isSelected ? "check_circle" : "description" }}
</i>
</span>
<span
class="
py-3
cursor-pointer
pr-2
flex flex-1
min-w-0
text-xs
group-hover:text-secondaryDark
transition
"
@click="!doc ? selectRequest() : {}"
>
<span class="truncate"> {{ request.name }} </span>
</span>
<tippy <tippy
ref="options" ref="options"
interactive interactive

View File

@@ -1,95 +1,108 @@
<template> <template>
<AppSection label="collections"> <AppSection label="collections">
<div class="flex"> <div class="flex flex-col sticky top-10 z-10 bg-primary">
<input <input
v-if="showCollActions" v-if="showCollActions"
v-model="filterText" v-model="filterText"
aria-label="Search"
type="search" type="search"
:placeholder="$t('search')" :placeholder="$t('search')"
class="input rounded-t-lg" class="
px-4
py-3
text-xs
border-b border-dividerLight
flex flex-1
bg-primaryLight
focus:outline-none
"
/>
<CollectionsGraphqlAdd
:show="showModalAdd"
@hide-modal="displayModalAdd(false)"
/>
<CollectionsGraphqlEdit
:show="showModalEdit"
:editing-collection="editingCollection"
:editing-collection-index="editingCollectionIndex"
@hide-modal="displayModalEdit(false)"
/>
<CollectionsGraphqlAddFolder
:show="showModalAddFolder"
:folder-path="editingFolderPath"
@add-folder="onAddFolder($event)"
@hide-modal="displayModalAddFolder(false)"
/>
<CollectionsGraphqlEditFolder
:show="showModalEditFolder"
:collection-index="editingCollectionIndex"
:folder="editingFolder"
:folder-index="editingFolderIndex"
:folder-path="editingFolderPath"
@hide-modal="displayModalEditFolder(false)"
/>
<CollectionsGraphqlEditRequest
:show="showModalEditRequest"
:folder-path="editingFolderPath"
:request="editingRequest"
:request-index="editingRequestIndex"
@hide-modal="displayModalEditRequest(false)"
/>
<CollectionsGraphqlImportExport
:show="showModalImportExport"
@hide-modal="displayModalImportExport(false)"
/>
<div class="border-b flex justify-between flex-1 border-dividerLight">
<ButtonSecondary
icon="add"
:label="$t('new')"
@click.native="displayModalAdd(true)"
/>
<ButtonSecondary
v-if="showCollActions"
v-tippy="{ theme: 'tooltip' }"
:title="$t('import_export')"
icon="import_export"
@click.native="displayModalImportExport(true)"
/>
</div>
</div>
<div
v-if="collections.length === 0"
class="flex items-center text-secondaryLight flex-col p-4 justify-center"
>
<i class="material-icons opacity-50 pb-2">create_new_folder</i>
<span class="text-xs">
{{ $t("create_new_collection") }}
</span>
</div>
<div class="flex-col">
<CollectionsGraphqlCollection
v-for="(collection, index) in filteredCollections"
:key="collection.name"
:picked="picked"
:name="collection.name"
:collection-index="index"
:collection="collection"
:doc="doc"
:is-filtered="filterText.length > 0"
:saving-mode="savingMode"
@edit-collection="editCollection(collection, index)"
@add-folder="addFolder($event)"
@edit-folder="editFolder($event)"
@edit-request="editRequest($event)"
@select-collection="$emit('use-collection', collection)"
@select="$emit('select', $event)"
/> />
</div> </div>
<CollectionsGraphqlAdd <div
:show="showModalAdd" v-if="!(filteredCollections.length !== 0 || collections.length === 0)"
@hide-modal="displayModalAdd(false)" class="flex items-center text-secondaryLight flex-col p-4 justify-center"
/> >
<CollectionsGraphqlEdit <i class="material-icons opacity-50 pb-2">manage_search</i>
:show="showModalEdit" <span class="text-xs">
:editing-collection="editingCollection" {{ $t("nothing_found") }} "{{ filterText }}"
:editing-collection-index="editingCollectionIndex" </span>
@hide-modal="displayModalEdit(false)"
/>
<CollectionsGraphqlAddFolder
:show="showModalAddFolder"
:folder-path="editingFolderPath"
@add-folder="onAddFolder($event)"
@hide-modal="displayModalAddFolder(false)"
/>
<CollectionsGraphqlEditFolder
:show="showModalEditFolder"
:collection-index="editingCollectionIndex"
:folder="editingFolder"
:folder-index="editingFolderIndex"
:folder-path="editingFolderPath"
@hide-modal="displayModalEditFolder(false)"
/>
<CollectionsGraphqlEditRequest
:show="showModalEditRequest"
:folder-path="editingFolderPath"
:request="editingRequest"
:request-index="editingRequestIndex"
@hide-modal="displayModalEditRequest(false)"
/>
<CollectionsGraphqlImportExport
:show="showModalImportExport"
@hide-modal="displayModalImportExport(false)"
/>
<div class="border-b flex flex-1 border-divider">
<ButtonSecondary
icon="new"
:label="$t('new')"
@click.native="displayModalAdd(true)"
/>
<ButtonSecondary
v-if="showCollActions"
:label="$t('import_export')"
@click.native="displayModalImportExport(true)"
/>
</div> </div>
<p v-if="collections.length === 0">
<i class="material-icons">help_outline</i>
{{ $t("create_new_collection") }}
</p>
<div class="overflow-auto">
<ul class="flex-col">
<li
v-for="(collection, index) in filteredCollections"
:key="collection.name"
>
<CollectionsGraphqlCollection
:picked="picked"
:name="collection.name"
:collection-index="index"
:collection="collection"
:doc="doc"
:is-filtered="filterText.length > 0"
:saving-mode="savingMode"
@edit-collection="editCollection(collection, index)"
@add-folder="addFolder($event)"
@edit-folder="editFolder($event)"
@edit-request="editRequest($event)"
@select-collection="$emit('use-collection', collection)"
@select="$emit('select', $event)"
/>
</li>
</ul>
</div>
<p v-if="filterText && filteredCollections.length === 0">
<i class="material-icons">not_interested</i> {{ $t("nothing_found") }} "{{
filterText
}}"
</p>
</AppSection> </AppSection>
</template> </template>

View File

@@ -1,22 +1,61 @@
<template> <template>
<AppSection label="collections"> <AppSection label="collections">
<div class="flex sticky top-10 border-b border-dividerLight"> <div class="flex flex-col sticky top-10 z-10 bg-primary">
<input <input
v-if="!saveRequest" v-if="!saveRequest"
v-model="filterText" v-model="filterText"
aria-label="Search"
type="search" type="search"
:placeholder="$t('search')" :placeholder="$t('search')"
class="px-4 py-3 text-xs flex flex-1 bg-primary focus:outline-none" class="
px-4
py-3
text-xs
border-b border-dividerLight
flex flex-1
bg-primaryLight
focus:outline-none
"
/> />
<CollectionsChooseType
:collections-type="collectionsType"
:show="showTeamCollections"
:doc="doc"
@update-collection-type="updateCollectionType"
@update-selected-team="updateSelectedTeam"
/>
<div class="border-b flex justify-between flex-1 border-dividerLight">
<ButtonSecondary
v-if="
collectionsType.type == 'team-collections' &&
(collectionsType.selectedTeam == undefined ||
collectionsType.selectedTeam.myRole == 'VIEWER')
"
v-tippy="{ theme: 'tooltip' }"
disabled
icon="add"
:title="$t('disable_new_collection')"
:label="$t('new')"
@click.native="displayModalAdd(true)"
/>
<ButtonSecondary
v-else
icon="add"
:label="$t('new')"
@click.native="displayModalAdd(true)"
/>
<ButtonSecondary
v-if="!saveRequest"
v-tippy="{ theme: 'tooltip' }"
:disabled="
collectionsType.type == 'team-collections' &&
collectionsType.selectedTeam == undefined
"
icon="import_export"
:title="$t('import_export')"
@click.native="displayModalImportExport(true)"
/>
</div>
</div> </div>
<CollectionsChooseType
:collections-type="collectionsType"
:show="showTeamCollections"
:doc="doc"
@update-collection-type="updateCollectionType"
@update-selected-team="updateSelectedTeam"
/>
<CollectionsAdd <CollectionsAdd
:show="showModalAdd" :show="showModalAdd"
@submit="addNewRootCollection" @submit="addNewRootCollection"
@@ -53,38 +92,6 @@
@hide-modal="displayModalImportExport(false)" @hide-modal="displayModalImportExport(false)"
@update-team-collections="updateTeamCollections" @update-team-collections="updateTeamCollections"
/> />
<div class="border-b flex justify-between flex-1 border-dividerLight">
<ButtonSecondary
v-if="
collectionsType.type == 'team-collections' &&
(collectionsType.selectedTeam == undefined ||
collectionsType.selectedTeam.myRole == 'VIEWER')
"
v-tippy="{ theme: 'tooltip' }"
disabled
icon="add"
:title="$t('disable_new_collection')"
:label="$t('new')"
@click.native="displayModalAdd(true)"
/>
<ButtonSecondary
v-else
icon="add"
:label="$t('new')"
@click.native="displayModalAdd(true)"
/>
<ButtonSecondary
v-if="!saveRequest"
v-tippy="{ theme: 'tooltip' }"
:disabled="
collectionsType.type == 'team-collections' &&
collectionsType.selectedTeam == undefined
"
icon="import_export"
:title="$t('import_export')"
@click.native="displayModalImportExport(true)"
/>
</div>
<div <div
v-if="collections.length === 0" v-if="collections.length === 0"
class="flex items-center text-secondaryLight flex-col p-4 justify-center" class="flex items-center text-secondaryLight flex-col p-4 justify-center"
@@ -126,7 +133,7 @@
/> />
</div> </div>
<div <div
v-if="filterText && filteredCollections.length === 0" v-if="!(filteredCollections.length !== 0 || collections.length === 0)"
class="flex items-center text-secondaryLight flex-col p-4 justify-center" class="flex items-center text-secondaryLight flex-col p-4 justify-center"
> >
<i class="material-icons opacity-50 pb-2">manage_search</i> <i class="material-icons opacity-50 pb-2">manage_search</i>

View File

@@ -21,13 +21,15 @@
" "
@click="toggleShowChildren()" @click="toggleShowChildren()"
> >
<i class="material-icons">{{ getCollectionIcon }}</i> <i class="material-icons" :class="{ 'text-green-400': isSelected }">
{{ getCollectionIcon }}
</i>
</span> </span>
<span <span
class=" class="
py-3 py-3
cursor-pointer cursor-pointer
pr-3 pr-2
flex flex-1 flex flex-1
min-w-0 min-w-0
text-xs text-xs

View File

@@ -21,13 +21,15 @@
" "
@click="toggleShowChildren()" @click="toggleShowChildren()"
> >
<i class="material-icons">{{ getCollectionIcon }}</i> <i class="material-icons" :class="{ 'text-green-400': isSelected }">
{{ getCollectionIcon }}
</i>
</span> </span>
<span <span
class=" class="
py-3 py-3
cursor-pointer cursor-pointer
pr-3 pr-2
flex flex-1 flex flex-1
min-w-0 min-w-0
text-xs text-xs

View File

@@ -16,23 +16,29 @@
items-center items-center
text-xs text-xs
w-12 w-12
mx-2
truncate truncate
cursor-pointer cursor-pointer
" "
:class="[ :class="getRequestLabelColor(request.method)"
getRequestLabelColor(request.method),
{ 'mx-3 text-green-400': isSelected },
]"
@click="!doc ? selectRequest() : {}" @click="!doc ? selectRequest() : {}"
> >
<i v-if="isSelected" class="material-icons">check_circle</i> <i
{{ request.method }} v-if="isSelected"
class="material-icons"
:class="{ 'text-green-400': isSelected }"
>
check_circle
</i>
<span v-else>
{{ request.method }}
</span>
</span> </span>
<span <span
class=" class="
py-3 py-3
cursor-pointer cursor-pointer
pr-3 pr-2
flex flex-1 flex flex-1
min-w-0 min-w-0
text-xs text-xs

View File

@@ -13,13 +13,15 @@
" "
@click="toggleShowChildren()" @click="toggleShowChildren()"
> >
<i class="material-icons">{{ getCollectionIcon }}</i> <i class="material-icons" :class="{ 'text-green-400': isSelected }">
{{ getCollectionIcon }}
</i>
</span> </span>
<span <span
class=" class="
py-3 py-3
cursor-pointer cursor-pointer
pr-3 pr-2
flex flex-1 flex flex-1
min-w-0 min-w-0
text-xs text-xs

View File

@@ -13,13 +13,15 @@
" "
@click="toggleShowChildren()" @click="toggleShowChildren()"
> >
<i class="material-icons">{{ getCollectionIcon }}</i> <i class="material-icons" :class="{ 'text-green-400': isSelected }">
{{ getCollectionIcon }}
</i>
</span> </span>
<span <span
class=" class="
py-3 py-3
cursor-pointer cursor-pointer
pr-3 pr-2
flex flex-1 flex flex-1
min-w-0 min-w-0
text-xs text-xs

View File

@@ -9,23 +9,29 @@
items-center items-center
text-xs text-xs
w-12 w-12
mx-2
truncate truncate
cursor-pointer cursor-pointer
" "
:class="[ :class="getRequestLabelColor(request.method)"
getRequestLabelColor(request.method),
{ 'mx-3 text-green-400': isSelected },
]"
@click="!doc ? selectRequest() : {}" @click="!doc ? selectRequest() : {}"
> >
<i v-if="isSelected" class="material-icons">check_circle</i> <i
{{ request.method }} v-if="isSelected"
class="material-icons"
:class="{ 'text-green-400': isSelected }"
>
check_circle
</i>
<span v-else>
{{ request.method }}
</span>
</span> </span>
<span <span
class=" class="
py-3 py-3
cursor-pointer cursor-pointer
pr-3 pr-2
flex flex-1 flex flex-1
min-w-0 min-w-0
text-xs text-xs

View File

@@ -18,7 +18,7 @@
class=" class="
py-3 py-3
cursor-pointer cursor-pointer
pr-3 pr-2
flex flex-1 flex flex-1
min-w-0 min-w-0
text-xs text-xs

View File

@@ -1,31 +1,48 @@
<template> <template>
<AppSection label="environments"> <AppSection label="environments">
<select <div class="flex flex-col sticky z-10 top-10 bg-primary">
v-model="selectedEnvironmentIndex" <div class="select-wrapper">
:disabled="environments.length == 0" <select
class=" v-model="selectedEnvironmentIndex"
flex :disabled="environments.length == 0"
w-full class="
px-4 flex
text-xs w-full
py-2 px-4
focus:outline-none text-xs
border-b border-dividerLight py-3
bg-primary focus:outline-none
" border-b border-dividerLight
> bg-primaryLight
<option :value="-1">No environment</option> "
<option v-if="environments.length === 0" value="0"> >
{{ $t("create_new_environment") }} <option :value="-1">No environment</option>
</option> <option v-if="environments.length === 0" value="0">
<option {{ $t("create_new_environment") }}
v-for="(environment, index) in environments" </option>
:key="index" <option
:value="index" v-for="(environment, index) in environments"
> :key="index"
{{ environment.name }} :value="index"
</option> >
</select> {{ environment.name }}
</option>
</select>
</div>
<div class="border-b flex justify-between flex-1 border-dividerLight">
<ButtonSecondary
icon="add"
:label="$t('new')"
@click.native="displayModalAdd(true)"
/>
<ButtonSecondary
v-tippy="{ theme: 'tooltip' }"
icon="import_export"
:title="$t('import_export')"
@click.native="displayModalImportExport(true)"
/>
</div>
</div>
<EnvironmentsAdd <EnvironmentsAdd
:show="showModalAdd" :show="showModalAdd"
@hide-modal="displayModalAdd(false)" @hide-modal="displayModalAdd(false)"
@@ -40,19 +57,6 @@
:show="showModalImportExport" :show="showModalImportExport"
@hide-modal="displayModalImportExport(false)" @hide-modal="displayModalImportExport(false)"
/> />
<div class="border-b flex justify-between flex-1 border-dividerLight">
<ButtonSecondary
icon="add"
:label="$t('new')"
@click.native="displayModalAdd(true)"
/>
<ButtonSecondary
v-tippy="{ theme: 'tooltip' }"
icon="import_export"
:title="$t('import_export')"
@click.native="displayModalImportExport(true)"
/>
</div>
<div <div
v-if="environments.length === 0" v-if="environments.length === 0"
class="flex items-center text-secondaryLight flex-col p-4 justify-center" class="flex items-center text-secondaryLight flex-col p-4 justify-center"

View File

@@ -1,119 +1,65 @@
<template> <template>
<div> <div class="flex flex-col group">
<div class="flex"> <div class="flex items-center">
<li> <span
<input class="
data-testid="'url'" py-3
:aria-label="$t('url')" cursor-pointer
type="text" pr-2
readonly pl-4
:value="entry.url" flex flex-1
:placeholder="$t('empty_req_name')" min-w-0
class="input cursor-pointer text-sm bg-transparent" text-xs
@click="$emit('use-entry')" group-hover:text-secondaryDark
/> transition
</li> "
@click="$emit('use-entry')"
>
<span class="truncate">
{{ entry.url }}
</span>
</span>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title="!entry.star ? $t('add_star') : $t('remove_star')" icon="delete"
data-testid="star_button" :title="$t('delete')"
:icon="entry.star ? 'star' : 'star_border'" class="group-hover:inline-flex hidden"
color="yellow" color="red"
@click.native="$emit('toggle-star')" @click.native="$emit('delete-entry')"
/> />
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title="expand ? $t('hide_more') : $t('show_more')" :title="expand ? $t('hide_more') : $t('show_more')"
data-testid="query_expand"
:icon="expand ? 'unfold_less' : 'unfold_more'" :icon="expand ? 'unfold_less' : 'unfold_more'"
class="group-hover:inline-flex hidden"
@click.native="expand = !expand" @click.native="expand = !expand"
/> />
<tippy <ButtonSecondary
ref="options" v-tippy="{ theme: 'tooltip' }"
interactive :title="!entry.star ? $t('add_star') : $t('remove_star')"
tabindex="-1" :icon="entry.star ? 'star' : 'star_border'"
trigger="click" color="yellow"
theme="popover" :class="{ 'group-hover:inline-flex hidden': !entry.star }"
arrow @click.native="$emit('toggle-star')"
/>
</div>
<div class="flex flex-col">
<span
v-for="(line, index) in query"
:key="`line-${index}`"
class="
text-xs
cursor-pointer
truncate
px-4
font-mono
text-secondaryLight
"
@click="$emit('use-entry')"
> >
<template #trigger> {{ line }}
<TabPrimary </span>
v-tippy="{ theme: 'tooltip' }"
:title="$t('options')"
data-testid="options"
icon="more_vert"
/>
</template>
<SmartItem
data-testid="restore_history_entry"
:aria-label="$t('restore')"
icon="restore"
:label="$t('restore')"
@click.native="
$emit('use-entry')
$refs.options.tippy().hide()
"
/>
<SmartItem
data-testid="delete_history_entry"
:aria-label="$t('delete')"
icon="delete"
:label="$t('delete')"
@click.native="
$emit('delete-entry')
$refs.options.tippy().hide()
"
/>
</tippy>
</div> </div>
<div class="flex">
<li data-testid="'query'">
<input
v-for="(line, index) in query"
:key="`line-${index}`"
:aria-label="$t('query')"
type="text"
readonly
:value="`${line}`"
class="input pt-0 mt-0 text-sm bg-transparent text-secondaryLight"
/>
</li>
</div>
<transition name="fade">
<div v-if="showMore" class="flex">
<li>
<input
v-tippy="{ theme: 'tooltip' }"
title="entry.date"
:aria-label="$t('time')"
type="text"
readonly
:value="entry.time"
class="input pt-0 mt-0 text-sm bg-transparent text-secondaryLight"
/>
</li>
<li>
<input
:aria-label="$t('duration')"
type="text"
readonly
:value="`Duration: ${entry.duration}ms`"
:placeholder="$t('no_duration')"
class="input pt-0 mt-0 text-sm bg-transparent text-secondaryLight"
/>
</li>
<!-- <li>
<input class="input"
:aria-label="$t('prerequest_script')"
type="text"
readonly
:value="entry.preRequestScript"
:placeholder="$t('no_prerequest_script')"
class="pt-0 mt-0 text-sm bg-transparent text-secondaryLight"
/>
</li> -->
</div>
</transition>
</div> </div>
</template> </template>

View File

@@ -1,11 +1,19 @@
<template> <template>
<AppSection label="history"> <AppSection label="history">
<div class="flex sticky top-10 border-b border-dividerLight"> <div
class="
flex
sticky
z-10
bg-primaryLight
top-10
border-b border-dividerLight
"
>
<input <input
v-model="filterText" v-model="filterText"
aria-label="Search"
type="search" type="search"
class="px-4 py-3 text-xs flex flex-1 bg-primary focus:outline-none" class="px-4 py-3 text-xs flex flex-1 bg-primaryLight focus:outline-none"
:placeholder="$t('search')" :placeholder="$t('search')"
/> />
<ButtonSecondary <ButtonSecondary
@@ -39,7 +47,7 @@
</div> </div>
</div> </div>
<div <div
:class="{ hidden: filteredHistory.length != 0 || history.length === 0 }" v-if="!(filteredHistory.length !== 0 || history.length === 0)"
class="flex items-center text-secondaryLight flex-col p-4 justify-center" class="flex items-center text-secondaryLight flex-col p-4 justify-center"
> >
<i class="material-icons opacity-50 pb-2">manage_search</i> <i class="material-icons opacity-50 pb-2">manage_search</i>

View File

@@ -21,7 +21,7 @@
class=" class="
py-3 py-3
cursor-pointer cursor-pointer
pr-3 pr-2
flex flex-1 flex flex-1
min-w-0 min-w-0
text-xs text-xs
@@ -36,7 +36,6 @@
</span> </span>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
data-testid="delete_history_entry"
icon="delete" icon="delete"
:title="$t('delete')" :title="$t('delete')"
class="group-hover:inline-flex hidden" class="group-hover:inline-flex hidden"

View File

@@ -601,7 +601,7 @@
</Pane> </Pane>
<Pane max-size="30" size="25" min-size="20" class="overflow-auto hide-scrollbar"> <Pane max-size="30" size="25" min-size="20" class="overflow-auto hide-scrollbar">
<aside class="h-full"> <aside class="h-full">
<SmartTabs styles="sticky top-0"> <SmartTabs styles="sticky z-10 top-0">
<SmartTab :id="'history'" :label="$t('history')" :selected="true"> <SmartTab :id="'history'" :label="$t('history')" :selected="true">
<History <History
:page="'rest'" :page="'rest'"

View File

@@ -323,95 +323,103 @@
</Pane> </Pane>
</Splitpanes> </Splitpanes>
</Pane> </Pane>
<Pane max-size="35" min-size="20" class="overflow-auto"> <Pane
max-size="30"
size="25"
min-size="20"
class="overflow-auto hide-scrollbar"
>
<aside class="lg:max-w-md"> <aside class="lg:max-w-md">
<SmartTabs> <SmartTabs styles="sticky z-10 top-0">
<SmartTab :id="'docs'" :label="`Docs`" :selected="true"> <SmartTab :id="'docs'" :label="`Docs`" :selected="true">
<AppSection label="docs"> <AppSection label="docs">
<section class="flex-col"> <div class="flex flex-col sticky z-10 bg-primaryLight top-10">
<input <input
v-model="graphqlFieldsFilterText" v-model="graphqlFieldsFilterText"
type="text" type="text"
:placeholder="$t('search')" :placeholder="$t('search')"
class="input rounded-t-lg" class="
px-4
py-3
text-xs
flex flex-1
bg-primaryLight
focus:outline-none
"
/> />
<SmartTabs ref="gqlTabs" styles="m-4"> </div>
<div class="gqlTabs"> <SmartTabs
<SmartTab ref="gqlTabs"
v-if="queryFields.length > 0" styles="
:id="'queries'" border-t border-dividerLight sticky z-10 top-20"
:label="$t('queries')" >
:selected="true" <SmartTab
> v-if="queryFields.length > 0"
<div :id="'queries'"
v-for="field in filteredQueryFields" :label="$t('queries')"
:key="field.name" :selected="true"
> >
<GraphqlField <div v-for="field in filteredQueryFields" :key="field.name">
:gql-field="field" <GraphqlField
:jump-type-callback="handleJumpToType" :gql-field="field"
/> :jump-type-callback="handleJumpToType"
</div> />
</SmartTab>
<SmartTab
v-if="mutationFields.length > 0"
:id="'mutations'"
:label="$t('mutations')"
>
<div
v-for="field in filteredMutationFields"
:key="field.name"
>
<GraphqlField
:gql-field="field"
:jump-type-callback="handleJumpToType"
/>
</div>
</SmartTab>
<SmartTab
v-if="subscriptionFields.length > 0"
:id="'subscriptions'"
:label="$t('subscriptions')"
>
<div
v-for="field in filteredSubscriptionFields"
:key="field.name"
>
<GraphqlField
:gql-field="field"
:jump-type-callback="handleJumpToType"
/>
</div>
</SmartTab>
<SmartTab
v-if="graphqlTypes.length > 0"
:id="'types'"
ref="typesTab"
:label="$t('types')"
>
<div
v-for="type in filteredGraphqlTypes"
:key="type.name"
>
<GraphqlType
:gql-type="type"
:gql-types="graphqlTypes"
:is-highlighted="
isGqlTypeHighlighted({ gqlType: type })
"
:highlighted-fields="
getGqlTypeHighlightedFields({ gqlType: type })
"
:jump-type-callback="handleJumpToType"
/>
</div>
</SmartTab>
</div> </div>
</SmartTabs> </SmartTab>
</section>
<SmartTab
v-if="mutationFields.length > 0"
:id="'mutations'"
:label="$t('mutations')"
>
<div
v-for="field in filteredMutationFields"
:key="field.name"
>
<GraphqlField
:gql-field="field"
:jump-type-callback="handleJumpToType"
/>
</div>
</SmartTab>
<SmartTab
v-if="subscriptionFields.length > 0"
:id="'subscriptions'"
:label="$t('subscriptions')"
>
<div
v-for="field in filteredSubscriptionFields"
:key="field.name"
>
<GraphqlField
:gql-field="field"
:jump-type-callback="handleJumpToType"
/>
</div>
</SmartTab>
<SmartTab
v-if="graphqlTypes.length > 0"
:id="'types'"
ref="typesTab"
:label="$t('types')"
>
<div v-for="type in filteredGraphqlTypes" :key="type.name">
<GraphqlType
:gql-type="type"
:gql-types="graphqlTypes"
:is-highlighted="
isGqlTypeHighlighted({ gqlType: type })
"
:highlighted-fields="
getGqlTypeHighlightedFields({ gqlType: type })
"
:jump-type-callback="handleJumpToType"
/>
</div>
</SmartTab>
</SmartTabs>
<p <p
v-if=" v-if="
queryFields.length === 0 && queryFields.length === 0 &&

View File

@@ -282,7 +282,6 @@
</div> </div>
</div> </div>
<FirebaseLogin :show="showLogin" @hide-modal="showLogin = false" /> <FirebaseLogin :show="showLogin" @hide-modal="showLogin = false" />
<FirebaseEmail :show="showEmail" @hide-modal="showEmail = false" />
<SmartConfirmModal <SmartConfirmModal
:show="confirmRemove" :show="confirmRemove"
:title="`${$t('are_you_sure_remove_telemetry')} ${$t( :title="`${$t('are_you_sure_remove_telemetry')} ${$t(