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
702b5d68
Commit
702b5d68
authored
Apr 11, 2016
by
Elias Nahum
Committed by
Juorder Antonio
May 23, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add pagination, loader to domains, add create DNS zone button to domain, etc
parent
a7d98ba7
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
150 additions
and
125 deletions
+150
-125
path.json
path.json
+1
-1
companies.jsx
src/components/companies/companies.jsx
+4
-0
domain_admin_dns.jsx
src/components/domain/domain_admin_dns.jsx
+24
-4
domains.jsx
src/components/domain/domains.jsx
+62
-46
mailbox.jsx
src/components/mailbox/mailbox.jsx
+2
-2
pagination.jsx
src/components/pagination.jsx
+5
-9
search.jsx
src/components/search/search.jsx
+16
-2
config.json
src/config/config.json
+2
-2
_loader.scss
src/sass/components/_loader.scss
+1
-1
_layout.scss
src/sass/layout/_layout.scss
+1
-1
client.jsx
src/utils/client.jsx
+32
-57
No files found.
path.json
View file @
702b5d68
module.exports
=
{
"main"
:{
"js"
:
"/928473bundle.js"
}}
module.exports
=
{
"main"
:{
"js"
:
"/531271bundle.js"
}}
\ No newline at end of file
\ No newline at end of file
src/components/companies/companies.jsx
View file @
702b5d68
...
@@ -120,6 +120,10 @@ export default class Companies extends React.Component {
...
@@ -120,6 +120,10 @@ export default class Companies extends React.Component {
});
});
}
}
componentWillReceiveProps
()
{
GlobalActions
.
emitEndLoading
();
}
componentDidMount
()
{
componentDidMount
()
{
$
(
'#sidebar-companies'
).
addClass
(
'active'
);
$
(
'#sidebar-companies'
).
addClass
(
'active'
);
this
.
getCompanies
();
this
.
getCompanies
();
...
...
src/components/domain/domain_admin_dns.jsx
View file @
702b5d68
...
@@ -3,6 +3,7 @@ import * as Utils from '../../utils/utils.jsx';
...
@@ -3,6 +3,7 @@ import * as Utils from '../../utils/utils.jsx';
import
Constants
from
'../../utils/constants.jsx'
;
import
Constants
from
'../../utils/constants.jsx'
;
import
EventStore
from
'../../stores/event_store.jsx'
;
import
EventStore
from
'../../stores/event_store.jsx'
;
import
DomainStore
from
'../../stores/domain_store.jsx'
;
import
DomainStore
from
'../../stores/domain_store.jsx'
;
import
Client
from
'../../utils/client.jsx'
;
const
Labels
=
Constants
.
Labels
;
const
Labels
=
Constants
.
Labels
;
...
@@ -56,6 +57,11 @@ export default class DNSZoneForm extends React.Component {
...
@@ -56,6 +57,11 @@ export default class DNSZoneForm extends React.Component {
addDNSRequest
()
{
addDNSRequest
()
{
const
records
=
this
.
defaultRows
;
const
records
=
this
.
defaultRows
;
const
zoneDNS
=
this
.
zoneDNS
;
const
zoneDNS
=
this
.
zoneDNS
;
const
request
=
{
name
:
this
.
props
.
domain
.
name
,
kind
:
'Master'
,
nameservers
:
[]
};
Utils
.
toggleStatusButtons
(
'.savedns'
,
true
);
Utils
.
toggleStatusButtons
(
'.savedns'
,
true
);
const
button
=
this
.
refs
.
savedns
;
const
button
=
this
.
refs
.
savedns
;
...
@@ -84,12 +90,25 @@ export default class DNSZoneForm extends React.Component {
...
@@ -84,12 +90,25 @@ export default class DNSZoneForm extends React.Component {
typeError
:
MessageType
.
SUCCESS
typeError
:
MessageType
.
SUCCESS
});
});
});
});
}
else
{
}
Client
.
createZoneWithRecords
(
request
,
records
,
()
=>
{
Utils
.
toggleStatusButtons
(
'.savedns'
,
false
);
button
.
innerHTML
=
oldContent
;
EventStore
.
emitMessage
({
message
:
'Se ha creado su zona DNS éxitosamente.'
,
typeError
:
MessageType
.
SUCCESS
});
},
(
error
)
=>
{
EventStore
.
emitMessage
({
EventStore
.
emitMessage
({
message
:
'Ha ocurrido un error general al intentar agregar un registro DNS'
,
message
:
error
.
extra
.
reason
,
typeError
:
MessageType
.
ERROR
typeError
:
MessageType
.
ERROR
});
});
}
Utils
.
toggleStatusButtons
(
'.savedns'
,
false
);
button
.
innerHTML
=
oldContent
;
});
}
}
addDNSRow
()
{
addDNSRow
()
{
...
@@ -172,6 +191,7 @@ export default class DNSZoneForm extends React.Component {
...
@@ -172,6 +191,7 @@ export default class DNSZoneForm extends React.Component {
}
}
render
()
{
render
()
{
const
textButton
=
this
.
zoneDNS
?
'Agregar otro registro'
:
'Crear zona DNS'
;
let
isVisible
=
false
;
let
isVisible
=
false
;
let
fields
=
null
;
let
fields
=
null
;
let
header
=
null
;
let
header
=
null
;
...
@@ -315,7 +335,7 @@ export default class DNSZoneForm extends React.Component {
...
@@ -315,7 +335,7 @@ export default class DNSZoneForm extends React.Component {
className=
'btn btn-info pull-right'
className=
'btn btn-info pull-right'
onClick=
{
this
.
addDNSRow
}
onClick=
{
this
.
addDNSRow
}
>
>
<
i
className=
'fa fa-plus-circle fa-lg'
></
i
>
Agregar otro registro
<
i
className=
'fa fa-plus-circle fa-lg'
></
i
>
{
textButton
}
</
button
>
</
button
>
</
p
>
</
p
>
</
blockquote
>
</
blockquote
>
...
...
src/components/domain/domains.jsx
View file @
702b5d68
...
@@ -33,7 +33,8 @@ export default class Domains extends React.Component {
...
@@ -33,7 +33,8 @@ export default class Domains extends React.Component {
this
.
state
=
{
this
.
state
=
{
page
,
page
,
offset
:
((
page
-
1
)
*
QueryOptions
.
DEFAULT_LIMIT
)
offset
:
((
page
-
1
)
*
QueryOptions
.
DEFAULT_LIMIT
),
loading
:
true
};
};
}
}
...
@@ -41,7 +42,7 @@ export default class Domains extends React.Component {
...
@@ -41,7 +42,7 @@ export default class Domains extends React.Component {
const
self
=
this
;
const
self
=
this
;
Client
.
getAllDomains
(
Client
.
getAllDomains
(
{
{
limit
:
200
,
limit
:
QueryOptions
.
DEFAULT_LIMIT
,
offset
:
this
.
state
.
offset
offset
:
this
.
state
.
offset
},
},
(
data
)
=>
{
(
data
)
=>
{
...
@@ -49,14 +50,16 @@ export default class Domains extends React.Component {
...
@@ -49,14 +50,16 @@ export default class Domains extends React.Component {
this
.
getPlans
(
domains
).
this
.
getPlans
(
domains
).
then
(()
=>
{
then
(()
=>
{
self
.
setState
({
self
.
setState
({
data
data
,
loading
:
false
});
});
}).
}).
catch
(()
=>
{
catch
(()
=>
{
this
.
setState
({
this
.
setState
({
error
:
{
error
:
{
message
:
'No se obtuvieron los planes de las cuentas'
,
message
:
'No se obtuvieron los planes de las cuentas'
,
type
:
messageType
.
ERROR
type
:
messageType
.
ERROR
,
loading
:
false
}
}
});
});
}).
}).
...
@@ -68,7 +71,8 @@ export default class Domains extends React.Component {
...
@@ -68,7 +71,8 @@ export default class Domains extends React.Component {
this
.
setState
({
this
.
setState
({
error
:
{
error
:
{
message
:
error
.
message
,
message
:
error
.
message
,
type
:
messageType
.
ERROR
type
:
messageType
.
ERROR
,
loading
:
false
}
}
});
});
GlobalActions
.
emitEndLoading
();
GlobalActions
.
emitEndLoading
();
...
@@ -104,7 +108,8 @@ export default class Domains extends React.Component {
...
@@ -104,7 +108,8 @@ export default class Domains extends React.Component {
this
.
state
=
{
this
.
state
=
{
page
,
page
,
offset
:
((
page
-
1
)
*
QueryOptions
.
DEFAULT_LIMIT
)
offset
:
((
page
-
1
)
*
QueryOptions
.
DEFAULT_LIMIT
),
loading
:
true
};
};
this
.
getDomains
();
this
.
getDomains
();
...
@@ -121,8 +126,12 @@ export default class Domains extends React.Component {
...
@@ -121,8 +126,12 @@ export default class Domains extends React.Component {
render
()
{
render
()
{
const
error
=
this
.
state
.
error
;
const
error
=
this
.
state
.
error
;
let
message
;
let
message
=
null
;
let
addDomainButton
=
null
;
let
addDomainButton
=
null
;
let
pagination
=
null
;
let
panelBody
=
null
;
let
tableResults
=
null
;
if
(
error
)
{
if
(
error
)
{
message
=
(
message
=
(
<
MessageBar
<
MessageBar
...
@@ -133,7 +142,16 @@ export default class Domains extends React.Component {
...
@@ -133,7 +142,16 @@ export default class Domains extends React.Component {
);
);
}
}
if
(
!
this
.
isGlobalAdmin
)
{
if
(
this
.
state
.
loading
)
{
panelBody
=
(
<
div
className=
'text-center'
>
<
i
className=
'fa fa-spinner fa-spin fa-4x fa-fw'
></
i
>
<
p
>
{
'Cargando Dominios...'
}
</
p
>
</
div
>
);
}
if
(
this
.
isGlobalAdmin
)
{
addDomainButton
=
[{
addDomainButton
=
[{
label
:
'Agregar Dominio'
,
label
:
'Agregar Dominio'
,
props
:
{
props
:
{
...
@@ -145,7 +163,6 @@ export default class Domains extends React.Component {
...
@@ -145,7 +163,6 @@ export default class Domains extends React.Component {
}];
}];
}
}
let
tableResults
;
if
(
this
.
state
.
data
)
{
if
(
this
.
state
.
data
)
{
const
configPlans
=
global
.
window
.
manager_config
.
plans
;
const
configPlans
=
global
.
window
.
manager_config
.
plans
;
tableResults
=
this
.
state
.
data
.
domain
.
map
((
d
)
=>
{
tableResults
=
this
.
state
.
data
.
domain
.
map
((
d
)
=>
{
...
@@ -224,10 +241,21 @@ export default class Domains extends React.Component {
...
@@ -224,10 +241,21 @@ export default class Domains extends React.Component {
</
tr
>
</
tr
>
);
);
});
});
if
(
this
.
state
.
offset
>
0
||
(
this
.
state
.
data
&&
this
.
state
.
data
.
more
))
{
const
totalPages
=
this
.
state
.
data
?
Math
.
ceil
(
this
.
state
.
data
.
total
/
QueryOptions
.
DEFAULT_LIMIT
)
:
0
;
pagination
=
(
<
Pagination
key=
'panelPagination'
url=
'domains'
currentPage=
{
this
.
state
.
page
}
totalPages=
{
totalPages
}
/>
);
}
}
const
panelBody
=
(
panelBody
=
(
<
div
key=
'panelBody'
>
<
div
>
<
div
<
div
id=
'index-domains-table'
id=
'index-domains-table'
className=
'table-responsive'
className=
'table-responsive'
...
@@ -239,7 +267,7 @@ export default class Domains extends React.Component {
...
@@ -239,7 +267,7 @@ export default class Domains extends React.Component {
className=
'table table-condensed table-striped vertical-align'
className=
'table table-condensed table-striped vertical-align'
>
>
<
thead
>
<
thead
>
<
tr
>
<
tr
key=
'table-heading'
>
<
th
>
{
'Nombre'
}
</
th
>
<
th
>
{
'Nombre'
}
</
th
>
<
th
className=
'text-center'
>
{
'Casillas Compradas'
}
</
th
>
<
th
className=
'text-center'
>
{
'Casillas Compradas'
}
</
th
>
<
th
className=
'text-center'
>
{
'Descripción'
}
</
th
>
<
th
className=
'text-center'
>
{
'Descripción'
}
</
th
>
...
@@ -254,18 +282,6 @@ export default class Domains extends React.Component {
...
@@ -254,18 +282,6 @@ export default class Domains extends React.Component {
</
div
>
</
div
>
</
div
>
</
div
>
);
);
let
pagination
;
if
(
this
.
state
.
offset
>
0
||
(
this
.
state
.
data
&&
this
.
state
.
data
.
more
))
{
const
totalPages
=
this
.
state
.
data
?
Math
.
ceil
(
this
.
state
.
data
.
total
/
QueryOptions
.
DEFAULT_LIMIT
)
:
0
;
pagination
=
(
<
Pagination
key=
'panelPagination'
url=
'domains'
currentPage=
{
this
.
state
.
page
}
totalPages=
{
totalPages
}
/>
);
}
}
return
(
return
(
...
...
src/components/mailbox/mailbox.jsx
View file @
702b5d68
...
@@ -508,10 +508,10 @@ export default class Mailboxes extends React.Component {
...
@@ -508,10 +508,10 @@ export default class Mailboxes extends React.Component {
}
}
];
];
const
totalPage
=
Math
.
ceil
(
totalAccounts
/
QueryOptions
.
DEFAULT_LIMIT
);
let
activePagination
=
{
let
activePagination
=
{
total
:
total
Accounts
total
:
total
Page
};
};
const
totalPage
=
Math
.
ceil
(
totalAccounts
/
QueryOptions
.
DEFAULT_LIMIT
);
if
(
activeAccounts
.
length
>
QueryOptions
.
DEFAULT_LIMIT
)
{
if
(
activeAccounts
.
length
>
QueryOptions
.
DEFAULT_LIMIT
)
{
activeAccounts
=
activeAccounts
.
slice
(
this
.
state
.
offset
,
(
this
.
state
.
page
*
QueryOptions
.
DEFAULT_LIMIT
));
activeAccounts
=
activeAccounts
.
slice
(
this
.
state
.
offset
,
(
this
.
state
.
page
*
QueryOptions
.
DEFAULT_LIMIT
));
activePagination
=
{
activePagination
=
{
...
...
src/components/pagination.jsx
View file @
702b5d68
import
React
from
'react'
;
import
React
from
'react'
;
import
{
browserHistory
}
from
'react-router'
;
import
{
browserHistory
}
from
'react-router'
;
import
Constants
from
'../utils/constants.jsx'
;
const
limit
=
Constants
.
QueryOptions
.
DEFAULT_LIMIT
;
export
default
class
Pagination
extends
React
.
Component
{
export
default
class
Pagination
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -51,14 +48,13 @@ export default class Pagination extends React.Component {
...
@@ -51,14 +48,13 @@ export default class Pagination extends React.Component {
}
}
handleLast
(
e
)
{
handleLast
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
const
page
=
this
.
getPageQueryString
(
Math
.
ceil
(
this
.
props
.
totalPages
/
limit
)
);
const
page
=
this
.
getPageQueryString
(
this
.
props
.
totalPages
);
browserHistory
.
push
(
`/
${
this
.
props
.
url
}${
page
}
`
);
browserHistory
.
push
(
`/
${
this
.
props
.
url
}${
page
}
`
);
}
}
render
()
{
render
()
{
//let i = 1;
//let i = 1;
const
total
=
this
.
props
.
totalPages
;
const
total
=
this
.
props
.
totalPages
;
const
current
=
this
.
props
.
currentPage
;
const
current
=
this
.
props
.
currentPage
;
const
totalPages
=
Math
.
ceil
(
total
/
limit
);
const
pages
=
[];
const
pages
=
[];
let
first
;
let
first
;
...
@@ -68,11 +64,11 @@ export default class Pagination extends React.Component {
...
@@ -68,11 +64,11 @@ export default class Pagination extends React.Component {
const
console
=
(
const
console
=
(
<
li
key=
'console-page'
>
<
li
key=
'console-page'
>
<
span
>
{
`${current} de ${total
Pages
}`
}
</
span
>
<
span
>
{
`${current} de ${total}`
}
</
span
>
</
li
>
</
li
>
);
);
if
(
current
>
1
&&
current
<=
total
Pages
)
{
if
(
current
>
1
&&
current
<=
total
)
{
first
=
(
first
=
(
<
li
key=
'first-page'
>
<
li
key=
'first-page'
>
<
a
<
a
...
@@ -90,7 +86,7 @@ export default class Pagination extends React.Component {
...
@@ -90,7 +86,7 @@ export default class Pagination extends React.Component {
);
);
}
}
if
(
current
<
total
Pages
)
{
if
(
current
<
total
)
{
next
=
(
next
=
(
<
li
key=
'next-page'
>
<
li
key=
'next-page'
>
<
a
<
a
...
@@ -109,7 +105,7 @@ export default class Pagination extends React.Component {
...
@@ -109,7 +105,7 @@ export default class Pagination extends React.Component {
}
}
const
rangeBack
=
current
-
this
.
props
.
range
;
const
rangeBack
=
current
-
this
.
props
.
range
;
const
rangeForward
=
((
current
+
this
.
props
.
range
)
+
1
)
>
total
Pages
?
totalPages
+
1
:
((
current
+
this
.
props
.
range
)
+
1
);
const
rangeForward
=
((
current
+
this
.
props
.
range
)
+
1
)
>
total
?
total
+
1
:
((
current
+
this
.
props
.
range
)
+
1
);
for
(
let
p
=
rangeBack
;
p
<
rangeForward
;
p
++
)
{
for
(
let
p
=
rangeBack
;
p
<
rangeForward
;
p
++
)
{
if
((
p
>
0
)
&&
(
p
<=
total
))
{
if
((
p
>
0
)
&&
(
p
<=
total
))
{
...
...
src/components/search/search.jsx
View file @
702b5d68
...
@@ -29,6 +29,9 @@ export default class SearchView extends React.Component {
...
@@ -29,6 +29,9 @@ export default class SearchView extends React.Component {
}
}
makeSearch
(
query
)
{
makeSearch
(
query
)
{
this
.
setState
({
loading
:
true
});
Client
.
search
({
Client
.
search
({
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'
...
@@ -45,12 +48,14 @@ export default class SearchView extends React.Component {
...
@@ -45,12 +48,14 @@ export default class SearchView extends React.Component {
if
(
success
.
total
<=
0
)
{
if
(
success
.
total
<=
0
)
{
return
this
.
setState
({
return
this
.
setState
({
notfound
:
true
notfound
:
true
,
loading
:
false
});
});
}
}
return
this
.
setState
({
return
this
.
setState
({
result
result
,
loading
:
false
});
});
},
(
error
)
=>
{
},
(
error
)
=>
{
console
.
log
(
error
);
//eslint-disable-line no-console
console
.
log
(
error
);
//eslint-disable-line no-console
...
@@ -195,6 +200,15 @@ export default class SearchView extends React.Component {
...
@@ -195,6 +200,15 @@ export default class SearchView extends React.Component {
);
);
}
}
if
(
this
.
state
.
loading
)
{
content
=
(
<
div
className=
'text-center'
>
<
i
className=
'fa fa-spinner fa-spin fa-4x fa-fw'
></
i
>
<
p
>
{
'Buscando...'
}
</
p
>
</
div
>
);
}
return
(
return
(
<
div
>
<
div
>
{
pagelInfo
}
{
pagelInfo
}
...
...
src/config/config.json
View file @
702b5d68
...
@@ -5,10 +5,10 @@
...
@@ -5,10 +5,10 @@
"dnsApiUrl"
:
"http://zimbra.zboxapp.dev:3000"
,
"dnsApiUrl"
:
"http://zimbra.zboxapp.dev:3000"
,
"webMailUrl"
:
"https://zimbra.zboxapp.dev"
,
"webMailUrl"
:
"https://zimbra.zboxapp.dev"
,
"dns"
:
{
"dns"
:
{
"url"
:
"http://192.168.1.8:8081"
,
"url"
:
"http://192.168.1.8:8081
/powerdns_proxy/
"
,
"token"
:
"otto"
"token"
:
"otto"
},
},
"maxResultOnRequestZimbra"
:
4
000
,
"maxResultOnRequestZimbra"
:
20
000
,
"autoincrementOnFailRequestZimbra"
:
500
,
"autoincrementOnFailRequestZimbra"
:
500
,
"plans"
:
{
"plans"
:
{
"basic"
:
{
"basic"
:
{
...
...
src/sass/components/_loader.scss
View file @
702b5d68
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
>
div
{
>
div
{
animation
:
sk-stretchdelay
1
.2s
infinite
ease-in-out
;
animation
:
sk-stretchdelay
1
.2s
infinite
ease-in-out
;
background-color
:
$color-green
;
//
background-color: $color-green;
display
:
inline-block
;
display
:
inline-block
;
height
:
100%
;
height
:
100%
;
width
:
8px
;
width
:
8px
;
...
...
src/sass/layout/_layout.scss
View file @
702b5d68
...
@@ -50,7 +50,7 @@ body {
...
@@ -50,7 +50,7 @@ body {
#wrapper
{
#wrapper
{
background
:
$color-background
;
background
:
$color-background
;
border-left
:
1px
solid
$border-color
;
border-left
:
1px
solid
$border-color
;
height
:
inherit
;
height
:
auto
;
margin
:
0
0
0
$menu-width
;
margin
:
0
0
0
$menu-width
;
min-height
:
100%
;
min-height
:
100%
;
padding
:
0
;
padding
:
0
;
...
...
src/utils/client.jsx
View file @
702b5d68
...
@@ -668,9 +668,9 @@ export function renameAccount(account, success, error) {
...
@@ -668,9 +668,9 @@ export function renameAccount(account, success, error) {
}
}
export
function
initPowerDNS
()
{
export
function
initPowerDNS
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
/*return new Promise((resolve, reject) => {
const
powerAttrs
=
window
.
manager_config
.
dns
;
const api = new Powerdns({url: powerAttrs.url, token: powerAttrs.token});
const api = new Powerdns({url: powerAttrs.url, token: powerAttrs.token});
console.log(api);
if (api) {
if (api) {
return resolve(api);
return resolve(api);
...
@@ -680,12 +680,14 @@ export function initPowerDNS() {
...
@@ -680,12 +680,14 @@ export function initPowerDNS() {
type: Constants.MessageType.ERROR,
type: Constants.MessageType.ERROR,
message: 'PowerDNS no instanciado'
message: 'PowerDNS no instanciado'
});
});
});
});*/
const
powerAttrs
=
window
.
manager_config
.
dns
;
const
api
=
new
Powerdns
({
url
:
powerAttrs
.
url
,
token
:
powerAttrs
.
token
});
return
api
;
}
}
export
function
createZoneWithRecords
(
zoneData
,
records
,
success
,
error
)
{
export
function
createZoneWithRecords
(
zoneData
,
records
,
success
,
error
)
{
initPowerDNS
().
then
(
const
api
=
initPowerDNS
();
(
api
)
=>
{
api
.
createZoneWithRecords
(
zoneData
,
records
,
(
er
,
data
)
=>
{
api
.
createZoneWithRecords
(
zoneData
,
records
,
(
er
,
data
)
=>
{
if
(
er
)
{
if
(
er
)
{
return
error
(
er
);
return
error
(
er
);
...
@@ -693,17 +695,10 @@ export function createZoneWithRecords(zoneData, records, success, error) {
...
@@ -693,17 +695,10 @@ export function createZoneWithRecords(zoneData, records, success, error) {
return
success
(
data
);
return
success
(
data
);
});
});
},
(
err
)
=>
{
const
e
=
handleError
(
'createZoneWithRecords'
,
err
);
return
error
(
e
);
}
);
}
}
export
function
getZone
(
domain
,
success
,
error
)
{
export
function
getZone
(
domain
,
success
,
error
)
{
initPowerDNS
().
then
(
const
api
=
initPowerDNS
();
(
api
)
=>
{
api
.
getZone
(
domain
,
(
er
,
data
)
=>
{
api
.
getZone
(
domain
,
(
er
,
data
)
=>
{
if
(
er
)
{
if
(
er
)
{
return
error
(
er
);
return
error
(
er
);
...
@@ -711,17 +706,10 @@ export function getZone(domain, success, error) {
...
@@ -711,17 +706,10 @@ export function getZone(domain, success, error) {
return
success
(
data
);
return
success
(
data
);
});
});
},
(
err
)
=>
{
const
e
=
handleError
(
'getZone'
,
err
);
return
error
(
e
);
}
);
}
}
export
function
modifyOrCreateRecords
(
record
,
success
,
error
)
{
export
function
modifyOrCreateRecords
(
record
,
success
,
error
)
{
initPowerDNS
().
then
(
const
api
=
initPowerDNS
();
(
api
)
=>
{
api
.
modifyOrCreateRecords
(
record
,
(
err
,
data
)
=>
{
api
.
modifyOrCreateRecords
(
record
,
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
const
e
=
handleError
(
'modifyOrCreateRecords'
,
err
);
const
e
=
handleError
(
'modifyOrCreateRecords'
,
err
);
...
@@ -730,17 +718,10 @@ export function modifyOrCreateRecords(record, success, error) {
...
@@ -730,17 +718,10 @@ export function modifyOrCreateRecords(record, success, error) {
return
success
(
data
);
return
success
(
data
);
});
});
},
(
err
)
=>
{
const
e
=
handleError
(
'modifyOrCreateRecords'
,
err
);
return
error
(
e
);
}
);
}
}
export
function
deleteRecords
(
zoneUrl
,
record
,
success
,
error
)
{
export
function
deleteRecords
(
zoneUrl
,
record
,
success
,
error
)
{
initPowerDNS
().
then
(
const
api
=
initPowerDNS
();
(
api
)
=>
{
api
.
deleteRecords
(
zoneUrl
,
record
,
(
err
,
data
)
=>
{
api
.
deleteRecords
(
zoneUrl
,
record
,
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
const
e
=
handleError
(
'deleteRecords'
,
err
);
const
e
=
handleError
(
'deleteRecords'
,
err
);
...
@@ -749,10 +730,4 @@ export function deleteRecords(zoneUrl, record, success, error) {
...
@@ -749,10 +730,4 @@ export function deleteRecords(zoneUrl, record, success, error) {
return
success
(
data
);
return
success
(
data
);
});
});
},
(
err
)
=>
{
const
e
=
handleError
(
'deleteRecords'
,
err
);
return
error
(
e
);
}
);
}
}
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