-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.yaml
576 lines (575 loc) · 17.5 KB
/
admin.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
about:
date: 10/30/2023
recent_changes: api_root, altered Customer/Order/Employee attribute ordering, tab captions, info, EmpType, dept emps, defaults, show_when, cascade add, toggles, images, security, login, virtual relns, global filters
# this file illustrates customizations; compare it to admin-created.yaml to see the spedific changes. version: 6.00.08
api_root: '{http_type}://{swagger_host}:{port}/{api}'
info_toggle_checked: true
info:
number_relationships: 13
number_tables: 17
authentication:
endpoint: '{http_type}://{swagger_host}:{port}/api/auth/#'
resources:
Category:
info_list: <h1>Tour - Application Information, Authorization</h1>
<h2>Application Information</h2>
Info is set in the <span style="font-family:'Courier New'">ui/admin/admin.yaml</span> file with <span style="font-family:'Courier New'">info_list</span> and
<span style="font-family:'Courier New'">info_show</span>. To show info...
<ul>
<li>On the page, click (?) to see the info dialog box</li>
<li>On the personalization icon (upper right), click the (?) toggle to see info on the page</li>
<li>In the admin.yaml, set <span style="font-family:'Courier New'">info_toggle_checked</span></li>
</ul>
Suggestion - visit the Customer, Department and Employee pages.<br><br>
<h2>Authorization</h2>
The table includes 8 rows (login as 'admin' with password 'p', upper right).<br><br>
But, logout and login as 'u1' -- only 1 is shown, per <a target="_blank" href="https://apilogicserver.github.io/Docs/Security-Authorization/">authorization</a>.
<br><br>
attributes:
- label: ' Category Name*'
name: CategoryName
search: true
sort: true
- name: Description
- name: Client_id
- name: Id
type: Category
user_key: CategoryName
Customer:
info_list: <h1>List Pages</h1>
In this
<a target="_blank" href="https://apilogicserver.github.io/Docs/Sample-Database/">Northwind demo,</a>
Info provides Tour suggestions (see Category for instructions). On this page...
<ul>
<li> <strong>Search</strong> on multiple fields (Company, Contact Name) -- try z</li>
<li> <strong>Sort</strong> by column headers</li>
<li> <strong>Pagination</strong> (at bottom) to handle large result sets</li>
<li> <strong>Multi-page</strong>
<ul>
<li>Reset your search / sort so that
<span style="font-family:'Courier New'">Alfreds</span> is at the top </li>
<li>Click <span style="font-family:'Courier New'">Alfreds,</span>
to "zoom in" to the <i>show</i> page
<ul><li>More info there</li></ul></li>
</ul>
</li>
</ul>
<br><br>
<h2>Authorization</h2>
The table includes many rows (login as 'admin' with password 'p', upper right).<br><br>
But, logout and login as 's1' -- only 1 is shown, per <a target="_blank" href="https://apilogicserver.github.io/Docs/Security-Authorization/">authorization</a>.
See `security/declare_logic.py`.
<br><br>
info_show: <h1>Multi-table</h1>
<ul>
<li><strong>Multi-Table Browsing - </strong>Note the list of related orders
<ul>
<li><strong>Navigations - </strong> Click first Order</li>
</ul>
</li>
<li> <strong>Multi-Table Add - </strong> Add a New Order
<ul>
<li>Observe several fields are not shown when inserting (e.g., Order.Id)</li>
<li>Observe that the Customer is filled in ("Cascade Add")</li>
<li>Lookup an Employee</li>
<li><strong>Click Save and Show</strong></li>
<li>Insert several OrderDetails
<ul>
<li>Observe OrderId value is defaulted ("Cascade Add") and not shown ("Show_when")</li>
<li>Lookup a Product</li>
<li>Click <strong>Save and Add Another</strong> </li>
<li>Lookup another Product, and click <strong>Add</strong> to see the added Order
</li>
</ul>
</li>
</ul>
attributes:
- name: Id
search: true
sort: true
- label: ' Company Name*'
name: CompanyName
search: true
sort: true
- name: Balance
type: DECIMAL
info: derived as sum(Order.AmountTotal where ShippedDate is None)
- name: CreditLimit
type: DECIMAL
info: Balance may not exceed this value
- name: OrderCount
info: derived as sum(Order)
- name: UnpaidOrderCount
info: derived as count(Order where ShippedDate is None)
- name: Client_id
- name: ContactName
- name: ContactTitle
- name: Address
- name: City
- name: Region
- name: PostalCode
- name: Country
- name: Phone
- name: Fax
tab_groups:
- direction: tomany
fks:
- CustomerId
name: OrderList
label: Placed Order List
resource: Order
type: Customer
user_key: CompanyName
CustomerDemographic:
attributes:
- label: ' Id*'
name: Id
search: true
sort: true
- name: CustomerDesc
type: CustomerDemographic
user_key: Id
Department:
info_list: <h1>Tour - Authorization</h1>
<h2>Global Security Filters</h2>
Only role sa & manager can view SecurityLevel > 0 - see security/declare_security.py
<br><br>
attributes:
- label: ' Department Name*'
name: DepartmentName
search: true
sort: true
- name: DepartmentId
- name: Id
- name: SecurityLevel
tab_groups:
- direction: tomany
fks:
- DepartmentId
name: DepartmentList
resource: Department
- direction: tomany
fks:
- OnLoanDepartmentId
name: EmployeeList
label: Employees On Loan
resource: Employee
- direction: tomany
fks:
- WorksForDepartmentId
name: EmployeeList1
label: Employees
resource: Employee
- direction: toone
fks:
- DepartmentId
name: Department
resource: Department
type: Department
user_key: DepartmentName
Employee:
info_list: <h1>Show When</h1>
Support for
<a target="_blank" href="https://apilogicserver.github.io/Docs/Admin-Customization/#show_when">Show When</a>
means you can define expressions that determine when a field is shown or hidden. On this page...
<ul>
<li> Click <strong>Suyama</strong> and note
<span style="font-family:'Courier New'">Dues</span> is hidden,
but visible if you click <strong>Steele</strong>
<ul>
<li>
That is because <span style="font-family:'Courier New'">Admin.yaml</span> has a
expression for the <span style="font-family:'Courier New'">show_when expression</span> for the
<span style="font-family:'Courier New'">Dues</span> field
</li>
</ul>
</li>
<li> Observe the same effect on Update / Insert screens as you alter the value of <span style="font-family:'Courier New'">EmployeeType</span></li>
</ul>
<h1>Images</h1>
Observe that "show" pages support images.
<h1>Virtual Relationships</h1>
Observe that "show" pages have tabs for Manages and Manager.<br>
These foreign keys are *not* defined in the database, but in <span style="font-family:'Courier New'">database/customize_models.py</span>.<br>
<h1>Derived Attributes</h1>
<span style="font-family:'Courier New'">ProperSalary</span> is not defined in the database.<br>
See <span style="font-family:'Courier New'">database/customize_models.py</span>.<br>
attributes:
- label: ' Last Name*'
name: LastName
search: true
sort: true
- name: OnLoanDepartmentId
- name: WorksForDepartmentId
- name: Salary
type: DECIMAL
- name: ProperSalary
type: DECIMAL
- name: EmployeeType
- name: Dues
type: DECIMAL
show_when: record["EmployeeType"] == "Hourly"
- name: FirstName
- name: Id
- name: Title
- name: TitleOfCourtesy
- name: BirthDate
- name: HireDate
- name: Address
- name: City
- name: Region
- name: PostalCode
- name: Country
- name: HomePhone
- name: Extension
- name: Notes
- name: ReportsTo
- name: PhotoPath
type: Image
- name: IsCommissioned
tab_groups:
- direction: tomany
fks:
- EmployeeId
name: EmployeeAuditList
resource: EmployeeAudit
- direction: tomany
fks:
- EmployeeId
name: EmployeeTerritoryList
resource: EmployeeTerritory
- direction: tomany
fks:
- EmployeeId
name: OrderList
resource: Order
- direction: toone
fks:
- OnLoanDepartmentId
name: Department
resource: Department
- direction: toone
fks:
- WorksForDepartmentId
name: Department1
resource: Department
- direction: toone
fks:
- UnionId
name: Union
resource: Union
- direction: tomany
fks:
- ReportsTo
name: Manages
resource: Employee
- direction: toone
fks:
- ReportsTo
name: Manager
resource: Employee
type: Employee
user_key: LastName
EmployeeAudit:
attributes:
- label: ' Last Name*'
name: LastName
search: true
sort: true
- name: EmployeeId
- name: Title
- name: Salary
type: DECIMAL
- name: FirstName
- name: CreatedOn
- name: Id
tab_groups:
- direction: toone
fks:
- EmployeeId
name: Employee
resource: Employee
type: EmployeeAudit
user_key: LastName
EmployeeTerritory:
attributes:
- label: ' Id*'
name: Id
search: true
sort: true
- name: TerritoryId
- name: EmployeeId
required: true
tab_groups:
- direction: toone
fks:
- TerritoryId
name: Territory
resource: Territory
- direction: toone
fks:
- EmployeeId
name: Employee
resource: Employee
type: EmployeeTerritory
user_key: Id
Location:
attributes:
- label: ' country*'
name: country
required: true
search: true
sort: true
- name: city
required: true
- name: notes
tab_groups:
- direction: tomany
fks:
- Country
- City
name: OrderList
resource: Order
type: Location
user_key: country
Order:
info_show: <h1>Tour</h1>
<h3>Automatic Joins</h3>
<ul>
<li> Observe the Product Name in the Order Detail list.</li>
<li> In the
<a target="_blank" href="https://apilogicserver.github.io/Docs/Sample-Database/">sample database,</a>
the Order Detail is related to the Product by
<span style="font-family:'Courier New'">ProductId.</span>
which makes no sense to End Users.<br>
So, the system joins a suitable field, automatically.
</li>
<li>
Automatic joins are configurable
<a target="_blank" href="https://apilogicserver.github.io/Docs/Admin-Customization/">configurable.</a>
</li>
</ul>
<h3>Update Support - Lookups, Logic</h3>
<ul>
<li> <strong>Edit</strong> the first Order Detail, and....
<ul>
<li> Use <strong>Lookup</strong> to select a different product. </li>
</ul>
</li>
<li> After save, observe the altered
<span style="font-family:'Courier New'">Amount Total.</span>
<ul>
<li>
This is not from code, but from
<a target="_blank" href="https://apilogicserver.github.io/Docs/Tutorial/#logic">this logic.</a>
</li>
</ul>
</li>
</ul>
attributes:
- name: Id
show_when: isInserting == false
- name: EmployeeId
- name: ShippedDate
info: set reduces Customer Balance, decreases Product Stock
show_when: isInserting == false
- name: OrderDate
type: DATE
- name: AmountTotal
type: DECIMAL
info: derived as sum(OrderDetail.Amount)
show_when: isInserting == false
- name: Ready
type : Boolean
- name: CloneFromOrder
- name: OrderDetailCount
show_when: isInserting == false
- name: Freight
type: DECIMAL
- name: Country
label: Country
- name: City
label: City
- name: RequiredDate
- name: CustomerId
required: true
- label: ' Ship Name*'
name: ShipName
search: true
sort: true
- name: ShipVia
- name: ShipAddress
- name: ShipCity
- name: ShipRegion
- name: ShipZip
- name: ShipCountry
tab_groups:
- direction: tomany
fks:
- OrderId
name: OrderDetailList
label: Order Detail List
resource: OrderDetail
- direction: toone
fks:
- CustomerId
name: Customer
resource: Customer
- direction: toone
fks:
- Country
- City
name: Location
resource: Location
- direction: toone
fks:
- EmployeeId
name: Employee
resource: Employee
type: Order
user_key: Id
OrderDetail:
attributes:
- label: ' Id*'
name: Id
search: true
sort: true
show_when: isInserting == false
- name: ProductId
required: true
- name: OrderId
required: true
show_when: isInserting == false
- name: UnitPrice
info: derived as copy(Product.UnitPrice)
type: DECIMAL
show_when: isInserting == false
- name: Quantity
- name: Discount
- name: Amount
type: DECIMAL
info: derived as UnitPrice * Quantity
show_when: isInserting == false
- name: ShippedDate
info: derived as Order.ShippedDate
show_when: isInserting == false
tab_groups:
- direction: toone
fks:
- ProductId
name: Product
resource: Product
- direction: toone
fks:
- OrderId
name: Order
resource: Order
type: OrderDetail
user_key: Id
Product:
attributes:
- label: ' Product Name*'
name: ProductName
search: true
sort: true
- name: QuantityPerUnit
- name: UnitPrice
required: true
type: DECIMAL
- name: UnitsInStock
required: true
info: derived as UnitsInStock - (UnitsShipped - old_row.UnitsShipped)
- name: UnitsOnOrder
required: true
- name: ReorderLevel
required: true
- name: Discontinued
required: true
- name: UnitsShipped
- name: Id
info: derived as sum(OrderDetail.Quantity where ShippedDate is not None)
- name: SupplierId
required: true
- name: CategoryId
required: true
tab_groups:
- direction: tomany
fks:
- ProductId
name: OrderDetailList
resource: OrderDetail
type: Product
user_key: ProductName
Region:
attributes:
- label: ' Region Description*'
name: RegionDescription
search: true
sort: true
- name: Id
type: Region
user_key: RegionDescription
Shipper:
attributes:
- label: ' Company Name*'
name: CompanyName
search: true
sort: true
- name: Phone
- name: Id
type: Shipper
user_key: CompanyName
Supplier:
attributes:
- label: ' Company Name*'
name: CompanyName
search: true
sort: true
- name: ContactName
- name: ContactTitle
- name: Address
- name: City
- name: Region
- name: PostalCode
- name: Country
- name: Phone
- name: Fax
- name: HomePage
- name: Id
type: Supplier
user_key: CompanyName
Territory:
attributes:
- label: ' Territory Description*'
name: TerritoryDescription
search: true
sort: true
- name: Id
- name: RegionId
required: true
tab_groups:
- direction: tomany
fks:
- TerritoryId
name: EmployeeTerritoryList
resource: EmployeeTerritory
type: Territory
user_key: TerritoryDescription
Union:
attributes:
- label: ' Name*'
name: Name
search: true
sort: true
- name: Id
tab_groups:
- direction: tomany
fks:
- UnionId
name: EmployeeList
resource: Employee
type: Union
user_key: Name
settings:
HomeJS: http://localhost:5656/admin-app/home.js
max_list_columns: 8