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