Commit 6473e3b0 authored by Juorder Gonzalez's avatar Juorder Gonzalez

Merge pull request #35 from ZBoxApp/cos

Add get plans to display for COS defined in the server
parents fd85cc86 9ccec89c
...@@ -493,3 +493,22 @@ export function batchRequest(requestArray, success, error) { ...@@ -493,3 +493,22 @@ export function batchRequest(requestArray, success, error) {
} }
); );
} }
export function getAllCos(success, error) {
initZimbra().then(
(zimbra) => {
zimbra.getAllCos((err, data) => {
if (err) {
const e = handleError('getAllCos', err);
return error(e);
}
return success(data);
});
},
(err) => {
const e = handleError('getAllCos', err);
return error(e);
}
);
}
...@@ -281,3 +281,17 @@ export function getPlansFromDomain(domain) { ...@@ -281,3 +281,17 @@ export function getPlansFromDomain(domain) {
export function titleCase(string) { export function titleCase(string) {
return string.charAt(0).toUpperCase() + string.slice(1); return string.charAt(0).toUpperCase() + string.slice(1);
} }
export function getEnabledPlansByCos(cosArray) {
const configPlans = global.window.manager_config.plans;
const plans = {};
cosArray.forEach((cos) => {
const key = cos.name;
if (configPlans.hasOwnProperty(key) && configPlans[key]) {
plans[key] = cos.id;
}
});
return plans;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment