fix api proxy, route urls and filters

This commit is contained in:
2021-07-16 00:39:41 -06:00
parent 9253a84d7e
commit dcd3c0a95b
5 changed files with 20 additions and 5 deletions

View File

@ -19,7 +19,6 @@
"@typescript-eslint/eslint-plugin": "^4.18.0", "@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0", "@typescript-eslint/parser": "^4.18.0",
"@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-pwa": "~4.5.0", "@vue/cli-plugin-pwa": "~4.5.0",
"@vue/cli-plugin-typescript": "~4.5.0", "@vue/cli-plugin-typescript": "~4.5.0",
"@vue/cli-service": "~4.5.0", "@vue/cli-service": "~4.5.0",

View File

@ -0,0 +1,10 @@
module.exports = {
devServer: {
proxy: {
'/api/': {
target: 'http://localhost:3000',
changeOrigin: true
},
}
}
}

View File

@ -22,7 +22,7 @@ export function buildAppLinks(component: ComponentDef, outDir: string, systemDef
} }
function createLinksMarkup(component: ComponentDef, systemDef: SystemDef): string { function createLinksMarkup(component: ComponentDef, systemDef: SystemDef): string {
let out = `<router-link to="/${component.component}">${component.component} List</router-link> let out = `<router-link to="/${component.component}">${component.component} List</router-link><br/>
`; `;
return out; return out;

View File

@ -147,7 +147,7 @@ function createFEServiceFunc(view: EndpointDef): string {
} }
let addTypeDeclaration = method === 'get' || method === 'post'; let addTypeDeclaration = method === 'get' || method === 'post';
let useList = view.type === 'list' || view.type === 'search'; let useList = view.type === 'list' || view.type === 'search';
let url = URL[view.type](view).replace(':' + view.component + '_id', '\' + ' + view.component + '_id'); let url = view.component + '/' + URL[view.type](view).replace(':' + view.component + '_id', '\' + ' + view.component + '_id');
let isUpdateOrCreate = view.type === 'update' || view.type === 'create'; let isUpdateOrCreate = view.type === 'update' || view.type === 'create';
func = ` func = `

View File

@ -66,6 +66,11 @@ export function buildListView(component: ComponentDef, outDir: string, systemDef
return insertFEFiltersMarkup(listEndpoints[0], filterSet, outDir); return insertFEFiltersMarkup(listEndpoints[0], filterSet, outDir);
}); });
} }
// TODO: add create component to sidebar
// TODO: add details component to sidebar
// TODO: if delete endpoint exists add delete button next to each row
return endpointPromise; return endpointPromise;
} }
@ -148,13 +153,14 @@ function createFilterMarkup(view: EndpointDef, filters: Filter[]): string {
if (f.type) { if (f.type) {
// base the filter markup on type // base the filter markup on type
out = out + `<div> out = out + `<div>
<input type="${inputType[f.type] || 'text'}" placeholder="${f.param}" v-model="item.${f.param}"/> <label>${f.param}: </label>
<input type="${inputType[f.type] || 'text'}" placeholder="${f.param}" v-model="filterItems.${f.param}"/>
</div> </div>
`; `;
} else { } else {
// default to a string filter // default to a string filter
out = out + `<div> out = out + `<div>
<input type="text" placeholder="${f.param}" v-model="item.${f.param}"/> <input type="text" placeholder="${f.param}" v-model="filterItems.${f.param}"/>
</div> </div>
`; `;
} }