Add "success" message type with green background
parent
ec575bfea0
commit
85fd4c46e2
|
|
@ -108,3 +108,6 @@ a.remove-tag {
|
||||||
.message-error {
|
.message-error {
|
||||||
background: #f44336 !important;
|
background: #f44336 !important;
|
||||||
}
|
}
|
||||||
|
.message-success {
|
||||||
|
background: #4caf50 !important;
|
||||||
|
}
|
||||||
|
|
@ -93,7 +93,7 @@ import SzuruWrapper from "../SzuruWrapper";
|
||||||
import { Post } from "../SzuruTypes";
|
import { Post } from "../SzuruTypes";
|
||||||
import { Config, SzuruSiteConfig } from "../Config";
|
import { Config, SzuruSiteConfig } from "../Config";
|
||||||
|
|
||||||
type MessageType = "error" | "info";
|
type MessageType = "error" | "info" | "success";
|
||||||
|
|
||||||
class Message {
|
class Message {
|
||||||
content: string;
|
content: string;
|
||||||
|
|
@ -154,6 +154,7 @@ export default Vue.extend({
|
||||||
// TODO: Clicking a link doesn't actually open it in a new tab,
|
// TODO: Clicking a link doesn't actually open it in a new tab,
|
||||||
// see https://stackoverflow.com/questions/8915845
|
// see https://stackoverflow.com/questions/8915845
|
||||||
uploadMsg.content = `<a href='${this.getPostUrl(createdPost)}'>Uploaded post</a>`;
|
uploadMsg.content = `<a href='${this.getPostUrl(createdPost)}'>Uploaded post</a>`;
|
||||||
|
uploadMsg.type = "success";
|
||||||
|
|
||||||
// Find tags with "default" category and update it
|
// Find tags with "default" category and update it
|
||||||
// TODO: Make all these categories configurable
|
// TODO: Make all these categories configurable
|
||||||
|
|
@ -172,11 +173,12 @@ export default Vue.extend({
|
||||||
|
|
||||||
for (let i in tags) {
|
for (let i in tags) {
|
||||||
tagsMsg.content = `Updating tag ${i}/${unsetCategoryTags.length}`;
|
tagsMsg.content = `Updating tag ${i}/${unsetCategoryTags.length}`;
|
||||||
tags[i].category = tagsWithCategory.find(x => tags[i].names.includes(x.name))!.category!
|
tags[i].category = tagsWithCategory.find(x => tags[i].names.includes(x.name))!.category!;
|
||||||
await this.szuru.updateTag(tags[i]);
|
await this.szuru.updateTag(tags[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
tagsMsg.content = "Updated all tags";
|
tagsMsg.content = `Updated ${tags.length} tags`;
|
||||||
|
tagsMsg.type = "success";
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
const error = ex as LocalError;
|
const error = ex as LocalError;
|
||||||
|
|
@ -224,6 +226,9 @@ export default Vue.extend({
|
||||||
case "error":
|
case "error":
|
||||||
classes.push("message-error");
|
classes.push("message-error");
|
||||||
break;
|
break;
|
||||||
|
case "success":
|
||||||
|
classes.push("message-success");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return classes;
|
return classes;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue