diff --git a/client/src/app/admin/panel/settings/admin-panel-advanced-settings.js b/client/src/app/admin/panel/settings/admin-panel-advanced-settings.js index e0151063..bb8354c8 100644 --- a/client/src/app/admin/panel/settings/admin-panel-advanced-settings.js +++ b/client/src/app/admin/panel/settings/admin-panel-advanced-settings.js @@ -2,6 +2,7 @@ import React from 'react'; import {connect} from 'react-redux'; import ConfigActions from 'actions/config-actions'; +import API from 'lib-app/api-call'; import i18n from 'lib-app/i18n'; import ToggleButton from 'app-components/toggle-button'; import AreYouSure from 'app-components/are-you-sure'; @@ -9,16 +10,21 @@ import AreYouSure from 'app-components/are-you-sure'; import Button from 'core-components/button'; import FileUploader from 'core-components/file-uploader'; import Header from 'core-components/header'; +import Listing from 'core-components/listing'; class AdminPanelAdvancedSettings extends React.Component { state = { loading: true, values: { - + apikeys: [] } }; + componentDidMount() { + this.getAllKeys(); + } + render() { return (
@@ -62,11 +68,52 @@ class AdminPanelAdvancedSettings extends React.Component {
+
+
{i18n('REGISTRATION_API_KEYS')}
+
+ +
+
+
{i18n('NAME_OF_KEY')}
+
+
{i18n('KEY')}
+
+ +
+
); } + getListingProps() { + return { + title: i18n('REGISTRATION_API_KEYS'), + enableAddNew: true, + items: this.state.values.apikeys.map((item) => { + return { + content: item.name, + icon: '' + }; + }) + } + } + + getAllKeys() { + API.call({ + path: '/system/get-all-keys', + data: {} + }).then(this.onRetrieveSuccess.bind(this)); + } + + onRetrieveSuccess(result) { + this.setState({ + values: { + apikeys: result.data + } + }); + } + onToggleButtonChange() { AreYouSure.openModal(
{i18n('PLEASE_CONFIRM_PASSWORD')}
, (a) => a, 'secure'); } diff --git a/client/src/app/admin/panel/settings/admin-panel-advanced-settings.scss b/client/src/app/admin/panel/settings/admin-panel-advanced-settings.scss index 3e836b97..30ea3730 100644 --- a/client/src/app/admin/panel/settings/admin-panel-advanced-settings.scss +++ b/client/src/app/admin/panel/settings/admin-panel-advanced-settings.scss @@ -1,3 +1,5 @@ +@import "../../../../scss/vars"; + .admin-panel-system-settings { &__user-system-enabled { @@ -21,5 +23,27 @@ &__button { margin-bottom: 30px; + width: 150px; + } + + &__api-keys { + text-align: left; + + &-title { + font-size: $font-size--bg; + margin-bottom: 20px; + text-align: left; + } + + &-subtitle { + font-size: $font-size--md; + margin-bottom: 5px; + } + + &-button { + margin-left: 20px; + margin-right: 20px; + width: 150px; + } } } diff --git a/client/src/data/fixtures/system-fixtures.js b/client/src/data/fixtures/system-fixtures.js index 8b6e0e19..3e98c9a8 100644 --- a/client/src/data/fixtures/system-fixtures.js +++ b/client/src/data/fixtures/system-fixtures.js @@ -169,13 +169,36 @@ module.exports = [ }; } }, + { + path: '/system/get-all-keys', + time: 300, + response: function () { + return { + status: "success", + data: [ + { + name: 'Game System Registration', + token: '9as8da9s51c6a51c51a9s1c9asdf1' + }, + { + name: 'PHPbb forum', + token: 'apires1qe65fq65e1f6a5e1f6afaef2' + }, + { + name: 'How do you turn this on?', + token: 'das65d4as651age16wq6ofqwwcemcw' + } + ] + } + } + }, { path: '/system/get-logs', time: 300, - response: function() { + response: function () { return { - "status": "success", - "data": [ + status: "success", + data: [ { "type": "EDIT_SETTINGS", "to": null, diff --git a/client/src/data/languages/en.js b/client/src/data/languages/en.js index 0c934834..5b9fd926 100644 --- a/client/src/data/languages/en.js +++ b/client/src/data/languages/en.js @@ -159,6 +159,9 @@ export default { 'BACKUP_DATABASE': 'Backup database', 'DELETE_ALL_USERS': 'Delete all users', 'PLEASE_CONFIRM_PASSWORD': 'Please confirm your password to make these changes', + 'REGISTRATION_API_KEYS': 'Registration API keys', + 'NAME_OF_KEY': 'Name of key', + 'KEY': 'Key', //ACTIVITIES 'ACTIVITY_COMMENT': 'commented ticket',