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
26c93376
Commit
26c93376
authored
May 31, 2016
by
Juorder Antonio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
now global admin can be able to edit quantity of plans in domain
parent
80dff840
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
6 deletions
+114
-6
path.json
path.json
+1
-1
edit_domain.jsx
src/components/domain/edit_domain.jsx
+96
-4
utils.jsx
src/utils/utils.jsx
+17
-1
No files found.
path.json
View file @
26c93376
module.exports
=
{
"main"
:{
"js"
:
"/482549bundle.js"
}}
module.exports
=
{
"main"
:{
"js"
:
"/665473bundle.js"
}}
\ No newline at end of file
\ No newline at end of file
src/components/domain/edit_domain.jsx
View file @
26c93376
//import Textarea from 'react-textarea-autosize';
import
React
from
'react'
;
import
React
from
'react'
;
import
Textarea
from
'react-textarea-autosize'
;
import
{
browserHistory
}
from
'react-router'
;
import
{
browserHistory
}
from
'react-router'
;
import
MessageBar
from
'../message_bar.jsx'
;
import
MessageBar
from
'../message_bar.jsx'
;
...
@@ -8,6 +8,7 @@ import Panel from '../panel.jsx';
...
@@ -8,6 +8,7 @@ import Panel from '../panel.jsx';
import
CompanyStore
from
'../../stores/company_store.jsx'
;
import
CompanyStore
from
'../../stores/company_store.jsx'
;
import
DomainStore
from
'../../stores/domain_store.jsx'
;
import
DomainStore
from
'../../stores/domain_store.jsx'
;
import
UserStore
from
'../../stores/user_store.jsx'
;
import
UserStore
from
'../../stores/user_store.jsx'
;
import
ZimbraStore
from
'../../stores/zimbra_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'
;
...
@@ -23,9 +24,12 @@ export default class EditDomain extends React.Component {
...
@@ -23,9 +24,12 @@ export default class EditDomain extends React.Component {
this
.
getDomain
=
this
.
getDomain
.
bind
(
this
);
this
.
getDomain
=
this
.
getDomain
.
bind
(
this
);
this
.
getCompanies
=
this
.
getCompanies
.
bind
(
this
);
this
.
getCompanies
=
this
.
getCompanies
.
bind
(
this
);
this
.
handleSubmit
=
this
.
handleSubmit
.
bind
(
this
);
this
.
handleSubmit
=
this
.
handleSubmit
.
bind
(
this
);
this
.
planSize
=
this
.
planSize
.
bind
(
this
);
this
.
isGlobalAdmin
=
UserStore
.
isGlobalAdmin
();
this
.
isGlobalAdmin
=
UserStore
.
isGlobalAdmin
();
this
.
state
=
{};
this
.
state
=
{
plans
:
Utils
.
getEnabledPlansByCos
(
ZimbraStore
.
getAllCos
())
};
}
}
getDomain
()
{
getDomain
()
{
...
@@ -90,13 +94,21 @@ export default class EditDomain extends React.Component {
...
@@ -90,13 +94,21 @@ export default class EditDomain extends React.Component {
const
businessCategory
=
this
.
refs
.
company
.
value
.
trim
();
const
businessCategory
=
this
.
refs
.
company
.
value
.
trim
();
const
description
=
this
.
refs
.
description
.
value
.
trim
();
const
description
=
this
.
refs
.
description
.
value
.
trim
();
const
zimbraNotes
=
this
.
refs
.
notes
.
value
.
trim
();
const
zimbraNotes
=
this
.
refs
.
notes
.
value
.
trim
();
const
plans
=
this
.
state
.
plans
;
const
plansKeys
=
Object
.
keys
(
plans
);
const
zimbraDomainCOSMaxAccounts
=
[];
plansKeys
.
forEach
((
p
)
=>
{
zimbraDomainCOSMaxAccounts
.
push
(
`
${
plans
[
p
]}
:
${
this
.
refs
[
`plan-
${
plans
[
p
]}
`
].
value
||
0
}
`
);
});
const
domain
=
{
const
domain
=
{
id
,
id
,
attrs
:
{
attrs
:
{
businessCategory
,
businessCategory
,
description
,
description
,
zimbraNotes
zimbraNotes
,
zimbraDomainCOSMaxAccounts
}
}
};
};
...
@@ -124,6 +136,20 @@ export default class EditDomain extends React.Component {
...
@@ -124,6 +136,20 @@ export default class EditDomain extends React.Component {
});
});
}
}
planSize
(
e
)
{
e
.
preventDefault
();
let
total
=
0
;
const
objectPlans
=
this
.
state
.
plans
;
const
plans
=
Object
.
keys
(
objectPlans
);
plans
.
forEach
((
p
)
=>
{
const
planId
=
objectPlans
[
p
];
total
+=
parseInt
(
this
.
refs
[
`plan-
${
planId
}
`
].
value
,
10
)
||
0
;
});
this
.
refs
.
mailboxLimit
.
value
=
total
;
}
componentDidMount
()
{
componentDidMount
()
{
if
(
this
.
isGlobalAdmin
)
{
if
(
this
.
isGlobalAdmin
)
{
this
.
getDomain
();
this
.
getDomain
();
...
@@ -133,6 +159,7 @@ export default class EditDomain extends React.Component {
...
@@ -133,6 +159,7 @@ export default class EditDomain extends React.Component {
render
()
{
render
()
{
const
domain
=
this
.
state
.
domain
;
const
domain
=
this
.
state
.
domain
;
const
error
=
this
.
state
.
error
;
const
error
=
this
.
state
.
error
;
const
plans
=
this
.
state
.
plans
;
let
form
=
null
;
let
form
=
null
;
if
(
domain
||
error
)
{
if
(
domain
||
error
)
{
...
@@ -186,6 +213,47 @@ export default class EditDomain extends React.Component {
...
@@ -186,6 +213,47 @@ export default class EditDomain extends React.Component {
// </div>
// </div>
// </div>
// </div>
let
enabledPlans
=
Object
.
keys
(
plans
);
const
maxCosAccounts
=
Utils
.
parseMaxCOSAccounts
(
domain
.
attrs
.
zimbraDomainCOSMaxAccounts
);
let
total
=
0
;
const
ownPlans
=
enabledPlans
.
map
((
p
)
=>
{
const
planId
=
maxCosAccounts
[
plans
[
p
]];
total
+=
parseInt
(
planId
,
10
)
||
0
;
return
(
<
div
key=
{
`plan-${p}`
}
className=
'col-md-4 form-group required'
>
<
label
htmlFor=
{
`plan-${p}`
}
clasName=
'label-top control-label'
>
<
abbr
title=
'Requerido'
>
{
'*'
}
</
abbr
><
br
/>
{
Utils
.
titleCase
(
p
)
}
</
label
>
<
br
/>
<
div
className=
'row'
>
<
div
className=
'col-sm-8'
>
<
input
type=
'text'
className=
'form-control'
defaultValue=
{
planId
}
data
-
required=
'true'
data
-
message=
{
`Debe asignar la cantidad de casillas del tipo ${Utils.titleCase(p)}`
}
data
-
id=
{
p
}
ref=
{
`plan-${plans[p]}`
}
onKeyUp=
{
(
e
)
=>
{
this
.
planSize
(
e
);
}
}
/>
</
div
>
</
div
>
</
div
>
);
});
if
(
this
.
isGlobalAdmin
)
{
if
(
this
.
isGlobalAdmin
)
{
form
=
(
form
=
(
<
form
<
form
...
@@ -230,6 +298,14 @@ export default class EditDomain extends React.Component {
...
@@ -230,6 +298,14 @@ export default class EditDomain extends React.Component {
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
'form-group row'
>
<
div
className=
'col-md-8 col-md-offset-3'
>
<
div
className=
'box-content'
>
{
ownPlans
}
</
div
>
</
div
>
</
div
>
<
div
className=
'form-group string'
>
<
div
className=
'form-group string'
>
<
label
className=
'string col-sm-3 control-label'
>
<
label
className=
'string col-sm-3 control-label'
>
{
'Descripción'
}
{
'Descripción'
}
...
@@ -252,7 +328,7 @@ export default class EditDomain extends React.Component {
...
@@ -252,7 +328,7 @@ export default class EditDomain extends React.Component {
</
label
>
</
label
>
<
div
className=
'col-sm-8'
>
<
div
className=
'col-sm-8'
>
<
T
extarea
<
t
extarea
className=
'form-control'
className=
'form-control'
ref=
'notes'
ref=
'notes'
defaultValue=
{
domain
.
attrs
.
zimbraNotes
}
defaultValue=
{
domain
.
attrs
.
zimbraNotes
}
...
@@ -263,6 +339,22 @@ export default class EditDomain extends React.Component {
...
@@ -263,6 +339,22 @@ export default class EditDomain extends React.Component {
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
'form-group string'
>
<
label
className=
'string required col-sm-3 control-label'
>
{
'Límite de casillas'
}
</
label
>
<
div
className=
'col-sm-8'
>
<
input
type=
'text'
className=
'form-control'
ref=
'mailboxLimit'
value=
{
total
}
disabled=
'disabled'
/>
</
div
>
</
div
>
<
div
className=
'form-group'
>
<
div
className=
'form-group'
>
<
div
className=
'col-sm-8 col-sm-offset-3'
>
<
div
className=
'col-sm-8 col-sm-offset-3'
>
<
input
<
input
...
...
src/utils/utils.jsx
View file @
26c93376
...
@@ -171,7 +171,7 @@ export function validateInputRequired(refs) {
...
@@ -171,7 +171,7 @@ export function validateInputRequired(refs) {
}
}
for
(
const
ref
in
refs
)
{
for
(
const
ref
in
refs
)
{
if
(
refs
.
hasOwnProperty
(
ref
)
&&
refs
[
ref
].
hasAttribute
)
{
if
(
refs
.
hasOwnProperty
(
ref
))
{
if
(
refs
[
ref
].
hasAttribute
(
'data-required'
)
&&
refs
[
ref
].
getAttribute
(
'data-required'
)
===
'true'
&&
refs
[
ref
].
value
===
''
)
{
if
(
refs
[
ref
].
hasAttribute
(
'data-required'
)
&&
refs
[
ref
].
getAttribute
(
'data-required'
)
===
'true'
&&
refs
[
ref
].
value
===
''
)
{
let
message
;
let
message
;
if
(
refs
[
ref
].
getAttribute
(
'data-message'
)
&&
refs
[
ref
].
getAttribute
(
'data-message'
).
length
>
0
)
{
if
(
refs
[
ref
].
getAttribute
(
'data-message'
)
&&
refs
[
ref
].
getAttribute
(
'data-message'
).
length
>
0
)
{
...
@@ -673,3 +673,19 @@ export function extractLockOuts(object) {
...
@@ -673,3 +673,19 @@ export function extractLockOuts(object) {
return
object
;
return
object
;
}
}
export
function
parseMaxCOSAccounts
(
maxCosAccounts
)
{
const
response
=
{};
const
arrCos
=
maxCosAccounts
||
false
;
if
(
arrCos
)
{
arrCos
.
forEach
((
p
)
=>
{
const
splitter
=
p
.
split
(
':'
);
response
[
splitter
.
shift
()]
=
splitter
[
0
]
||
0
;
});
return
response
;
}
return
arrCos
;
}
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