Add virtual parameters page
This commit is contained in:
1 parent
5b84b1daad
commit
f9c26dac1a
12 files changed
+453
-20
No files matched your search
+7
-2
@@ -13,9 +13,12 @@ const RESOURCE_DB = {
|
||||
tasks: "genieacs",
|
||||
presets: "genieacs",
|
||||
provisions: "genieacs",
|
||||
virtualParameters: "genieacs",
|
||||
files: "genieacs"
|
||||
};
|
||||
|
||||
const RESOURCE_COLLECTION = {};
|
||||
|
||||
function getClient() {
|
||||
if (!_clientPromise)
|
||||
_clientPromise = new Promise((resolve, reject) => {
|
||||
@@ -54,7 +57,7 @@ function query(resource, filter, options, callback) {
|
||||
getClient().then(client => {
|
||||
const collection = client
|
||||
.db(RESOURCE_DB[resource])
|
||||
.collection(resource);
|
||||
.collection(RESOURCE_COLLECTION[resource] || resource);
|
||||
let cursor = collection.find(
|
||||
q,
|
||||
resource === "Devices"
|
||||
@@ -130,7 +133,9 @@ function count(resource, filter) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
getClient().then(client => {
|
||||
const collection = client.db(RESOURCE_DB[resource]).collection(resource);
|
||||
const collection = client
|
||||
.db(RESOURCE_DB[resource])
|
||||
.collection(RESOURCE_COLLECTION[resource] || resource);
|
||||
collection.find(q).count((err, c) => {
|
||||
if (err) reject(err);
|
||||
else resolve(c);
|
||||
|
||||
Reference in new issue
Block a user