chore: remove unused code

This commit is contained in:
liyasthomas
2021-06-15 06:34:21 +05:30
parent b357dc8e2f
commit 0cedc9ed51
27 changed files with 5 additions and 328 deletions

View File

@@ -361,7 +361,6 @@ _Add-ons are developed and maintained under **[Official Hoppscotch Organization]
- History
- Collections
- Environments
- Notes
**Post-Request Tests β:** Write tests associated with a request that are executed after the request response.
@@ -378,10 +377,6 @@ _Add-ons are developed and maintained under **[Official Hoppscotch Organization]
</details>
📝 **Notes** : Instantly jot down notes, tasks or whatever you feel like as they come to your mind.
_Notes are only available for signed-in users_
🌱 **Environments** : Environment variables allow you to store and reuse values in your requests and scripts.
<details>

View File

@@ -1,62 +0,0 @@
<template>
<div
v-if="currentFeeds && currentFeeds.length !== 0"
class="divide-y virtual-list divide-dashed divide-divider"
>
<ul v-for="feed in currentFeeds" :key="feed.id" class="flex-col">
<div data-test="list-item" class="show-on-large-screen">
<li class="info">
<label data-test="list-label" class="break-all">
{{ feed.label || $t("no_label") }}
</label>
</li>
<button class="icon" @click="deleteFeed(feed)">
<i class="material-icons">delete</i>
</button>
</div>
<div class="show-on-large-screen">
<li data-test="list-message" class="info clamb-3">
<label class="break-all">{{ feed.message || $t("empty") }}</label>
</li>
</div>
</ul>
</div>
<ul v-else class="flex-col">
<li>
<p class="info">{{ $t("empty") }}</p>
</li>
</ul>
</template>
<script>
import { deleteFeed, currentFeeds$ } from "~/helpers/fb/feeds"
export default {
subscriptions() {
return {
currentFeeds: currentFeeds$,
}
},
methods: {
async deleteFeed({ id }) {
await deleteFeed(id)
this.$toast.error(this.$t("deleted"), {
icon: "delete",
})
},
},
}
</script>
<style scoped lang="scss">
.virtual-list {
max-height: calc(100vh - 270px);
}
.clamb-3 {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
@apply overflow-hidden;
}
</style>

View File

@@ -1,59 +0,0 @@
<template>
<div class="flex-col">
<div class="show-on-large-screen">
<input
v-model="message"
:aria-label="$t('label')"
type="text"
autofocus
:placeholder="$t('paste_a_note')"
class="rounded-t-lg"
@keyup.enter="formPost"
/>
</div>
<div class="border-b show-on-large-screen border-divider">
<input
v-model="label"
:aria-label="$t('label')"
type="text"
autofocus
:placeholder="$t('label')"
@keyup.enter="formPost"
/>
<button
class="icon"
:disabled="!(message || label)"
value="Save"
@click="formPost"
>
<i class="material-icons">add</i>
<span>Add</span>
</button>
</div>
</div>
</template>
<script lang="ts">
import Vue from "vue"
import { writeFeed } from "~/helpers/fb/feeds"
export default Vue.extend({
data() {
return {
message: null as string | null,
label: null as string | null,
}
},
methods: {
formPost() {
// TODO: Check this ?
if (!(this.message || this.label)) {
return
}
writeFeed(this.label as string, this.message as string)
this.message = null
this.label = null
},
},
})
</script>

View File

@@ -71,7 +71,6 @@ export default {
applySetting("syncHistory", true)
applySetting("syncCollections", true)
applySetting("syncEnvironments", true)
this.$router.push({ path: "/settings" })
toastObject.remove()
},
},
@@ -144,7 +143,6 @@ export default {
applySetting("syncHistory", true)
applySetting("syncCollections", true)
applySetting("syncEnvironments", true)
this.$router.push({ path: "/settings" })
toastObject.remove()
},
},

View File

@@ -1,30 +0,0 @@
<template>
<AppSection ref="sync" :label="$t('notes')" no-legend>
<div v-if="currentUser">
<FirebaseInputform />
<FirebaseFeeds />
</div>
<div v-else>
<p class="info">{{ $t("login_first") }}</p>
<FirebaseLogin @show-email="showEmail = true" />
</div>
<FirebaseEmail :show="showEmail" @hide-modal="showEmail = false" />
</AppSection>
</template>
<script>
import { currentUser$ } from "~/helpers/fb/auth"
export default {
subscriptions() {
return {
currentUser: currentUser$,
}
},
data() {
return {
showEmail: false,
}
},
}
</script>

