Commit 64ea4892 authored by Elias Nahum's avatar Elias Nahum Committed by Juorder Antonio

add status to mailbox if mailbox is admin, add limitless word if cos is...

add status to mailbox if mailbox is admin, add limitless word if cos is premium, add store to domain mailboxes
parent 29ac4f3d
module.exports = {"main":{"js":"/896467bundle.js"}}
\ No newline at end of file
module.exports = {"main":{"js":"/070120bundle.js"}}
\ No newline at end of file
......@@ -94,7 +94,7 @@ export default class DomainMailboxPlans extends React.Component {
});
}
for (const key in this.state.plans) {
for (const key in plans) {
if (plans.hasOwnProperty(key)) {
const plan = plans[key];
totalUsed += (parseInt(plan.used, 10)) ? parseInt(plan.used, 10) : 0;
......
......@@ -51,7 +51,7 @@ export default class BlockGeneralInfoMailbox extends React.Component {
if (window.manager_config.plans[cosID.name]) {
cosName = Utils.titleCase(cosID.name);
statusCos = 'label btn-xs ' + window.manager_config.plans[cosID.name].statusCos;
statusCos = 'label btn-xs margin-left ' + window.manager_config.plans[cosID.name].statusCos;
}
if (this.state.hasDomain) {
......@@ -61,9 +61,18 @@ export default class BlockGeneralInfoMailbox extends React.Component {
const mail = data.name;
//properties
let AdminStatus = null;
const description = attrs.description;
const mailhost = attrs.zimbraMailHost;
const archive = attrs.zimbraArchiveAccount;
const isAdminDelegated = attrs.zimbraIsDelegatedAdminAccount === 'TRUE';
if (isAdminDelegated) {
AdminStatus = (
<StatusLabel classes={'label btn-xs btn-warning2'}>
{'Administrador'}
</StatusLabel>
);
}
let btnArchive = archive;
if (this.props.webmail) {
......@@ -135,9 +144,12 @@ export default class BlockGeneralInfoMailbox extends React.Component {
<div>
<p>
<StatusLabel classes={statusCos}>
{cosName}
</StatusLabel>
<span>
{AdminStatus}
<StatusLabel classes={statusCos}>
{cosName}
</StatusLabel>
</span>
</p>
</div>
</article>
......
......@@ -45,6 +45,7 @@ export default class Mailboxes extends React.Component {
this.filtering = false;
this.selectedStatusFilter = '';
this.selectedPlanFilter = '';
this.selectedPlan = '';
this.cos = Utils.getEnabledPlansByCos(ZimbraStore.getAllCos());
this.cosById = Utils.getEnabledPlansByCosId(ZimbraStore.getAllCos());
this.isRefreshing = true;
......@@ -55,6 +56,7 @@ export default class Mailboxes extends React.Component {
closed: 'Cerrada'
};
this.optionPlans = window.manager_config.plans;
this.domainId = null;
this.state = {
page,
......@@ -70,6 +72,7 @@ export default class Mailboxes extends React.Component {
this.selectedPlanFilter = '';
if (this.cos[selected]) {
this.selectedPlanFilter = this.cos[selected];
this.selectedPlan = selected;
}
}
......@@ -77,7 +80,7 @@ export default class Mailboxes extends React.Component {
this.selectedStatusFilter = selected.length > 0 ? selected : null;
}
const domainId = this.props.params.domain_id;
const domainId = this.domainId;
this.getAllMailboxes(domainId, window.manager_config.maxResultOnRequestZimbra);
}
......@@ -143,15 +146,18 @@ export default class Mailboxes extends React.Component {
loading: true
};
domainId = this.props.params.domain_id;
domainId = this.domainId;
if (this.props.params.domain_id) {
domainId = this.props.params.domain_id;
this.domainId = domainId;
}
this.getAllMailboxes(domainId, window.manager_config.maxResultOnRequestZimbra);
} else {
GlobalActions.emitStartLoading();
if (newProps.params.domain_id !== this.props.params.domain_id) {
domainId = newProps.params.domain_id;
}
domainId = newProps.params.domain_id;
this.getAllMailboxes(domainId, window.manager_config.maxResultOnRequestZimbra);
}
......@@ -196,7 +202,14 @@ export default class Mailboxes extends React.Component {
new Promise((resolve, reject) => {
if (domainName) {
const hasMailboxForDomain = MailboxStore.getMailboxByDomainId(domainName);
if (hasMailboxForDomain) {
return resolve(hasMailboxForDomain);
}
return Client.getAllAccounts(attrs, (success) => {
MailboxStore.setMailboxesByDomain(domainName, success);
return resolve(success);
}, (error) => {
return reject(error);
......@@ -289,6 +302,7 @@ export default class Mailboxes extends React.Component {
EventStore.addMessageListener(this.showMessage);
MailboxStore.addListenerAddMassive(this.refreshAllAccounts);
const domainId = this.props.params.domain_id;
this.domainId = domainId;
this.getAllMailboxes(domainId);
}
......@@ -569,7 +583,7 @@ export default class Mailboxes extends React.Component {
<select
className='form-control plans'
onChange={this.handleChangeFilter}
value={this.selectedPlanFilter}
value={this.selectedPlan}
>
<option value=''>Todos los planes</option>
{plans}
......
......@@ -70,7 +70,7 @@ export default class BlockGeneralInfoMailbox extends React.Component {
if (this.sizeEnabled.hasOwnProperty('attrs') && this.sizeEnabled.attrs.zimbraMailQuota) {
const sizeOfPlan = typeof this.sizeEnabled.attrs.zimbraMailQuota === 'string' ? parseInt(this.sizeEnabled.attrs.zimbraMailQuota, 10) : this.sizeEnabled.attrs.zimbraMailQuota;
sizeEnaled = bytesConvertor(sizeOfPlan);
sizeEnaled = (sizeOfPlan) ? 'Ilimitado' : bytesConvertor(sizeOfPlan);
}
return (
......
......@@ -12,13 +12,34 @@ class MailboxStoreClass extends EventEmitter {
constructor() {
super();
this.current = null;
this.mailboxesByDomain = null;
}
resetThisStore() {
this.current = null;
this.mailboxesByDomain = null;
mailboxesArray = null;
}
setMailboxesByDomain(id, mailboxes) {
if (mailboxes) {
this.mailboxesByDomain = {};
this.mailboxesByDomain[id] = mailboxes;
}
return true;
}
getMailboxByDomainId(id) {
if (id) {
if (this.mailboxesByDomain) {
return this.mailboxesByDomain[id];
}
}
return false;
}
getMailboxById(id) {
if (mailboxesArray) {
const accounts = mailboxesArray.account;
......
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