@@ -12,10 +12,10 @@ export default class extends BaseGenerator {
1212 // COMMON COMPONENTS
1313 "app/components/common/delete/delete.component.html",
1414 "app/components/common/delete/delete.component.ts",
15- "app/components/common/form/form.component.html",
16- "app/components/common/form/form.component.ts",
1715 "app/components/common/header/header.component.html",
1816 "app/components/common/header/header.component.ts",
17+ "app/components/common/layout/layout.component.html",
18+ "app/components/common/layout/layout.component.ts",
1919 "app/components/common/sidebar/sidebar.component.html",
2020 "app/components/common/sidebar/sidebar.component.ts",
2121 "app/components/common/table/table.component.html",
@@ -26,6 +26,8 @@ export default class extends BaseGenerator {
2626 "app/components/foo/create/create.component.ts",
2727 "app/components/foo/edit/edit.component.html",
2828 "app/components/foo/edit/edit.component.ts",
29+ "app/components/foo/form/form.component.html",
30+ "app/components/foo/form/form.component.ts",
2931 "app/components/foo/list/list.component.html",
3032 "app/components/foo/list/list.component.ts",
3133 "app/components/foo/show/show.component.html",
@@ -45,11 +47,6 @@ export default class extends BaseGenerator {
4547
4648 //INTERFACE
4749 "app/interface/api.ts",
48- "app/interface/foo.model.ts",
49- "app/interface/hero.model.ts",
50- "app/interface/list.model.ts",
51- "app/interface/show.model.ts",
52- "app/interface/update.model.ts",
5350
5451 // ROUTER
5552 "app/router/foo.ts",
@@ -89,7 +86,6 @@ export default class extends BaseGenerator {
8986 const titleUcFirst =
9087 resource.title.charAt(0).toUpperCase() + resource.title.slice(1);
9188 const fields = this.parseFields(resource);
92- console.log(fields);
9389 const hasIsRelation = fields.some((field) => field.isRelation);
9490 const hasIsRelations = fields.some((field) => field.isRelations);
9591 const hasDateField = fields.some((field) => field.type === "dateTime");
@@ -108,19 +104,19 @@ export default class extends BaseGenerator {
108104 hasIsRelations,
109105 hasRelations: hasIsRelation || hasIsRelations,
110106 hasDateField,
107+ apiResource: this.apiResource(api),
111108 };
112- console.log("api ==>", api);
113109
114110 //CREATE DIRECTORIES - These directories may already exist
115111 [
116112 `${dir}/assets`,
117113 `${dir}/utils`,
118114 `${dir}/app/components/${lc}/create`,
119115 `${dir}/app/components/${lc}/edit`,
116+ `${dir}/app/components/${lc}/form`,
120117 `${dir}/app/components/${lc}/list`,
121118 `${dir}/app/components/${lc}/show`,
122119 `${dir}/app/components/common/delete`,
123- `${dir}/app/components/common/form`,
124120 `${dir}/app/components/common/header`,
125121 `${dir}/app/components/common/sidebar`,
126122 `${dir}/app/components/common/table`,
@@ -145,13 +141,14 @@ export default class extends BaseGenerator {
145141 "app/components/svg/menu/menu.component.ts",
146142 "app/components/common/delete/delete.component.html",
147143 "app/components/common/delete/delete.component.ts",
148- "app/components/common/form/form.component.html",
149- "app/components/common/form/form.component.ts",
150144 "app/components/common/header/header.component.html",
151145 "app/components/common/header/header.component.ts",
146+ "app/components/common/sidebar/sidebar.component.css",
152147 "app/components/common/sidebar/sidebar.component.html",
153148 "app/components/common/sidebar/sidebar.component.ts",
154-
149+ "app/components/common/table/table.component.html",
150+ "app/components/common/table/table.component.ts",
151+ "app/interface/api.ts",
155152 "app/app.component.html",
156153 "app/app.component.ts",
157154 "app/app.routes.ts",
@@ -165,10 +162,13 @@ export default class extends BaseGenerator {
165162 "app/components/%s/list/list.component.ts",
166163 "app/components/%s/create/create.component.html",
167164 "app/components/%s/create/create.component.ts",
168- /* "app/components/%s/edit/edit.component.html",
165+ "app/components/%s/edit/edit.component.html",
169166 "app/components/%s/edit/edit.component.ts",
170- "app/components/%s/show/show.component.svg",
171- "app/components/%s/show/show.component.ts",*/
167+ "app/components/%s/form/form.component.html",
168+ "app/components/%s/form/form.component.ts",
169+ "app/components/%s/show/show.component.html",
170+ "app/components/%s/show/show.component.ts",
171+ "app/components/%s/show/show.component.html",
172172 ].forEach((file) =>
173173 this.createFileFromPattern(file, dir, [lc, formFields], context)
174174 );
@@ -202,4 +202,10 @@ export default class extends BaseGenerator {
202202
203203 return Object.values(fields);
204204 }
205+
206+ apiResource(api) {
207+ return api.resources
208+ .filter((val) => !val.deprecated)
209+ .map((val) => val.title);
210+ }
205211}
0 commit comments