2019-10-23 12:30:52 -04:00
|
|
|
import Component from "@ember/component";
|
2020-05-13 16:23:41 -04:00
|
|
|
import I18n from "I18n";
|
2021-11-04 19:23:28 -04:00
|
|
|
import UppyUploadMixin from "discourse/mixins/uppy-upload";
|
2019-10-30 16:28:29 -04:00
|
|
|
import { alias } from "@ember/object/computed";
|
2020-08-26 12:57:13 -04:00
|
|
|
import bootbox from "bootbox";
|
2019-11-07 16:38:28 -05:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2017-06-28 16:56:44 -04:00
|
|
|
|
2021-11-04 19:23:28 -04:00
|
|
|
export default Component.extend(UppyUploadMixin, {
|
2019-07-22 07:59:56 -04:00
|
|
|
type: "txt",
|
2017-06-28 16:56:44 -04:00
|
|
|
classNames: "watched-words-uploader",
|
2021-04-01 02:14:17 -04:00
|
|
|
uploadUrl: "/admin/customize/watched_words/upload",
|
2019-10-30 16:28:29 -04:00
|
|
|
addDisabled: alias("uploading"),
|
2021-11-04 19:23:28 -04:00
|
|
|
preventDirectS3Uploads: true,
|
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
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|