2020-05-13 16:23:41 -04:00
|
|
|
import I18n from "I18n";
|
2019-11-07 16:38:28 -05:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2019-10-30 16:28:29 -04:00
|
|
|
import { alias } from "@ember/object/computed";
|
2019-10-23 12:30:52 -04:00
|
|
|
import Component from "@ember/component";
|
2017-06-28 16:56:44 -04:00
|
|
|
import UploadMixin from "discourse/mixins/upload";
|
2020-08-26 12:57:13 -04:00
|
|
|
import bootbox from "bootbox";
|
2017-06-28 16:56:44 -04:00
|
|
|
|
2019-10-23 12:30:52 -04:00
|
|
|
export default Component.extend(UploadMixin, {
|
2019-07-22 07:59:56 -04:00
|
|
|
type: "txt",
|
2017-06-28 16:56:44 -04:00
|
|
|
classNames: "watched-words-uploader",
|
2017-07-31 17:06:26 -04:00
|
|
|
uploadUrl: "/admin/logs/watched_words/upload",
|
2019-10-30 16:28:29 -04:00
|
|
|
addDisabled: alias("uploading"),
|
2017-06-28 16:56:44 -04:00
|
|
|
|
|
|
|
validateUploadedFilesOptions() {
|
2019-07-22 07:59:56 -04:00
|
|
|
return { skipValidation: true };
|
2017-06-28 16:56:44 -04:00
|
|
|
},
|
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("actionKey")
|
2017-06-28 16:56:44 -04:00
|
|
|
data(actionKey) {
|
|
|
|
return { action_key: actionKey };
|
|
|
|
},
|
|
|
|
|
|
|
|
uploadDone() {
|
|
|
|
if (this) {
|
|
|
|
bootbox.alert(I18n.t("admin.watched_words.form.upload_successful"));
|
2019-01-10 05:06:01 -05:00
|
|
|
this.done();
|
2017-06-28 16:56:44 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|