2019-11-08 05:38:28 +08:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2019-10-31 04:28:29 +08:00
|
|
|
import { alias } from "@ember/object/computed";
|
2019-10-24 00:30:52 +08:00
|
|
|
import Component from "@ember/component";
|
2017-06-29 04:56:44 +08:00
|
|
|
import UploadMixin from "discourse/mixins/upload";
|
|
|
|
|
2019-10-24 00:30:52 +08:00
|
|
|
export default Component.extend(UploadMixin, {
|
2019-07-22 19:59:56 +08:00
|
|
|
type: "txt",
|
2017-06-29 04:56:44 +08:00
|
|
|
classNames: "watched-words-uploader",
|
2017-08-01 05:06:26 +08:00
|
|
|
uploadUrl: "/admin/logs/watched_words/upload",
|
2019-10-31 04:28:29 +08:00
|
|
|
addDisabled: alias("uploading"),
|
2017-06-29 04:56:44 +08:00
|
|
|
|
|
|
|
validateUploadedFilesOptions() {
|
2019-07-22 19:59:56 +08:00
|
|
|
return { skipValidation: true };
|
2017-06-29 04:56:44 +08:00
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("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
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|