Skip to content

Commit 92d8427

Browse files
committed
!410 - Added bundles and generate new release.
1 parent 184eb3a commit 92d8427

File tree

14 files changed

+1577
-112
lines changed

14 files changed

+1577
-112
lines changed

apps/Core/Components/Devtools/Modules/ModulesComponent.php

Lines changed: 156 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ public function initialize()
2020
*/
2121
public function viewAction()
2222
{
23+
if (isset($this->getData()['bundles'])) {
24+
$this->view->bundles = true;
25+
}
26+
2327
if (isset($this->getData()['includecoremodules'])) {
2428
$this->view->includecoremodules = true;
2529
}
@@ -28,6 +32,10 @@ public function viewAction()
2832
$this->view->clone = true;
2933
}
3034

35+
if (isset($this->getData()['newrelease'])) {
36+
$this->view->newrelease = true;
37+
}
38+
3139
$appTypesArr = $this->apps->types->types;
3240
$appTypes = [];
3341

@@ -57,11 +65,16 @@ public function viewAction()
5765
$modules['core']['value'] = 'Core';
5866
$modules['core']['childs'][1] = $module;
5967

60-
$modulesTypeArr = ['components', 'packages', 'middlewares', 'views'];
68+
$modulesTypeArr = ['components', 'packages', 'middlewares', 'views', 'bundles'];
6169

