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
d36467ce
Commit
d36467ce
authored
May 24, 2016
by
Juorder Gonzalez
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #100 from ZBoxApp/issues_resolved_manager
add pagination to companies section
parents
2b204ae9
2a4f264a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
5 deletions
+36
-5
companies.jsx
src/components/companies/companies.jsx
+36
-5
No files found.
src/components/companies/companies.jsx
View file @
d36467ce
...
...
@@ -8,6 +8,7 @@ import Promise from 'bluebird';
import
MessageBar
from
'../message_bar.jsx'
;
import
PageInfo
from
'../page_info.jsx'
;
import
Panel
from
'../panel.jsx'
;
import
Pagination
from
'../pagination.jsx'
;
import
CompaniesStore
from
'../../stores/company_store.jsx'
;
import
ZimbraStore
from
'../../stores/zimbra_store.jsx'
;
...
...
@@ -26,12 +27,16 @@ export default class Companies extends React.Component {
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{};
this
.
getCompanies
=
this
.
getCompanies
.
bind
(
this
);
this
.
getDomains
=
this
.
getDomains
.
bind
(
this
);
this
.
getPlans
=
this
.
getPlans
.
bind
(
this
);
this
.
gotoCompany
=
this
.
gotoCompany
.
bind
(
this
);
const
page
=
parseInt
(
this
.
props
.
location
.
query
.
page
,
10
)
||
1
;
this
.
state
=
{
page
,
offset
:
((
page
-
1
)
*
Constants
.
QueryOptions
.
DEFAULT_LIMIT
)
};
this
.
isGlobalAdmin
=
UserStore
.
isGlobalAdmin
();
}
...
...
@@ -160,7 +165,15 @@ export default class Companies extends React.Component {
});
}
componentWillReceiveProps
()
{
componentWillReceiveProps
(
nextProps
)
{
const
arePagesDiff
=
(
nextProps
.
location
.
query
.
page
!==
this
.
props
.
location
.
query
.
page
);
if
(
arePagesDiff
)
{
const
page
=
parseInt
(
nextProps
.
location
.
query
.
page
,
10
)
||
1
;
this
.
setState
({
page
,
offset
:
((
page
-
1
)
*
Constants
.
QueryOptions
.
DEFAULT_LIMIT
)
});
}
GlobalActions
.
emitEndLoading
();
}
...
...
@@ -180,6 +193,8 @@ export default class Companies extends React.Component {
let
panelBody
;
let
noLimitError
;
let
pagination
=
null
;
if
(
this
.
state
.
companies
.
length
===
0
)
{
panelBody
=
(
<
div
className=
'center-block text-center'
>
...
...
@@ -192,7 +207,23 @@ export default class Companies extends React.Component {
</
div
>
);
}
else
{
const
rows
=
this
.
state
.
companies
.
map
((
c
)
=>
{
const
data
=
this
.
state
.
companies
;
if
(
data
.
length
>
Constants
.
QueryOptions
.
DEFAULT_LIMIT
)
{
const
totalPages
=
Math
.
ceil
(
data
.
length
/
Constants
.
QueryOptions
.
DEFAULT_LIMIT
);
pagination
=
(
<
Pagination
key=
'panelPaginationCompanies'
url=
'companies'
currentPage=
{
this
.
state
.
page
}
totalPages=
{
totalPages
}
/>
);
}
const
chunk
=
data
.
slice
(
this
.
state
.
offset
,
(
this
.
state
.
page
*
Constants
.
QueryOptions
.
DEFAULT_LIMIT
));
const
rows
=
chunk
.
map
((
c
)
=>
{
const
cos
=
Utils
.
getEnabledPlansByCosId
(
ZimbraStore
.
getAllCos
());
const
plansString
=
[];
const
domains
=
c
.
domains
;
...
...
@@ -290,7 +321,7 @@ export default class Companies extends React.Component {
<
div
className=
'col-md-12 central-content'
>
<
Panel
hasHeader=
{
false
}
children=
{
panelBody
}
children=
{
[
panelBody
,
pagination
]
}
/>
</
div
>
</
div
>
...
...
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