-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
290 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
plugins/admin/components/Configuration/LicenseDetailsPage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import React, { useEffect, useState } from 'react' | ||
import { useTranslation } from "react-i18next"; | ||
import { connect } from 'react-redux' | ||
import GluuFormDetailRow from '../../../../app/routes/Apps/Gluu/GluuFormDetailRow' | ||
import { HeaderMain } from '../../../../app/routes/components/HeaderMain' | ||
import { getLicenseDetails } from '../../redux/actions/LicenseDetailsActions' | ||
import { Container, Row, Col } from '../../../../app/components' | ||
|
||
function LicenseDetailsPage({ item, loading, dispatch }) { | ||
const { t } = useTranslation(); | ||
|
||
useEffect(() => { | ||
dispatch(getLicenseDetails()) | ||
}, []); | ||
|
||
return ( | ||
<React.Fragment> | ||
{/* <Container> */} | ||
<HeaderMain | ||
title={t('fields.licenseDetails')} | ||
className="mb-5 mt-4" | ||
/> | ||
<Container style={{ backgroundColor: '#F5F5F5' }}> | ||
<Row> | ||
<Col sm={3}> | ||
<GluuFormDetailRow | ||
label="fields.productName" | ||
value={item.productName} | ||
isBadge={true} | ||
/> | ||
</Col> | ||
<Col sm={9}> | ||
<GluuFormDetailRow | ||
label="fields.productCode" | ||
value={item.productCode} | ||
isBadge={true} | ||
lsize={3} | ||
rsize={9} | ||
/> | ||
</Col> | ||
</Row> | ||
<Row> | ||
<Col sm={3}> | ||
<GluuFormDetailRow | ||
label="fields.licenseType" | ||
value={item.licenseType} | ||
isBadge={true} | ||
/> | ||
</Col> | ||
<Col sm={9}> | ||
<GluuFormDetailRow | ||
label="fields.maxActivations" | ||
value={item.maxActivations} | ||
isBadge={true} | ||
lsize={3} | ||
rsize={9} | ||
/> | ||
</Col> | ||
</Row> | ||
<Row> | ||
<Col sm={3}> | ||
<GluuFormDetailRow | ||
label="fields.licenseKey" | ||
value={item.licenseKey} | ||
isBadge={true} | ||
/> | ||
</Col> | ||
<Col sm={9}> | ||
<GluuFormDetailRow | ||
label="fields.isLicenseActive" | ||
value={item.isLicenseActive} | ||
isBadge={true} | ||
lsize={3} | ||
rsize={9} | ||
/> | ||
</Col> | ||
</Row> | ||
<Row> | ||
<Col sm={3}> | ||
<GluuFormDetailRow | ||
label="fields.validityPeriod" | ||
value={item.validityPeriod} | ||
isBadge={true} | ||
/> | ||
</Col> | ||
<Col sm={9}> | ||
<GluuFormDetailRow | ||
label="fields.companyName" | ||
value={item.companyName} | ||
isBadge={true} | ||
lsize={3} | ||
rsize={9} | ||
/> | ||
</Col> | ||
</Row> | ||
<Row> | ||
<Col sm={3}> | ||
<GluuFormDetailRow | ||
label="fields.customerEmail" | ||
value={item.customerEmail} | ||
isBadge={true} | ||
/> | ||
</Col> | ||
<Col sm={9}> | ||
<GluuFormDetailRow | ||
label="fields.companyName" | ||
value={item.customerFirstName + " " + item.customerLastName} | ||
isBadge={true} | ||
lsize={3} | ||
rsize={9} | ||
/> | ||
</Col> | ||
</Row> | ||
</Container> | ||
|
||
</React.Fragment> | ||
) | ||
} | ||
|
||
const mapStateToProps = (state) => { | ||
alert(JSON.stringify(state.licenseDetailsReducer.item)) | ||
return { | ||
item: state.licenseDetailsReducer.item, | ||
loading: state.licenseDetailsReducer.loading, | ||
} | ||
} | ||
export default connect(mapStateToProps)(LicenseDetailsPage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { GET_LICENSE_DETAILS, GET_LICENSE_DETAILS_RESPONSE } from './types' | ||
|
||
export const getLicenseDetails = () => ({ | ||
type: GET_LICENSE_DETAILS, | ||
}) | ||
|
||
export const getLicenseDetailsResponse = (data) => ({ | ||
type: GET_LICENSE_DETAILS_RESPONSE, | ||
payload: { data }, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import axios from '../../../../app/redux/api/axios' | ||
|
||
// Get License Details | ||
export const getLicenseDetails = async () => { | ||
return await axios | ||
.get('/license/getLicenseDetails') | ||
.then((response) => response.data) | ||
.catch((error) => { | ||
console.error( | ||
'Problems getting license details in order to process authz code flow.', | ||
error, | ||
) | ||
return -1 | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { GET_LICENSE_DETAILS, GET_LICENSE_DETAILS_RESPONSE } from '../actions/types' | ||
import reducerRegistry from '../../../../app/redux/reducers/ReducerRegistry' | ||
const INIT_STATE = { | ||
item: {}, | ||
loading: true, | ||
} | ||
|
||
const reducerName = 'licenseDetailsReducer' | ||
|
||
export default function licenseDetailsReducer(state = INIT_STATE, action) { | ||
switch (action.type) { | ||
case GET_LICENSE_DETAILS: | ||
alert('-------') | ||
return { | ||
...state, | ||
loading: true, | ||
} | ||
case GET_LICENSE_DETAILS_RESPONSE: | ||
if (action.payload.data) { | ||
return { | ||
...state, | ||
item: action.payload.data, | ||
loading: false, | ||
} | ||
} else { | ||
return { | ||
...state, | ||
loading: false, | ||
} | ||
} | ||
default: | ||
return { | ||
...state, | ||
} | ||
} | ||
} | ||
reducerRegistry.register(reducerName, licenseDetailsReducer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* License Sagas | ||
*/ | ||
import { all, call, fork, put, takeEvery } from 'redux-saga/effects' | ||
import { GET_LICENSE_DETAILS, GET_LICENSE_DETAILS_RESPONSE } from '../actions/types' | ||
import { | ||
getLicenseDetailsResponse, | ||
} from '../actions/LicenseDetailsActions' | ||
|
||
import { | ||
getLicenseDetails, | ||
} from '../api/LicenseDetailsApi' | ||
|
||
function* getLicenseDetailsPresentWorker() { | ||
try { | ||
alert('Inside getLicenseDetailsPresentWorker') | ||
const response = yield call(getLicenseDetails) | ||
alert(response) | ||
if (response) { | ||
yield put(getLicenseDetailsResponse(response)) | ||
return | ||
} | ||
} catch (error) { | ||
console.log('Error in fetching License Details.', error) | ||
} | ||
yield put(getLicenseDetailsResponse()) | ||
} | ||
|
||
//watcher sagas | ||
export function* getLicensePresentWatcher() { | ||
yield takeEvery(GET_LICENSE_DETAILS, getLicenseDetailsPresentWorker) | ||
} | ||
|
||
|
||
/** | ||
* License Root Saga | ||
*/ | ||
export default function* rootSaga() { | ||
yield all([ | ||
fork(getLicensePresentWatcher), | ||
]) | ||
} |