Removed MessageForAuthor feature
parent
2f12be405a
commit
86931af2c4
|
@ -8,6 +8,9 @@
|
|||
"NUMBER": "{{number,intlNumber}}",
|
||||
"DECIMAL": "{{number,intlDecimal}}",
|
||||
"DECIMAL2": "{{number,intlDecimal2}}",
|
||||
"Global": {
|
||||
"InDevelopment": "In development..."
|
||||
},
|
||||
"Language": {
|
||||
"English": "English",
|
||||
"Romanian": "Romanian"
|
||||
|
@ -99,10 +102,6 @@
|
|||
"ActiveSession": "Active session",
|
||||
"ActiveSessionSubtitle": "Expand to see forwards",
|
||||
"DDNSProvider": "Dynamic DNS Provider",
|
||||
"Actions": {
|
||||
"SendMessageToAuthor": "Send message to author"
|
||||
},
|
||||
"MessageForAuthor": "Message for author",
|
||||
"Details": "Details"
|
||||
},
|
||||
"Charts": {
|
||||
|
@ -116,9 +115,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"Notifications": {
|
||||
"MessageSaved": "Message saved"
|
||||
},
|
||||
"Chatbot": {
|
||||
"Wizard": {
|
||||
"Message1": "I'm the wizard.",
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"Global": {
|
||||
"InDevelopment": "In curs de dezvoltare..."
|
||||
},
|
||||
"Language": {
|
||||
"English": "Engleză",
|
||||
"Romanian": "Română"
|
||||
|
@ -90,10 +93,6 @@
|
|||
"ActiveSession": "Sesiune activă",
|
||||
"ActiveSessionSubtitle": "Extindeţi pentru a vedea redirectările",
|
||||
"DDNSProvider": "Furnizor DNS dinamic",
|
||||
"Actions": {
|
||||
"SendMessageToAuthor": "Trimite mesaj către autor"
|
||||
},
|
||||
"MessageForAuthor": "Mesaj pentru autor",
|
||||
"Details": "Detalii"
|
||||
},
|
||||
"Charts": {
|
||||
|
@ -107,9 +106,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"Notifications": {
|
||||
"MessageSaved": "Mesaj salvat"
|
||||
},
|
||||
"Chatbot": {
|
||||
"Wizard": {
|
||||
"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 MoreVertIcon from "@material-ui/icons/MoreVert";
|
||||
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 ServerSummary from "./ServerSummary";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
@ -31,7 +31,6 @@ const ServerComponent = ({
|
|||
serverHost,
|
||||
openAbout,
|
||||
handleOpenInNewTab,
|
||||
showMessageForAuthor,
|
||||
summonWizard
|
||||
}) => {
|
||||
const classes = useStyles();
|
||||
|
@ -44,7 +43,7 @@ const ServerComponent = ({
|
|||
setExpanded(!expanded);
|
||||
};
|
||||
|
||||
const handleClick = (event) => {
|
||||
const handleClick = event => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
};
|
||||
|
||||
|
@ -98,12 +97,9 @@ const ServerComponent = ({
|
|||
)}
|
||||
</CardContent>
|
||||
<CardActions disableSpacing>
|
||||
<Tooltip title={t("Server.Actions.SendMessageToAuthor")}>
|
||||
<IconButton
|
||||
aria-label="sent message"
|
||||
onClick={showMessageForAuthor}
|
||||
>
|
||||
<MessageRoundedIcon />
|
||||
<Tooltip title={t("Global.InDevelopment")}>
|
||||
<IconButton aria-label="in development" onClick={() => {}}>
|
||||
<DeveloperBoardIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<IconButton aria-label="share">
|
||||
|
@ -135,7 +131,6 @@ ServerComponent.propTypes = {
|
|||
serverHost: PropTypes.string,
|
||||
openAbout: PropTypes.func.isRequired,
|
||||
handleOpenInNewTab: PropTypes.func.isRequired,
|
||||
showMessageForAuthor: 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 { bindActionCreators } from "redux";
|
||||
import PropTypes from "prop-types";
|
||||
import { loadServerData, loadSystemVersion } from "../actionCreators";
|
||||
import ServerComponent from "./ServerComponent";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import MessageForAuthorContainer from "../../messageForAuthor/components/MessageForAuthorContainer";
|
||||
import { summonWizard } from "../../chatbot/actionCreators";
|
||||
|
||||
const ServerContainer = ({ actions, data, serverHost, history }) => {
|
||||
const [openMessageForAuthor, setOpenMessageForAuthor] = useState(false);
|
||||
|
||||
const closeMessageForAuthor = () => {
|
||||
setOpenMessageForAuthor(false);
|
||||
};
|
||||
|
||||
const showMessageForAuthor = () => {
|
||||
setOpenMessageForAuthor(true);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
actions.loadServerData();
|
||||
actions.loadSystemVersion();
|
||||
}, []);
|
||||
|
||||
const openAbout = (event) => {
|
||||
const openAbout = event => {
|
||||
history.push("/about");
|
||||
event.preventDefault();
|
||||
};
|
||||
|
||||
const handleOpenInNewTab = (url) => (event) => {
|
||||
const handleOpenInNewTab = url => event => {
|
||||
window.open(url, "_blank");
|
||||
event.preventDefault();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<ServerComponent
|
||||
data={data}
|
||||
serverHost={serverHost}
|
||||
openAbout={openAbout}
|
||||
handleOpenInNewTab={handleOpenInNewTab}
|
||||
showMessageForAuthor={showMessageForAuthor}
|
||||
summonWizard={actions.summonWizard}
|
||||
/>
|
||||
<MessageForAuthorContainer
|
||||
open={openMessageForAuthor}
|
||||
handleClose={closeMessageForAuthor}
|
||||
/>
|
||||
</>
|
||||
<ServerComponent
|
||||
data={data}
|
||||
serverHost={serverHost}
|
||||
openAbout={openAbout}
|
||||
handleOpenInNewTab={handleOpenInNewTab}
|
||||
summonWizard={actions.summonWizard}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue