diff --git a/public/app/features/all.ts b/public/app/features/all.ts index b1283fdfd3e..1ba6a85899c 100644 --- a/public/app/features/all.ts +++ b/public/app/features/all.ts @@ -11,3 +11,4 @@ import './alerting/NotificationsListCtrl'; import './manage-dashboards'; import './teams/CreateTeamCtrl'; import './profile/all'; +import './datasources/settings/HttpSettingsCtrl'; diff --git a/public/app/features/plugins/partials/ds_http_settings.html b/public/app/features/datasources/partials/http_settings.html similarity index 100% rename from public/app/features/plugins/partials/ds_http_settings.html rename to public/app/features/datasources/partials/http_settings.html diff --git a/public/app/features/datasources/settings/HttpSettingsCtrl.ts b/public/app/features/datasources/settings/HttpSettingsCtrl.ts new file mode 100644 index 00000000000..47022c283f8 --- /dev/null +++ b/public/app/features/datasources/settings/HttpSettingsCtrl.ts @@ -0,0 +1,26 @@ +import { coreModule } from 'app/core/core'; + +coreModule.directive('datasourceHttpSettings', () => { + return { + scope: { + current: '=', + suggestUrl: '@', + noDirectAccess: '@', + }, + templateUrl: 'public/app/features/datasources/partials/http_settings.html', + link: { + pre: ($scope, elem, attrs) => { + // do not show access option if direct access is disabled + $scope.showAccessOption = $scope.noDirectAccess !== 'true'; + $scope.showAccessHelp = false; + $scope.toggleAccessHelp = () => { + $scope.showAccessHelp = !$scope.showAccessHelp; + }; + + $scope.getSuggestUrls = () => { + return [$scope.suggestUrl]; + }; + }, + }, + }; +});