Merge pull request #25008 from owncloud/externals_test_with_origin
Add support to know where the storage test comes from
This commit is contained in:
commit
ac163426ef
|
@ -299,7 +299,8 @@ StorageConfig.prototype = {
|
|||
mountPoint: this.mountPoint,
|
||||
backend: this.backend,
|
||||
authMechanism: this.authMechanism,
|
||||
backendOptions: this.backendOptions
|
||||
backendOptions: this.backendOptions,
|
||||
testOnly: true
|
||||
};
|
||||
if (this.id) {
|
||||
data.id = this.id;
|
||||
|
@ -326,6 +327,7 @@ StorageConfig.prototype = {
|
|||
$.ajax({
|
||||
type: 'GET',
|
||||
url: OC.generateUrl(this._url + '/{id}', {id: this.id}),
|
||||
data: {'testOnly': true},
|
||||
success: options.success,
|
||||
error: options.error
|
||||
});
|
||||
|
@ -908,6 +910,7 @@ MountConfigListView.prototype = _.extend({
|
|||
$.ajax({
|
||||
type: 'GET',
|
||||
url: OC.generateUrl('apps/files_external/userglobalstorages'),
|
||||
data: {'testOnly' : true},
|
||||
contentType: 'application/json',
|
||||
success: function(result) {
|
||||
var onCompletion = jQuery.Deferred();
|
||||
|
|
|
@ -78,6 +78,7 @@ OCA.External.StatusManager = {
|
|||
defObj = $.ajax({
|
||||
type: 'GET',
|
||||
url: OC.webroot + '/index.php/apps/files_external/' + ((mountData.type === 'personal') ? 'userstorages' : 'userglobalstorages') + '/' + mountData.id,
|
||||
data: {'testOnly' : false},
|
||||
success: function (response) {
|
||||
if (response && response.status === 0) {
|
||||
self.mountStatus[mountData.mount_point] = response;
|
||||
|
|
|
@ -139,7 +139,8 @@ class GlobalStoragesController extends StoragesController {
|
|||
$mountOptions,
|
||||
$applicableUsers,
|
||||
$applicableGroups,
|
||||
$priority
|
||||
$priority,
|
||||
$testOnly = true
|
||||
) {
|
||||
$storage = $this->createStorage(
|
||||
$mountPoint,
|
||||
|
@ -172,7 +173,7 @@ class GlobalStoragesController extends StoragesController {
|
|||
);
|
||||
}
|
||||
|
||||
$this->updateStorageStatus($storage);
|
||||
$this->updateStorageStatus($storage, $testOnly);
|
||||
|
||||
return new DataResponse(
|
||||
$storage,
|
||||
|
|
|
@ -238,7 +238,7 @@ abstract class StoragesController extends Controller {
|
|||
*
|
||||
* @param StorageConfig $storage storage configuration
|
||||
*/
|
||||
protected function updateStorageStatus(StorageConfig &$storage) {
|
||||
protected function updateStorageStatus(StorageConfig &$storage, $testOnly = true) {
|
||||
try {
|
||||
$this->manipulateStorageConfig($storage);
|
||||
|
||||
|
@ -249,7 +249,8 @@ abstract class StoragesController extends Controller {
|
|||
\OC_Mount_Config::getBackendStatus(
|
||||
$backend->getStorageClass(),
|
||||
$storage->getBackendOptions(),
|
||||
false
|
||||
false,
|
||||
$testOnly
|
||||
)
|
||||
);
|
||||
} catch (InsufficientDataForMeaningfulAnswerException $e) {
|
||||
|
@ -293,11 +294,11 @@ abstract class StoragesController extends Controller {
|
|||
*
|
||||
* @return DataResponse
|
||||
*/
|
||||
public function show($id) {
|
||||
public function show($id, $testOnly = true) {
|
||||
try {
|
||||
$storage = $this->service->getStorage($id);
|
||||
|
||||
$this->updateStorageStatus($storage);
|
||||
$this->updateStorageStatus($storage, $testOnly);
|
||||
} catch (NotFoundException $e) {
|
||||
return new DataResponse(
|
||||
[
|
||||
|
|
|
@ -111,11 +111,11 @@ class UserGlobalStoragesController extends StoragesController {
|
|||
*
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function show($id) {
|
||||
public function show($id, $testOnly = true) {
|
||||
try {
|
||||
$storage = $this->service->getStorage($id);
|
||||
|
||||
$this->updateStorageStatus($storage);
|
||||
$this->updateStorageStatus($storage, $testOnly);
|
||||
} catch (NotFoundException $e) {
|
||||
return new DataResponse(
|
||||
[
|
||||
|
@ -146,7 +146,8 @@ class UserGlobalStoragesController extends StoragesController {
|
|||
*/
|
||||
public function update(
|
||||
$id,
|
||||
$backendOptions
|
||||
$backendOptions,
|
||||
$testOnly = true
|
||||
) {
|
||||
try {
|
||||
$storage = $this->service->getStorage($id);
|
||||
|
@ -171,7 +172,7 @@ class UserGlobalStoragesController extends StoragesController {
|
|||
);
|
||||
}
|
||||
|
||||
$this->updateStorageStatus($storage);
|
||||
$this->updateStorageStatus($storage, $testOnly);
|
||||
$this->sanitizeStorage($storage);
|
||||
|
||||
return new DataResponse(
|
||||
|
|
|
@ -101,8 +101,8 @@ class UserStoragesController extends StoragesController {
|
|||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function show($id) {
|
||||
return parent::show($id);
|
||||
public function show($id, $testOnly = true) {
|
||||
return parent::show($id, $testOnly);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,7 +170,8 @@ class UserStoragesController extends StoragesController {
|
|||
$backend,
|
||||
$authMechanism,
|
||||
$backendOptions,
|
||||
$mountOptions
|
||||
$mountOptions,
|
||||
$testOnly = true
|
||||
) {
|
||||
$storage = $this->createStorage(
|
||||
$mountPoint,
|
||||
|
@ -200,7 +201,7 @@ class UserStoragesController extends StoragesController {
|
|||
);
|
||||
}
|
||||
|
||||
$this->updateStorageStatus($storage);
|
||||
$this->updateStorageStatus($storage, $testOnly);
|
||||
|
||||
return new DataResponse(
|
||||
$storage,
|
||||
|
|
|
@ -215,7 +215,7 @@ class OC_Mount_Config {
|
|||
* @return int see self::STATUS_*
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getBackendStatus($class, $options, $isPersonal) {
|
||||
public static function getBackendStatus($class, $options, $isPersonal, $testOnly = true) {
|
||||
if (self::$skipTest) {
|
||||
return StorageNotAvailableException::STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ class OC_Mount_Config {
|
|||
$storage = new $class($options);
|
||||
|
||||
try {
|
||||
$result = $storage->test($isPersonal);
|
||||
$result = $storage->test($isPersonal, $testOnly);
|
||||
$storage->setAvailability($result);
|
||||
if ($result) {
|
||||
return StorageNotAvailableException::STATUS_SUCCESS;
|
||||
|
|
|
@ -223,7 +223,8 @@ describe('OCA.External.Settings tests', function() {
|
|||
applicableGroups: [],
|
||||
mountOptions: {
|
||||
'previews': true
|
||||
}
|
||||
},
|
||||
testOnly: true
|
||||
});
|
||||
|
||||
// TODO: respond and check data-id
|
||||
|
|
Loading…
Reference in New Issue