diff --git a/frontend/src/metabase/home/components/Activity.jsx b/frontend/src/metabase/home/components/Activity.jsx index 083345b0443dbdc5708c5a35032540c3a61b2013..4e385298dda6d0128f1e341a97dae15efbf75d59 100644 --- a/frontend/src/metabase/home/components/Activity.jsx +++ b/frontend/src/metabase/home/components/Activity.jsx @@ -68,7 +68,7 @@ export default class Activity extends Component { userName(user, currentUser) { if (user && currentUser && user.id === currentUser.id) { - return "You"; + return t`You`; } else if (user) { return user.first_name; } else { @@ -81,7 +81,7 @@ export default class Activity extends Component { // this is a base to start with const description = { userName: this.userName(item.user, user), - summary: "did some super awesome stuff thats hard to describe", + summary: t`did some super awesome stuff thats hard to describe`, timeSince: item.timestamp.fromNow() }; @@ -89,43 +89,84 @@ export default class Activity extends Component { case "card-create": case "card-update": if(item.table) { - description.summary = (<span>saved a question about <Link to={Urls.tableRowsQuery(item.database_id, item.table_id)} data-metabase-event={"Activity Feed;Header Clicked;Database -> "+item.topic} className="link text-dark">{item.table.display_name}</Link></span>); + description.summary = ( + <span> + {t`saved a question about `} + <Link + to={Urls.tableRowsQuery(item.database_id, item.table_id)} + data-metabase-event={"Activity Feed;Header Clicked;Database -> "+item.topic} + className="link text-dark" + > + {item.table.display_name} + </Link> + </span> + ); } else { - description.summary = "saved a question"; + description.summary = t`saved a question`; } break; case "card-delete": - description.summary = "deleted a question"; + description.summary = t`deleted a question`; break; case "dashboard-create": - description.summary = "created a dashboard"; + description.summary = t`created a dashboard`; break; case "dashboard-delete": - description.summary = "deleted a dashboard"; + description.summary = t`deleted a dashboard`; break; case "dashboard-add-cards": if(item.model_exists) { - description.summary = (<span>added a question to the dashboard - <Link to={Urls.dashboard(item.model_id)} data-metabase-event={"Activity Feed;Header Clicked;Dashboard -> "+item.topic} className="link text-dark">{item.details.name}</Link></span>); + description.summary = ( + <span> + {t`added a question to the dashboard - `} + <Link + to={Urls.dashboard(item.model_id)} + data-metabase-event={"Activity Feed;Header Clicked;Dashboard -> "+item.topic} + className="link text-dark" + > + {item.details.name} + </Link> + </span> + ); } else { - description.summary = (<span>added a question to the dashboard - <span className="text-dark">{item.details.name}</span></span>); + description.summary = ( + <span>{t`added a question to the dashboard - `}<span className="text-dark">{item.details.name}</span></span> + ); } break; case "dashboard-remove-cards": if(item.model_exists) { - description.summary = (<span>removed a question from the dashboard - <Link to={Urls.dashboard(item.model_id)} data-metabase-event={"Activity Feed;Header Clicked;Dashboard -> "+item.topic} className="link text-dark">{item.details.name}</Link></span>); + description.summary = ( + <span> + {t`removed a question from the dashboard - `} + <Link + to={Urls.dashboard(item.model_id)} + data-metabase-event={"Activity Feed;Header Clicked;Dashboard -> " + item.topic} + className="link text-dark" + > + {item.details.name} + </Link> + </span> + ); } else { - description.summary = (<span>removed a question from the dashboard - <span className="text-dark">{item.details.name}</span></span>); + description.summary = ( + <span>{t`removed a question from the dashboard - `}<span className="text-dark">{item.details.name}</span></span> + ); } break; case "database-sync": // NOTE: this is a relic from the very early days of the activity feed when we accidentally didn't // capture the name/description/engine of a Database properly in the details and so it was // possible for a database to be deleted and we'd lose any way of knowing what it's name was :( - const oldName = (item.database && 'name' in item.database) ? item.database.name : "Unknown"; + const oldName = (item.database && 'name' in item.database) ? item.database.name : t`Unknown`; if(item.details.name) { - description.summary = (<span>received the latest data from <span className="text-dark">{item.details.name}</span></span>); + description.summary = ( + <span>{t`received the latest data from`} <span className="text-dark">{item.details.name}</span></span> + ); } else { - description.summary = (<span>received the latest data from <span className="text-dark">{oldName}</span></span>); + description.summary = ( + <span>{t`received the latest data from`} <span className="text-dark">{oldName}</span></span> + ); } break; case "install": @@ -134,47 +175,131 @@ export default class Activity extends Component { break; case "metric-create": if(item.model_exists) { - description.summary = (<span>added the metric <Link to={Urls.tableRowsQuery(item.database_id, item.table_id, item.model_id)} data-metabase-event={"Activity Feed;Header Clicked;Metric -> "+item.topic} className="link text-dark">{item.details.name}</Link> to the <Link to={Urls.tableRowsQuery(item.database_id, item.table_id)} data-metabase-event={"Activity Feed;Header Clicked;Table -> "+item.topic} className="link text-dark">{item.table.display_name}</Link> table</span>); + description.summary = ( + <span> + {t`added the metric `} + <Link + to={Urls.tableRowsQuery(item.database_id, item.table_id, item.model_id)} + data-metabase-event={"Activity Feed;Header Clicked;Metric -> "+item.topic} + className="link text-dark" + > + {item.details.name} + </Link> + {t` to the `} + <Link + to={Urls.tableRowsQuery(item.database_id, item.table_id)} + data-metabase-event={"Activity Feed;Header Clicked;Table -> "+item.topic} + className="link text-dark" + > + {item.table.display_name} + </Link> + {t` table`} + </span> + ); } else { - description.summary = (<span>added the metric <span className="text-dark">{item.details.name}</span></span>); + description.summary = ( + <span>{t`added the metric `} <span className="text-dark">{item.details.name}</span></span> + ); } break; case "metric-update": if(item.model_exists) { - description.summary = (<span>made changes to the metric <Link to={Urls.tableRowsQuery(item.database_id, item.table_id, item.model_id)} data-metabase-event={"Activity Feed;Header Clicked;Metric -> "+item.topic} className="link text-dark">{item.details.name}</Link> in the <Link to={Urls.tableRowsQuery(item.database_id, item.table_id)} data-metabase-event={"Activity Feed;Header Clicked;Table -> "+item.topic} className="link text-dark">{item.table.display_name}</Link> table</span>); + description.summary = ( + <span> + {t`made changes to the metric `} + <Link + to={Urls.tableRowsQuery(item.database_id, item.table_id, item.model_id)} + data-metabase-event={"Activity Feed;Header Clicked;Metric -> "+item.topic} + className="link text-dark" + > + {item.details.name} + </Link> + {t` in the `} + <Link + to={Urls.tableRowsQuery(item.database_id, item.table_id)} + data-metabase-event={"Activity Feed;Header Clicked;Table -> "+item.topic} + className="link text-dark" + > + {item.table.display_name} + </Link> + {t` table`} + </span> + ); } else { - description.summary = (<span>made changes to the metric <span className="text-dark">{item.details.name}</span></span>); + description.summary = ( + <span>{t`made changes to the metric `} <span className="text-dark">{item.details.name}</span></span> + ); } break; case "metric-delete": - description.summary = "removed the metric "+item.details.name; + description.summary = t`removed the metric `+item.details.name; break; case "pulse-create": - description.summary = "created a pulse"; + description.summary = t`created a pulse`; break; case "pulse-delete": - description.summary = "deleted a pulse"; + description.summary = t`deleted a pulse`; break; case "segment-create": if(item.model_exists) { description.summary = ( <span> - added the filter <Link to={Urls.tableRowsQuery(item.database_id, item.table_id, null, item.model_id)} data-metabase-event={"Activity Feed;Header Clicked;Segment -> "+item.topic} className="link text-dark">{item.details.name}</Link> to the <Link to={Urls.tableRowsQuery(item.database_id, item.table_id)} data-metabase-event={"Activity Feed;Header Clicked;Table -> "+item.topic} className="link text-dark">{item.table.display_name}</Link> table + {t`added the filter `} + <Link + to={Urls.tableRowsQuery(item.database_id, item.table_id, null, item.model_id)} + data-metabase-event={"Activity Feed;Header Clicked;Segment -> "+item.topic} + className="link text-dark" + > + {item.details.name} + </Link> + {t` to the `} + <Link + to={Urls.tableRowsQuery(item.database_id, item.table_id)} + data-metabase-event={"Activity Feed;Header Clicked;Table -> "+item.topic} + className="link text-dark" + > + {item.table.display_name} + </Link> + {t` table`} </span> ); } else { - description.summary = (<span>added the filter <span className="text-dark">{item.details.name}</span></span>); + description.summary = ( + <span>{t`added the filter`} <span className="text-dark">{item.details.name}</span></span> + ); } break; case "segment-update": if(item.model_exists) { - description.summary = (<span>made changes to the filter <Link to={Urls.tableRowsQuery(item.database_id, item.table_id, null, item.model_id)} data-metabase-event={"Activity Feed;Header Clicked;Segment -> "+item.topic} className="link text-dark">{item.details.name}</Link> in the <Link to={Urls.tableRowsQuery(item.database_id, item.table_id)} data-metabase-event={"Activity Feed;Header Clicked;Table -> "+item.topic} className="link text-dark">{item.table.display_name}</Link> table</span>); + description.summary = ( + <span> + {t`made changes to the filter `} + <Link + to={Urls.tableRowsQuery(item.database_id, item.table_id, null, item.model_id)} + data-metabase-event={"Activity Feed;Header Clicked;Segment -> "+item.topic} + className="link text-dark" + > + {item.details.name} + </Link> + {t` in the `} + <Link + to={Urls.tableRowsQuery(item.database_id, item.table_id)} + data-metabase-event={"Activity Feed;Header Clicked;Table -> "+item.topic} + className="link text-dark" + > + {item.table.display_name} + </Link> + {t` table`} + </span> + ); } else { - description.summary = (<span>made changes to the filter <span className="text-dark">{item.details.name}</span></span>); + description.summary = ( + <span>{t`made changes to the filter`} <span className="text-dark">{item.details.name}</span></span> + ); } break; case "segment-delete": - description.summary = t`removed the filter {item.details.name}`; + description.summary = t`removed the filter ${item.details.name}`; break; case "user-joined": description.summary = t`joined!`; @@ -269,8 +394,12 @@ export default class Activity extends Component { { activity.length === 0 ? <div className="flex flex-column layout-centered mt4"> <span className="QuestionCircle">!</span> - <div className="text-normal mt3 mb1">Hmmm, looks like nothing has happened yet.</div> - <div className="text-normal text-grey-2">Save a question and get this baby going!</div> + <div className="text-normal mt3 mb1"> + {t`Hmmm, looks like nothing has happened yet.`} + </div> + <div className="text-normal text-grey-2"> + {t`Save a question and get this baby going!`} + </div> </div> : <ul className="pb4 relative">