View File

@@ -1,91 +0,0 @@
import firebase from "firebase"
import { BehaviorSubject } from "rxjs"
import { currentUser$ } from "./auth"
type HoppFeed = firebase.firestore.DocumentData & {
id: string
label: string
message: string
}
/**
* An observable subject which is defined as an array of feeds
* the current user has.
*
* Note: If this is null, then it means the user is not signed in
*/
export const currentFeeds$ = new BehaviorSubject<HoppFeed[] | null>(null)
export function initFeeds() {
let snapshotStop: (() => void) | null = null
currentUser$.subscribe((user) => {
if (!user && snapshotStop) {
// User has logged out, clean up snapshot listeners
snapshotStop()
snapshotStop = null
} else if (user) {
snapshotStop = firebase
.firestore()
.collection("users")
.doc(user.uid)
.collection("feeds")
.orderBy("createdOn", "desc")
.onSnapshot((feedsRef) => {
const feeds: HoppFeed[] = []
feedsRef.forEach((doc) => {
const feed = doc.data()
feed.id = doc.id
feeds.push(feed as HoppFeed)
})
currentFeeds$.next(feeds)
})
}
})
}
export async function writeFeed(label: string, message: string) {
if (currentUser$.value == null)
throw new Error("Logged out user cannot write to feeds")
const dt = {
createdOn: new Date(),
author: currentUser$.value.uid,
author_name: currentUser$.value.displayName,
author_image: currentUser$.value.photoURL,
message,
label,
}
try {
await firebase
.firestore()
.collection("users")
.doc(currentUser$.value.uid)
.collection("feeds")
.add(dt)
} catch (e) {
console.error("error inserting", dt, e)
throw e
}
}
export async function deleteFeed(id: string) {
if (currentUser$.value == null)
throw new Error("Logged out user cannot delete feed")
try {
await firebase
.firestore()
.collection("users")
.doc(currentUser$.value.uid)
.collection("feeds")
.doc(id)
.delete()
} catch (e) {
console.error("error deleting", id, e)
throw e
}
}

View File

@@ -2,7 +2,6 @@ import firebase from "firebase"
import { initAuth } from "./auth"
import { initCollections } from "./collections"
import { initEnvironments } from "./environments"
import { initFeeds } from "./feeds"
import { initHistory } from "./history"
import { initSettings } from "./settings"
@@ -25,5 +24,4 @@ export function initializeFirebase() {
initCollections()
initHistory()
initEnvironments()
initFeeds()
}

View File

@@ -263,10 +263,7 @@
"syncCollections": "সংগ্রহ",
"syncEnvironments": "এনভায়রনমেন্টসমূহ",
"turn_on": "চালু করুন",
"login_first": "প্রথমে লগিন করুন",
"paste_a_note": "একটি মন্তব্য লিপিবদ্ধ করুন",
"import_from_sync": "সিঙ্ক থেকে ইমপোর্ট করুন",
"notes": "মন্তব্য",
"socketio": "সকেট ইনপুট/আউটপুট",
"event_name": "ইভেন্টের নাম",
"mqtt": "এম.কিউ.টি.টি",

View File

@@ -90,10 +90,7 @@
"syncEnvironments": "Environments",
"turn_on": "Anschalten",
"turn_off": "Ausschalten",
"login_first": "Logge dich zuerst ein",
"paste_a_note": "Füge eine Notiz hinzu",
"import_from_sync": "Von Sync importieren",
"notes": "Notizen",
"socketio": "Socket.IO",
"event_name": "Event Name",
"mqtt": "MQTT",

View File

@@ -266,10 +266,7 @@
"syncEnvironments": "Environments",
"turn_on": "Turn on",
"turn_off": "Turn off",
"login_first": "Login first",
"paste_a_note": "Paste a note",
"import_from_sync": "Import from Sync",
"notes": "Notes",
"socketio": "Socket.IO",
"event_name": "Event Name",
"mqtt": "MQTT",

View File

