Change colour of input fields instead of printing 'Access granted'
This commit is contained in:
parent
43abe2b648
commit
a09ef66eea
|
@ -45,6 +45,10 @@ td.mountPoint, td.backend { width:160px; }
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#externalStorage td.configuration input.disabled-success {
|
||||||
|
background-color: rgba(134, 255, 110, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#externalStorage td.applicable div.chzn-container {
|
#externalStorage td.applicable div.chzn-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
function displayGranted($tr) {
|
||||||
|
$tr.find('.configuration input.auth-param').attr('disabled', 'disabled').addClass('disabled-success');
|
||||||
|
}
|
||||||
|
|
||||||
OCA.External.Settings.mountConfig.whenSelectAuthMechanism(function($tr, authMechanism, scheme, onCompletion) {
|
OCA.External.Settings.mountConfig.whenSelectAuthMechanism(function($tr, authMechanism, scheme, onCompletion) {
|
||||||
if (authMechanism === 'oauth1::oauth1') {
|
if (authMechanism === 'oauth1::oauth1') {
|
||||||
var config = $tr.find('.configuration');
|
var config = $tr.find('.configuration');
|
||||||
|
@ -13,8 +17,7 @@ $(document).ready(function() {
|
||||||
onCompletion.then(function() {
|
onCompletion.then(function() {
|
||||||
var configured = $tr.find('[data-parameter="configured"]');
|
var configured = $tr.find('[data-parameter="configured"]');
|
||||||
if ($(configured).val() == 'true') {
|
if ($(configured).val() == 'true') {
|
||||||
$tr.find('.configuration input.auth-param').attr('disabled', 'disabled');
|
displayGranted($tr);
|
||||||
$tr.find('.configuration').append('<span id="access" style="padding-left:0.5em;">'+t('files_external', 'Access granted')+'</span>');
|
|
||||||
} else {
|
} else {
|
||||||
var app_key = $tr.find('.configuration [data-parameter="app_key"]').val();
|
var app_key = $tr.find('.configuration [data-parameter="app_key"]').val();
|
||||||
var app_secret = $tr.find('.configuration [data-parameter="app_secret"]').val();
|
var app_secret = $tr.find('.configuration [data-parameter="app_secret"]').val();
|
||||||
|
@ -33,8 +36,7 @@ $(document).ready(function() {
|
||||||
$(configured).val('true');
|
$(configured).val('true');
|
||||||
OCA.External.Settings.mountConfig.saveStorageConfig($tr, function(status) {
|
OCA.External.Settings.mountConfig.saveStorageConfig($tr, function(status) {
|
||||||
if (status) {
|
if (status) {
|
||||||
$tr.find('.configuration input.auth-param').attr('disabled', 'disabled');
|
displayGranted($tr);
|
||||||
$tr.find('.configuration').append('<span id="access" style="padding-left:0.5em;">'+t('files_external', 'Access granted')+'</span>');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
function displayGranted($tr) {
|
||||||
|
$tr.find('.configuration input.auth-param').attr('disabled', 'disabled').addClass('disabled-success');
|
||||||
|
}
|
||||||
|
|
||||||
OCA.External.Settings.mountConfig.whenSelectAuthMechanism(function($tr, authMechanism, scheme, onCompletion) {
|
OCA.External.Settings.mountConfig.whenSelectAuthMechanism(function($tr, authMechanism, scheme, onCompletion) {
|
||||||
if (authMechanism === 'oauth2::oauth2') {
|
if (authMechanism === 'oauth2::oauth2') {
|
||||||
var config = $tr.find('.configuration');
|
var config = $tr.find('.configuration');
|
||||||
|
@ -13,9 +17,7 @@ $(document).ready(function() {
|
||||||
onCompletion.then(function() {
|
onCompletion.then(function() {
|
||||||
var configured = $tr.find('[data-parameter="configured"]');
|
var configured = $tr.find('[data-parameter="configured"]');
|
||||||
if ($(configured).val() == 'true') {
|
if ($(configured).val() == 'true') {
|
||||||
$tr.find('.configuration input.auth-param').attr('disabled', 'disabled');
|
displayGranted($tr);
|
||||||
$tr.find('.configuration').append($('<span/>').attr('id', 'access')
|
|
||||||
.text(t('files_external', 'Access granted')));
|
|
||||||
} else {
|
} else {
|
||||||
var client_id = $tr.find('.configuration [data-parameter="client_id"]').val();
|
var client_id = $tr.find('.configuration [data-parameter="client_id"]').val();
|
||||||
var client_secret = $tr.find('.configuration [data-parameter="client_secret"]')
|
var client_secret = $tr.find('.configuration [data-parameter="client_secret"]')
|
||||||
|
@ -43,10 +45,7 @@ $(document).ready(function() {
|
||||||
$(configured).val('true');
|
$(configured).val('true');
|
||||||
OCA.External.Settings.mountConfig.saveStorageConfig($tr, function(status) {
|
OCA.External.Settings.mountConfig.saveStorageConfig($tr, function(status) {
|
||||||
if (status) {
|
if (status) {
|
||||||
$tr.find('.configuration input.auth-param').attr('disabled', 'disabled');
|
displayGranted($tr);
|
||||||
$tr.find('.configuration').append($('<span/>')
|
|
||||||
.attr('id', 'access')
|
|
||||||
.text(t('files_external', 'Access granted')));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue