Removed MessageForAuthor feature
parent
2f12be405a
commit
86931af2c4
|
@ -8,6 +8,9 @@
|
||||||
"NUMBER": "{{number,intlNumber}}",
|
"NUMBER": "{{number,intlNumber}}",
|
||||||
"DECIMAL": "{{number,intlDecimal}}",
|
"DECIMAL": "{{number,intlDecimal}}",
|
||||||
"DECIMAL2": "{{number,intlDecimal2}}",
|
"DECIMAL2": "{{number,intlDecimal2}}",
|
||||||
|
"Global": {
|
||||||
|
"InDevelopment": "In development..."
|
||||||
|
},
|
||||||
"Language": {
|
"Language": {
|
||||||
"English": "English",
|
"English": "English",
|
||||||
"Romanian": "Romanian"
|
"Romanian": "Romanian"
|
||||||
|
@ -99,10 +102,6 @@
|
||||||
"ActiveSession": "Active session",
|
"ActiveSession": "Active session",
|
||||||
"ActiveSessionSubtitle": "Expand to see forwards",
|
"ActiveSessionSubtitle": "Expand to see forwards",
|
||||||
"DDNSProvider": "Dynamic DNS Provider",
|
"DDNSProvider": "Dynamic DNS Provider",
|
||||||
"Actions": {
|
|
||||||
"SendMessageToAuthor": "Send message to author"
|
|
||||||
},
|
|
||||||
"MessageForAuthor": "Message for author",
|
|
||||||
"Details": "Details"
|
"Details": "Details"
|
||||||
},
|
},
|
||||||
"Charts": {
|
"Charts": {
|
||||||
|
@ -116,9 +115,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Notifications": {
|
|
||||||
"MessageSaved": "Message saved"
|
|
||||||
},
|
|
||||||
"Chatbot": {
|
"Chatbot": {
|
||||||
"Wizard": {
|
"Wizard": {
|
||||||
"Message1": "I'm the wizard.",
|
"Message1": "I'm the wizard.",
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
{
|
{
|
||||||
|
"Global": {
|
||||||
|
"InDevelopment": "In curs de dezvoltare..."
|
||||||
|
},
|
||||||
"Language": {
|
"Language": {
|
||||||
"English": "Engleză",
|
"English": "Engleză",
|
||||||
"Romanian": "Română"
|
"Romanian": "Română"
|
||||||
|
@ -90,10 +93,6 @@
|
||||||
"ActiveSession": "Sesiune activă",
|
"ActiveSession": "Sesiune activă",
|
||||||
"ActiveSessionSubtitle": "Extindeţi pentru a vedea redirectările",
|
"ActiveSessionSubtitle": "Extindeţi pentru a vedea redirectările",
|
||||||
"DDNSProvider": "Furnizor DNS dinamic",
|
"DDNSProvider": "Furnizor DNS dinamic",
|
||||||
"Actions": {
|
|
||||||
"SendMessageToAuthor": "Trimite mesaj către autor"
|
|
||||||
},
|
|
||||||
"MessageForAuthor": "Mesaj pentru autor",
|
|
||||||
"Details": "Detalii"
|
"Details": "Detalii"
|
||||||
},
|
},
|
||||||
"Charts": {
|
"Charts": {
|
||||||
|
@ -107,9 +106,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Notifications": {
|
|
||||||
"MessageSaved": "Mesaj salvat"
|
|
||||||
},
|
|
||||||
"Chatbot": {
|
"Chatbot": {
|
||||||
"Wizard": {
|
"Wizard": {
|
||||||
"Message1": "Eu sunt vrăjitorul.",
|
"Message1": "Eu sunt vrăjitorul.",
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
import * as types from "./actionTypes";
|
|
||||||
import api from "./api";
|
|
||||||
import { sendHttpRequest } from "../../redux/actions/httpActions";
|
|
||||||
|
|
||||||
export function saveMessageForAuthor(messageContent) {
|
|
||||||
return async function (dispatch, getState) {
|
|
||||||
try {
|
|
||||||
const sessionId = getState().frontendSession.sessionId;
|
|
||||||
const event = await dispatch(
|
|
||||||
sendHttpRequest(api.saveMessageForAuthor(sessionId, messageContent))
|
|
||||||
);
|
|
||||||
dispatch({ type: types.SAVE_MESSAGE_FOR_AUTHOR_SUCCESS, payload: event });
|
|
||||||
return event;
|
|
||||||
} catch (error) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
export const SAVE_MESSAGE_FOR_AUTHOR_SUCCESS =
|
|
||||||
"SAVE_MESSAGE_FOR_AUTHOR_SUCCESS";
|
|
|
@ -1,9 +0,0 @@
|
||||||
import { post } from "../../api/axiosApi";
|
|
||||||
const baseUrl = process.env.REVERSE_PROXY_API_URL;
|
|
||||||
|
|
||||||
const saveMessageForAuthor = (sessionId, messageContent) =>
|
|
||||||
post(`${baseUrl}/system/message-for-author`, { sessionId, messageContent });
|
|
||||||
|
|
||||||
export default {
|
|
||||||
saveMessageForAuthor
|
|
||||||
};
|
|
|
@ -1,66 +0,0 @@
|
||||||
import React, { useState } from "react";
|
|
||||||
import { connect } from "react-redux";
|
|
||||||
import { bindActionCreators } from "redux";
|
|
||||||
import PropTypes from "prop-types";
|
|
||||||
import MessageForAuthorDialog from "./MessageForAuthorDialog";
|
|
||||||
import { saveMessageForAuthor } from "../actionCreators";
|
|
||||||
import { showInfo, showError } from "../../snackbar/actionCreators";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
|
|
||||||
const MessageForAuthorContainer = ({ actions, open, handleClose }) => {
|
|
||||||
const [messageForAuthor, setMessageForAuthor] = useState("");
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
const onMessageForAuthorChanged = (event) => {
|
|
||||||
const value = event.target.value;
|
|
||||||
setMessageForAuthor(value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const saveMessage = () => {
|
|
||||||
actions
|
|
||||||
.saveMessageForAuthor(messageForAuthor)
|
|
||||||
.then((event) => {
|
|
||||||
if (event.success) actions.showInfo(t("Notifications.MessageSaved"));
|
|
||||||
else actions.showError(event.message);
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
actions.showError(error);
|
|
||||||
});
|
|
||||||
setMessageForAuthor("");
|
|
||||||
handleClose();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<MessageForAuthorDialog
|
|
||||||
open={open}
|
|
||||||
handleClose={handleClose}
|
|
||||||
messageForAuthor={messageForAuthor}
|
|
||||||
onMessageForAuthorChanged={onMessageForAuthorChanged}
|
|
||||||
saveMessage={saveMessage}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
MessageForAuthorContainer.propTypes = {
|
|
||||||
actions: PropTypes.object.isRequired,
|
|
||||||
open: PropTypes.bool.isRequired,
|
|
||||||
handleClose: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
function mapStateToProps() {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
|
||||||
return {
|
|
||||||
actions: bindActionCreators(
|
|
||||||
{ saveMessageForAuthor, showInfo, showError },
|
|
||||||
dispatch
|
|
||||||
)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(
|
|
||||||
mapStateToProps,
|
|
||||||
mapDispatchToProps
|
|
||||||
)(MessageForAuthorContainer);
|
|
|
@ -1,69 +0,0 @@
|
||||||
import React from "react";
|
|
||||||
import PropTypes from "prop-types";
|
|
||||||
import TextField from "@material-ui/core/TextField";
|
|
||||||
import {
|
|
||||||
Dialog,
|
|
||||||
DialogContent,
|
|
||||||
IconButton,
|
|
||||||
Grid,
|
|
||||||
Tooltip
|
|
||||||
} from "@material-ui/core";
|
|
||||||
import SendRoundedIcon from "@material-ui/icons/SendRounded";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
|
|
||||||
const MessageForAuthorDialog = ({
|
|
||||||
open,
|
|
||||||
handleClose,
|
|
||||||
messageForAuthor,
|
|
||||||
onMessageForAuthorChanged,
|
|
||||||
saveMessage
|
|
||||||
}) => {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<Dialog
|
|
||||||
fullWidth
|
|
||||||
open={open}
|
|
||||||
onClose={handleClose}
|
|
||||||
aria-labelledby="form-dialog-title"
|
|
||||||
>
|
|
||||||
<DialogContent>
|
|
||||||
<Grid container>
|
|
||||||
<Grid item xs={11} sm={11} md={11}>
|
|
||||||
<TextField
|
|
||||||
autoFocus
|
|
||||||
id="message-for-author"
|
|
||||||
label={t("Server.MessageForAuthor")}
|
|
||||||
fullWidth
|
|
||||||
value={messageForAuthor}
|
|
||||||
onChange={onMessageForAuthorChanged}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={1} sm={1} md={1}>
|
|
||||||
<Tooltip title={t("General.Send")}>
|
|
||||||
<IconButton
|
|
||||||
aria-label="send message"
|
|
||||||
onClick={saveMessage}
|
|
||||||
color="primary"
|
|
||||||
>
|
|
||||||
<SendRoundedIcon />
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
MessageForAuthorDialog.propTypes = {
|
|
||||||
open: PropTypes.bool.isRequired,
|
|
||||||
handleClose: PropTypes.func.isRequired,
|
|
||||||
messageForAuthor: PropTypes.string.isRequired,
|
|
||||||
onMessageForAuthorChanged: PropTypes.func.isRequired,
|
|
||||||
saveMessage: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default MessageForAuthorDialog;
|
|
|
@ -18,7 +18,7 @@ import ShareIcon from "@material-ui/icons/Share";
|
||||||
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
|
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
|
||||||
import MoreVertIcon from "@material-ui/icons/MoreVert";
|
import MoreVertIcon from "@material-ui/icons/MoreVert";
|
||||||
import DnsRoundedIcon from "@material-ui/icons/DnsRounded";
|
import DnsRoundedIcon from "@material-ui/icons/DnsRounded";
|
||||||
import MessageRoundedIcon from "@material-ui/icons/MessageRounded";
|
import DeveloperBoardIcon from "@material-ui/icons/DeveloperBoard";
|
||||||
import styles from "../../../components/common/styles/expandableCardStyles";
|
import styles from "../../../components/common/styles/expandableCardStyles";
|
||||||
import ServerSummary from "./ServerSummary";
|
import ServerSummary from "./ServerSummary";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
@ -31,7 +31,6 @@ const ServerComponent = ({
|
||||||
serverHost,
|
serverHost,
|
||||||
openAbout,
|
openAbout,
|
||||||
handleOpenInNewTab,
|
handleOpenInNewTab,
|
||||||
showMessageForAuthor,
|
|
||||||
summonWizard
|
summonWizard
|
||||||
}) => {
|
}) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
@ -44,7 +43,7 @@ const ServerComponent = ({
|
||||||
setExpanded(!expanded);
|
setExpanded(!expanded);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClick = (event) => {
|
const handleClick = event => {
|
||||||
setAnchorEl(event.currentTarget);
|
setAnchorEl(event.currentTarget);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -98,12 +97,9 @@ const ServerComponent = ({
|
||||||
)}
|
)}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardActions disableSpacing>
|
<CardActions disableSpacing>
|
||||||
<Tooltip title={t("Server.Actions.SendMessageToAuthor")}>
|
<Tooltip title={t("Global.InDevelopment")}>
|
||||||
<IconButton
|
<IconButton aria-label="in development" onClick={() => {}}>
|
||||||
aria-label="sent message"
|
<DeveloperBoardIcon />
|
||||||
onClick={showMessageForAuthor}
|
|
||||||
>
|
|
||||||
<MessageRoundedIcon />
|
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<IconButton aria-label="share">
|
<IconButton aria-label="share">
|
||||||
|
@ -135,7 +131,6 @@ ServerComponent.propTypes = {
|
||||||
serverHost: PropTypes.string,
|
serverHost: PropTypes.string,
|
||||||
openAbout: PropTypes.func.isRequired,
|
openAbout: PropTypes.func.isRequired,
|
||||||
handleOpenInNewTab: PropTypes.func.isRequired,
|
handleOpenInNewTab: PropTypes.func.isRequired,
|
||||||
showMessageForAuthor: PropTypes.func.isRequired,
|
|
||||||
summonWizard: PropTypes.func.isRequired
|
summonWizard: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,54 +1,36 @@
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { bindActionCreators } from "redux";
|
import { bindActionCreators } from "redux";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { loadServerData, loadSystemVersion } from "../actionCreators";
|
import { loadServerData, loadSystemVersion } from "../actionCreators";
|
||||||
import ServerComponent from "./ServerComponent";
|
import ServerComponent from "./ServerComponent";
|
||||||
import { withRouter } from "react-router-dom";
|
import { withRouter } from "react-router-dom";
|
||||||
import MessageForAuthorContainer from "../../messageForAuthor/components/MessageForAuthorContainer";
|
|
||||||
import { summonWizard } from "../../chatbot/actionCreators";
|
import { summonWizard } from "../../chatbot/actionCreators";
|
||||||
|
|
||||||
const ServerContainer = ({ actions, data, serverHost, history }) => {
|
const ServerContainer = ({ actions, data, serverHost, history }) => {
|
||||||
const [openMessageForAuthor, setOpenMessageForAuthor] = useState(false);
|
|
||||||
|
|
||||||
const closeMessageForAuthor = () => {
|
|
||||||
setOpenMessageForAuthor(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const showMessageForAuthor = () => {
|
|
||||||
setOpenMessageForAuthor(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
actions.loadServerData();
|
actions.loadServerData();
|
||||||
actions.loadSystemVersion();
|
actions.loadSystemVersion();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const openAbout = (event) => {
|
const openAbout = event => {
|
||||||
history.push("/about");
|
history.push("/about");
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOpenInNewTab = (url) => (event) => {
|
const handleOpenInNewTab = url => event => {
|
||||||
window.open(url, "_blank");
|
window.open(url, "_blank");
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
|
||||||
<ServerComponent
|
<ServerComponent
|
||||||
data={data}
|
data={data}
|
||||||
serverHost={serverHost}
|
serverHost={serverHost}
|
||||||
openAbout={openAbout}
|
openAbout={openAbout}
|
||||||
handleOpenInNewTab={handleOpenInNewTab}
|
handleOpenInNewTab={handleOpenInNewTab}
|
||||||
showMessageForAuthor={showMessageForAuthor}
|
|
||||||
summonWizard={actions.summonWizard}
|
summonWizard={actions.summonWizard}
|
||||||
/>
|
/>
|
||||||
<MessageForAuthorContainer
|
|
||||||
open={openMessageForAuthor}
|
|
||||||
handleClose={closeMessageForAuthor}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue