diff --git a/apps/Core/Views/Default/html/system/api/client/services/apis/repos/generic/form.html b/apps/Core/Views/Default/html/system/api/client/services/apis/repos/generic/form.html deleted file mode 100644 index 57604e56e..000000000 --- a/apps/Core/Views/Default/html/system/api/client/services/apis/repos/generic/form.html +++ /dev/null @@ -1,296 +0,0 @@ -{% if api['id'] is defined %} - {% set apiId = api['id'] %} - {% set apiSetup = api['setup'] %} - {% set apiName = api['name'] %} - {% set apiInUse = api['in_use'] %} - {% set apiUsedBy = api['used_by'] %} - {% set apiDescription = api['description'] %} - {% set apiApiUrl = api['api_url'] %} - {% set apiAuthType = api['auth_type'] %} - {% set apiUsername = api['username'] %} - {% set apiPassword = api['password'] %} - {% set apiToken = api['token'] %} - {% set apiAuthorization = api['authorization'] %} -{% else %} - {% set apiId = '' %} - {% set apiSetup = '' %} - {% set apiName = '' %} - {% set apiInUse = '0' %} - {% set apiUsedBy = '' %} - {% set apiDescription = '' %} - {% set apiApiUrl = '' %} - {% set apiAuthType = 'none' %} - {% set apiUsername = '' %} - {% set apiPassword = '' %} - {% set apiToken = '' %} - {% set apiAuthorization = '' %} -{% endif %} -{% if apiAuthType === 'auth' %} - {% set authDisabled = false %} - {% set authoDisabled = true %} - {% set tokenDisabled = true %} -{% elseif apiAuthType === 'token' %} - {% set authDisabled = true %} - {% set authoDisabled = true %} - {% set tokenDisabled = false %} -{% elseif apiAuthType === 'autho' %} - {% set authDisabled = true %} - {% set authoDisabled = false %} - {% set tokenDisabled = true %} -{% else %} - {% set authDisabled = true %} - {% set authoDisabled = true %} - {% set tokenDisabled = true %} -{% endif %} -
-
- {% include 'services/apis/common.html' %} -
-
- {{adminltetags.useTag('fields', - [ - 'component' : component, - 'componentName' : componentName, - 'componentId' : componentId, - 'sectionId' : sectionId, - 'fieldId' : 'api_url', - 'fieldLabel' : 'API Url', - 'fieldType' : 'input', - 'fieldHelp' : true, - 'fieldHelpTooltipContent' : 'API URL', - 'fieldRequired' : true, - 'fieldBazScan' : true, - 'fieldBazPostOnCreate' : true, - 'fieldBazPostOnUpdate' : true, - 'fieldDataInputMinLength' : 1, - 'fieldDataInputMaxLength' : 1024, - 'fieldValue' : apiApiUrl - ] - )}} -
-
-
-
-
- {{adminltetags.useTag('fields', - [ - 'component' : component, - 'componentName' : componentName, - 'componentId' : componentId, - 'sectionId' : sectionId, - 'fieldId' : 'auth_type', - 'fieldLabel' : 'Auth/Token/Authorization?', - 'fieldType' : 'radio', - 'fieldHelp' : true, - 'fieldHelpTooltipContent' : 'Select either basic user authentication is used or user token/authorization is used.', - 'fieldRequired' : true, - 'fieldBazPostOnCreate' : true, - 'fieldBazPostOnUpdate' : true, - 'fieldBazScan' : true, - 'fieldRadioButtons' : - [ - 'none' : - [ - 'title' : 'None', - 'type' : 'secondary', - 'dataValue' : 'none' - ], - 'auth' : - [ - 'title' : 'Auth', - 'type' : 'primary', - 'dataValue' : 'auth' - ], - 'token' : - [ - 'title' : 'Token', - 'type' : 'primary', - 'dataValue' : 'token' - ], - 'autho' : - [ - 'title' : 'Authorization', - 'type' : 'primary', - 'dataValue' : 'autho' - ] - ], - 'fieldRadioChecked' : apiAuthType - ] - )}} -
-
-
-
- {{adminltetags.useTag('fields', - [ - 'component' : component, - 'componentName' : componentName, - 'componentId' : componentId, - 'sectionId' : sectionId, - 'fieldId' : 'username', - 'fieldLabel' : 'Username', - 'fieldType' : 'input', - 'fieldRequired' : true, - 'fieldHelp' : true, - 'fieldHelpTooltipContent' : 'Username', - 'fieldBazPostOnCreate' : true, - 'fieldBazPostOnUpdate' : true, - 'fieldBazScan' : true, - 'fieldDataInputMinLength' : 1, - 'fieldDataInputMaxLength' : 50, - 'fieldDisabled' : authDisabled, - 'fieldValue' : apiUsername - ] - )}} -
-
- {{adminltetags.useTag('fields', - [ - 'component' : component, - 'componentName' : componentName, - 'componentId' : componentId, - 'sectionId' : sectionId, - 'fieldId' : 'password', - 'fieldLabel' : 'Password', - 'fieldType' : 'input', - 'fieldInputType' : 'password', - 'fieldHelp' : true, - 'fieldHelpTooltipContent' : 'Password', - 'fieldRequired' : true, - 'fieldBazScan' : true, - 'fieldBazPostOnCreate' : true, - 'fieldBazPostOnUpdate' : true, - 'fieldDisabled' : authDisabled, - 'fieldValue' : apiPassword - ] - )}} -
-
-
-
- {{adminltetags.useTag('fields', - [ - 'component' : component, - 'componentName' : componentName, - 'componentId' : componentId, - 'sectionId' : sectionId, - 'fieldId' : 'token', - 'fieldLabel' : 'Token', - 'fieldType' : 'input', - 'fieldInputType' : 'password', - 'fieldHelp' : true, - 'fieldHelpTooltipContent' : 'Token', - 'fieldRequired' : true, - 'fieldBazScan' : true, - 'fieldBazPostOnCreate' : true, - 'fieldBazPostOnUpdate' : true, - 'fieldDisabled' : tokenDisabled, - 'fieldValue' : apiToken - ] - )}} -
-
-
-
- {{adminltetags.useTag('fields', - [ - 'component' : component, - 'componentName' : componentName, - 'componentId' : componentId, - 'sectionId' : sectionId, - 'fieldId' : 'authorization', - 'fieldLabel' : 'Authorization Code', - 'fieldType' : 'textarea', - 'fieldHelp' : true, - 'fieldHelpTooltipContent' : 'Authorization Code', - 'fieldRequired' : true, - 'fieldBazScan' : true, - 'fieldBazPostOnCreate' : true, - 'fieldBazPostOnUpdate' : true, - 'fieldDisabled' : authoDisabled, - 'fieldValue' : apiAuthorization - ] - )}} -
-
-
-
-
-
- \ No newline at end of file diff --git a/apps/Core/Views/Default/html/system/api/client/services/apis/repos/generic/view.html b/apps/Core/Views/Default/html/system/api/client/services/apis/repos/generic/view.html deleted file mode 100644 index a160eb78d..000000000 --- a/apps/Core/Views/Default/html/system/api/client/services/apis/repos/generic/view.html +++ /dev/null @@ -1,27 +0,0 @@ -{{adminltetags.useTag('content', - [ - 'component' : component, - 'componentName' : componentName, - 'componentId' : componentId, - 'parentComponentId' : parent, - 'sectionId' : 'main', - 'contentType' : 'sectionWithForm', - 'cardHeader' : true, - 'cardFooter' : true, - 'cardType' : 'primary', - 'cardIcon' : 'exchange-alt', - 'cardTitle' : title, - 'cardAdditionalClass' : 'rounded-0', - 'cardBodyInclude' : 'services/apis/repo/gitea/form', - 'formButtons' : - [ - 'updateButtonId' : apiId, - 'addActionUrl' : 'system/api/client/services/add', - 'addSuccessRedirectUrl' : 'system/api/client/services', - 'updateActionUrl' : 'system/api/client/services/update', - 'updateSuccessRedirectUrl' : 'system/api/client/services', - 'cancelActionUrl' : 'system/api/client/services', - 'closeActionUrl' : 'system/api/client/services' - ] - ] -)}} \ No newline at end of file diff --git a/apps/Core/Views/Default/html/system/api/client/services/view.html b/apps/Core/Views/Default/html/system/api/client/services/view.html index cb312ac08..4509c50a1 100644 --- a/apps/Core/Views/Default/html/system/api/client/services/view.html +++ b/apps/Core/Views/Default/html/system/api/client/services/view.html @@ -3,14 +3,6 @@ {% set title = 'API:' ~ api['category'] ~ ':' ~ api['provider'] ~ ' - ' ~ api['name'] %} {% else %} {% set apiId = '' %} - {% if api['repository'] is defined and api['repository'] === true %} - {% set title = 'New API:' ~ api['category'] %} - {% else %} - {% set title = 'New API:' ~ api['category'] ~ ':' ~ api['provider'] %} - {% endif %} + {% set title = 'New API:' ~ api['category'] ~ ':' ~ api['provider'] %} {% endif %} -{% if api['repository'] is defined and api['repository'] === true %} - {{view.getPartial('../../modules/repositories/view')}} -{% else %} - {{view.getPartial('services/apis/' ~ api['category'] ~ '/' ~ api['provider']|lower ~ '/view')}} -{% endif %} \ No newline at end of file +{{view.getPartial('services/apis/' ~ api['category'] ~ '/' ~ api['provider']|lower ~ '/view')}} \ No newline at end of file diff --git a/system/Base/Providers/BasepackagesServiceProvider/Packages/ApiClientServices/ApiClientServices.php b/system/Base/Providers/BasepackagesServiceProvider/Packages/ApiClientServices/ApiClientServices.php index 493df07e1..5dcecb075 100644 --- a/system/Base/Providers/BasepackagesServiceProvider/Packages/ApiClientServices/ApiClientServices.php +++ b/system/Base/Providers/BasepackagesServiceProvider/Packages/ApiClientServices/ApiClientServices.php @@ -95,13 +95,19 @@ protected function registerApiCategories() { $this->apiCategories = []; - $basepackagesApis = $this->modules->packages->getPackagesForCategory('basepackagesApis'); $apis = $this->modules->packages->getPackagesForCategory('appsApis'); - $apis = array_merge($basepackagesApis, $apis); + if ($this->apps->getAppInfo()['app_type'] === 'core') { + $basepackagesApis = $this->modules->packages->getPackagesForCategory('basepackagesApis'); + $apis = array_merge($basepackagesApis, $apis); + } if ($apis && is_array($apis) && count($apis) > 0) { foreach ($apis as $api) { + if ($this->apps->getAppInfo()['app_type'] !== $api['app_type']) { + continue; + } + $api['class'] = explode('\\', $api['class']); $category = strtolower($api['class'][$this->helper->lastKey($api['class']) - 2]);