mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 12:43:42 +08:00
30 lines
943 B
JavaScript
30 lines
943 B
JavaScript
import Component from "@ember/component";
|
|
import { alias } from "@ember/object/computed";
|
|
import { getOwner } from "@ember/owner";
|
|
import { service } from "@ember/service";
|
|
import { classNames } from "@ember-decorators/component";
|
|
import UppyUpload from "discourse/lib/uppy/uppy-upload";
|
|
import I18n from "discourse-i18n";
|
|
|
|
@classNames("watched-words-uploader")
|
|
export default class WatchedWordUploader extends Component {
|
|
@service dialog;
|
|
|
|
uppyUpload = new UppyUpload(getOwner(this), {
|
|
id: "watched-word-uploader",
|
|
type: "txt",
|
|
uploadUrl: "/admin/customize/watched_words/upload",
|
|
preventDirectS3Uploads: true,
|
|
validateUploadedFilesOptions: {
|
|
skipValidation: true,
|
|
},
|
|
perFileData: () => ({ action_key: this.actionKey }),
|
|
uploadDone: () => {
|
|
this.dialog.alert(I18n.t("admin.watched_words.form.upload_successful"));
|
|
this.done();
|
|
},
|
|
});
|
|
|
|
@alias("uppyUpload.uploading") addDisabled;
|
|
}
|