@@ -240,7 +240,6 @@
"syncCollections": "Colecciones",
"syncEnvironments": "Entornos",
"turn_on": "Encender",
"login_first": "Inicie sesión primero",
"import_from_sync": "Importar desde Sync",
"add_one_variable": "(añade al menos una variable)",
"check_graphql_valid": "Compruebe la URL para ver si es un endpoint GraphQL válido",
@@ -262,8 +261,6 @@
"scrollInto_use_toggle": "Auto scroll",
"prettify_query": "Formatear query",
"prettify_body": "Formatear cuerpo",
"paste_a_note": "Pegar una nota",
"notes": "Notas",
"new_environment": "Nuevo entorno",
"my_new_environment": "Mi nuevo entorno",
"mqtt_unsubscribe": "Desuscribirse",

View File

@@ -241,7 +241,6 @@
"syncCollections": "Collections",
"syncEnvironments": "Environments",
"turn_on": "Activer",
"login_first": "Se connecter d'abord",
"paste_a_collection": "Coller une collection",
"import_from_sync": "Importer depuis la synchronisation",
"create_new_collection": "Créer une nouvelle collection",

View File

@@ -263,10 +263,7 @@
"syncEnvironments": "Lingkungan",
"turn_on": "Nyalakan",
"turn_off": "Matikan",
"login_first": "Masuk dahulu",
"paste_a_note": "Tempel catatan",
"import_from_sync": "Impor dari Sinkronasi",
"notes": "Catatan",
"socketio": "Socket.IO",
"event_name": "Nama Kejadian",
"mqtt": "MQTT",

View File

@@ -266,10 +266,7 @@
"syncEnvironments": "वातावरण",
"turn_on": "चालू करो",
"turn_off": "बंद करें",
"login_first": "पहले प्रवेश करो",
"paste_a_note": "एक नोट चिपकाएं",
"import_from_sync": "सिंक से आयात करें",
"notes": "टिप्पणियाँ",
"socketio": "सॉकेट.आईओ",
"event_name": "घटना नाम",
"mqtt": "एमक्यूटीटी",

View File

@@ -263,10 +263,7 @@
"syncCollections": "컬렉션",
"syncEnvironments": "환경변수",
"turn_on": "Turn on",
"login_first": "먼저 로그인해주세요.",
"paste_a_note": "노트 붙여넣기",
"import_from_sync": "동기화에서 가져오기",
"notes": "노트",
"socketio": "Socket.IO",
"event_name": "이",
"mqtt": "MQTT",

View File

@@ -263,10 +263,7 @@
"syncCollections": "ശേഖരങ്ങൾ",
"syncEnvironments": "പരിതസ്ഥിതികൾ",
"turn_on": "ഓൺ ചെയ്യുക",
"login_first": "ആദ്യം പ്രവേശിക്കുക",
"paste_a_note": "ഒരു കുറിപ്പ് ഒട്ടിക്കുക",
"import_from_sync": "Sync-ൽ നിന്ന് ഇറക്കുമതി ചെയ്യുക",
"notes": "കുറിപ്പുകൾ",
"socketio": "Socket.IO",
"event_name": "ഇവന്റിന്റെ പേര്",
"mqtt": "MQTT",

View File

@@ -266,10 +266,7 @@
"syncEnvironments": "Miljøer",
"turn_on": "Slå på",
"turn_off": "Slå av",
"login_first": "Logg inn først",
"paste_a_note": "Lim inn et notat",
"import_from_sync": "Importer fra synkronisering",
"notes": "Notater",
"socketio": "Socket.IO",
"event_name": "Hendelsesnavn",
"mqtt": "MQTT",

View File

@@ -263,10 +263,7 @@
"syncCollections": "Collecties",
"syncEnvironments": "Omgevingen",
"turn_on": "Inschakelen",
"login_first": "Meld u eerst aan",
"paste_a_note": "Notitie plakken",
"import_from_sync": "Importeren van Sync",
"notes": "Notities",
"socketio": "Socket.IO",
"event_name": "Event-naam",
"mqtt": "MQTT",

View File

@@ -271,10 +271,7 @@
"scrollInto_use_toggle": "Auto rolagem",
"sync": "Sincronizar",
"turn_on": "Ligar",
"login_first": "Realize o login primeiro",
"paste_a_note": "Cole uma nota",
"import_from_sync": "Importar de Sincronização",
"notes": "Notas",
"socketio": "Socket.IO",
"event_name": "Nome do Evento",
"mqtt": "MQTT",

View File

@@ -260,10 +260,7 @@
"syncCollections": "Coleções",
"syncEnvironments": "Ambientes",
"turn_on": "Ativar",
"login_first": "Entre primeiro",
"paste_a_note": "Cole uma nota",
"import_from_sync": "Importar from Sync",
"notes": "Notas",
"socketio": "Socket.IO",
"event_name": "Nome do evento",
"mqtt": "MQTT",

