mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
f5d0dc75bd
|
@ -44,22 +44,52 @@
|
||||||
$('.login-window #databases').show();
|
$('.login-window #databases').show();
|
||||||
|
|
||||||
$.ajax(url).success(function (permissions) {
|
$.ajax(url).success(function (permissions) {
|
||||||
// enable db select and login button
|
var successFunc = function (availableDbs) {
|
||||||
$('#loginDatabase').html('');
|
// enable db select and login button
|
||||||
// fill select with allowed dbs
|
$('#loginDatabase').html('');
|
||||||
_.each(permissions.result, function (rule, db) {
|
// fill select with allowed dbs
|
||||||
if (errCallback) {
|
_.each(permissions.result, function (rule, db) {
|
||||||
$('#loginDatabase').append(
|
if (errCallback) {
|
||||||
'<option>' + db + '</option>'
|
if (availableDbs) {
|
||||||
);
|
if (availableDbs.indexOf(db) > -1) {
|
||||||
} else {
|
$('#loginDatabase').append(
|
||||||
$('#loginDatabase').append(
|
'<option>' + db + '</option>'
|
||||||
'<option>' + rule + '</option>'
|
);
|
||||||
);
|
}
|
||||||
}
|
} else {
|
||||||
});
|
$('#loginDatabase').append(
|
||||||
|
'<option>' + db + '</option>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (availableDbs) {
|
||||||
|
if (availableDbs.indexOf(db) > -1) {
|
||||||
|
$('#loginDatabase').append(
|
||||||
|
'<option>' + rule + '</option>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('#loginDatabase').append(
|
||||||
|
'<option>' + rule + '</option>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
self.renderDBS();
|
self.renderDBS();
|
||||||
|
};
|
||||||
|
|
||||||
|
// fetch available dbs
|
||||||
|
var availableDbs;
|
||||||
|
try {
|
||||||
|
$.ajax(arangoHelper.databaseUrl('/_api/database/user')).success(function (dbs) {
|
||||||
|
availableDbs = dbs.result;
|
||||||
|
successFunc(availableDbs);
|
||||||
|
});
|
||||||
|
} catch (ignore) {
|
||||||
|
console.log(ignore);
|
||||||
|
successFunc();
|
||||||
|
}
|
||||||
}).error(function () {
|
}).error(function () {
|
||||||
if (errCallback) {
|
if (errCallback) {
|
||||||
errCallback();
|
errCallback();
|
||||||
|
@ -191,14 +221,35 @@
|
||||||
// enable db select and login button
|
// enable db select and login button
|
||||||
$('#loginDatabase').html('');
|
$('#loginDatabase').html('');
|
||||||
|
|
||||||
// fill select with allowed dbs
|
var successFunc = function (availableDbs) {
|
||||||
_.each(permissions.result, function (db, key) {
|
if (availableDbs) {
|
||||||
$('#loginDatabase').append(
|
_.each(permissions.result, function (db, key) {
|
||||||
'<option>' + key + '</option>'
|
if (availableDbs.indexOf(key) > -1) {
|
||||||
);
|
$('#loginDatabase').append(
|
||||||
});
|
'<option>' + key + '</option>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// fill select with allowed dbs
|
||||||
|
_.each(permissions.result, function (db, key) {
|
||||||
|
$('#loginDatabase').append(
|
||||||
|
'<option>' + key + '</option>'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
self.renderDBS();
|
self.renderDBS();
|
||||||
|
};
|
||||||
|
|
||||||
|
// fetch available dbs
|
||||||
|
try {
|
||||||
|
$.ajax(arangoHelper.databaseUrl('/_api/database/user')).success(function (dbs) {
|
||||||
|
successFunc(dbs.result);
|
||||||
|
});
|
||||||
|
} catch (ignore) {
|
||||||
|
successFunc();
|
||||||
|
}
|
||||||
}).error(function () {
|
}).error(function () {
|
||||||
$('.wrong-credentials').show();
|
$('.wrong-credentials').show();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue