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
2b316059
Commit
2b316059
authored
Apr 11, 2016
by
Elias Nahum
Committed by
Juorder Antonio
May 24, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add store functionality to companies, and show or hide if user is global admin or no.
parent
1cb0e59a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
179 additions
and
79 deletions
+179
-79
path.json
path.json
+1
-1
companies.jsx
src/components/companies/companies.jsx
+55
-15
create_domain.jsx
src/components/domain/create_domain.jsx
+86
-60
search.jsx
src/components/search/search.jsx
+7
-3
_search.scss
src/sass/routes/_search.scss
+11
-0
domain_store.jsx
src/stores/domain_store.jsx
+19
-0
No files found.
path.json
View file @
2b316059
module.exports
=
{
"main"
:{
"js"
:
"/263980bundle.js"
}}
module.exports
=
{
"main"
:{
"js"
:
"/699779bundle.js"
}}
\ No newline at end of file
\ No newline at end of file
src/components/companies/companies.jsx
View file @
2b316059
...
@@ -11,6 +11,8 @@ import Panel from '../panel.jsx';
...
@@ -11,6 +11,8 @@ import Panel from '../panel.jsx';
import
CompaniesStore
from
'../../stores/company_store.jsx'
;
import
CompaniesStore
from
'../../stores/company_store.jsx'
;
import
ZimbraStore
from
'../../stores/zimbra_store.jsx'
;
import
ZimbraStore
from
'../../stores/zimbra_store.jsx'
;
import
UserStore
from
'../../stores/user_store.jsx'
;
import
DomainStore
from
'../../stores/domain_store.jsx'
;
import
*
as
Client
from
'../../utils/client.jsx'
;
import
*
as
Client
from
'../../utils/client.jsx'
;
import
*
as
Utils
from
'../../utils/utils.jsx'
;
import
*
as
Utils
from
'../../utils/utils.jsx'
;
...
@@ -30,6 +32,8 @@ export default class Companies extends React.Component {
...
@@ -30,6 +32,8 @@ export default class Companies extends React.Component {
this
.
getDomains
=
this
.
getDomains
.
bind
(
this
);
this
.
getDomains
=
this
.
getDomains
.
bind
(
this
);
this
.
getPlans
=
this
.
getPlans
.
bind
(
this
);
this
.
getPlans
=
this
.
getPlans
.
bind
(
this
);
this
.
gotoCompany
=
this
.
gotoCompany
.
bind
(
this
);
this
.
gotoCompany
=
this
.
gotoCompany
.
bind
(
this
);
this
.
isGlobalAdmin
=
UserStore
.
isGlobalAdmin
();
}
}
gotoCompany
(
e
,
company
)
{
gotoCompany
(
e
,
company
)
{
...
@@ -47,29 +51,65 @@ export default class Companies extends React.Component {
...
@@ -47,29 +51,65 @@ export default class Companies extends React.Component {
return
GlobalActions
.
emitEndLoading
();
return
GlobalActions
.
emitEndLoading
();
}
}
return
Client
.
getAllCompanies
().
then
((
data
)
=>
{
const
mydomain
=
UserStore
.
getCurrentUser
().
name
.
split
(
'@'
).
pop
();
const
domains
=
data
.
map
((
company
)
=>
{
return
self
.
getDomains
(
company
);
});
return
Promise
.
all
(
domains
).
then
((
comps
)
=>
{
if
(
this
.
isGlobalAdmin
)
{
CompaniesStore
.
setCompanies
(
comps
);
return
Client
.
getAllCompanies
().
then
((
data
)
=>
{
const
domains
=
data
.
map
((
company
)
=>
{
return
self
.
getDomains
(
company
);
});
self
.
setState
({
return
Promise
.
all
(
domains
).
then
((
comps
)
=>
{
companies
:
comps
CompaniesStore
.
setCompanies
(
comps
);
self
.
setState
({
companies
:
comps
});
}).
catch
((
error
)
=>
{
self
.
setState
({
error
:
{
message
:
error
,
type
:
messageTypes
.
ERROR
}});
});
});
}).
}).
catch
((
error
)
=>
{
catch
((
error
)
=>
{
self
.
setState
({
error
});
}).
finally
(()
=>
{
GlobalActions
.
emitEndLoading
();
});
}
if
(
DomainStore
.
getDomains
())
{
const
domain
=
DomainStore
.
getDomainByName
(
mydomain
);
Client
.
getCompany
(
domain
.
attrs
.
businessCategory
,
(
company
)
=>
{
CompaniesStore
.
setCompanies
(
company
);
},
(
error
)
=>
{
self
.
setState
({
error
:
{
self
.
setState
({
error
:
{
message
:
error
,
message
:
error
,
type
:
messageTypes
.
ERROR
type
:
messageTypes
.
ERROR
}});
}});
});
});
}).
catch
((
error
)
=>
{
}
else
{
self
.
setState
({
error
});
Client
.
getDomain
(
mydomain
,
(
dom
)
=>
{
}).
finally
(()
=>
{
Client
.
getCompany
(
dom
.
attrs
.
businessCategory
,
(
company
)
=>
{
GlobalActions
.
emitEndLoading
();
self
.
setState
({
});
companies
:
company
});
},
(
error
)
=>
{
self
.
setState
({
error
:
{
message
:
error
,
type
:
messageTypes
.
ERROR
}});
});
},
(
error
)
=>
{
self
.
setState
({
error
,
type
:
messageTypes
.
ERROR
});
});
}
return
GlobalActions
.
emitEndLoading
();
}
}
getDomains
(
company
)
{
getDomains
(
company
)
{
...
...
src/components/domain/create_domain.jsx
View file @
2b316059
...
@@ -7,6 +7,8 @@ import DNSZoneForm from './multiform/dns_form.jsx';
...
@@ -7,6 +7,8 @@ import DNSZoneForm from './multiform/dns_form.jsx';
import
DomainStore
from
'../../stores/domain_store.jsx'
;
import
DomainStore
from
'../../stores/domain_store.jsx'
;
import
EventStore
from
'../../stores/event_store.jsx'
;
import
EventStore
from
'../../stores/event_store.jsx'
;
import
MessageBar
from
'../message_bar.jsx'
;
import
MessageBar
from
'../message_bar.jsx'
;
import
UserStore
from
'../../stores/user_store.jsx'
;
import
*
as
GlobalActions
from
'../../action_creators/global_actions.jsx'
;
export
default
class
CreateDomain
extends
React
.
Component
{
export
default
class
CreateDomain
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -15,6 +17,7 @@ export default class CreateDomain extends React.Component {
...
@@ -15,6 +17,7 @@ export default class CreateDomain extends React.Component {
this
.
getNextStep
=
this
.
getNextStep
.
bind
(
this
);
this
.
getNextStep
=
this
.
getNextStep
.
bind
(
this
);
this
.
showMessage
=
this
.
showMessage
.
bind
(
this
);
this
.
showMessage
=
this
.
showMessage
.
bind
(
this
);
this
.
isGlobalAdmin
=
UserStore
.
isGlobalAdmin
();
this
.
multiform
=
window
.
manager_config
.
multiFormDomain
;
this
.
multiform
=
window
.
manager_config
.
multiFormDomain
;
let
total
=
1
;
let
total
=
1
;
...
@@ -30,7 +33,8 @@ export default class CreateDomain extends React.Component {
...
@@ -30,7 +33,8 @@ export default class CreateDomain extends React.Component {
this
.
state
=
{
this
.
state
=
{
step
:
1
,
step
:
1
,
total
total
,
isGlobalAdmin
:
this
.
isGlobalAdmin
};
};
}
}
...
@@ -56,6 +60,7 @@ export default class CreateDomain extends React.Component {
...
@@ -56,6 +60,7 @@ export default class CreateDomain extends React.Component {
componentDidMount
()
{
componentDidMount
()
{
DomainStore
.
addNextStepListener
(
this
.
getNextStep
);
DomainStore
.
addNextStepListener
(
this
.
getNextStep
);
EventStore
.
addMessageListener
(
this
.
showMessage
);
EventStore
.
addMessageListener
(
this
.
showMessage
);
GlobalActions
.
emitEndLoading
();
}
}
componentWillUnmount
()
{
componentWillUnmount
()
{
...
@@ -73,76 +78,97 @@ export default class CreateDomain extends React.Component {
...
@@ -73,76 +78,97 @@ export default class CreateDomain extends React.Component {
width
:
`
${
width
}
%`
width
:
`
${
width
}
%`
};
};
let
error
=
null
;
let
error
=
null
;
let
actions
=
null
;
if
(
this
.
state
.
isGlobalAdmin
)
{
if
(
this
.
state
.
error
)
{
error
=
(
<
MessageBar
message=
{
this
.
state
.
error
}
type=
{
this
.
state
.
type
}
autoclose=
{
true
}
/>
);
}
if
(
this
.
state
.
error
)
{
let
step
=
this
.
state
.
step
;
error
=
(
<
MessageBar
message=
{
this
.
state
.
error
}
type=
{
this
.
state
.
type
}
autoclose=
{
true
}
/>
);
}
let
step
=
this
.
state
.
step
;
if
(
!
this
.
multiform
.
hasMailCleaner
&&
step
>
1
)
{
if
(
!
this
.
multiform
.
hasMailCleaner
&&
step
>
1
)
{
++
step
;
++
step
;
}
}
switch
(
step
)
{
switch
(
step
)
{
case
1
:
case
1
:
form
=
(
form
=
(
<
CreateDomainForm
<
CreateDomainForm
params=
{
this
.
props
.
params
}
params=
{
this
.
props
.
params
}
state=
{
this
.
state
}
state=
{
this
.
state
}
/>
/>
);
);
titleForm
=
'Creación de Dominio'
;
titleForm
=
'Creación de Dominio'
;
break
;
break
;
case
2
:
case
2
:
form
=
<
MailCleanerForm
state=
{
this
.
state
}
/>;
form
=
<
MailCleanerForm
state=
{
this
.
state
}
/>;
titleForm
=
'Asignación del Dominio al MailCleaner'
;
titleForm
=
'Asignación del Dominio al MailCleaner'
;
break
;
break
;
case
3
:
case
3
:
form
=
<
DNSZoneForm
state=
{
this
.
state
}
/>;
form
=
<
DNSZoneForm
state=
{
this
.
state
}
/>;
titleForm
=
'Asignación de la Zona DNS'
;
titleForm
=
'Asignación de la Zona DNS'
;
break
;
break
;
}
}
//onClick: (e) => Utils.handleLink(e, backUrl)
//onClick: (e) => Utils.handleLink(e, backUrl)
const
actions
=
[
actions
=
[
{
{
label
:
'Cancelar'
,
label
:
'Cancelar'
,
props
:
{
props
:
{
className
:
'btn btn-default btn-xs'
className
:
'btn btn-default btn-xs'
}
}
}
}
];
];
if
(
this
.
state
.
total
>
1
)
{
if
(
this
.
state
.
total
>
1
)
{
progressForm
=
(
progressForm
=
(
<
div
className=
'progress'
>
<
div
className=
'progress'
>
<
div
<
div
className=
{
'progress-bar progress-bar-info progress-bar-striped active text-center step'
}
className=
{
'progress-bar progress-bar-info progress-bar-striped active text-center step'
}
style=
{
progressSize
}
style=
{
progressSize
}
>
>
<
span
className=
'progress-text'
>
{
`${titleForm} - ${progress}`
}
</
span
>
<
span
className=
'progress-text'
>
{
`${titleForm} - ${progress}`
}
</
span
>
<
/
div
>
</
div
>
</
div
>
);
}
}
if
(
!
this
.
state
.
isGlobalAdmin
)
{
form
=
(
<
div
className=
'text-center'
>
<
h4
>
{
'Lo sentimos pero usted no tiene permiso para crear dominios.'
}
</
h4
>
</
div
>
</
div
>
);
);
}
}
return
(
return
(
<
Panel
<
div
>
title=
{
'Agregar Dominio'
}
<
div
className=
'content animate-panel'
>
classHeader=
{
'forum-box'
}
<
div
className=
'row'
>
btnsHeader=
{
actions
}
<
div
className=
'col-md-12 panel-with-tabs'
>
>
<
Panel
{
error
}
title=
{
'Agregar Dominio'
}
{
progressForm
}
classHeader=
{
'forum-box'
}
{
form
}
btnsHeader=
{
actions
}
</
Panel
>
>
{
error
}
{
progressForm
}
{
form
}
</
Panel
>
</
div
>
</
div
>
</
div
>
</
div
>
);
);
}
}
}
}
...
...
src/components/search/search.jsx
View file @
2b316059
...
@@ -33,8 +33,10 @@ export default class SearchView extends React.Component {
...
@@ -33,8 +33,10 @@ export default class SearchView extends React.Component {
loading
:
true
loading
:
true
});
});
Client
.
search
({
Client
.
search
({
maxResults
:
window
.
manager_config
.
maxResultOnRequestZimbra
,
query
:
`(|(mail=*
${
query
}
*)(cn=*
${
query
}
*)(sn=*
${
query
}
*)(gn=*
${
query
}
*)(displayName=*
${
query
}
*)(zimbraMailDeliveryAddress=*
${
query
}
*)(zimbraDomainName=*
${
query
}
*)(uid=*
${
query
}
*)(zimbraMailAlias=*
${
query
}
*)(uid=*
${
query
}
*)(zimbraDomainName=*
${
query
}
*)(cn=*
${
query
}
*))`
,
query
:
`(|(mail=*
${
query
}
*)(cn=*
${
query
}
*)(sn=*
${
query
}
*)(gn=*
${
query
}
*)(displayName=*
${
query
}
*)(zimbraMailDeliveryAddress=*
${
query
}
*)(zimbraDomainName=*
${
query
}
*)(uid=*
${
query
}
*)(zimbraMailAlias=*
${
query
}
*)(uid=*
${
query
}
*)(zimbraDomainName=*
${
query
}
*)(cn=*
${
query
}
*))`
,
types
:
'accounts,distributionlists,domains'
types
:
'accounts,distributionlists,domains'
,
attrs
:
'objectClass'
},
(
success
)
=>
{
},
(
success
)
=>
{
const
result
=
[];
const
result
=
[];
...
@@ -55,7 +57,8 @@ export default class SearchView extends React.Component {
...
@@ -55,7 +57,8 @@ export default class SearchView extends React.Component {
return
this
.
setState
({
return
this
.
setState
({
result
,
result
,
loading
:
false
loading
:
false
,
notfound
:
false
});
});
},
(
error
)
=>
{
},
(
error
)
=>
{
console
.
log
(
error
);
//eslint-disable-line no-console
console
.
log
(
error
);
//eslint-disable-line no-console
...
@@ -131,6 +134,7 @@ export default class SearchView extends React.Component {
...
@@ -131,6 +134,7 @@ export default class SearchView extends React.Component {
<
tr
<
tr
key=
{
id
}
key=
{
id
}
className=
{
'mailbox-row'
}
className=
{
'mailbox-row'
}
onClick=
{
(
e
)
=>
Utils
.
handleLink
(
e
,
url
)
}
>
>
<
td
className=
{
'mailbox-name'
}
>
<
td
className=
{
'mailbox-name'
}
>
{
tipo
}
{
tipo
}
...
@@ -166,7 +170,7 @@ export default class SearchView extends React.Component {
...
@@ -166,7 +170,7 @@ export default class SearchView extends React.Component {
id=
'index-domains'
id=
'index-domains'
cellPadding=
'1'
cellPadding=
'1'
cellSpacing=
'1'
cellSpacing=
'1'
className=
'table table-condensed table-striped vertical-align index-mailbox-table'
className=
'table table-condensed table-striped vertical-align index-mailbox-table
table-search
'
>
>
<
thead
>
<
thead
>
<
tr
>
<
tr
>
...
...
src/sass/routes/_search.scss
View file @
2b316059
.margin-left
{
.margin-left
{
margin-left
:
5px
;
margin-left
:
5px
;
}
}
.table-search
{
.mailbox-row
{
transition
:
background-color
.5s
;
&
:hover
{
background-color
:
$color-background
;
cursor
:
pointer
;
}
}
}
src/stores/domain_store.jsx
View file @
2b316059
...
@@ -18,6 +18,7 @@ class DomainStoreClass extends EventEmitter {
...
@@ -18,6 +18,7 @@ class DomainStoreClass extends EventEmitter {
resetThisStore
()
{
resetThisStore
()
{
this
.
current
=
null
;
this
.
current
=
null
;
this
.
domains
=
null
;
this
.
distributionListOwners
=
null
;
this
.
distributionListOwners
=
null
;
this
.
distributionListMembers
=
null
;
this
.
distributionListMembers
=
null
;
this
.
zoneDNS
=
null
;
this
.
zoneDNS
=
null
;
...
@@ -39,6 +40,24 @@ class DomainStoreClass extends EventEmitter {
...
@@ -39,6 +40,24 @@ class DomainStoreClass extends EventEmitter {
return
null
;
return
null
;
}
}
getDomainByName
(
name
)
{
if
(
this
.
domains
)
{
const
data
=
this
.
domains
.
domain
;
if
(
data
)
{
let
length
=
data
.
length
;
for
(;
length
--
>
0
;)
{
if
(
data
[
length
].
name
===
name
)
{
return
data
[
length
];
}
}
}
}
return
null
;
}
getCurrent
()
{
getCurrent
()
{
return
this
.
current
;
return
this
.
current
;
}
}
...
...
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