Skip to content

Fix enter to submit, and dynamic entities not loading #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/components/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,16 @@ const onError = (error) => {

<template>
<main>
<el-form ref="requestFormRef" :model="requestForm">
<el-form ref="requestFormRef" :model="requestForm" @submit.prevent>
<el-form-item prop="url">
<div class="flex-request-preview-panel">
<input type="text" v-model="url" :set="(requestForm.url = url)" id="search-input" />
<input
type="text"
v-model="url"
:set="(requestForm.url = url)"
id="search-input"
@keyup.enter="submit(requestFormRef, submitRequest)"
/>
<el-button
:type="type"
id="search-button"
Expand Down
22 changes: 22 additions & 0 deletions src/obp/resource-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ export async function getOBPResourceDocs(apiStandardAndVersion: string): Promise
return await get(`/obp/${OBP_API_VERSION}/resource-docs/${apiStandardAndVersion}/obp`)
}


export async function getOBPDynamicResourceDocs(apiStandardAndVersion: string): Promise<any> {
const logMessage = `Loading Dynamic Docs for ${apiStandardAndVersion}`
console.log(logMessage)
updateLoadingInfoMessage(logMessage)
return await get(`/obp/${OBP_API_VERSION}/resource-docs/${apiStandardAndVersion}/obp?content=dynamic`)
}

export function getFilteredGroupedResourceDocs(apiStandardAndVersion: string, tags: any, docs: any): Promise<any> {
console.log(docs);
if (apiStandardAndVersion === undefined || docs === undefined || docs[apiStandardAndVersion] === undefined) return Promise.resolve<any>({})
Expand Down Expand Up @@ -70,6 +78,20 @@ export async function cacheDoc(cacheStorageOfResourceDocs: any): Promise<any> {
const scannedAPIVersions = apiVersions.scanned_api_versions
const resourceDocsMapping: any = {}
for (const { apiStandard, API_VERSION } of scannedAPIVersions) {

// we need this to cache the dynamic entities resource doc
if (API_VERSION === 'dynamic-entity') {
const logMessage = `Caching Dynamic API { standard: ${apiStandard}, version: ${API_VERSION} }`
console.log(logMessage)
if (apiStandard) {
const version = `${apiStandard.toUpperCase()}${API_VERSION}`
const resourceDocs = await getOBPDynamicResourceDocs(version)
if (version && Object.keys(resourceDocs).includes('resource_docs'))
resourceDocsMapping[version] = resourceDocs
}
updateLoadingInfoMessage(logMessage)
continue
}
const logMessage = `Caching API { standard: ${apiStandard}, version: ${API_VERSION} }`
console.log(logMessage)
if (apiStandard) {
Expand Down