View File

@@ -261,10 +261,7 @@
"syncCollections": "Koleksiyonlar",
"syncEnvironments": "Ortamlar",
"turn_on": "Aç",
"login_first": "Önce Giriş Yap",
"paste_a_note": "Bir not yapıştır",
"import_from_sync": "Senkronizasyondan İçeri Aktar",
"notes": "Notlar",
"socketio": "Socket.IO",
"event_name": "Olay Adı",
"mqtt": "MQTT",

View File

@@ -263,10 +263,7 @@
"syncCollections": "Bộ sưu tập",
"syncEnvironments": "Môi trường",
"turn_on": "Bật",
"login_first": "Đăng nhập trước",
"paste_a_note": "Dán ghi chú",
"import_from_sync": "Nhập từ đồng bồ",
"notes": "Ghi chú",
"socketio": "Socket.IO",
"event_name": "Tên Event",
"mqtt": "MQTT",

View File

@@ -268,10 +268,7 @@
"syncEnvironments": "环境",
"turn_on": "点击开启",
"turn_off": "点击关闭",
"login_first": "请先登录:",
"paste_a_note": "输入新便笺",
"import_from_sync": "从云存储导入",
"notes": "便笺",
"socketio": "Socket.IO",
"event_name": "事件名称",
"mqtt": "MQTT",

View File

@@ -258,10 +258,7 @@
"syncCollections": "收藏庫",
"syncEnvironments": "環境",
"turn_on": "打開",
"login_first": "請先登入",
"paste_a_note": "Paste a note",
"import_from_sync": "Import from Sync",
"notes": "Notes",
"socketio": "Socket.IO",
"event_name": "Event Name",
"mqtt": "MQTT",

View File

@@ -457,14 +457,6 @@
<SmartTab :id="'collections'" :label="$t('collections')">
<CollectionsGraphql />
</SmartTab>
<!-- <SmartTab :id="'env'" :label="$t('environments')">
<Environments @use-environment="useSelectedEnvironment($event)" />
</SmartTab>
<SmartTab :id="'notes'" :label="$t('notes')">
<HttpNotes />
</SmartTab> -->
</SmartTabs>
</aside>
</TranslateSlideLeft>

View File

@@ -637,10 +637,6 @@
<SmartTab :id="'env'" :label="$t('environments')">
<Environments />
</SmartTab>
<SmartTab :id="'notes'" :label="$t('notes')">
<HttpNotes />
</SmartTab>
</SmartTabs>
</section>
</aside>
@@ -775,7 +771,11 @@ import runTestScriptWithVariables from "~/helpers/postwomanTesting"
import parseTemplateString from "~/helpers/templating"
import { tokenRequest, oauthRedirect } from "~/helpers/oauth"
import { cancelRunningRequest, sendNetworkRequest } from "~/helpers/network"
import { hasPathParams, addPathParamsToVariables, getQueryParams } from "~/helpers/requestParams"
import {
hasPathParams,
addPathParamsToVariables,
getQueryParams,
} from "~/helpers/requestParams"
import { parseUrlAndPath } from "~/helpers/utils/uri"
import { httpValid } from "~/helpers/utils/valid"
import {

View File

@@ -57,13 +57,6 @@
{{ SYNC_HISTORY ? $t("enabled") : $t("disabled") }}
</SmartToggle>
</p>
<p v-if="isSyncDisabled">
<button @click="initSettings">
<i class="material-icons">sync</i>
<span>{{ $t("turn_on") + " " + $t("sync") }}</span>
</button>
</p>
</div>
<div v-else>
<label>{{ $t("login_with") }}</label>
@@ -286,9 +279,6 @@ export default Vue.extend({
key: this.PROXY_KEY,
}
},
isSyncDisabled(): boolean {
return this.SYNC_COLLECTIONS && this.SYNC_ENVIRONMENTS && this.SYNC_HISTORY
}
},
watch: {
proxySettings: {
@@ -318,11 +308,6 @@ export default Vue.extend({
) {
this.applySetting(name, value)
},
initSettings() {
applySetting("syncHistory", true)
applySetting("syncCollections", true)
applySetting("syncEnvironments", true)
},
resetProxy({ target }: { target: HTMLElement }) {
applySetting("PROXY_URL", `https://proxy.hoppscotch.io/`)