Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Website
Commits
f2853042
Commit
f2853042
authored
Nov 10, 2018
by
Matija Obreza
Browse files
Sensible code updates from Catalog
parent
d3607bd2
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/requests/ui/StepperPage.tsx
View file @
f2853042
...
...
@@ -19,7 +19,7 @@ import {log} from 'utilities/debug';
import
PageLayout
from
'
ui/layout/PageLayout
'
;
import
{
BaseStepperPage
}
from
'
ui/pages/_base/StepperPage
'
;
import
steps
from
'
requests/ui/request-stepper/steps
'
;
import
ContentHeader
from
'
../../
ui/common/heading/ContentHeader
'
;
import
ContentHeader
from
'
ui/common/heading/ContentHeader
'
;
interface
IRequestStepperPageProps
extends
React
.
ClassAttributes
<
any
>
{
initiateRequest
:
()
=>
Promise
<
MaterialRequest
>
;
...
...
src/service/genesys/GeoService.ts
View file @
f2853042
...
...
@@ -6,11 +6,15 @@ import CountryDetails from 'model/geo/CountryDetails';
import
GeoRegion
from
'
model/geo/GeoRegion
'
;
import
RegionDetails
from
'
model/geo/RegionDetails
'
;
const
URL_LIST_COUNTRIES
=
`/api/v1/geo/countries`
;
const
URL_GET_COUNTRY_DETAILS
=
UrlTemplate
.
parse
(
`/api/v1/geo/country/details/{iso3code}`
);
const
URL_GET_GEO_REGIONS
=
`/api/v1/geo/regions`
;
const
URL_GET_GEO_REGION
=
UrlTemplate
.
parse
(
`/api/v1/geo/region/details/{isoCode}`
);
const
URL_GET
=
UrlTemplate
.
parse
(
`/api/v0/geo/iso3166/{code}`
);
const
URL_GET_COUNTRY
=
UrlTemplate
.
parse
(
`/api/v1/geo/country/{iso3code}`
);
class
GeoService
{
/**
...
...
@@ -83,6 +87,42 @@ class GeoService {
}).
then
(({
data
})
=>
data
as
RegionDetails
);
}
/**
* get at /api/v0/geo/iso3166/{code}
*
* @param code code
*/
public
static
get
(
code
?:
string
):
Promise
<
any
>
{
const
apiUrl
=
URL_GET
.
expand
({
code
});
// console.log(`Fetching from ${apiUrl}`);
const
content
=
{
/* No content in request body */
};
return
axiosBackend
.
request
({
url
:
apiUrl
,
method
:
'
GET
'
,
...
content
,
}).
then
(({
data
})
=>
data
as
any
);
}
/**
* getCountry at /api/v1/geo/country/{iso3code}
*
* @param iso3code iso3code
*/
public
static
getCountry
(
iso3code
:
string
):
Promise
<
Country
>
{
const
apiUrl
=
URL_GET_COUNTRY
.
expand
({
iso3code
});
// console.log(`Fetching from ${apiUrl}`);
const
content
=
{
/* No content in request body */
};
return
axiosBackend
.
request
({
url
:
apiUrl
,
method
:
'
GET
'
,
...
content
,
}).
then
(({
data
})
=>
data
as
Country
);
}
}
export
default
GeoService
;
src/service/genesys/SubsetService.ts
View file @
f2853042
...
...
@@ -320,7 +320,7 @@ class SubsetService {
return
axiosBackend
.
request
({
url
:
apiUrl
,
method
:
'
DELETE
'
,
method
:
'
POST
'
,
...
content
,
}).
then
(({
data
})
=>
data
as
SubsetCreator
);
}
...
...
src/subsets/actions/public.ts
View file @
f2853042
...
...
@@ -14,6 +14,7 @@ import FilteredPage, { IPageRequest } from 'model/FilteredPage';
import
Subset
from
'
model/subset/Subset
'
;
import
SubsetFilter
from
'
model/subset/SubsetFilter
'
;
import
SubsetService
from
'
service/genesys/SubsetService
'
;
import
Page
from
'
model/Page
'
;
const
receiveSubsets
=
(
paged
:
FilteredPage
<
Subset
>
,
error
=
null
)
=>
({
type
:
RECEIVE_SUBSETS
,
...
...
@@ -30,8 +31,19 @@ const receiveSubset = (subset: Subset, error = null) => ({
payload
:
{
subset
,
error
},
});
export
const
listSubsetsPromise
=
(
filter
:
string
|
SubsetFilter
,
page
:
IPageRequest
)
=>
(
dispatch
,
getState
):
Promise
<
FilteredPage
<
Subset
>>
=>
{
return
SubsetService
.
list
(
filter
,
page
);
export
const
loadMoreSubsets
=
(
paged
:
FilteredPage
<
Subset
>
)
=>
(
dispatch
,
getState
)
=>
{
return
SubsetService
.
list
(
paged
?
paged
.
filterCode
:
''
,
Page
.
nextPage
(
paged
))
.
then
((
paged
)
=>
{
if
(
paged
.
number
===
0
)
{
dispatch
(
receiveSubsets
(
paged
));
}
else
{
dispatch
(
appendSubsets
(
paged
));
}
dispatch
(
updateRoute
(
paged
));
}).
catch
((
error
)
=>
{
console
.
log
(
`API error`
,
error
);
dispatch
(
receiveSubsets
(
null
,
error
));
});
};
export
const
listMySubsetsPromise
=
(
filter
:
string
|
SubsetFilter
,
page
:
IPageRequest
)
=>
(
dispatch
,
getState
):
Promise
<
FilteredPage
<
Subset
>>
=>
{
...
...
src/subsets/ui/BrowsePage.tsx
View file @
f2853042
...
...
@@ -5,7 +5,7 @@ import {bindActionCreators} from 'redux';
import
{
parse
}
from
'
query-string
'
;
// Actions
import
{
applyFilters
,
loadSubsets
Page
,
updateRoute
}
from
'
subsets/actions/public
'
;
import
{
applyFilters
,
load
More
Subsets
,
updateRoute
}
from
'
subsets/actions/public
'
;
// Models
import
Page
from
'
model/Page
'
;
...
...
@@ -53,7 +53,7 @@ class BrowsePage extends BrowsePageTemplate<Subset> {
<
PaginationComponent
pageObj
=
{
paged
}
onSortChange
=
{
this
.
onSortChange
}
displayName
=
"
subsets.common.modelName
"
displayName
=
{
t
(
'
subsets.common.modelName
'
)
}
sortOptions
=
{
Subset
.
SORT_OPTIONS
}
infinite
/>
...
...
@@ -84,7 +84,7 @@ const mapStateToProps = (state, ownProps) => ({
const
mapDispatchToProps
=
(
dispatch
)
=>
bindActionCreators
({
applyFilters
,
loadData
Page
:
loadSubsets
Page
,
load
More
Data
:
load
More
Subsets
,
updateRoute
,
},
dispatch
);
...
...
src/ui/common/Properties.tsx
View file @
f2853042
...
...
@@ -79,6 +79,7 @@ class PropertiesItem1 extends React.Component<IItemProps & WithStyles<'propertie
}
interface
IProps
extends
React
.
ClassAttributes
<
any
>
{
className
?:
string
;
// classes: any;
// children: any;
}
...
...
src/ui/common/heading/index.tsx
View file @
f2853042
import
*
as
React
from
'
react
'
;
interface
IProps
extends
React
.
Props
<
any
>
{
title
:
string
;
level
?:
number
;
title
:
string
;
level
?:
number
;
}
export
default
function
Heading
({
title
=
'
Default heading
'
,
level
=
1
,
title
=
'
Default heading
'
,
level
=
1
,
}:
IProps
)
{
switch
(
level
)
{
case
1
:
return
(<
h1
>
{
title
}
</
h1
>);
case
2
:
return
(<
h2
>
{
title
}
</
h2
>);
case
3
:
return
(<
h3
>
{
title
}
</
h3
>);
case
4
:
return
(<
h4
>
{
title
}
</
h4
>);
case
5
:
return
(<
h5
>
{
title
}
</
h5
>);
default
:
return
(<
h6
>
{
title
}
</
h6
>);
}
switch
(
level
)
{
case
1
:
return
(<
h1
>
{
title
}
</
h1
>);
case
2
:
return
(<
h2
>
{
title
}
</
h2
>);
case
3
:
return
(<
h3
>
{
title
}
</
h3
>);
case
4
:
return
(<
h4
>
{
title
}
</
h4
>);
case
5
:
return
(<
h5
>
{
title
}
</
h5
>);
default
:
return
(<
h6
>
{
title
}
</
h6
>);
}
}
src/ui/pages/_base/BrowsePage.tsx
View file @
f2853042
...
...
@@ -15,7 +15,7 @@ interface IBrowsePageProps<T> extends React.ClassAttributes<any> {
t
?:
any
;
}
class
BrowsePage
<
T
>
extends
React
.
Component
<
IBrowsePageProps
<
T
>
,
any
>
{
class
BrowsePage
<
T
>
extends
React
.
Component
<
IBrowsePageProps
<
T
>
&
any
,
any
>
{
constructor
(
props
:
IBrowsePageProps
<
T
>
,
context
:
any
)
{
super
(
props
,
context
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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