2017-06-29 04:56:44 +08:00
|
|
|
import computed from "ember-addons/ember-computed-decorators";
|
|
|
|
import UploadMixin from "discourse/mixins/upload";
|
|
|
|
|
2019-01-12 00:54:23 +08:00
|
|
|
export default Ember.Component.extend(UploadMixin, {
|
2018-06-15 23:03:24 +08:00
|
|
|
type: "csv",
|
|
|
|
classNames: "watched-words-uploader",
|
|
|
|
uploadUrl: "/admin/logs/watched_words/upload",
|
2019-01-12 00:54:23 +08:00
|
|
|
addDisabled: Ember.computed.alias("uploading"),
|
2017-06-29 04:56:44 +08:00
|
|
|
|
|
|
|
validateUploadedFilesOptions() {
|
|
|
|
return { csvOnly: true };
|
|
|
|
},
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
@computed("actionKey")
|
2017-06-29 04:56:44 +08:00
|
|
|
data(actionKey) {
|
|
|
|
return { action_key: actionKey };
|
|
|
|
},
|
|
|
|
|
|
|
|
uploadDone() {
|
|
|
|
if (this) {
|
|
|
|
bootbox.alert(I18n.t("admin.watched_words.form.upload_successful"));
|
2019-01-10 18:06:01 +08:00
|
|
|
this.done();
|
2017-06-29 04:56:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|