Merge pull request #1004 from liyasthomas/feat/doc

This commit is contained in:
Liyas Thomas
2020-07-18 17:56:12 +05:30
committed by GitHub
6 changed files with 334 additions and 288 deletions

View File

@@ -1,14 +1,21 @@
<template> <template>
<div> <div>
<div class="flex-wrap"> <div class="flex-wrap">
<div>
<button class="icon" @click="toggleShowChildren"> <button class="icon" @click="toggleShowChildren">
<i class="material-icons" v-show="!showChildren">arrow_right</i> <i class="material-icons" v-show="!showChildren">arrow_right</i>
<i class="material-icons" v-show="showChildren">arrow_drop_down</i> <i class="material-icons" v-show="showChildren">arrow_drop_down</i>
<i class="material-icons">folder</i> <i class="material-icons">folder</i>
<span>{{ collection.name }}</span> <span>{{ collection.name }}</span>
</button> </button>
</div> <div>
<button
v-if="doc"
class="icon"
@click="$emit('select-collection')"
v-tooltip.left="$t('import')"
>
<i class="material-icons">topic</i>
</button>
<v-popover> <v-popover>
<button class="tooltip-target icon" v-tooltip.left="$t('more')"> <button class="tooltip-target icon" v-tooltip.left="$t('more')">
<i class="material-icons">more_vert</i> <i class="material-icons">more_vert</i>
@@ -35,6 +42,7 @@
</template> </template>
</v-popover> </v-popover>
</div> </div>
</div>
<div v-show="showChildren"> <div v-show="showChildren">
<ul> <ul>
@@ -43,6 +51,7 @@
:folder="folder" :folder="folder"
:folderIndex="index" :folderIndex="index"
:collection-index="collectionIndex" :collection-index="collectionIndex"
:doc="doc"
@edit-folder="editFolder(collectionIndex, folder, index)" @edit-folder="editFolder(collectionIndex, folder, index)"
@edit-request="$emit('edit-request', $event)" @edit-request="$emit('edit-request', $event)"
/> />
@@ -58,6 +67,7 @@
:collection-index="collectionIndex" :collection-index="collectionIndex"
:folder-index="-1" :folder-index="-1"
:request-index="index" :request-index="index"
:doc="doc"
@edit-request=" @edit-request="
$emit('edit-request', { $emit('edit-request', {
request, request,
@@ -97,6 +107,7 @@ export default {
props: { props: {
collectionIndex: Number, collectionIndex: Number,
collection: Object, collection: Object,
doc: Boolean,
}, },
data() { data() {
return { return {

View File

@@ -38,6 +38,7 @@
:collection-index="collectionIndex" :collection-index="collectionIndex"
:folder-index="folderIndex" :folder-index="folderIndex"
:request-index="index" :request-index="index"
:doc="doc"
@edit-request=" @edit-request="
$emit('edit-request', { $emit('edit-request', {
request, request,
@@ -77,6 +78,7 @@ export default {
folder: Object, folder: Object,
collectionIndex: Number, collectionIndex: Number,
folderIndex: Number, folderIndex: Number,
doc: Boolean,
}, },
components: { components: {
request: () => import("./request"), request: () => import("./request"),

View File

@@ -70,26 +70,22 @@ TODO:
<collection <collection
:collection-index="index" :collection-index="index"
:collection="collection" :collection="collection"
:doc="doc"
@edit-collection="editCollection(collection, index)" @edit-collection="editCollection(collection, index)"
@add-folder="addFolder(collection, index)" @add-folder="addFolder(collection, index)"
@edit-folder="editFolder($event)" @edit-folder="editFolder($event)"
@edit-request="editRequest($event)" @edit-request="editRequest($event)"
@select-collection="$emit('use-collection', collection)"
/> />
</li> </li>
</ul> </ul>
</div> </div>
<nuxt-link :to="localePath('doc')" :aria-label="$t('documentation')">
<button class="icon">
<i class="material-icons">topic</i>
<span>{{ $t("generate_docs") }}</span>
</button>
</nuxt-link>
</pw-section> </pw-section>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.virtual-list { .virtual-list {
max-height: calc(100vh - 290px); max-height: calc(100vh - 245px);
} }
ul { ul {
@@ -113,6 +109,9 @@ export default {
editRequest: () => import("./editRequest"), editRequest: () => import("./editRequest"),
importExportCollections: () => import("./importExportCollections"), importExportCollections: () => import("./importExportCollections"),
}, },
props: {
doc: Boolean,
},
data() { data() {
return { return {
showModalAdd: false, showModalAdd: false,

View File

@@ -1,7 +1,11 @@
<template> <template>
<div class="flex-wrap"> <div class="flex-wrap">
<div> <div>
<button class="icon" @click="selectRequest()" v-tooltip="$t('use_request')"> <button
class="icon"
@click="!doc ? selectRequest() : {}"
v-tooltip="!doc ? $t('use_request') : ''"
>
<i class="material-icons">insert_drive_file</i> <i class="material-icons">insert_drive_file</i>
<span>{{ request.name }}</span> <span>{{ request.name }}</span>
</button> </button>
@@ -50,6 +54,7 @@ export default {
collectionIndex: Number, collectionIndex: Number,
folderIndex: Number, folderIndex: Number,
requestIndex: Number, requestIndex: Number,
doc: Boolean,
}, },
methods: { methods: {
syncCollections() { syncCollections() {

View File

@@ -126,7 +126,7 @@
<nav class="secondary-nav"> <nav class="secondary-nav">
<ul> <ul>
<li> <li>
<a href="#collections" v-tooltip.right="$t('collections')"> <a href="#import" v-tooltip.right="$t('import')">
<i class="material-icons">folder</i> <i class="material-icons">folder</i>
</a> </a>
</li> </li>

View File

@@ -1,6 +1,8 @@
<template> <template>
<div class="page"> <div class="page">
<pw-section class="blue" :label="$t('collections')" ref="collections"> <div class="content">
<div class="page-columns inner-left">
<pw-section class="blue" :label="$t('import')" ref="import">
<ul> <ul>
<li> <li>
<p class="info"> <p class="info">
@@ -10,8 +12,13 @@
</ul> </ul>
<ul> <ul>
<li> <li>
<div class="flex-wrap">
<label for="collectionUpload"> <label for="collectionUpload">
<button class="icon" @click="$refs.collectionUpload.click()" v-tooltip="$t('json')"> <button
class="icon"
@click="$refs.collectionUpload.click()"
v-tooltip="$t('json')"
>
<i class="material-icons">folder</i> <i class="material-icons">folder</i>
<span>{{ $t("import_collections") }}</span> <span>{{ $t("import_collections") }}</span>
</button> </button>
@@ -22,6 +29,16 @@
type="file" type="file"
@change="uploadCollection" @change="uploadCollection"
/> />
<div>
<button
class="icon"
@click="collectionJSON = '[]'"
v-tooltip.bottom="$t('clear')"
>
<i class="material-icons">clear_all</i>
</button>
</div>
</div>
</li> </li>
</ul> </ul>
<ul> <ul>
@@ -258,6 +275,12 @@
</div> </div>
</pw-section> </pw-section>
</div> </div>
<aside class="sticky-inner inner-right">
<collections @use-collection="useSelectedCollection($event)" :doc="true" />
</aside>
</div>
</div>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
@@ -309,6 +332,7 @@ export default {
components: { components: {
"pw-section": () => import("~/components/layout/section"), "pw-section": () => import("~/components/layout/section"),
Editor: AceEditor, Editor: AceEditor,
collections: () => import("~/components/collections"),
}, },
data() { data() {
return { return {
@@ -349,6 +373,11 @@ export default {
}) })
} }
}, },
useSelectedCollection(collection) {
let importCollection = `[${JSON.stringify(collection, null, 2)}]`
this.collectionJSON = JSON.stringify(JSON.parse(importCollection), null, 2)
},
}, },
head() { head() {
return { return {