mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 15:54:23 +08:00
UX: Allow admin to copy IP address details of a user. (#6270)
This commit is contained in:
parent
ac40fede66
commit
1d913d3204
|
@ -1,5 +1,6 @@
|
|||
import { ajax } from "discourse/lib/ajax";
|
||||
import AdminUser from "admin/models/admin-user";
|
||||
import copyText from "discourse/lib/copy-text";
|
||||
|
||||
export default Ember.Component.extend({
|
||||
classNames: ["ip-lookup"],
|
||||
|
@ -62,6 +63,38 @@ export default Ember.Component.extend({
|
|||
this.set("show", false);
|
||||
},
|
||||
|
||||
copy: function() {
|
||||
let text = `IP: ${this.get("ip")}\n`;
|
||||
const location = this.get("location");
|
||||
if (location) {
|
||||
if (location.hostname) {
|
||||
text += `${I18n.t("ip_lookup.hostname")}: ${location.hostname}\n`;
|
||||
}
|
||||
|
||||
text += I18n.t("ip_lookup.location");
|
||||
if (location.loc) {
|
||||
text += `: ${location.loc} ${this.get("city")}\n`;
|
||||
} else {
|
||||
text += `: ${I18n.t("ip_lookup.location_not_found")}\n`;
|
||||
}
|
||||
|
||||
if (location.org) {
|
||||
text += I18n.t("ip_lookup.organisation");
|
||||
text += `: ${location.org}\n`;
|
||||
}
|
||||
|
||||
if (location.phone) {
|
||||
text += I18n.t("ip_lookup.phone");
|
||||
text += `: ${location.phone}\n`;
|
||||
}
|
||||
}
|
||||
const copyRange = $(`<textarea id="copy-range"></textarea>`);
|
||||
copyRange.text(text);
|
||||
$(document.body).append(copyRange);
|
||||
copyText(text, copyRange[0]);
|
||||
copyRange.remove();
|
||||
},
|
||||
|
||||
deleteOtherAccounts: function() {
|
||||
var self = this;
|
||||
bootbox.confirm(
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
{{#if show}}
|
||||
<div class="location-box">
|
||||
<a class="close pull-right" {{action "hide"}}>{{d-icon "times"}}</a>
|
||||
<a class="btn pull-right" {{action "copy"}}>{{d-icon "copy"}}</a>
|
||||
<h4>{{i18n 'ip_lookup.title'}}</h4>
|
||||
<p class='powered-by'>{{{i18n 'ip_lookup.powered_by'}}}</p>
|
||||
<dl>
|
||||
|
|
Loading…
Reference in New Issue
Block a user