Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zimbra-admin-api-js
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Public
zimbra-admin-api-js
Commits
3061904d
Commit
3061904d
authored
Apr 11, 2016
by
Elias Nahum
Committed by
Juorder Antonio
May 25, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed filter mailboxes, fixed sum to domain, fixed mx, fixed mailbox limits
parent
d36467ce
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
131 additions
and
98 deletions
+131
-98
action_set_name
.vagrant/machines/default/virtualbox/action_set_name
+1
-1
path.json
path.json
+1
-1
companies.jsx
src/components/companies/companies.jsx
+23
-7
domain_general_info.jsx
src/components/domain/domain_general_info.jsx
+10
-12
domain_mailbox_plans.jsx
src/components/domain/domain_mailbox_plans.jsx
+4
-5
mailbox.jsx
src/components/mailbox/mailbox.jsx
+85
-68
stats_mailbox.jsx
src/components/mailbox/stats_mailbox.jsx
+1
-1
config.json
src/config/config.json
+6
-3
No files found.
.vagrant/machines/default/virtualbox/action_set_name
View file @
3061904d
1464106868
\ No newline at end of file
1464204428
\ No newline at end of file
path.json
View file @
3061904d
module.exports
=
{
"main"
:{
"js"
:
"/699779bundle.js"
}}
\ No newline at end of file
module.exports
=
{
"main"
:{
"js"
:
"/896467bundle.js"
}}
\ No newline at end of file
src/components/companies/companies.jsx
View file @
3061904d
...
...
@@ -35,7 +35,8 @@ export default class Companies extends React.Component {
this
.
state
=
{
page
,
offset
:
((
page
-
1
)
*
Constants
.
QueryOptions
.
DEFAULT_LIMIT
)
offset
:
((
page
-
1
)
*
Constants
.
QueryOptions
.
DEFAULT_LIMIT
),
loading
:
true
};
this
.
isGlobalAdmin
=
UserStore
.
isGlobalAdmin
();
...
...
@@ -68,13 +69,15 @@ export default class Companies extends React.Component {
CompaniesStore
.
setCompanies
(
comps
);
self
.
setState
({
companies
:
comps
companies
:
comps
,
loading
:
false
});
}).
catch
((
error
)
=>
{
self
.
setState
({
error
:
{
message
:
error
,
type
:
messageTypes
.
ERROR
type
:
messageTypes
.
ERROR
,
loading
:
false
}});
});
}).
catch
((
error
)
=>
{
...
...
@@ -91,7 +94,8 @@ export default class Companies extends React.Component {
},
(
error
)
=>
{
self
.
setState
({
error
:
{
message
:
error
,
type
:
messageTypes
.
ERROR
type
:
messageTypes
.
ERROR
,
loading
:
false
}});
});
}
else
{
...
...
@@ -103,13 +107,15 @@ export default class Companies extends React.Component {
},
(
error
)
=>
{
self
.
setState
({
error
:
{
message
:
error
,
type
:
messageTypes
.
ERROR
type
:
messageTypes
.
ERROR
,
loading
:
false
}});
});
},
(
error
)
=>
{
self
.
setState
({
error
,
type
:
messageTypes
.
ERROR
type
:
messageTypes
.
ERROR
,
loading
:
false
});
});
}
...
...
@@ -194,6 +200,16 @@ export default class Companies extends React.Component {
let
panelBody
;
let
noLimitError
;
let
pagination
=
null
;
const
textLoading
=
this
.
isGlobalAdmin
?
'Cargando Empresas...'
:
'Cargando Mi Empresa...'
;
if
(
this
.
state
.
loading
)
{
panelBody
=
(
<
div
className=
'text-center'
>
<
i
className=
'fa fa-spinner fa-spin fa-4x fa-fw'
></
i
>
<
p
>
{
textLoading
}
</
p
>
</
div
>
);
}
if
(
this
.
state
.
companies
.
length
===
0
)
{
panelBody
=
(
...
...
@@ -213,7 +229,7 @@ export default class Companies extends React.Component {
const
totalPages
=
Math
.
ceil
(
data
.
length
/
Constants
.
QueryOptions
.
DEFAULT_LIMIT
);
pagination
=
(
<
Pagination
key=
'pa
nelPaginationCompanies
'
key=
'pa
ginationCompany
'
url=
'companies'
currentPage=
{
this
.
state
.
page
}
totalPages=
{
totalPages
}
...
...
src/components/domain/domain_general_info.jsx
View file @
3061904d
...
...
@@ -29,25 +29,23 @@ export default class DomainGeneralInfo extends React.Component {
}
componentWillMount
()
{
const
domain
=
this
.
props
.
domain
;
this
.
getMXRecord
(
domain
.
name
);
this
.
getMXRecord
(
domain
);
this
.
getCompany
(
domain
.
attrs
.
businessCategory
);
}
getMXRecord
(
name
)
{
getMXRecord
(
domain
)
{
const
self
=
this
;
Client
.
getDnsInfo
(
name
,
(
data
)
=>
{
self
.
setState
({
mx
:
data
.
mx
});
},
(
err
)
=>
{
self
.
setState
({
domain
.
checkMxRecord
((
err
,
data
)
=>
{
if
(
err
)
{
return
self
.
setState
({
mx
:
err
});
}
);
return
self
.
setState
({
mx
:
data
.
entry
});
});
}
getCompany
(
id
)
{
const
company
=
CompanyStore
.
getCompanyById
(
id
);
...
...
src/components/domain/domain_mailbox_plans.jsx
View file @
3061904d
...
...
@@ -30,13 +30,13 @@ export default class DomainMailboxPlans extends React.Component {
plans
});
}
return
this
.
props
.
domain
.
countAccounts
(
(
err
,
data
)
=>
{
if
(
err
)
{
return
this
.
setState
({
plans
:
{}});
}
this
.
props
.
domain
.
plans
=
data
;
return
this
.
setState
({
plans
:
data
});
}
);
...
...
@@ -94,12 +94,12 @@ export default class DomainMailboxPlans extends React.Component {
});
}
for
(
const
key
in
plans
)
{
for
(
const
key
in
this
.
state
.
plans
)
{
if
(
plans
.
hasOwnProperty
(
key
))
{
const
plan
=
plans
[
key
];
totalUsed
+=
plan
.
used
;
totalUsed
+=
(
parseInt
(
plan
.
used
,
10
))
?
parseInt
(
plan
.
used
,
10
)
:
0
;
if
(
plan
.
limit
===
0
)
{
totalLimit
=
'
\
u221e'
;
//
totalLimit = '\u221e';
if
(
!
noLimitError
)
{
noLimitError
=
(
...
...
@@ -111,7 +111,6 @@ export default class DomainMailboxPlans extends React.Component {
);
}
}
else
{
console
.
log
(
totalLimit
);
//eslint-disable-line no-console
totalLimit
+=
plan
.
limit
;
}
...
...
src/components/mailbox/mailbox.jsx
View file @
3061904d
...
...
@@ -36,14 +36,25 @@ export default class Mailboxes extends React.Component {
this
.
showMessage
=
this
.
showMessage
.
bind
(
this
);
this
.
refreshAllAccounts
=
this
.
refreshAllAccounts
.
bind
(
this
);
this
.
handleFilterMailbox
=
this
.
handleFilterMailbox
.
bind
(
this
);
this
.
handleChangeFilter
=
this
.
handleChangeFilter
.
bind
(
this
);
this
.
makeFilter
=
this
.
makeFilter
.
bind
(
this
);
const
page
=
parseInt
(
this
.
props
.
location
.
query
.
page
,
10
)
||
1
;
this
.
mailboxes
=
null
;
this
.
status
=
''
;
this
.
mailboxesFiltered
=
null
;
this
.
filtering
=
false
;
this
.
selectedStatusFilter
=
''
;
this
.
selectedPlanFilter
=
''
;
this
.
cos
=
Utils
.
getEnabledPlansByCos
(
ZimbraStore
.
getAllCos
());
this
.
cosById
=
Utils
.
getEnabledPlansByCosId
(
ZimbraStore
.
getAllCos
());
this
.
isRefreshing
=
true
;
this
.
optionStatus
=
{
active
:
'Active'
,
locked
:
'Inactiva'
,
lockedout
:
'Bloqueada'
,
closed
:
'Cerrada'
};
this
.
optionPlans
=
window
.
manager_config
.
plans
;
this
.
state
=
{
page
,
...
...
@@ -54,65 +65,49 @@ export default class Mailboxes extends React.Component {
handleChangeFilter
(
e
)
{
const
selected
=
e
.
target
.
value
;
const
cos
=
Utils
.
getEnabledPlansByCos
(
ZimbraStore
.
getAllCos
());
if
(
e
.
target
.
className
.
indexOf
(
'plans'
)
>
-
1
)
{
this
.
cos
=
cos
[
selected
];
this
.
selectedPlanFilter
=
''
;
if
(
this
.
cos
[
selected
])
{
this
.
selectedPlanFilter
=
this
.
cos
[
selected
];
}
}
if
(
e
.
target
.
className
.
indexOf
(
'status'
)
>
-
1
)
{
this
.
s
tatus
=
selected
;
this
.
s
electedStatusFilter
=
selected
.
length
>
0
?
selected
:
null
;
}
const
d
ata
=
Object
.
assign
({},
this
.
mailboxes
)
;
const
d
omainId
=
this
.
props
.
params
.
domain_id
;
const
arrayFiltered
=
data
.
account
.
filter
((
strArray
)
=>
{
const
status
=
this
.
status
===
''
?
strArray
.
attrs
.
zimbraAccountStatus
:
this
.
status
;
const
plan
=
this
.
cos
?
this
.
cos
:
strArray
.
attrs
.
zimbraCOSId
;
this
.
getAllMailboxes
(
domainId
,
window
.
manager_config
.
maxResultOnRequestZimbra
);
}
if
(
strArray
.
attrs
.
zimbraAccountStatus
===
status
&&
strArray
.
attrs
.
zimbraCOSId
===
plan
)
{
return
strArray
;
}
makeFilter
()
{
const
mailboxes
=
Object
.
assign
({},
this
.
mailboxes
);
let
cos
=
this
.
selectedPlanFilter
;
let
status
=
this
.
selectedStatusFilter
;
if
(
cos
===
''
&&
status
===
''
)
{
return
false
;
});
data
.
account
=
arrayFiltered
;
data
.
total
=
arrayFiltered
.
length
;
const
tables
=
this
.
buildTableFromData
(
data
,
[
'Todas'
,
'Bloqueadas'
]);
return
this
.
setState
({
data
:
tables
});
}
handleFilterMailbox
(
e
,
info
)
{
const
search
=
e
.
target
.
value
;
const
data
=
Object
.
assign
({},
info
);
}
const
arrayFiltered
=
data
.
account
.
filter
((
strArray
)
=>
{
if
(
this
.
status
===
''
)
{
if
(
strArray
.
name
.
match
(
search
))
{
return
strArray
;
}
}
const
arrayFiltered
=
mailboxes
.
account
.
filter
((
strArray
)
=>
{
const
CurrentStatus
=
status
||
strArray
.
attrs
.
zimbraAccountStatus
;
const
plan
=
cos
||
strArray
.
attrs
.
zimbraCOSId
;
if
(
strArray
.
name
.
match
(
search
)
&&
strArray
.
attrs
.
zimbraAccountStatus
===
this
.
status
)
{
if
(
strArray
.
attrs
.
zimbraAccountStatus
===
CurrentStatus
&&
strArray
.
attrs
.
zimbraCOSId
===
plan
)
{
return
strArray
;
}
return
false
;
});
data
.
account
=
arrayFiltered
;
data
.
total
=
arrayFiltered
.
length
;
mailboxes
.
account
=
arrayFiltered
;
mailboxes
.
total
=
arrayFiltered
.
length
;
const
tables
=
this
.
buildTableFromData
(
data
,
[
'Todas'
,
'Bloqueadas'
])
;
this
.
mailboxesFiltered
=
mailboxes
;
return
this
.
setState
({
data
:
tables
});
return
this
.
mailboxesFiltered
;
}
showMessage
(
attrs
)
{
...
...
@@ -224,7 +219,9 @@ export default class Mailboxes extends React.Component {
this
.
isRefreshing
=
false
;
const
tables
=
this
.
buildTableFromData
(
data
,
[
'Todas'
,
'Bloqueadas'
]);
const
items
=
this
.
makeFilter
()
||
this
.
mailboxes
;
const
tables
=
this
.
buildTableFromData
(
items
,
[
'Todas'
,
'Bloqueadas'
]);
if
(
tables
.
lockedAlert
)
{
GlobalActions
.
emitMessage
({
...
...
@@ -441,26 +438,33 @@ export default class Mailboxes extends React.Component {
if
(
data
.
account
)
{
const
accounts
=
data
.
account
;
const
totalAccounts
=
data
.
total
;
const
limit
=
data
.
account
.
length
;
let
limit
=
data
.
account
.
length
;
const
hasPage
=
totalAccounts
>
Constants
.
QueryOptions
.
DEFAULT_LIMIT
;
let
activeAccounts
=
[];
let
lockedAccounts
=
[];
const
tabs
=
{};
let
partialAccounts
=
accounts
;
if
(
hasPage
)
{
partialAccounts
=
accounts
.
slice
(
this
.
state
.
offset
,
(
this
.
state
.
page
*
Constants
.
QueryOptions
.
DEFAULT_LIMIT
));
limit
=
partialAccounts
.
length
;
}
for
(
let
i
=
0
;
i
<
limit
;
i
++
)
{
const
account
=
a
ccounts
[
i
].
attrs
;
const
account
=
partialA
ccounts
[
i
].
attrs
;
switch
(
account
.
zimbraAccountStatus
)
{
case
'active'
:
activeAccounts
.
push
(
this
.
buildRow
(
a
ccounts
[
i
],
'label label-success m-r'
,
'Activa'
));
activeAccounts
.
push
(
this
.
buildRow
(
partialA
ccounts
[
i
],
'label label-success m-r'
,
'Activa'
));
break
;
case
'closed'
:
activeAccounts
.
push
(
this
.
buildRow
(
a
ccounts
[
i
],
'label label-default m-r'
,
'Cerrada'
));
activeAccounts
.
push
(
this
.
buildRow
(
partialA
ccounts
[
i
],
'label label-default m-r'
,
'Cerrada'
));
break
;
case
'locked'
:
activeAccounts
.
push
(
this
.
buildRow
(
a
ccounts
[
i
],
'label label-warning m-r'
,
'Inactiva'
));
activeAccounts
.
push
(
this
.
buildRow
(
partialA
ccounts
[
i
],
'label label-warning m-r'
,
'Inactiva'
));
break
;
case
'lockedout'
:
lockedAccounts
.
push
(
this
.
buildRow
(
a
ccounts
[
i
],
'label label-locked m-r'
,
'Bloqueada'
));
activeAccounts
.
push
(
this
.
buildRow
(
a
ccounts
[
i
],
'label label-locked m-r'
,
'Bloqueada'
));
lockedAccounts
.
push
(
this
.
buildRow
(
partialA
ccounts
[
i
],
'label label-locked m-r'
,
'Bloqueada'
));
activeAccounts
.
push
(
this
.
buildRow
(
partialA
ccounts
[
i
],
'label label-locked m-r'
,
'Bloqueada'
));
break
;
}
}
...
...
@@ -513,24 +517,40 @@ export default class Mailboxes extends React.Component {
}
];
const
totalPage
=
Math
.
ceil
(
totalAccounts
/
QueryOptions
.
DEFAULT_LIMIT
);
let
activePagination
=
{
total
:
totalPage
};
if
(
activeAccounts
.
length
>
QueryOptions
.
DEFAULT_LIMIT
)
{
activeAccounts
=
activeAccounts
.
slice
(
this
.
state
.
offset
,
(
this
.
state
.
page
*
QueryOptions
.
DEFAULT_LIMIT
));
let
activePagination
=
null
;
let
lockedPagination
=
null
;
if
(
hasPage
)
{
const
totalPage
=
Math
.
ceil
(
totalAccounts
/
QueryOptions
.
DEFAULT_LIMIT
);
activePagination
=
{
total
:
totalPage
};
}
let
lockedPagination
=
null
;
if
(
lockedAccounts
.
length
>
QueryOptions
.
DEFAULT_LIMIT
)
{
lockedAccounts
=
lockedAccounts
.
slice
(
this
.
state
.
offset
,
(
this
.
state
.
page
*
QueryOptions
.
DEFAULT_LIMIT
));
lockedPagination
=
{
total
:
totalPage
};
}
const
status
=
Object
.
keys
(
this
.
optionStatus
).
map
((
item
,
i
)
=>
{
return
(
<
option
key=
{
`status-${i}`
}
value=
{
`${item}`
}
>
{
Utils
.
titleCase
(
this
.
optionStatus
[
item
])
}
</
option
>
);
});
const
plans
=
Object
.
keys
(
this
.
optionPlans
).
map
((
item
,
i
)
=>
{
if
(
item
.
toLowerCase
()
===
'default'
)
{
return
false
;
}
return
(
<
option
key=
{
`plan-${i}`
}
value=
{
`${item}`
}
>
{
Utils
.
titleCase
(
this
.
optionPlans
[
item
].
label
)
}
</
option
>
);
});
const
filter
=
(
<
div
>
...
...
@@ -538,12 +558,10 @@ export default class Mailboxes extends React.Component {
<
select
className=
'form-control status'
onChange=
{
this
.
handleChangeFilter
}
value=
{
this
.
selectedStatusFilter
}
>
<
option
value=
''
>
Todas
</
option
>
<
option
value=
'active'
>
Activa
</
option
>
<
option
value=
'locked'
>
Inactiva
</
option
>
<
option
value=
'lockedout'
>
Bloqueada
</
option
>
<
option
value=
'closed'
>
Cerradas
</
option
>
{
status
}
</
select
>
</
div
>
...
...
@@ -551,11 +569,10 @@ export default class Mailboxes extends React.Component {
<
select
className=
'form-control plans'
onChange=
{
this
.
handleChangeFilter
}
value=
{
this
.
selectedPlanFilter
}
>
<
option
value=
''
>
Todos los planes
</
option
>
<
option
value=
'basic'
>
Básico
</
option
>
<
option
value=
'professional'
>
Profesional
</
option
>
<
option
value=
'premium'
>
Premium
</
option
>
{
plans
}
</
select
>
</
div
>
</
div
>
...
...
src/components/mailbox/stats_mailbox.jsx
View file @
3061904d
...
...
@@ -107,7 +107,7 @@ export default class BlockGeneralInfoMailbox extends React.Component {
<
div
className=
'col-xs-6'
>
{
sizeEnaled
&&
(
<
p
>
<
span
className=
'center-block'
>
Espacio
Disponible
</
span
>
<
span
className=
'center-block'
>
Espacio
Total
</
span
>
<
strong
>
{
sizeEnaled
}
</
strong
>
</
p
>
)
}
...
...
src/config/config.json
View file @
3061904d
...
...
@@ -12,13 +12,16 @@
"autoincrementOnFailRequestZimbra"
:
500
,
"plans"
:
{
"basic"
:
{
"statusCos"
:
"btn-success"
"statusCos"
:
"btn-success"
,
"label"
:
"Básica"
},
"premium"
:
{
"statusCos"
:
"btn-primary2"
"statusCos"
:
"btn-primary2"
,
"label"
:
"Premium"
},
"professional"
:
{
"statusCos"
:
"btn-primary"
"statusCos"
:
"btn-primary"
,
"label"
:
"Profesional"
},
"default"
:
false
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment