Angular: More isolation and removing of unused components (#41630)

* Angular: More isolation and removing of unused components

* Moved some more and fixed a test
This commit is contained in:
Torkel Ödegaard
2021-11-15 15:12:45 +01:00
committed by GitHub
parent 8ea75c9401
commit dbcefb70f6
20 changed files with 17 additions and 350 deletions

View File

@@ -1,7 +0,0 @@
<datasource-http-settings-next
on-change="onChange"
dataSourceConfig="current"
showAccessOptions="showAccessOption"
defaultUrl="suggestUrl"
showForwardOAuthIdentityOption="showForwardOAuthIdentityOption"
/>

View File

@@ -1,81 +0,0 @@
<div class="gf-form-group">
<div class="gf-form">
<h6>TLS/SSL Auth Details</h6>
<info-popover mode="header">TLS/SSL certificates are encrypted and stored in the Grafana database.</info-popover>
</div>
<div ng-if="current.jsonData.tlsAuthWithCACert">
<div class="gf-form-inline">
<div class="gf-form gf-form--v-stretch"><label class="gf-form-label width-7">CA Cert</label></div>
<div class="gf-form gf-form--grow" ng-if="!current.secureJsonFields.tlsCACert">
<textarea
rows="7"
class="gf-form-input gf-form-textarea"
ng-model="current.secureJsonData.tlsCACert"
placeholder="Begins with -----BEGIN CERTIFICATE-----"
></textarea>
</div>
<div class="gf-form" ng-if="current.secureJsonFields.tlsCACert">
<input type="text" class="gf-form-input max-width-12" disabled="disabled" value="configured" />
<button
type="reset"
aria-label="Reset CA Cert"
class="btn btn-secondary gf-form-btn"
ng-click="current.secureJsonFields.tlsCACert = false"
>
reset
</button>
</div>
</div>
</div>
<div ng-if="current.jsonData.tlsAuth">
<div class="gf-form-inline">
<div class="gf-form gf-form--v-stretch"><label class="gf-form-label width-7">Client Cert</label></div>
<div class="gf-form gf-form--grow" ng-if="!current.secureJsonFields.tlsClientCert">
<textarea
rows="7"
class="gf-form-input gf-form-textarea"
ng-model="current.secureJsonData.tlsClientCert"
placeholder="Begins with -----BEGIN CERTIFICATE-----"
required
></textarea>
</div>
<div class="gf-form" ng-if="current.secureJsonFields.tlsClientCert">
<input type="text" class="gf-form-input max-width-12" disabled="disabled" value="configured" />
<button
class="btn btn-secondary gf-form-btn"
aria-label="Reset Client Cert"
type="reset"
ng-click="current.secureJsonFields.tlsClientCert = false"
>
reset
</button>
</div>
</div>
<div class="gf-form-inline">
<div class="gf-form gf-form--v-stretch"><label class="gf-form-label width-7">Client Key</label></div>
<div class="gf-form gf-form--grow" ng-if="!current.secureJsonFields.tlsClientKey">
<textarea
rows="7"
class="gf-form-input gf-form-textarea"
ng-model="current.secureJsonData.tlsClientKey"
placeholder="Begins with -----BEGIN RSA PRIVATE KEY-----"
required
></textarea>
</div>
<div class="gf-form" ng-if="current.secureJsonFields.tlsClientKey">
<input type="text" class="gf-form-input max-width-12" disabled="disabled" value="configured" />
<button
class="btn btn-secondary gf-form-btn"
type="reset"
aria-label="Reset Client Key"
ng-click="current.secureJsonFields.tlsClientKey = false"
>
reset
</button>
</div>
</div>
</div>
</div>

View File

@@ -1,22 +0,0 @@
import { coreModule } from 'app/angular/core_module';
coreModule.directive('datasourceHttpSettings', () => {
return {
scope: {
current: '=',
suggestUrl: '@',
noDirectAccess: '@',
showForwardOAuthIdentityOption: '@',
},
templateUrl: 'public/app/features/datasources/partials/http_settings_next.html',
link: {
pre: ($scope: any) => {
// do not show access option if direct access is disabled
$scope.showAccessOption = $scope.noDirectAccess !== 'true';
$scope.onChange = (datasourceSetting: any) => {
$scope.current = datasourceSetting;
};
},
},
};
});

View File

@@ -1,10 +0,0 @@
import { coreModule } from 'app/angular/core_module';
coreModule.directive('datasourceTlsAuthSettings', () => {
return {
scope: {
current: '=',
},
templateUrl: 'public/app/features/datasources/partials/tls_auth_settings.html',
};
});