@@ -12,10 +12,10 @@ export default class extends BaseGenerator {
12
12
// COMMON COMPONENTS
13
13
"app/components/common/delete/delete.component.html" ,
14
14
"app/components/common/delete/delete.component.ts" ,
15
- "app/components/common/form/form.component.html" ,
16
- "app/components/common/form/form.component.ts" ,
17
15
"app/components/common/header/header.component.html" ,
18
16
"app/components/common/header/header.component.ts" ,
17
+ "app/components/common/layout/layout.component.html" ,
18
+ "app/components/common/layout/layout.component.ts" ,
19
19
"app/components/common/sidebar/sidebar.component.html" ,
20
20
"app/components/common/sidebar/sidebar.component.ts" ,
21
21
"app/components/common/table/table.component.html" ,
@@ -26,6 +26,8 @@ export default class extends BaseGenerator {
26
26
"app/components/foo/create/create.component.ts" ,
27
27
"app/components/foo/edit/edit.component.html" ,
28
28
"app/components/foo/edit/edit.component.ts" ,
29
+ "app/components/foo/form/form.component.html" ,
30
+ "app/components/foo/form/form.component.ts" ,
29
31
"app/components/foo/list/list.component.html" ,
30
32
"app/components/foo/list/list.component.ts" ,
31
33
"app/components/foo/show/show.component.html" ,
@@ -45,11 +47,6 @@ export default class extends BaseGenerator {
45
47
46
48
//INTERFACE
47
49
"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" ,
53
50
54
51
// ROUTER
55
52
"app/router/foo.ts" ,
@@ -89,7 +86,6 @@ export default class extends BaseGenerator {
89
86
const titleUcFirst =
90
87
resource . title . charAt ( 0 ) . toUpperCase ( ) + resource . title . slice ( 1 ) ;
91
88
const fields = this . parseFields ( resource ) ;
92
- console . log ( fields ) ;
93
89
const hasIsRelation = fields . some ( ( field ) => field . isRelation ) ;
94
90
const hasIsRelations = fields . some ( ( field ) => field . isRelations ) ;
95
91
const hasDateField = fields . some ( ( field ) => field . type === "dateTime" ) ;
@@ -108,19 +104,19 @@ export default class extends BaseGenerator {
108
104
hasIsRelations,
109
105
hasRelations : hasIsRelation || hasIsRelations ,
110
106
hasDateField,
107
+ apiResource : this . apiResource ( api ) ,
111
108
} ;
112
- console . log ( "api ==>" , api ) ;
113
109
114
110
//CREATE DIRECTORIES - These directories may already exist
115
111
[
116
112
`${ dir } /assets` ,
117
113
`${ dir } /utils` ,
118
114
`${ dir } /app/components/${ lc } /create` ,
119
115
`${ dir } /app/components/${ lc } /edit` ,
116
+ `${ dir } /app/components/${ lc } /form` ,
120
117
`${ dir } /app/components/${ lc } /list` ,
121
118
`${ dir } /app/components/${ lc } /show` ,
122
119
`${ dir } /app/components/common/delete` ,
123
- `${ dir } /app/components/common/form` ,
124
120
`${ dir } /app/components/common/header` ,
125
121
`${ dir } /app/components/common/sidebar` ,
126
122
`${ dir } /app/components/common/table` ,
@@ -145,13 +141,14 @@ export default class extends BaseGenerator {
145
141
"app/components/svg/menu/menu.component.ts" ,
146
142
"app/components/common/delete/delete.component.html" ,
147
143
"app/components/common/delete/delete.component.ts" ,
148
- "app/components/common/form/form.component.html" ,
149
- "app/components/common/form/form.component.ts" ,
150
144
"app/components/common/header/header.component.html" ,
151
145
"app/components/common/header/header.component.ts" ,
146
+ "app/components/common/sidebar/sidebar.component.css" ,
152
147
"app/components/common/sidebar/sidebar.component.html" ,
153
148
"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" ,
155
152
"app/app.component.html" ,
156
153
"app/app.component.ts" ,
157
154
"app/app.routes.ts" ,
@@ -165,10 +162,13 @@ export default class extends BaseGenerator {
165
162
"app/components/%s/list/list.component.ts" ,
166
163
"app/components/%s/create/create.component.html" ,
167
164
"app/components/%s/create/create.component.ts" ,
168
- /* "app/components/%s/edit/edit.component.html",
165
+ "app/components/%s/edit/edit.component.html" ,
169
166
"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" ,
172
172
] . forEach ( ( file ) =>
173
173
this . createFileFromPattern ( file , dir , [ lc , formFields ] , context )
174
174
) ;
@@ -202,4 +202,10 @@ export default class extends BaseGenerator {
202
202
203
203
return Object . values ( fields ) ;
204
204
}
205
+
206
+ apiResource ( api ) {
207
+ return api . resources
208
+ . filter ( ( val ) => ! val . deprecated )
209
+ . map ( ( val ) => val . title ) ;
210
+ }
205
211
}
0 commit comments