Commit 194636a5 authored by Juorder Gonzalez's avatar Juorder Gonzalez

Merge pull request #114 from ZBoxApp/issues_resolved_manager

fixed hide menu, not show plans not assigned, link to company from do…
parents 53092b3f 7b6d3be2
1464204428 1464270876
\ No newline at end of file \ No newline at end of file
...@@ -22,7 +22,7 @@ Vagrant.configure(2) do |config| ...@@ -22,7 +22,7 @@ Vagrant.configure(2) do |config|
config.vm.network 'forwarded_port', guest: 8081, host: 8081 config.vm.network 'forwarded_port', guest: 8081, host: 8081
config.vm.network 'forwarded_port', guest: 9081, host: 9081 config.vm.network 'forwarded_port', guest: 9081, host: 9081
config.vm.network 'forwarded_port', guest: 9082, host: 9082 config.vm.network 'forwarded_port', guest: 9082, host: 9082
config.vm.network 'forwarded_port', guest: 443, host: 7443 config.vm.network 'forwarded_port', guest: 8443, host: 7443
config.vm.network 'forwarded_port', guest: 80, host: 7080 config.vm.network 'forwarded_port', guest: 80, host: 7080
config.vm.network 'forwarded_port', guest: 389, host: 7389 config.vm.network 'forwarded_port', guest: 389, host: 7389
......
module.exports = {"main":{"js":"/070120bundle.js"}} module.exports = {"main":{"js":"/220281bundle.js"}}
\ No newline at end of file \ No newline at end of file
...@@ -34,6 +34,8 @@ export default class DistributionLists extends React.Component { ...@@ -34,6 +34,8 @@ export default class DistributionLists extends React.Component {
this.onSubmitMembers = this.onSubmitMembers.bind(this); this.onSubmitMembers = this.onSubmitMembers.bind(this);
this.onCancelMember = this.onCancelMember.bind(this); this.onCancelMember = this.onCancelMember.bind(this);
this.onCancelOwner = this.onCancelOwner.bind(this); this.onCancelOwner = this.onCancelOwner.bind(this);
this.onExportMembers = this.onExportMembers.bind(this);
this.onExportAllowers = this.onExportAllowers.bind(this);
this.domain = null; this.domain = null;
this.state = {}; this.state = {};
...@@ -48,6 +50,16 @@ export default class DistributionLists extends React.Component { ...@@ -48,6 +50,16 @@ export default class DistributionLists extends React.Component {
}); });
} }
onExportMembers(data) {
const title = `Miembros de la lista de distribución '${this.state.distributionsList.name}' de ${this.state.domain.name}`;
Utils.exportAsCSV(data, 'members', title, true);
}
onExportAllowers(data) {
const title = `Permitidos de la lista de distribución '${this.state.distributionsList.name}' de ${this.state.domain.name}`;
Utils.exportAsCSV(data, 'allowers', title, true);
}
getDistributionLists() { getDistributionLists() {
const id = this.props.params.id; const id = this.props.params.id;
const response = {}; const response = {};
...@@ -451,6 +463,9 @@ export default class DistributionLists extends React.Component { ...@@ -451,6 +463,9 @@ export default class DistributionLists extends React.Component {
onCancel={(response) => { onCancel={(response) => {
this.onCancelMember(response); this.onCancelMember(response);
}} }}
onExport={(members) => {
this.onExportMembers(members);
}}
/> />
); );
...@@ -469,6 +484,9 @@ export default class DistributionLists extends React.Component { ...@@ -469,6 +484,9 @@ export default class DistributionLists extends React.Component {
onCancel={(response) => { onCancel={(response) => {
this.onCancelOwner(response); this.onCancelOwner(response);
}} }}
onExport={(allowers) => {
this.onExportAllowers(allowers);
}}
/> />
); );
} }
......
...@@ -95,7 +95,7 @@ export default class DomainGeneralInfo extends React.Component { ...@@ -95,7 +95,7 @@ export default class DomainGeneralInfo extends React.Component {
<p> <p>
<a <a
className='account-name' className='account-name'
onClick={(e) => Utils.handleLink(e, `/accounts/${domain.id_empresa}`, this.props.location)} onClick={(e) => Utils.handleLink(e, `/companies/${domain.attrs.businessCategory}`, this.props.location)}
> >
{this.state.company} {this.state.company}
</a> </a>
......
...@@ -64,6 +64,7 @@ export default class DomainMailboxPlans extends React.Component { ...@@ -64,6 +64,7 @@ export default class DomainMailboxPlans extends React.Component {
]; ];
const mailboxPlans = []; const mailboxPlans = [];
let panelBody = null;
const cos = Utils.getEnabledPlansByCosId(ZimbraStore.getAllCos()); const cos = Utils.getEnabledPlansByCosId(ZimbraStore.getAllCos());
const planKeys = Object.keys(cos).map((c) => { const planKeys = Object.keys(cos).map((c) => {
return cos[c]; return cos[c];
...@@ -95,7 +96,7 @@ export default class DomainMailboxPlans extends React.Component { ...@@ -95,7 +96,7 @@ export default class DomainMailboxPlans extends React.Component {
} }
for (const key in plans) { for (const key in plans) {
if (plans.hasOwnProperty(key)) { if (plans.hasOwnProperty(key) && plans[key].used !== 0 && plans[key].limit !== 0) {
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;
if (plan.limit === 0) { if (plan.limit === 0) {
...@@ -138,6 +139,7 @@ export default class DomainMailboxPlans extends React.Component { ...@@ -138,6 +139,7 @@ export default class DomainMailboxPlans extends React.Component {
} }
} }
if (mailboxPlans.length > 0) {
mailboxPlans.push( mailboxPlans.push(
<tr key='totalizacion-planes'> <tr key='totalizacion-planes'>
<td className='mbx-plan' <td className='mbx-plan'
...@@ -160,7 +162,7 @@ export default class DomainMailboxPlans extends React.Component { ...@@ -160,7 +162,7 @@ export default class DomainMailboxPlans extends React.Component {
</tr> </tr>
); );
const panelBody = ( panelBody = (
<table <table
id='domain-mbxs' id='domain-mbxs'
cellPadding='1' cellPadding='1'
...@@ -180,6 +182,13 @@ export default class DomainMailboxPlans extends React.Component { ...@@ -180,6 +182,13 @@ export default class DomainMailboxPlans extends React.Component {
</tbody> </tbody>
</table> </table>
); );
} else {
panelBody = (
<div className='text-center'>
<h4 className='text-danger'>{'No posee casillas asignadas a su dominio.'}</h4>
</div>
);
}
return ( return (
<Panel <Panel
......
...@@ -57,6 +57,7 @@ export default class Mailboxes extends React.Component { ...@@ -57,6 +57,7 @@ export default class Mailboxes extends React.Component {
}; };
this.optionPlans = window.manager_config.plans; this.optionPlans = window.manager_config.plans;
this.domainId = null; this.domainId = null;
this.domainName = null;
this.state = { this.state = {
page, page,
...@@ -122,10 +123,10 @@ export default class Mailboxes extends React.Component { ...@@ -122,10 +123,10 @@ export default class Mailboxes extends React.Component {
handleExportAsCSV(e) { handleExportAsCSV(e) {
e.preventDefault(); e.preventDefault();
const accounts = MailboxStore.getMailboxes(); if (MailboxStore.getMailboxByDomainId(this.domainId)) {
const accounts = MailboxStore.getMailboxByDomainId(this.domainId);
if (accounts && accounts.account && accounts.account.length > 0) { const title = `Casillas de ${accounts.account[0].domain}`;
return Utils.exportAsCSV(accounts.account, 'all_accounts', true); return Utils.exportAsCSV(accounts.account, 'domain', title, true);
} }
return false; return false;
...@@ -134,6 +135,7 @@ export default class Mailboxes extends React.Component { ...@@ -134,6 +135,7 @@ export default class Mailboxes extends React.Component {
componentWillReceiveProps(newProps) { componentWillReceiveProps(newProps) {
const condition = this.props.location.query.page !== newProps.location.query.page; const condition = this.props.location.query.page !== newProps.location.query.page;
let domainId = null; let domainId = null;
this.domainName = null;
if (condition) { if (condition) {
const page = parseInt(newProps.location.query.page, 10) || 1; const page = parseInt(newProps.location.query.page, 10) || 1;
...@@ -198,18 +200,19 @@ export default class Mailboxes extends React.Component { ...@@ -198,18 +200,19 @@ export default class Mailboxes extends React.Component {
if (domainName) { if (domainName) {
attrs.domain = domainName; attrs.domain = domainName;
this.domainName = domainName;
} }
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
if (domainName) { if (domainName) {
const hasMailboxForDomain = MailboxStore.getMailboxByDomainId(domainName); const hasMailboxForDomain = MailboxStore.getMailboxByDomainId(this.domainId);
if (hasMailboxForDomain) { if (hasMailboxForDomain) {
return resolve(hasMailboxForDomain); return resolve(hasMailboxForDomain);
} }
return Client.getAllAccounts(attrs, (success) => { return Client.getAllAccounts(attrs, (success) => {
MailboxStore.setMailboxesByDomain(domainName, success); MailboxStore.setMailboxesByDomain(this.domainId, success);
return resolve(success); return resolve(success);
}, (error) => { }, (error) => {
return reject(error); return reject(error);
...@@ -265,8 +268,10 @@ export default class Mailboxes extends React.Component { ...@@ -265,8 +268,10 @@ export default class Mailboxes extends React.Component {
} }
}).finally(() => { }).finally(() => {
if (!this.isRefreshing) { if (!this.isRefreshing) {
GlobalActions.emitEndLoading(); return GlobalActions.emitEndLoading();
} }
return GlobalActions.emitEndLoading();
}); });
} }
...@@ -310,6 +315,7 @@ export default class Mailboxes extends React.Component { ...@@ -310,6 +315,7 @@ export default class Mailboxes extends React.Component {
EventStore.removeMessageListener(this.showMessage); EventStore.removeMessageListener(this.showMessage);
MailboxStore.removeListenerAddMassive(this.showMessage); MailboxStore.removeListenerAddMassive(this.showMessage);
$('#sidebar-mailboxes').removeClass('active'); $('#sidebar-mailboxes').removeClass('active');
this.domainName = null;
} }
buildRow(row, classes, status) { buildRow(row, classes, status) {
...@@ -464,6 +470,8 @@ export default class Mailboxes extends React.Component { ...@@ -464,6 +470,8 @@ export default class Mailboxes extends React.Component {
limit = partialAccounts.length; limit = partialAccounts.length;
} }
const response = {};
for (let i = 0; i < limit; i++) { for (let i = 0; i < limit; i++) {
const account = partialAccounts[i].attrs; const account = partialAccounts[i].attrs;
switch (account.zimbraAccountStatus) { switch (account.zimbraAccountStatus) {
...@@ -476,14 +484,12 @@ export default class Mailboxes extends React.Component { ...@@ -476,14 +484,12 @@ export default class Mailboxes extends React.Component {
case 'locked': case 'locked':
activeAccounts.push(this.buildRow(partialAccounts[i], 'label label-warning m-r', 'Inactiva')); activeAccounts.push(this.buildRow(partialAccounts[i], 'label label-warning m-r', 'Inactiva'));
break; break;
case 'lockedout': case 'lockout':
lockedAccounts.push(this.buildRow(partialAccounts[i], 'label label-locked m-r', 'Bloqueada')); lockedAccounts.push(this.buildRow(partialAccounts[i], 'label label-locked m-r', 'Bloqueada'));
activeAccounts.push(this.buildRow(partialAccounts[i], 'label label-locked m-r', 'Bloqueada')); activeAccounts.push(this.buildRow(partialAccounts[i], 'label label-locked m-r', 'Bloqueada'));
break; break;
} }
} }
const response = {};
const all = `${arrayTabNames.shift()} (${totalAccounts})`; const all = `${arrayTabNames.shift()} (${totalAccounts})`;
const locked = `${arrayTabNames.shift()} (${lockedAccounts.length})`; const locked = `${arrayTabNames.shift()} (${lockedAccounts.length})`;
...@@ -622,6 +628,8 @@ export default class Mailboxes extends React.Component { ...@@ -622,6 +628,8 @@ export default class Mailboxes extends React.Component {
render() { render() {
let message = null; let message = null;
let content = null; let content = null;
let panelInfo = null;
const data = this.state.data;
if (this.state.loading) { if (this.state.loading) {
content = ( content = (
...@@ -643,7 +651,7 @@ export default class Mailboxes extends React.Component { ...@@ -643,7 +651,7 @@ export default class Mailboxes extends React.Component {
} }
if (this.state.notMatches) { if (this.state.notMatches) {
const domain = (this.state.domain) ? `para el dominio: ${this.state.domain}` : ''; const domain = (this.domainName) ? `para el dominio: ${this.domainName}` : '';
content = ( content = (
<div className='text-center'> <div className='text-center'>
<h4> <h4>
...@@ -653,16 +661,24 @@ export default class Mailboxes extends React.Component { ...@@ -653,16 +661,24 @@ export default class Mailboxes extends React.Component {
); );
} }
const pagelInfo = ( panelInfo = (
<PageInfo <PageInfo
titlePage='Casillas' titlePage='Casillas'
descriptionPage='Usuarios de correo electrónico' descriptionPage='Usuarios de correo electrónico'
/> />
); );
if (this.state.data) { if (this.domainId && data && this.domainName) {
const data = this.state.data; const domainName = this.domainName;
panelInfo = (
<PageInfo
titlePage='Casillas'
descriptionPage={`Usuarios de correo electrónico de ${domainName}`}
/>
);
}
if (data) {
content = ( content = (
<PanelTab <PanelTab
tabNames={data.tabNames} tabNames={data.tabNames}
...@@ -675,7 +691,7 @@ export default class Mailboxes extends React.Component { ...@@ -675,7 +691,7 @@ export default class Mailboxes extends React.Component {
return ( return (
<div> <div>
{pagelInfo} {panelInfo}
<div className='content animate-panel'> <div className='content animate-panel'>
{message} {message}
<div className='row'> <div className='row'>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"zimbraUrl": "http://zimbra.zboxapp.dev:9081/zimbra_proxy/service/admin/soap", "zimbraUrl": "http://zimbra.zboxapp.dev:9081/zimbra_proxy/service/admin/soap",
"zimbraProxy": "https://192.168.1.8:7071", "zimbraProxy": "https://192.168.1.8:7071",
"dnsApiUrl": "http://zimbra.zboxapp.dev:3000", "dnsApiUrl": "http://zimbra.zboxapp.dev:3000",
"webMailUrl": "https://zimbra.zboxapp.dev", "webMailUrl": "https://192.168.1.8:8443",
"dns": { "dns": {
"url": "http://zimbra.zboxapp.dev:9081//powerdns_proxy/", "url": "http://zimbra.zboxapp.dev:9081//powerdns_proxy/",
"token": "otto" "token": "otto"
...@@ -56,5 +56,21 @@ ...@@ -56,5 +56,21 @@
"zimbraLastLogonTimestamp": true "zimbraLastLogonTimestamp": true
} }
} }
},
"export" : {
"domain": {
"name": "Email",
"giverName": "Nombre",
"sn": "Apellido",
"cn": "Usuario",
"zimbraCOSId": "Plan",
"zimbraAccountStatus": "Status"
},
"members": {
"name": "Miembros"
},
"allowers": {
"name": "Permitidos"
}
} }
} }
...@@ -516,10 +516,12 @@ body { ...@@ -516,10 +516,12 @@ body {
margin-left: -$menu-width; margin-left: -$menu-width;
} }
#root {
#wrapper { #wrapper {
margin-left: 0; margin-left: 0;
} }
} }
}
.page-small { .page-small {
#menu { #menu {
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import {browserHistory} from 'react-router'; import {browserHistory} from 'react-router';
import * as GlobalActions from '../action_creators/global_actions.jsx'; import * as GlobalActions from '../action_creators/global_actions.jsx';
import Constants from './constants.jsx'; import Constants from './constants.jsx';
import ZimbraStore from '../stores/zimbra_store.jsx';
const messageType = Constants.MessageType; const messageType = Constants.MessageType;
...@@ -345,34 +346,55 @@ export function getDomainFromString(string, otherwise) { ...@@ -345,34 +346,55 @@ export function getDomainFromString(string, otherwise) {
return domain; return domain;
} }
export function exportAsCSV(data, title, hasLabel) { export function exportAsCSV(data, target, title, hasLabel) {
const info = (typeof data === 'object') ? data : JSON.parse(data); let info = (typeof data === 'object') ? data : JSON.parse(data);
const cos = getEnabledPlansByCosId(ZimbraStore.getAllCos());
const headers = window.manager_config.export[target];
const keys = Object.keys(headers);
const colNames = Object.values(headers);
const status = {
active: 'Activa',
closed: 'Cerrada',
locked: 'Inactiva',
lockout: 'Bloqueada'
};
let row = '';
let CSV = ''; let CSV = '';
CSV += title + '\r\n\n'; CSV += title + '\r\n\n';
if (hasLabel) { if (hasLabel) {
let row = ''; row = colNames.join(',');
for (const index in info[0]) { CSV += row + '\r\n';
if (info[0].hasOwnProperty(index)) {
row += index + ',';
}
} }
row = row.slice(0, row.length - 1); for (var i = 0; i < info.length; i++) {
row = '';
const item = info[i];
for (var j = 0; j < keys.length; j++) {
let col = null;
CSV += row + '\r\n'; if (typeof item === 'object') {
col = status[item.attrs[keys[j]]] || item.attrs[keys[j]];
} }
for (var i = 0; i < info.length; i++) { if (keys[j] === 'name') {
let row = ''; if (typeof item === 'string') {
col = item;
} else {
col = item[keys[j]] || item;
}
}
for (var index in info[i]) { if (keys[j] === 'zimbraCOSId') {
if (info[i].hasOwnProperty(index)) { col = cos[item.attrs[keys[j]]] || 'Sin plan';
row += '\'' + info[i][index] + '\','; col = titleCase(col);
} }
col = col || 'No definido';
row += col + ',';
} }
row = row.slice(0, -1); row = row.slice(0, -1);
......
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