mirror of https://gitee.com/bigwinds/arangodb
issue #2131 - display process and error of pending or failed index creations
This commit is contained in:
parent
c8511619a6
commit
4ab8671bff
|
@ -63,6 +63,8 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
getIndex: function (callback) {
|
getIndex: function (callback) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
cache: false,
|
cache: false,
|
||||||
|
@ -70,10 +72,10 @@
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
processData: false,
|
processData: false,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
callback(false, data);
|
callback(false, data, self.get('id'));
|
||||||
},
|
},
|
||||||
error: function (data) {
|
error: function (data) {
|
||||||
callback(true, data);
|
callback(true, data, self.get('id'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -36,11 +36,11 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
getIndex: function () {
|
getIndex: function () {
|
||||||
var callback = function (error, data) {
|
var callback = function (error, data, id) {
|
||||||
if (error) {
|
if (error) {
|
||||||
window.arangoHelper.arangoError('Index', data.errorMessage);
|
window.arangoHelper.arangoError('Index', data.errorMessage);
|
||||||
} else {
|
} else {
|
||||||
this.renderIndex(data);
|
this.renderIndex(data, id);
|
||||||
}
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
|
@ -237,9 +237,54 @@
|
||||||
'<i class="fa fa-circle-o-notch fa-spin"></i>'
|
'<i class="fa fa-circle-o-notch fa-spin"></i>'
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
renderIndex: function (data) {
|
renderIndex: function (data, id) {
|
||||||
this.index = data;
|
this.index = data;
|
||||||
|
|
||||||
|
// get pending jobs
|
||||||
|
var checkState = function (error, data) {
|
||||||
|
if (error) {
|
||||||
|
arangoHelper.arangoError('Jobs', 'Could not read pending jobs.');
|
||||||
|
} else {
|
||||||
|
var readJob = function (error, data, job) {
|
||||||
|
if (error) {
|
||||||
|
if (data.responseJSON.code === 404) {
|
||||||
|
// delete non existing aardvark job
|
||||||
|
arangoHelper.deleteAardvarkJob(job);
|
||||||
|
} else if (data.responseJSON.code === 400) {
|
||||||
|
// index job failed -> print error
|
||||||
|
arangoHelper.arangoError('Index creation failed', data.responseJSON.errorMessage);
|
||||||
|
// delete non existing aardvark job
|
||||||
|
arangoHelper.deleteAardvarkJob(job);
|
||||||
|
} else if (data.responseJSON.code === 204) {
|
||||||
|
// job is still in quere or pending
|
||||||
|
arangoHelper.arangoMessage('Index', 'There is at least one new index in the queue or in the process of beeing created.');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
arangoHelper.deleteAardvarkJob(job);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
_.each(data, function (job) {
|
||||||
|
if (job.collection === id) {
|
||||||
|
$.ajax({
|
||||||
|
type: 'PUT',
|
||||||
|
cache: false,
|
||||||
|
url: arangoHelper.databaseUrl('/_api/job/' + job.id),
|
||||||
|
contentType: 'application/json',
|
||||||
|
success: function (data, a, b) {
|
||||||
|
readJob(false, data, job.id);
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
readJob(true, data, job.id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
arangoHelper.getAardvarkJobs(checkState);
|
||||||
|
|
||||||
var cssClass = 'collectionInfoTh modal-text';
|
var cssClass = 'collectionInfoTh modal-text';
|
||||||
if (this.index) {
|
if (this.index) {
|
||||||
var fieldString = '';
|
var fieldString = '';
|
||||||
|
|
Loading…
Reference in New Issue