Skip to content

Commit 53917a5

Browse files
committed
[spalenque] - #14274 * set component and category order according to yaml files
1 parent e4d50e4 commit 53917a5

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

software/code/tasks/IngestOpenStackComponentsDataCronTask.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ private function processComponentsAndCategories()
303303

304304
$category->Enabled = 1;
305305
$category->write();
306+
$subCatOrder = 1;
306307

307308
foreach($categoryYaml['tabs'] as $tab) {
308309
$subcatName = $tab['name'];
@@ -319,9 +320,13 @@ private function processComponentsAndCategories()
319320
}
320321
$subcat->Enabled = 1;
321322
$subcat->ParentCategoryID = $category->ID;
323+
$subcat->Order = $subCatOrder;
322324
$subcat->write();
325+
326+
$subCatOrder++;
323327
}
324328

329+
$subSubCatOrder = 1;
325330
foreach($tab['categories'] as $subcategory) {
326331
$subcatName2 = $subcategory['category'];
327332
//echo sprintf("-- cat %s ", $subcatName2).PHP_EOL;
@@ -334,8 +339,12 @@ private function processComponentsAndCategories()
334339
$subcat2->Enabled = 1;
335340
$subcat2->ParentCategoryID = $subcat->ID;
336341
$subcat2->OpenStackComponents()->removeAll();
342+
$subcat2->Order = $subSubCatOrder;
337343
$subcat2->write();
338344

345+
$subSubCatOrder++;
346+
347+
$compOrder = 1;
339348
foreach($subcategory['components'] as $component) {
340349
$compSlug = $component['name'];
341350
//echo sprintf("--- comp %s ", $compSlug).PHP_EOL;
@@ -350,10 +359,11 @@ private function processComponentsAndCategories()
350359
$comp->CodeName = (isset($component['name'])) ? ucfirst($component['name']) : '';
351360
$comp->Description = (isset($component['desc'])) ? $component['desc'] : '';
352361
$comp->Since = (isset($component['since'])) ? $component['since'] : '';
353-
354-
355362
$comp->CategoryID = $subcat2->ID;
363+
$comp->Order = $compOrder;
356364
$comp->write();
365+
366+
$compOrder++;
357367
}
358368
}
359369
}

0 commit comments

Comments
 (0)