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
b1bd98c2
Commit
b1bd98c2
authored
Apr 29, 2016
by
Juorder Gonzalez
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #34 from ZBoxApp/admins
add/remove domain admins (adding fails to return error)
parents
6473e3b0
5d639210
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
22 deletions
+72
-22
add_admin_modal.jsx
src/components/domain/add_admin_modal.jsx
+26
-9
domain_admin_list.jsx
src/components/domain/domain_admin_list.jsx
+35
-3
domain_details.jsx
src/components/domain/domain_details.jsx
+2
-1
mailbox.jsx
src/components/mailbox/mailbox.jsx
+3
-2
domain_store.jsx
src/stores/domain_store.jsx
+6
-4
webpack.config.js
webpack.config.js
+0
-3
No files found.
src/components/domain/add_admin_modal.jsx
View file @
b1bd98c2
...
...
@@ -7,6 +7,8 @@ import * as GlobalActions from '../../action_creators/global_actions.jsx';
import
*
as
Client
from
'../../utils/client.jsx'
;
import
*
as
Utils
from
'../../utils/utils.jsx'
;
import
Constants
from
'../../utils/constants.jsx'
;
import
StatusLabel
from
'../status_label.jsx'
;
import
{
Modal
}
from
'react-bootstrap'
;
...
...
@@ -34,18 +36,19 @@ export default class AddAdminModal extends React.Component {
GlobalActions
.
emitStartLoading
();
Client
.
getAllAccounts
(
{
query
:
`mail=*
${
query
}
*`
,
domain
:
this
.
props
.
domain
.
name
query
:
`mail=*
${
query
}
*`
},
(
data
)
=>
{
const
admins
=
DomainStore
.
getAdmins
(
this
.
props
.
domain
);
let
users
=
[];
if
(
admins
)
{
data
.
account
.
forEach
((
u
)
=>
{
if
(
!
admins
.
hasOwnProperty
(
u
.
id
))
{
users
.
push
(
u
);
}
});
if
(
data
.
account
)
{
data
.
account
.
forEach
((
u
)
=>
{
if
(
!
admins
.
hasOwnProperty
(
u
.
id
))
{
users
.
push
(
u
);
}
});
}
}
else
{
users
=
data
.
account
;
}
...
...
@@ -65,8 +68,22 @@ export default class AddAdminModal extends React.Component {
}
handleAddAdmin
(
e
,
user
)
{
e
.
preventDefault
();
console
.
log
(
user
);
//eslint-disable-line no-console
DomainStore
.
addAdmin
(
user
);
this
.
props
.
domain
.
addAdmin
(
user
.
name
,
(
error
)
=>
{
if
(
error
)
{
return
this
.
setState
({
error
:
{
message
:
error
.
extra
.
reason
,
type
:
Constants
.
MessageType
.
ERROR
}
});
}
return
DomainStore
.
addAdmin
(
user
);
}
);
}
shouldComponentUpdate
(
nextProps
,
nextState
)
{
...
...
src/components/domain/domain_admin_list.jsx
View file @
b1bd98c2
...
...
@@ -5,12 +5,15 @@ import React from 'react';
import
DomainStore
from
'../../stores/domain_store.jsx'
;
import
MessageBar
from
'../message_bar.jsx'
;
import
Panel
from
'../panel.jsx'
;
import
ToggleModalButton
from
'../toggle_modal_button.jsx'
;
import
AddAdminModal
from
'./add_admin_modal.jsx'
;
import
*
as
Utils
from
'../../utils/utils.jsx'
;
import
Constants
from
'../../utils/constants.jsx'
;
export
default
class
DomainAdminList
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
...
...
@@ -29,7 +32,7 @@ export default class DomainAdminList extends React.Component {
getAdmins
()
{
const
domain
=
this
.
props
.
domain
;
domain
.
getAdmins
((
err
,
data
)
=>
{
const
admins
=
data
.
account
;
const
admins
=
data
.
account
||
[]
;
DomainStore
.
setAdmins
(
domain
,
admins
);
this
.
setState
({
admins
});
});
...
...
@@ -38,7 +41,21 @@ export default class DomainAdminList extends React.Component {
e
.
preventDefault
();
if
(
confirm
(
`¿Seguro quieres eliminar a
${
admin
.
name
}
como administrador del dominio?`
))
{
//eslint-disable-line no-alert
// previo a esto hay que remover el usuario como admin del dominio
DomainStore
.
removeAdmin
(
admin
.
id
);
this
.
props
.
domain
.
removeAdmin
(
admin
.
name
,
(
error
)
=>
{
if
(
error
)
{
return
this
.
setState
({
error
:
{
message
:
error
.
extra
.
reason
,
type
:
Constants
.
MessageType
.
ERROR
}
});
}
return
DomainStore
.
removeAdmin
(
admin
.
id
);
}
);
}
}
onAdminsChange
()
{
...
...
@@ -64,6 +81,20 @@ export default class DomainAdminList extends React.Component {
return
<
div
/>;
}
let
messageBar
;
if
(
this
.
state
.
error
)
{
const
error
=
this
.
state
.
error
;
messageBar
=
(
<
MessageBar
message=
{
error
.
message
}
type=
{
error
.
type
}
canClose=
{
true
}
autoclose=
{
true
}
autocloseInSecs=
{
5
}
/>
);
}
const
domain
=
this
.
props
.
domain
;
const
adminRows
=
this
.
state
.
admins
.
map
((
a
)
=>
{
return
(
...
...
@@ -75,7 +106,7 @@ export default class DomainAdminList extends React.Component {
{
a
.
name
}
</
td
>
<
td
className=
'user-name text-center'
>
{
a
.
attrs
.
given
Name
}
{
a
.
attrs
.
display
Name
}
</
td
>
<
td
className=
'user-type text-center'
>
</
td
>
...
...
@@ -156,6 +187,7 @@ export default class DomainAdminList extends React.Component {
<
Panel
hasHeader=
{
false
}
children=
{
adminContent
}
error=
{
messageBar
}
/>
);
}
...
...
src/components/domain/domain_details.jsx
View file @
b1bd98c2
...
...
@@ -30,7 +30,7 @@ export default class DomainDetails extends React.Component {
getDomain
()
{
const
domain
=
DomainStore
.
getCurrent
();
if
(
domain
)
{
if
(
domain
&&
domain
.
id
===
this
.
props
.
params
.
id
)
{
GlobalActions
.
emitEndLoading
();
this
.
setState
({
domain
...
...
@@ -39,6 +39,7 @@ export default class DomainDetails extends React.Component {
Client
.
getDomain
(
this
.
props
.
params
.
id
,
(
data
)
=>
{
DomainStore
.
setCurrent
(
data
);
this
.
setState
({
domain
:
data
});
...
...
src/components/mailbox/mailbox.jsx
View file @
b1bd98c2
...
...
@@ -171,8 +171,9 @@ export default class Mailboxes extends React.Component {
const
arrLocked
=
[];
if
(
this
.
state
.
data
)
{
total
=
this
.
state
.
data
.
account
.
length
;
tableResults
=
this
.
state
.
data
.
account
.
map
((
mail
)
=>
{
const
accounts
=
this
.
state
.
data
.
account
||
[];
total
=
accounts
.
length
;
tableResults
=
accounts
.
map
((
mail
)
=>
{
let
attrs
=
mail
.
attrs
;
let
statusClass
=
''
;
let
status
=
attrs
.
zimbraAccountStatus
;
...
...
src/stores/domain_store.jsx
View file @
b1bd98c2
...
...
@@ -72,11 +72,13 @@ class DomainStoreClass extends EventEmitter {
const
admins
=
{};
adminsArray
.
forEach
((
a
)
=>
{
admins
[
a
.
id
]
=
a
;
});
if
(
adminsArray
)
{
adminsArray
.
forEach
((
a
)
=>
{
admins
[
a
.
id
]
=
a
;
});
this
.
current
.
admins
=
admins
;
this
.
current
.
admins
=
admins
;
}
}
addAdmin
(
user
)
{
...
...
webpack.config.js
View file @
b1bd98c2
...
...
@@ -68,9 +68,6 @@ var config = {
}
]
},
sassLoader
:
{
includePaths
:
[
'node_modules/compass-mixins/lib'
]
},
plugins
:
[
new
CopyWebpackPlugin
([
{
from
:
'src/config'
,
to
:
'config'
}
...
...
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