Add data to system info help page

[MAILPOET-949]
This commit is contained in:
Pavel Dohnal
2017-06-29 09:34:28 +01:00
parent b4be9e1d28
commit 7fa94a67c9
3 changed files with 35 additions and 3 deletions

View File

@ -1,10 +1,35 @@
import React from 'react'
import MailPoet from 'mailpoet'
import _ from 'underscore'
import Tabs from './tabs.jsx'
function KnowledgeBase() {
function handleFocus(event) {
event.target.select();
}
function printData(data) {
if (_.isObject(data)) {
const printableData = Object.keys(data).map((key) => {
return `${key}: ${data[key]}`;
});
return (<textarea
readOnly={true}
onFocus={handleFocus}
value={printableData.join("\n")}
style={{
width: "100%",
height: "400px",
}}
/>);
} else {
return (<p>{MailPoet.I18n.t('systemInfoDataError')}</p>);
}
}
function KnowledgeBase() {
const data = window.help_scout_data;
return (
<div>
<h1 className="title">
@ -17,7 +42,7 @@ function KnowledgeBase() {
<p>{MailPoet.I18n.t('systemInfoIntro')}</p>
</div>
<textarea readOnly={true}></textarea>
{printData(data)}
</div>
);
};