Adição da rule para que apenas o usuário master conecte ou desconecte a sessão do whatsapp

pull/1/head
adriano 2022-02-22 21:53:10 -03:00
parent 0db6e88477
commit eff9c9bb7e
3 changed files with 42 additions and 8 deletions

View File

@ -208,6 +208,12 @@ const Connections = () => {
const renderActionButtons = whatsApp => { const renderActionButtons = whatsApp => {
return ( return (
<Can
role={user.profile}
perform="connection-button:show"
yes={() => (
<> <>
{whatsApp.status === "qrcode" && ( {whatsApp.status === "qrcode" && (
<Button <Button
@ -220,6 +226,7 @@ const Connections = () => {
</Button> </Button>
)} )}
{whatsApp.status === "DISCONNECTED" && ( {whatsApp.status === "DISCONNECTED" && (
<> <>
<Button <Button
size="small" size="small"
@ -259,6 +266,10 @@ const Connections = () => {
</Button> </Button>
)} )}
</> </>
)}
/>
); );
}; };
@ -358,9 +369,20 @@ const Connections = () => {
<TableCell align="center"> <TableCell align="center">
{i18n.t("connections.table.status")} {i18n.t("connections.table.status")}
</TableCell> </TableCell>
<Can
role={user.profile}
perform="connection-button:show"
yes={() => (
<TableCell align="center"> <TableCell align="center">
{i18n.t("connections.table.session")} {i18n.t("connections.table.session")}
</TableCell> </TableCell>
)}
/>
<TableCell align="center"> <TableCell align="center">
{i18n.t("connections.table.lastUpdate")} {i18n.t("connections.table.lastUpdate")}
</TableCell> </TableCell>
@ -384,9 +406,19 @@ const Connections = () => {
<TableCell align="center"> <TableCell align="center">
{renderStatusToolTips(whatsApp)} {renderStatusToolTips(whatsApp)}
</TableCell> </TableCell>
<Can
role={user.profile}
perform="connection-button:show"
yes={() => (
<TableCell align="center"> <TableCell align="center">
{renderActionButtons(whatsApp)} {renderActionButtons(whatsApp)}
</TableCell> </TableCell>
)}
/>
<TableCell align="center"> <TableCell align="center">
{format(parseISO(whatsApp.updatedAt), "dd/MM/yy HH:mm")} {format(parseISO(whatsApp.updatedAt), "dd/MM/yy HH:mm")}
</TableCell> </TableCell>

View File

@ -38,6 +38,7 @@ const rules = {
"btn-add-whatsapp", "btn-add-whatsapp",
"btn-remove-whatsapp", "btn-remove-whatsapp",
"ticket-report:show", "ticket-report:show",
"connection-button:show"
], ],
}, },
}; };

View File

@ -80,7 +80,8 @@ const messages = {
qrcode: { qrcode: {
title: "Esperando leitura do QR Code", title: "Esperando leitura do QR Code",
content: content:
"Clique no botão 'QR CODE' e leia o QR Code com o seu celular para iniciar a sessão", // "Clique no botão 'QR CODE' e leia o QR Code com o seu celular para iniciar a sessão",
"Entre em contato com o suporte para realizar a leitura do QR code",
}, },
connected: { connected: {
title: "Conexão estabelecida!", title: "Conexão estabelecida!",