Commit b72a575f authored by Patricio Bruna's avatar Patricio Bruna

Merge pull request #122 from ZBoxApp/link_to_domain_withoutlimit

Link para mostrar dominios sin limites asignados, Fix #62
parents 5e94fe33 2fe981a5
...@@ -185,13 +185,13 @@ ...@@ -185,13 +185,13 @@
"react/no-is-mounted": 2, "react/no-is-mounted": 2,
"react/no-string-refs": 0, "react/no-string-refs": 0,
"react/jsx-pascal-case": 2, "react/jsx-pascal-case": 2,
"react/jsx-indent": [1, 4], // "react/jsx-indent": [1, 4],
"react/jsx-equals-spacing": [2, "never"], "react/jsx-equals-spacing": [2, "never"],
"react/jsx-handler-names": 0, "react/jsx-handler-names": 0,
"react/jsx-boolean-value": [2, "always"], "react/jsx-boolean-value": [2, "always"],
"react/jsx-closing-bracket-location": [2, { "location": "tag-aligned" }], "react/jsx-closing-bracket-location": [2, { "location": "tag-aligned" }],
"react/jsx-curly-spacing": [2, "never"], "react/jsx-curly-spacing": [2, "never"],
"react/jsx-indent-props": [2, 4], // "react/jsx-indent-props": [2, 4],
"react/jsx-key": 2, "react/jsx-key": 2,
"react/jsx-max-props-per-line": [2, { "maximum": 1 }], "react/jsx-max-props-per-line": [2, { "maximum": 1 }],
"react/jsx-no-bind": 1, "react/jsx-no-bind": 1,
......
module.exports = {"main":{"js":"/950474bundle.js"}} module.exports = {"main":{"js":"/080240bundle.js"}}
\ No newline at end of file \ No newline at end of file
...@@ -264,7 +264,9 @@ export default class Companies extends React.Component { ...@@ -264,7 +264,9 @@ export default class Companies extends React.Component {
<MessageBar <MessageBar
message='Existen dominios sin límites asignados' message='Existen dominios sin límites asignados'
type='WARNING' type='WARNING'
autoclose={true} autoclose={false}
link={`/search/${Constants.ZimbraSearchs.DOMAINS_WITHOUT_LIMITS}`}
linkText='Ver dominios sin límites'
/> />
); );
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
import $ from 'jquery'; import $ from 'jquery';
import React from 'react'; import React from 'react';
import {Link} from 'react-router';
import Constants from '../utils/constants.jsx'; import Constants from '../utils/constants.jsx';
...@@ -64,6 +65,21 @@ export default class MessageBar extends React.Component { ...@@ -64,6 +65,21 @@ export default class MessageBar extends React.Component {
); );
} }
const link = this.props.link;
const linkText = this.props.linkText ? this.props.linkText : link;
let messageLink;
if (link) {
messageLink = (
<span> -
<Link to={link}
style={{color: '#fff'}}
>
{` ${linkText}`}
</Link>
</span>
);
}
const alertClass = `alert flash-${this.props.type.toLowerCase()} ${dismissible}`; const alertClass = `alert flash-${this.props.type.toLowerCase()} ${dismissible}`;
let icon; let icon;
switch (this.props.type) { switch (this.props.type) {
...@@ -91,7 +107,7 @@ export default class MessageBar extends React.Component { ...@@ -91,7 +107,7 @@ export default class MessageBar extends React.Component {
role='alert' role='alert'
> >
{closeButton} {closeButton}
{icon} {message} {icon} {message} {messageLink}
</div> </div>
</div> </div>
); );
...@@ -107,7 +123,9 @@ MessageBar.defaultProps = { ...@@ -107,7 +123,9 @@ MessageBar.defaultProps = {
position: 'relative', position: 'relative',
canClose: true, canClose: true,
autoclose: false, autoclose: false,
autocloseInSecs: 10 autocloseInSecs: 10,
link: null,
linkText: null
}; };
MessageBar.propTypes = { MessageBar.propTypes = {
...@@ -116,5 +134,7 @@ MessageBar.propTypes = { ...@@ -116,5 +134,7 @@ MessageBar.propTypes = {
position: React.PropTypes.oneOf(['absolute', 'fixed', 'relative', 'static', 'inherit']), position: React.PropTypes.oneOf(['absolute', 'fixed', 'relative', 'static', 'inherit']),
canClose: React.PropTypes.bool, canClose: React.PropTypes.bool,
autoclose: React.PropTypes.bool, autoclose: React.PropTypes.bool,
autocloseInSecs: React.PropTypes.number autocloseInSecs: React.PropTypes.number,
link: React.PropTypes.string,
linkText: React.PropTypes.string
}; };
...@@ -28,41 +28,56 @@ export default class SearchView extends React.Component { ...@@ -28,41 +28,56 @@ export default class SearchView extends React.Component {
this.makeSearch(query); this.makeSearch(query);
} }
runSearch(queryObject) {
this.setState({
loading: true
});
Client.search(queryObject, (success) => {
const result = [];
for (const key in success) {
if (success.hasOwnProperty(key)) {
if (key === 'dl' || key === 'domain' || key === 'account') {
Array.prototype.push.apply(result, success[key]);
}
}
}
if (success.total <= 0) {
return this.setState({
notfound: true,
loading: false
});
}
return this.setState({
result,
loading: false,
notfound: false
});
}, (error) => {
console.log(error); //eslint-disable-line no-console
});
}
makeSearch(query) { makeSearch(query) {
this.setState({ let advanceQuery = false;
loading: true try {
}); advanceQuery = JSON.parse(query).advanceQuery;
Client.search({ } catch (e) {
advanceQuery = false;
}
if (advanceQuery) {
this.runSearch(advanceQuery);
} else {
const queryObject = {
maxResults: window.manager_config.maxResultOnRequestZimbra, 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' attrs: 'objectClass'
}, (success) => { };
const result = []; this.runSearch(queryObject);
}
for (const key in success) {
if (success.hasOwnProperty(key)) {
if (key === 'dl' || key === 'domain' || key === 'account') {
Array.prototype.push.apply(result, success[key]);
}
}
}
if (success.total <= 0) {
return this.setState({
notfound: true,
loading: false
});
}
return this.setState({
result,
loading: false,
notfound: false
});
}, (error) => {
console.log(error); //eslint-disable-line no-console
});
} }
render() { render() {
......
...@@ -23,4 +23,10 @@ ...@@ -23,4 +23,10 @@
background: $color-violet; background: $color-violet;
color: $white; color: $white;
} }
a {
color: $white;
text-decoration: underline;
}
} }
...@@ -49,6 +49,10 @@ export default { ...@@ -49,6 +49,10 @@ export default {
AUTH__REQUIRED: 'service.AUTH_REQUIRED' AUTH__REQUIRED: 'service.AUTH_REQUIRED'
}, },
ZimbraSearchs: {
DOMAINS_WITHOUT_LIMITS: '{"advance_query": {"query": "(!(zimbraDomainCOSMaxAccounts=*))", "types": "domains"}}'
},
RESERVED_USERNAMES: [ RESERVED_USERNAMES: [
'admin', 'admin',
'root' 'root'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment