Max Red - add items from fixtures to registration api keys [skip ci]

This commit is contained in:
ivan 2017-01-17 21:39:16 -03:00
parent e04d967c14
commit 18b736dea7
4 changed files with 101 additions and 4 deletions

View File

@ -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 (
<div className="admin-panel-system-settings">
@ -62,11 +68,52 @@ class AdminPanelAdvancedSettings extends React.Component {
<div className="col-md-12">
<span className="separator" />
</div>
<div className="col-md-12 admin-panel-system-settings__api-keys">
<div className="col-md-12 admin-panel-system-settings__api-keys-title">{i18n('REGISTRATION_API_KEYS')}</div>
<div className="col-md-4">
<Listing {...this.getListingProps()} />
</div>
<div className="col-md-8">
<div className="admin-panel-system-settings__api-keys-subtitle">{i18n('NAME_OF_KEY')}</div>
<div></div>
<div className="admin-panel-system-settings__api-keys-subtitle">{i18n('KEY')}</div>
<div></div>
<Button className="admin-panel-system-settings__api-keys-button" size="medium">{i18n('DELETE')}</Button>
</div>
</div>
</div>
</div>
);
}
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(<div>{i18n('PLEASE_CONFIRM_PASSWORD')}</div>, (a) => a, 'secure');
}

View File

@ -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;
}
}
}

View File

@ -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,

View File

@ -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',