fix linting issues
Dieser Commit ist enthalten in:
Ursprung
b616adaf71
Commit
b4f463778d
13 geänderte Dateien mit 99 neuen und 71 gelöschten Zeilen
|
@ -4,18 +4,22 @@ import discourseComputed from "discourse-common/utils/decorators";
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
classNameBindings: [":subscription-container", "subscribed"],
|
classNameBindings: [":subscription-container", "subscribed"],
|
||||||
|
|
||||||
@discourseComputed('subscribed')
|
@discourseComputed("subscribed")
|
||||||
subscribedIcon(subscribed) {
|
subscribedIcon(subscribed) {
|
||||||
return subscribed ? 'check' : 'dash';
|
return subscribed ? "check" : "dash";
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed('subscribed')
|
@discourseComputed("subscribed")
|
||||||
subscribedLabel(subscribed) {
|
subscribedLabel(subscribed) {
|
||||||
return `admin.wizard.subscription_container.${subscribed ? 'subscribed' : 'not_subscribed'}.label`;
|
return `admin.wizard.subscription_container.${
|
||||||
|
subscribed ? "subscribed" : "not_subscribed"
|
||||||
|
}.label`;
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed('subscribed')
|
@discourseComputed("subscribed")
|
||||||
subscribedTitle(subscribed) {
|
subscribedTitle(subscribed) {
|
||||||
return `admin.wizard.subscription_container.${subscribed ? 'subscribed' : 'not_subscribed'}.title`;
|
return `admin.wizard.subscription_container.${
|
||||||
}
|
subscribed ? "subscribed" : "not_subscribed"
|
||||||
|
}.title`;
|
||||||
|
},
|
||||||
});
|
});
|
|
@ -1,7 +1,7 @@
|
||||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||||
import wizardSchema, {
|
import wizardSchema, {
|
||||||
actionsAvailableWithAdditionalSubscription,
|
actionsAvailableWithAdditionalSubscription,
|
||||||
actionsAvailableWithCurrentSubscription
|
actionsAvailableWithCurrentSubscription,
|
||||||
} from "discourse/plugins/discourse-custom-wizard/discourse/lib/wizard-schema";
|
} from "discourse/plugins/discourse-custom-wizard/discourse/lib/wizard-schema";
|
||||||
import { empty, equal, or } from "@ember/object/computed";
|
import { empty, equal, or } from "@ember/object/computed";
|
||||||
import { notificationLevels, selectKitContent } from "../lib/wizard";
|
import { notificationLevels, selectKitContent } from "../lib/wizard";
|
||||||
|
@ -99,11 +99,15 @@ export default Component.extend(UndoChanges, {
|
||||||
|
|
||||||
@discourseComputed("subscribed", "subscription")
|
@discourseComputed("subscribed", "subscription")
|
||||||
actionTypes(subscribed, subscription) {
|
actionTypes(subscribed, subscription) {
|
||||||
let unsubscribedActions =
|
let unsubscribedActions = actionsAvailableWithAdditionalSubscription(
|
||||||
actionsAvailableWithAdditionalSubscription(subscription);
|
subscription
|
||||||
let subscribedActions = actionsAvailableWithCurrentSubscription(subscription);
|
);
|
||||||
|
let subscribedActions = actionsAvailableWithCurrentSubscription(
|
||||||
|
subscription
|
||||||
|
);
|
||||||
return Object.keys(wizardSchema.action.types).reduce((result, type) => {
|
return Object.keys(wizardSchema.action.types).reduce((result, type) => {
|
||||||
let subscriptionLabel = (subscribedActions.includes(type) || unsubscribedActions.includes(type));
|
let subscriptionLabel =
|
||||||
|
subscribedActions.includes(type) || unsubscribedActions.includes(type);
|
||||||
let disabled = unsubscribedActions.includes(type);
|
let disabled = unsubscribedActions.includes(type);
|
||||||
result.push({
|
result.push({
|
||||||
id: type,
|
id: type,
|
||||||
|
|
|
@ -4,33 +4,39 @@ import { not, notEmpty } from "@ember/object/computed";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
classNameBindings: [':wizard-notice', 'notice.type', 'dismissed', 'expired', 'resolved'],
|
classNameBindings: [
|
||||||
|
":wizard-notice",
|
||||||
|
"notice.type",
|
||||||
|
"dismissed",
|
||||||
|
"expired",
|
||||||
|
"resolved",
|
||||||
|
],
|
||||||
showFull: false,
|
showFull: false,
|
||||||
resolved: notEmpty('notice.expired_at'),
|
resolved: notEmpty("notice.expired_at"),
|
||||||
dismissed: notEmpty('notice.dismissed_at'),
|
dismissed: notEmpty("notice.dismissed_at"),
|
||||||
canDismiss: not('dismissed'),
|
canDismiss: not("dismissed"),
|
||||||
|
|
||||||
@discourseComputed('notice.type')
|
@discourseComputed("notice.type")
|
||||||
title(type) {
|
title(type) {
|
||||||
return I18n.t(`admin.wizard.notice.title.${type}`);
|
return I18n.t(`admin.wizard.notice.title.${type}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed('notice.type')
|
@discourseComputed("notice.type")
|
||||||
icon(type) {
|
icon(type) {
|
||||||
return {
|
return {
|
||||||
plugin_status_warning: 'exclamation-circle',
|
plugin_status_warning: "exclamation-circle",
|
||||||
plugin_status_connection_error: 'bolt',
|
plugin_status_connection_error: "bolt",
|
||||||
subscription_messages_connection_error: 'bolt',
|
subscription_messages_connection_error: "bolt",
|
||||||
info: 'info-circle'
|
info: "info-circle",
|
||||||
}[type];
|
}[type];
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
dismiss() {
|
dismiss() {
|
||||||
this.set('dismissing', true);
|
this.set("dismissing", true);
|
||||||
this.notice.dismiss().then(() => {
|
this.notice.dismiss().then(() => {
|
||||||
this.set('dismissing', false);
|
this.set("dismissing", false);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
|
@ -7,7 +7,8 @@ export default SingleSelectComponent.extend({
|
||||||
autoFilterable: false,
|
autoFilterable: false,
|
||||||
filterable: false,
|
filterable: false,
|
||||||
showFullTitle: true,
|
showFullTitle: true,
|
||||||
headerComponent: "wizard-subscription-selector/wizard-subscription-selector-header",
|
headerComponent:
|
||||||
|
"wizard-subscription-selector/wizard-subscription-selector-header",
|
||||||
caretUpIcon: "caret-up",
|
caretUpIcon: "caret-up",
|
||||||
caretDownIcon: "caret-down",
|
caretDownIcon: "caret-down",
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,5 +16,5 @@ export default SelectKitRowComponent.extend({
|
||||||
this.selectKit.select(this.rowValue, this.item);
|
this.selectKit.select(this.rowValue, this.item);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,7 +25,9 @@ export default Component.extend({
|
||||||
|
|
||||||
@discourseComputed("stateClass")
|
@discourseComputed("stateClass")
|
||||||
stateLabel(stateClass) {
|
stateLabel(stateClass) {
|
||||||
return I18n.t(`admin.wizard.subscription.subscription.status.${stateClass}`);
|
return I18n.t(
|
||||||
|
`admin.wizard.subscription.subscription.status.${stateClass}`
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -6,11 +6,11 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
setupComponent() {
|
setupComponent() {
|
||||||
const controller = getOwner(this).lookup('controller:admin-dashboard');
|
const controller = getOwner(this).lookup("controller:admin-dashboard");
|
||||||
const importantNotice = controller.get('customWizardImportantNotice');
|
const importantNotice = controller.get("customWizardImportantNotice");
|
||||||
|
|
||||||
if (importantNotice) {
|
if (importantNotice) {
|
||||||
this.set('importantNotice', importantNotice);
|
this.set("importantNotice", importantNotice);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
};
|
};
|
|
@ -8,13 +8,13 @@ export default Controller.extend({
|
||||||
ajax(`/admin/wizards/notice/${this.id}`, {
|
ajax(`/admin/wizards/notice/${this.id}`, {
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
})
|
})
|
||||||
.then(result => {
|
.then((result) => {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
const notices = this.notices;
|
const notices = this.notices;
|
||||||
notices.removeObject(notices.findBy('id', noticeId));
|
notices.removeObject(notices.findBy("id", noticeId));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError);
|
.catch(popupAjaxError);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
|
@ -21,27 +21,37 @@ export default {
|
||||||
};
|
};
|
||||||
|
|
||||||
withPluginApi("0.8.36", (api) => {
|
withPluginApi("0.8.36", (api) => {
|
||||||
api.modifyClass('route:admin-dashboard', {
|
api.modifyClass("route:admin-dashboard", {
|
||||||
afterModel() {
|
afterModel() {
|
||||||
return CustomWizardNotice.list().then(result => {
|
return CustomWizardNotice.list().then((result) => {
|
||||||
if (result && result.length) {
|
if (result && result.length) {
|
||||||
this.set('notices', A(result.map(n => CustomWizardNotice.create(n))));
|
this.set(
|
||||||
|
"notices",
|
||||||
|
A(result.map((n) => CustomWizardNotice.create(n)))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController(controller) {
|
setupController(controller) {
|
||||||
if (this.notices) {
|
if (this.notices) {
|
||||||
let pluginStatusConnectionError = this.notices.filter(n => n.type === 'plugin_status_connection_error')[0];
|
let pluginStatusConnectionError = this.notices.filter(
|
||||||
let pluginStatusWarning = this.notices.filter(n => n.type === 'plugin_status_warning')[0];
|
(n) => n.type === "plugin_status_connection_error"
|
||||||
|
)[0];
|
||||||
|
let pluginStatusWarning = this.notices.filter(
|
||||||
|
(n) => n.type === "plugin_status_warning"
|
||||||
|
)[0];
|
||||||
|
|
||||||
if (pluginStatusConnectionError || pluginStatusWarning) {
|
if (pluginStatusConnectionError || pluginStatusWarning) {
|
||||||
controller.set('customWizardImportantNotice', pluginStatusConnectionError || pluginStatusWarning);
|
controller.set(
|
||||||
|
"customWizardImportantNotice",
|
||||||
|
pluginStatusConnectionError || pluginStatusWarning
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -230,13 +230,12 @@ export function actionsAvailableWithAdditionalSubscription(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function actionsAvailableWithCurrentSubscription(
|
export function actionsAvailableWithCurrentSubscription(currentSubscription) {
|
||||||
currentSubscription
|
|
||||||
) {
|
|
||||||
switch (currentSubscription) {
|
switch (currentSubscription) {
|
||||||
case "advanced":
|
case "advanced":
|
||||||
return action.actionTypesWithSubscription["advanced"].concat(
|
return action.actionTypesWithSubscription["advanced"].concat(
|
||||||
action.actionTypesWithSubscription["basic"]);
|
action.actionTypesWithSubscription["basic"]
|
||||||
|
);
|
||||||
case "basic":
|
case "basic":
|
||||||
return action.actionTypesWithSubscription["basic"];
|
return action.actionTypesWithSubscription["basic"];
|
||||||
case "none":
|
case "none":
|
||||||
|
|
|
@ -6,18 +6,20 @@ const CustomWizardNotice = EmberObject.extend();
|
||||||
|
|
||||||
CustomWizardNotice.reopen({
|
CustomWizardNotice.reopen({
|
||||||
dismiss() {
|
dismiss() {
|
||||||
return ajax(`/admin/wizards/notice/${this.id}`, { type: 'PUT' }).then(result => {
|
return ajax(`/admin/wizards/notice/${this.id}`, { type: "PUT" })
|
||||||
|
.then((result) => {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
this.set('dismissed_at', result.dismissed_at);
|
this.set("dismissed_at", result.dismissed_at);
|
||||||
}
|
|
||||||
}).catch(popupAjaxError);
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.catch(popupAjaxError);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
CustomWizardNotice.reopenClass({
|
CustomWizardNotice.reopenClass({
|
||||||
list() {
|
list() {
|
||||||
return ajax('/admin/wizards/notice').catch(popupAjaxError);
|
return ajax("/admin/wizards/notice").catch(popupAjaxError);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default CustomWizardNotice;
|
export default CustomWizardNotice;
|
|
@ -4,17 +4,17 @@ import { A } from "@ember/array";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
model() {
|
model() {
|
||||||
return ajax('/admin/wizards');
|
return ajax("/admin/wizards");
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.set('notices', A(model.notices));
|
controller.set("notices", A(model.notices));
|
||||||
controller.set('api_section', model.api_section);
|
controller.set("api_section", model.api_section);
|
||||||
},
|
},
|
||||||
|
|
||||||
afterModel(model, transition) {
|
afterModel(model, transition) {
|
||||||
if (transition.targetName === "adminWizards.index") {
|
if (transition.targetName === "adminWizards.index") {
|
||||||
this.transitionTo("adminWizardsWizard");
|
this.transitionTo("adminWizardsWizard");
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -928,7 +928,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.d-icon {
|
.d-icon {
|
||||||
margin-right: .4em;
|
margin-right: 0.4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-header {
|
.notice-header {
|
||||||
|
@ -939,9 +939,9 @@
|
||||||
border: 1px solid var(--primary);
|
border: 1px solid var(--primary);
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 .5em;
|
padding: 0 0.5em;
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
font-size: .9em;
|
font-size: 0.9em;
|
||||||
line-height: 25px;
|
line-height: 25px;
|
||||||
min-height: 25px;
|
min-height: 25px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
@ -967,12 +967,12 @@
|
||||||
|
|
||||||
.notice-issued,
|
.notice-issued,
|
||||||
.notice-resolved {
|
.notice-resolved {
|
||||||
margin-right: .3em;
|
margin-right: 0.3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-message {
|
.notice-message {
|
||||||
p {
|
p {
|
||||||
margin: .5em 0;
|
margin: 0.5em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p:last-of-type {
|
p:last-of-type {
|
||||||
|
|
Laden …
In neuem Issue referenzieren