6270
foreach ($modulesTypeArr as $modulesType) {
63-
$modulesArr = $this->processModulesArr(msort($this->modules->{$modulesType}->{$modulesType}, 'name'));
64-
${$modulesType . 'CategoryArr'} = $modulesArr['categoryArr'];
71+
if ($modulesType === 'bundles') {
72+
$modulesArr['modules'] = $this->modulesPackage->getAll()->bundles;
73+
} else {
74+
$modulesArr = $this->processModulesArr(msort($this->modules->{$modulesType}->{$modulesType}, 'name'));
75+
${$modulesType . 'CategoryArr'} = $modulesArr['categoryArr'];
76+
}
77+
6578
if (count($modulesArr['modules']) > 0) {
6679
$modules[$modulesType]['value'] = ucfirst($modulesType);
6780
$modules[$modulesType]['childs'] = $modulesArr['modules'];
@@ -75,6 +88,10 @@ public function viewAction()
7588
$modulesJson = [];
7689

7790
foreach ($modules as $moduleKey => $moduleJson) {
91+
if ($moduleKey === 'bundles') {
92+
continue;
93+
}
94+
7895
foreach ($moduleJson['childs'] as $childKey => $child) {
7996
$modulesJson[$moduleKey][$child['id']] =
8097
[
@@ -97,6 +114,24 @@ public function viewAction()
97114

98115
$this->view->modulesJson = Json::encode($modulesJson);
99116

117+
$apisArr = $this->basepackages->api->init()->getAll()->api;
118+
if (count($apisArr) > 0) {
119+
$apis[0]['id'] = 0;
120+
$apis[0]['name'] = 'Local Modules';
121+
$apis[0]['data']['url'] = 'https://.../';
122+
123+
foreach ($apisArr as $api) {
124+
if ($api['category'] === 'repos') {
125+
$useApi = $this->basepackages->api->useApi($api['id'], true);
126+
$apiConfig = $useApi->getApiConfig();
127+
128+
$apis[$api['id']]['id'] = $apiConfig['id'];
129+
$apis[$api['id']]['name'] = $apiConfig['name'];
130+
$apis[$api['id']]['data']['url'] = $apiConfig['repo_url'];
131+
}
132+
}
133+
}
134+
100135
if (isset($this->getData()['id']) &&
101136
isset($this->getData()['module']) &&
102137
isset($this->getData()['type'])
@@ -116,24 +151,6 @@ public function viewAction()
116151
$this->view->type = $type;
117152
$this->view->module = null;
118153

119-
$apisArr = $this->basepackages->api->init()->getAll()->api;
120-
if (count($apisArr) > 0) {
121-
$apis[0]['id'] = 0;
122-
$apis[0]['name'] = 'Local Modules';
123-
$apis[0]['data']['url'] = 'https://.../';
124-
125-
foreach ($apisArr as $api) {
126-
if ($api['category'] === 'repos') {
127-
$useApi = $this->basepackages->api->useApi($api['id'], true);
128-
$apiConfig = $useApi->getApiConfig();
129-
130-
$apis[$api['id']]['id'] = $apiConfig['id'];
131-
$apis[$api['id']]['name'] = $apiConfig['name'];
132-
$apis[$api['id']]['data']['url'] = $apiConfig['repo_url'];
133-
}
134-
}
135-
}
136-
137154
$this->view->apis = $apis;
138155
$this->view->moduleTypes = $this->modulesPackage->getModuleTypes();
139156
$this->view->moduleSettings = $this->modulesPackage->getDefaultSettings();
@@ -224,6 +241,31 @@ public function viewAction()
224241

225242
$this->view->module = $module;
226243
}
244+
} else if (isset($this->getData()['id']) &&
245+
isset($this->getData()['bundles'])
246+
) {
247+
$this->view->type = 'bundles';
248+
unset($apis[0]);//Remove local
249+
$this->view->apis = $apis;
250+
$this->view->bundleModules = $this->modulesPackage->getDefaultDependencies();
251+
252+
if ($this->getData()['id'] != 0) {
253+
$bundle = $this->modulesPackage->getById($this->getData()['id']);
254+
255+
if (!$bundle) {
256+
return $this->throwIdNotFound();
257+
}
258+
259+
$this->view->bundle = $bundle;
260+
261+
if (isset($modules['bundles'])) {
262+
unset($modules['bundles']);
263+
}
264+
265+
$this->view->modules = $modules;
266+
}
267+
268+
$this->view->pick('modules/view');
227269
} else {
228270
$this->view->pick('modules/list');
229271
}
@@ -283,19 +325,19 @@ public function updateAction()
283325
// }
284326
// }
285327

286-
public function validateJsonAction()
287-
{
288-
if ($this->request->isPost()) {
289-
if (!$this->checkCSRF()) {
290-
return;
291-
}
292-
$this->modulesPackage->updateModules($this->postData());
328+
// public function validateJsonAction()
329+
// {
330+
// if ($this->request->isPost()) {
331+
// if (!$this->checkCSRF()) {
332+
// return;
333+
// }
334+
// $this->modulesPackage->updateModules($this->postData());
293335

294-
$this->addResponse($this->modulesPackage->packagesData->responseMessage, $this->modulesPackage->packagesData->responseCode);
295-
} else {
296-
$this->addResponse('Method Not Allowed', 1);
297-
}
298-
}
336+
// $this->addResponse($this->modulesPackage->packagesData->responseMessage, $this->modulesPackage->packagesData->responseCode);
337+
// } else {
338+
// $this->addResponse('Method Not Allowed', 1);
339+
// }
340+
// }
299341

300342
public function formatJsonAction()
301343
{
@@ -307,9 +349,9 @@ public function formatJsonAction()
307349
$this->basepackages->utils->formatJson($this->postData());
308350

309351
$this->addResponse(
310-
$this->modulesPackage->packagesData->responseMessage,
311-
$this->modulesPackage->packagesData->responseCode,
312-
$this->modulesPackage->packagesData->responseData
352+
$this->basepackages->utils->packagesData->responseMessage,
353+
$this->basepackages->utils->packagesData->responseCode,
354+
$this->basepackages->utils->packagesData->responseData
313355
);
314356
} else {
315357
$this->addResponse('Method Not Allowed', 1);
@@ -377,4 +419,82 @@ private function generateTree($menusTree)
377419
]
378420
);
379421
}
422+
423+
public function syncLabelsAction()
424+
{
425+
if ($this->request->isPost()) {
426+
if (!$this->checkCSRF()) {
427+
return;
428+
}
429+
430+
if ($this->modulesPackage->syncLabels($this->postData())) {
431+
$this->addResponse(
432+
$this->modulesPackage->packagesData->responseMessage,
433+
$this->modulesPackage->packagesData->responseCode,
434+
$this->modulesPackage->packagesData->responseData
435+
);
436+
437+
return;
438+
}
439+
440+
$this->addResponse(
441+
$this->modulesPackage->packagesData->responseMessage,
442+
$this->modulesPackage->packagesData->responseCode
443+
);
444+
} else {
445+
$this->addResponse('Method Not Allowed', 1);
446+
}
447+
}
448+
449+
public function getLabelIssuesAction()
450+
{
451+
if ($this->request->isPost()) {
452+
if (!$this->checkCSRF()) {
453+
return;
454+
}
455+
456+
if ($this->modulesPackage->getLabelIssues($this->postData())) {
457+
$this->addResponse(
458+
$this->modulesPackage->packagesData->responseMessage,
459+
$this->modulesPackage->packagesData->responseCode,
460+
$this->modulesPackage->packagesData->responseData
461+
);
462+
463+
return;
464+
}
465+
466+
$this->addResponse(
467+
$this->modulesPackage->packagesData->responseMessage,
468+
$this->modulesPackage->packagesData->responseCode
469+
);
470+
} else {
471+
$this->addResponse('Method Not Allowed', 1);
472+
}
473+
}
474+
475+
public function bumpVersionAction()
476+
{
477+
if ($this->request->isPost()) {
478+
if (!$this->checkCSRF()) {
479+
return;
480+
}
481+
482+
if ($this->modulesPackage->bumpVersion($this->postData())) {
483+
$this->addResponse(
484+
$this->modulesPackage->packagesData->responseMessage,
485+
$this->modulesPackage->packagesData->responseCode,
486+
$this->modulesPackage->packagesData->responseData
487+
);
488+
489+
return;
490+
}
491+
492+
$this->addResponse(
493+
$this->modulesPackage->packagesData->responseMessage,
494+
$this->modulesPackage->packagesData->responseCode
495+
);
496+
} else {
497+
$this->addResponse('Method Not Allowed', 1);
498+
}
499+
}
380500
}

apps/Core/Packages/Adminltetags/Tags/Fields/Input.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,7 @@ protected function postAddon()
410410
'<div class="dropdown-divider"></div>';
411411
} else {
412412
$this->content .=
413-
'<a class="dropdown-item text-uppercase" data-id="' . $key . '" ' . $this->fieldParams['fieldId'] . '-' . $key . '" href="#">' . $title . '</a>
414-
</div>';
413+
'<a class="dropdown-item text-uppercase" data-id="' . $key . '" ' . $this->fieldParams['fieldId'] . '-' . $key . '" href="#">' . $title . '</a>';
415414
}
416415
}
417416
}

0 commit comments

Comments
 (0)