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
6f62ef3b
Commit
6f62ef3b
authored
May 31, 2016
by
Juorder Antonio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable add admin buttons and add allowers for domain admins, add advances for store functionality
parent
0456f57e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
140 additions
and
109 deletions
+140
-109
path.json
path.json
+1
-1
distribution_lists.jsx
src/components/distribution/distribution_lists.jsx
+3
-1
domain_admin_list.jsx
src/components/domain/domain_admin_list.jsx
+3
-1
form_resp_vacaciones_mailbox.jsx
src/components/mailbox/form_resp_vacaciones_mailbox.jsx
+9
-3
mailbox.jsx
src/components/mailbox/mailbox.jsx
+39
-38
mailbox_details.jsx
src/components/mailbox/mailbox_details.jsx
+41
-60
mailbox_store.jsx
src/stores/mailbox_store.jsx
+42
-4
constants.jsx
src/utils/constants.jsx
+2
-1
No files found.
path.json
View file @
6f62ef3b
module.exports
=
{
"main"
:{
"js"
:
"/280485bundle.js"
}}
\ No newline at end of file
module.exports
=
{
"main"
:{
"js"
:
"/220021bundle.js"
}}
\ No newline at end of file
src/components/distribution/distribution_lists.jsx
View file @
6f62ef3b
...
...
@@ -581,7 +581,9 @@ export default class DistributionLists extends React.Component {
permitidos
:
allows
};
if
(
!
this
.
isGlobalAdmin
)
{
const
not
=
false
;
//if (!this.isGlobalAdmin) {
if
(
not
)
{
tabNamesArray
=
[
'Miembros'
];
tabs
=
{
miembros
:
members
...
...
src/components/domain/domain_admin_list.jsx
View file @
6f62ef3b
...
...
@@ -193,7 +193,9 @@ export default class DomainAdminList extends React.Component {
);
});
if
(
this
.
isGlobalAdmin
)
{
//if (this.isGlobalAdmin) {
const
go
=
true
;
if
(
go
)
{
btnAddNewAdmin
=
(
<
ToggleModalButton
role=
'button'
...
...
src/components/mailbox/form_resp_vacaciones_mailbox.jsx
View file @
6f62ef3b
...
...
@@ -7,6 +7,8 @@ import Constants from '../../utils/constants.jsx';
import
*
as
GlobalActions
from
'../../action_creators/global_actions.jsx'
;
import
MailboxStore
from
'../../stores/mailbox_store.jsx'
;
const
messageType
=
Constants
.
MessageType
;
export
default
class
FormVacacionesMailbox
extends
React
.
Component
{
...
...
@@ -18,6 +20,8 @@ export default class FormVacacionesMailbox extends React.Component {
this
.
dateStart
=
null
;
this
.
dateEnd
=
null
;
this
.
initialDate
=
Utils
.
setInitialDate
();
this
.
domain_id
=
this
.
props
.
domainId
||
null
;
}
handleChangeDate
(
x
,
from
)
{
...
...
@@ -62,7 +66,8 @@ export default class FormVacacionesMailbox extends React.Component {
attrs
.
zimbraPrefOutOfOfficeReplyEnabled
=
isEnabled
.
toString
().
toUpperCase
();
}
Client
.
modifyAccount
(
data
.
id
,
attrs
,
()
=>
{
Client
.
modifyAccount
(
data
.
id
,
attrs
,
(
mailbox
)
=>
{
MailboxStore
.
updateMailbox
(
data
.
id
,
mailbox
,
this
.
domain_id
);
GlobalActions
.
emitMessage
({
error
:
'Se ha modificado su respuesta de vacaciones con éxito.'
,
typeError
:
messageType
.
SUCCESS
...
...
@@ -120,7 +125,7 @@ export default class FormVacacionesMailbox extends React.Component {
onSubmit=
{
(
e
)
=>
{
this
.
handleSubmit
(
e
);
}
}
id=
'
createAccount
'
id=
'
resp-vacations
'
>
<
div
className=
'form-group string'
>
<
label
className=
'string required col-sm-3 control-label'
>
...
...
@@ -238,5 +243,6 @@ FormVacacionesMailbox.propTypes = {
data
:
React
.
PropTypes
.
oneOfType
([
React
.
PropTypes
.
object
,
React
.
PropTypes
.
string
])
]),
domainId
:
React
.
PropTypes
.
string
};
src/components/mailbox/mailbox.jsx
View file @
6f62ef3b
...
...
@@ -30,20 +30,23 @@ import ZimbraStore from '../../stores/zimbra_store.jsx';
const
QueryOptions
=
Constants
.
QueryOptions
;
const
messageType
=
Constants
.
MessageType
;
const
codes
=
Constants
.
ZimbraCodes
;
export
default
class
Mailboxes
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
isMounted
=
true
;
this
.
isStoreEnabled
=
window
.
manager_config
.
enableStores
;
this
.
archivingConfig
=
window
.
manager_config
.
plans
.
archiving
;
this
.
domainId
=
this
.
props
.
params
.
domain_id
||
null
;
this
.
regexp
=
new
RegExp
(
this
.
archivingConfig
.
regexp
,
'gi'
);
this
.
showMessage
=
this
.
showMessage
.
bind
(
this
);
this
.
refreshAllAccounts
=
this
.
refreshAllAccounts
.
bind
(
this
);
this
.
handleChangeFilter
=
this
.
handleChangeFilter
.
bind
(
this
);
this
.
handleTabChanged
=
this
.
handleTabChanged
.
bind
(
this
);
this
.
makeFilter
=
this
.
makeFilter
.
bind
(
this
);
this
.
c
=
0
;
const
page
=
parseInt
(
this
.
props
.
location
.
query
.
page
,
10
)
||
1
;
this
.
mailboxes
=
null
;
...
...
@@ -57,7 +60,6 @@ export default class Mailboxes extends React.Component {
this
.
isRefreshing
=
true
;
this
.
optionStatus
=
Constants
.
status
;
this
.
optionPlans
=
window
.
manager_config
.
plans
;
this
.
domainId
=
null
;
this
.
domainName
=
null
;
this
.
state
=
{
...
...
@@ -86,8 +88,6 @@ export default class Mailboxes extends React.Component {
this
.
selectedStatusFilter
=
selected
.
length
>
0
?
selected
:
''
;
}
/*const domainId = this.domainId;
this.getAllMailboxes(domainId, window.manager_config.maxResultOnRequestZimbra);*/
browserHistory
.
push
(
this
.
props
.
location
.
pathname
);
}
...
...
@@ -141,10 +141,9 @@ export default class Mailboxes extends React.Component {
componentWillReceiveProps
(
newProps
)
{
const
condition
=
this
.
props
.
location
.
query
.
page
!==
newProps
.
location
.
query
.
page
;
let
domainId
=
null
;
const
samePath
=
this
.
props
.
location
.
pathname
===
newProps
.
location
.
pathname
;
//this.domainName = null;
if
(
condition
)
{
if
(
condition
&&
samePath
)
{
const
page
=
parseInt
(
newProps
.
location
.
query
.
page
,
10
)
||
1
;
GlobalActions
.
emitStartLoading
();
...
...
@@ -155,20 +154,15 @@ export default class Mailboxes extends React.Component {
loading
:
true
};
domainId
=
this
.
domainId
;
if
(
this
.
props
.
params
.
domain_id
)
{
domainId
=
this
.
props
.
params
.
domain_id
;
this
.
domainId
=
domainId
;
}
this
.
domainId
=
this
.
props
.
params
.
domain_id
||
newProps
.
params
.
domain_id
||
null
;
this
.
getAllMailboxes
(
domainId
,
window
.
manager_config
.
maxResultOnRequestZimbra
);
this
.
getAllMailboxes
(
this
.
domainId
,
window
.
manager_config
.
maxResultOnRequestZimbra
);
}
else
{
GlobalActions
.
emitStartLoading
();
domainId
=
newProps
.
params
.
domain_id
;
this
.
domainId
=
newProps
.
params
.
domain_id
;
this
.
getAllMailboxes
(
domainId
,
window
.
manager_config
.
maxResultOnRequestZimbra
);
this
.
getAllMailboxes
(
this
.
domainId
,
window
.
manager_config
.
maxResultOnRequestZimbra
);
}
}
...
...
@@ -198,16 +192,16 @@ export default class Mailboxes extends React.Component {
getAccounts
(
domainName
,
maxResult
)
{
//const promises = [];
const
attrneeded
=
Utils
.
getAttrsBySectionFromConfig
(
'mailboxes'
);
const
attrs
=
{
maxResults
:
maxResult
,
limit
:
5000
maxResults
:
maxResult
};
this
.
setState
(
{
loading
:
true
});
const
attrneeded
=
Utils
.
getAttrsBySectionFromConfig
(
'mailboxes'
);
if
(
!
this
.
state
.
loading
)
{
this
.
setState
({
loading
:
true
});
}
if
(
attrneeded
)
{
attrs
.
attrs
=
attrneeded
;
...
...
@@ -219,21 +213,26 @@ export default class Mailboxes extends React.Component {
}
new
Promise
((
resolve
,
reject
)
=>
{
// if domain name exists, just search all mailbox from this domain
if
(
domainName
)
{
const
hasMailboxForDomain
=
this
.
isStoreEnabled
?
MailboxStore
.
getMailboxByDomainId
(
this
.
domainId
)
:
null
;
// if mailbox by domain exists return it
if
(
hasMailboxForDomain
)
{
return
resolve
(
hasMailboxForDomain
);
}
// get all mailboxes from domain
return
Client
.
getAllAccounts
(
attrs
,
(
success
)
=>
{
const
data
=
Utils
.
extractLockOuts
(
success
);
if
(
this
.
isStoreEnabled
)
{
MailboxStore
.
setMailboxesByDomain
(
this
.
domainId
,
data
);
}
else
{
this
.
setState
({
accounts
:
data
});
if
(
success
.
total
)
{
const
data
=
Utils
.
extractLockOuts
(
success
);
if
(
this
.
isStoreEnabled
)
{
MailboxStore
.
setMailboxesByDomain
(
this
.
domainId
,
data
);
}
else
{
this
.
setState
({
accounts
:
data
});
}
}
return
resolve
(
success
);
...
...
@@ -242,12 +241,17 @@ export default class Mailboxes extends React.Component {
});
}
// if all mailbox exists just return it
const
hasMailboxes
=
this
.
isStoreEnabled
?
MailboxStore
.
hasMailboxes
()
:
null
;
if
(
hasMailboxes
)
{
return
resolve
(
MailboxStore
.
getMailboxes
());
}
// if all mailboxes doesn't exist just search them.
return
Client
.
getAllAccounts
(
attrs
,
(
success
)
=>
{
const
data
=
Utils
.
extractLockOuts
(
success
);
if
(
this
.
isStoreEnabled
)
{
MailboxStore
.
setMailboxes
(
data
);
}
...
...
@@ -264,7 +268,6 @@ export default class Mailboxes extends React.Component {
const
items
=
this
.
makeFilter
()
||
this
.
mailboxes
;
//const tables = this.buildTableFromData(items, ['Todas', 'Bloqueadas']);
const
tables
=
this
.
buildTableFromData
(
items
);
if
(
items
.
lockout
)
{
...
...
@@ -287,7 +290,7 @@ export default class Mailboxes extends React.Component {
loading
:
false
});
}).
catch
((
error
)
=>
{
if
(
error
.
code
===
'account.TOO_MANY_SEARCH_RESULTS'
)
{
if
(
error
.
code
===
codes
.
TOO_MANY_SEARCH_RESULTS
)
{
this
.
isRefreshing
=
true
;
const
newMaxResult
=
(
parseInt
(
maxResult
,
10
)
+
window
.
manager_config
.
autoincrementOnFailRequestZimbra
);
window
.
manager_config
.
maxResultOnRequestZimbra
=
newMaxResult
;
...
...
@@ -332,18 +335,14 @@ export default class Mailboxes extends React.Component {
data
:
tables
});
}
const
domainId
=
this
.
props
.
params
.
domain_id
;
this
.
domainId
=
domainId
;
return
this
.
getAllMailboxes
(
domainId
);
return
this
.
getAllMailboxes
(
this
.
domainId
);
}
componentDidMount
()
{
$
(
'#sidebar-mailboxes'
).
addClass
(
'active'
);
EventStore
.
addMessageListener
(
this
.
showMessage
);
MailboxStore
.
addListenerAddMassive
(
this
.
refreshAllAccounts
);
const
domainId
=
this
.
props
.
params
.
domain_id
;
this
.
domainId
=
domainId
;
this
.
getAllMailboxes
(
domainId
);
this
.
getAllMailboxes
(
this
.
domainId
);
}
componentWillUnmount
()
{
...
...
@@ -351,6 +350,8 @@ export default class Mailboxes extends React.Component {
MailboxStore
.
removeListenerAddMassive
(
this
.
showMessage
);
$
(
'#sidebar-mailboxes'
).
removeClass
(
'active'
);
this
.
domainName
=
null
;
this
.
isMounted
=
false
;
this
.
domainId
=
null
;
}
buildRow
(
row
,
classes
,
status
)
{
...
...
src/components/mailbox/mailbox_details.jsx
View file @
6f62ef3b
...
...
@@ -38,6 +38,12 @@ export default class MailboxDetails extends React.Component {
this
.
onRemoveAlias
=
this
.
onRemoveAlias
.
bind
(
this
);
this
.
onCancelAlias
=
this
.
onCancelAlias
.
bind
(
this
);
this
.
domain_id
=
this
.
props
.
params
.
domain_id
||
null
;
this
.
mailboxId
=
this
.
props
.
params
.
id
||
null
;
this
.
editUrlFromParams
=
this
.
domain_id
?
`/domains/
${
this
.
domain_id
}
/mailboxes/
${
this
.
mailboxId
}
`
:
`/mailboxes/
${
this
.
mailboxId
}
`
;
this
.
editUrlFromParams
+=
'/edit'
;
this
.
state
=
{};
}
...
...
@@ -85,11 +91,24 @@ export default class MailboxDetails extends React.Component {
}
getMailbox
(
id
)
{
const
hasMailboxes
=
this
.
isStoreEnabled
?
MailboxStore
.
hasMailboxes
()
:
null
;
if
(
hasMailboxes
)
{
const
account
=
MailboxStore
.
getMailboxById
(
id
);
MailboxStore
.
setCurrent
(
account
);
let
items
=
account
.
attrs
.
zimbraMailAlias
;
return
new
Promise
((
resolve
,
reject
)
=>
{
// get mailbox from store if it exists
const
hasMailboxes
=
this
.
isStoreEnabled
?
MailboxStore
.
hasMailboxes
()
:
null
;
if
(
hasMailboxes
)
{
const
account
=
MailboxStore
.
getMailboxById
(
id
)
||
MailboxStore
.
getMailboxByIdInDomain
(
id
,
this
.
domain_id
);
return
resolve
(
account
);
}
//if is not into store just search it.
return
Client
.
getAccount
(
id
,
(
data
)
=>
{
return
resolve
(
data
);
},
(
error
)
=>
{
return
reject
(
error
);
});
}).
then
((
mailbox
)
=>
{
MailboxStore
.
setCurrent
(
mailbox
);
let
items
=
mailbox
.
attrs
.
zimbraMailAlias
||
null
;
if
(
items
)
{
if
(
!
Array
.
isArray
(
items
))
{
...
...
@@ -97,75 +116,36 @@ export default class MailboxDetails extends React.Component {
}
}
account
.
viewMailPath
(
global
.
window
.
manager_config
.
webmailLifetime
,
(
error
,
res
)
=>
{
mailbox
.
viewMailPath
(
global
.
window
.
manager_config
.
webmailLifetime
,
(
error
,
res
)
=>
{
if
(
res
)
{
return
this
.
setState
({
data
:
account
,
data
:
mailbox
,
alias
:
items
,
webmail
:
`
${
global
.
window
.
manager_config
.
webMailUrl
}${
res
}
`
});
}
return
this
.
setState
({
data
:
account
,
data
:
mailbox
,
alias
:
items
,
webmail
:
false
});
});
}).
catch
((
error
)
=>
{
GlobalActions
.
emitMessage
({
error
:
error
.
message
,
type
:
error
.
typeError
});
}).
finally
(()
=>
{
GlobalActions
.
emitEndLoading
();
Utils
.
toggleStatusButtons
(
'.action-info-btns'
,
false
);
}
else
{
return
new
Promise
((
resolve
,
reject
)
=>
{
Client
.
getAccount
(
id
,
(
data
)
=>
{
return
resolve
(
data
);
},
(
error
)
=>
{
return
reject
(
error
);
});
}).
then
((
result
)
=>
{
MailboxStore
.
setCurrent
(
result
);
let
items
=
result
.
attrs
.
zimbraMailAlias
;
if
(
items
)
{
if
(
!
Array
.
isArray
(
items
))
{
items
=
[
items
];
}
}
result
.
viewMailPath
(
global
.
window
.
manager_config
.
webmailLifetime
,
(
error
,
res
)
=>
{
if
(
res
)
{
return
this
.
setState
({
data
:
result
,
alias
:
items
,
webmail
:
`
${
global
.
window
.
manager_config
.
webMailUrl
}${
res
}
`
});
}
return
this
.
setState
({
data
:
result
,
alias
:
items
,
webmail
:
false
});
});
}).
catch
((
error
)
=>
{
GlobalActions
.
emitMessage
({
error
:
error
.
message
,
type
:
error
.
typeError
});
}).
finally
(()
=>
{
GlobalActions
.
emitEndLoading
();
Utils
.
toggleStatusButtons
(
'.action-info-btns'
,
false
);
});
}
return
true
;
});
}
componentDidMount
()
{
EventStore
.
addMessageListener
(
this
.
showMessage
);
$
(
'#sidebar-mailboxes'
).
addClass
(
'active'
);
this
.
getMailbox
(
this
.
props
.
params
.
i
d
);
this
.
getMailbox
(
this
.
mailboxI
d
);
}
componentWillUnmount
()
{
...
...
@@ -306,7 +286,7 @@ export default class MailboxDetails extends React.Component {
}
if
(
this
.
state
.
data
)
{
const
webmail
=
this
.
state
.
webmail
?
this
.
state
.
webmail
:
null
;
const
webmail
=
this
.
state
.
webmail
||
null
;
generalData
=
(
<
BlockGeneralInfoMailbox
data=
{
this
.
state
.
data
}
...
...
@@ -321,14 +301,12 @@ export default class MailboxDetails extends React.Component {
/>
);
const
editUrlFromParams
=
this
.
props
.
params
.
domain_id
?
`/domains/
${
this
.
props
.
params
.
domain_id
}
/mailboxes/`
:
'/mailboxes/'
;
btnsGeneralInfo
=
[
{
props
:
{
className
:
'btn btn-xs btn-default action-info-btns'
,
onClick
:
(
e
)
=>
{
this
.
handleEdit
(
e
,
`
${
editUrlFromParams
}${
this
.
state
.
data
.
id
}
/edit`
,
this
.
props
.
location
);
this
.
handleEdit
(
e
,
this
.
editUrlFromParams
,
this
.
props
.
location
);
}
},
label
:
'Editar'
...
...
@@ -375,7 +353,10 @@ export default class MailboxDetails extends React.Component {
}
const
formAutoResp
=
(
<
FormVacacionesMailbox
data=
{
this
.
state
.
data
}
/>
<
FormVacacionesMailbox
data=
{
this
.
state
.
data
}
domainId=
{
this
.
domain_id
}
/>
);
const
formAlias
=
(
...
...
src/stores/mailbox_store.jsx
View file @
6f62ef3b
...
...
@@ -12,7 +12,7 @@ class MailboxStoreClass extends EventEmitter {
constructor
()
{
super
();
this
.
current
=
null
;
this
.
mailboxesByDomain
=
null
;
this
.
mailboxesByDomain
=
{}
;
}
resetThisStore
()
{
...
...
@@ -23,11 +23,12 @@ class MailboxStoreClass extends EventEmitter {
setMailboxesByDomain
(
id
,
mailboxes
)
{
if
(
mailboxes
)
{
this
.
mailboxesByDomain
=
{};
this
.
mailboxesByDomain
[
id
]
=
mailboxes
;
//console.log('setMailboxesByDomain', this.mailboxesByDomain);
return
true
;
}
return
tru
e
;
return
fals
e
;
}
getMailboxByDomainId
(
id
)
{
...
...
@@ -85,7 +86,38 @@ class MailboxStoreClass extends EventEmitter {
}
setCurrent
(
account
)
{
this
.
current
=
account
;
if
(
account
)
{
this
.
current
=
account
;
//console.log('setCurrent', this.current);
return
true
;
}
return
false
;
}
updateMailbox
(
mailboxId
,
newMailbox
,
domainId
)
{
if
(
mailboxesArray
)
{
const
accounts
=
mailboxesArray
.
account
;
const
index
=
accounts
.
findIndex
((
mailbox
)
=>
{
return
mailbox
.
id
===
mailboxId
;
});
if
(
index
>
-
1
)
{
accounts
[
index
]
=
newMailbox
;
}
}
if
(
domainId
&&
this
.
mailboxesByDomain
[
domainId
])
{
const
accountsFromDomain
=
this
.
mailboxesByDomain
.
account
;
const
indexOfMailbox
=
accountsFromDomain
.
findIndex
((
mailbox
)
=>
{
return
mailbox
.
id
===
mailboxId
;
});
if
(
indexOfMailbox
>
-
1
)
{
accountsFromDomain
[
indexOfMailbox
]
=
newMailbox
;
}
}
return
true
;
}
getCurrent
()
{
...
...
@@ -108,9 +140,15 @@ class MailboxStoreClass extends EventEmitter {
return
mailboxesArray
;
}
getMailboxByIdInDomain
()
{
return
false
;
}
setMailboxes
(
mailboxes
)
{
if
(
mailboxes
)
{
mailboxesArray
=
mailboxes
;
//console.log('setMailboxes', mailboxesArray);
return
true
;
}
return
false
;
...
...
src/utils/constants.jsx
View file @
6f62ef3b
...
...
@@ -46,7 +46,8 @@ export default {
ZimbraCodes
:
{
AUTH_EXPIRED
:
'service.AUTH_EXPIRED'
,
AUTH__REQUIRED
:
'service.AUTH_REQUIRED'
AUTH__REQUIRED
:
'service.AUTH_REQUIRED'
,
TOO_MANY_SEARCH_RESULTS
:
'account.TOO_MANY_SEARCH_RESULTS'
},
ZimbraSearchs
:
{
...
...
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