0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 01:10:28 +01:00

fix linting issues

Dieser Commit ist enthalten in:
merefield 2021-10-19 13:49:06 +01:00
Ursprung b616adaf71
Commit b4f463778d
13 geänderte Dateien mit 99 neuen und 71 gelöschten Zeilen

Datei anzeigen

@ -4,18 +4,22 @@ import discourseComputed from "discourse-common/utils/decorators";
export default Component.extend({
classNameBindings: [":subscription-container", "subscribed"],
@discourseComputed('subscribed')
@discourseComputed("subscribed")
subscribedIcon(subscribed) {
return subscribed ? 'check' : 'dash';
return subscribed ? "check" : "dash";
},
@discourseComputed('subscribed')
@discourseComputed("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) {
return `admin.wizard.subscription_container.${subscribed ? 'subscribed' : 'not_subscribed'}.title`;
}
return `admin.wizard.subscription_container.${
subscribed ? "subscribed" : "not_subscribed"
}.title`;
},
});

Datei anzeigen

@ -1,7 +1,7 @@
import { default as discourseComputed } from "discourse-common/utils/decorators";
import wizardSchema, {
actionsAvailableWithAdditionalSubscription,
actionsAvailableWithCurrentSubscription
actionsAvailableWithCurrentSubscription,
} from "discourse/plugins/discourse-custom-wizard/discourse/lib/wizard-schema";
import { empty, equal, or } from "@ember/object/computed";
import { notificationLevels, selectKitContent } from "../lib/wizard";
@ -99,11 +99,15 @@ export default Component.extend(UndoChanges, {
@discourseComputed("subscribed", "subscription")
actionTypes(subscribed, subscription) {
let unsubscribedActions =
actionsAvailableWithAdditionalSubscription(subscription);
let subscribedActions = actionsAvailableWithCurrentSubscription(subscription);
let unsubscribedActions = actionsAvailableWithAdditionalSubscription(
subscription
);
let subscribedActions = actionsAvailableWithCurrentSubscription(
subscription
);
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);
result.push({
id: type,

Datei anzeigen

@ -4,33 +4,39 @@ import { not, notEmpty } from "@ember/object/computed";
import I18n from "I18n";
export default Component.extend({
classNameBindings: [':wizard-notice', 'notice.type', 'dismissed', 'expired', 'resolved'],
classNameBindings: [
":wizard-notice",
"notice.type",
"dismissed",
"expired",
"resolved",
],
showFull: false,
resolved: notEmpty('notice.expired_at'),
dismissed: notEmpty('notice.dismissed_at'),
canDismiss: not('dismissed'),
resolved: notEmpty("notice.expired_at"),
dismissed: notEmpty("notice.dismissed_at"),
canDismiss: not("dismissed"),
@discourseComputed('notice.type')
@discourseComputed("notice.type")
title(type) {
return I18n.t(`admin.wizard.notice.title.${type}`);
},
@discourseComputed('notice.type')
@discourseComputed("notice.type")
icon(type) {
return {
plugin_status_warning: 'exclamation-circle',
plugin_status_connection_error: 'bolt',
subscription_messages_connection_error: 'bolt',
info: 'info-circle'
plugin_status_warning: "exclamation-circle",
plugin_status_connection_error: "bolt",
subscription_messages_connection_error: "bolt",
info: "info-circle",
}[type];
},
actions: {
dismiss() {
this.set('dismissing', true);
this.set("dismissing", true);
this.notice.dismiss().then(() => {
this.set('dismissing', false);
this.set("dismissing", false);
});
}
}
},
},
});

Datei anzeigen

@ -7,7 +7,8 @@ export default SingleSelectComponent.extend({
autoFilterable: false,
filterable: false,
showFullTitle: true,
headerComponent: "wizard-subscription-selector/wizard-subscription-selector-header",
headerComponent:
"wizard-subscription-selector/wizard-subscription-selector-header",
caretUpIcon: "caret-up",
caretDownIcon: "caret-down",
},

Datei anzeigen

@ -16,5 +16,5 @@ export default SelectKitRowComponent.extend({
this.selectKit.select(this.rowValue, this.item);
}
return false;
}
},
});

Datei anzeigen

@ -25,7 +25,9 @@ export default Component.extend({
@discourseComputed("stateClass")
stateLabel(stateClass) {
return I18n.t(`admin.wizard.subscription.subscription.status.${stateClass}`);
return I18n.t(
`admin.wizard.subscription.subscription.status.${stateClass}`
);
},
actions: {

Datei anzeigen

@ -6,11 +6,11 @@ export default {
},
setupComponent() {
const controller = getOwner(this).lookup('controller:admin-dashboard');
const importantNotice = controller.get('customWizardImportantNotice');
const controller = getOwner(this).lookup("controller:admin-dashboard");
const importantNotice = controller.get("customWizardImportantNotice");
if (importantNotice) {
this.set('importantNotice', importantNotice);
this.set("importantNotice", importantNotice);
}
}
},
};

Datei anzeigen

@ -8,13 +8,13 @@ export default Controller.extend({
ajax(`/admin/wizards/notice/${this.id}`, {
type: "DELETE",
})
.then(result => {
.then((result) => {
if (result.success) {
const notices = this.notices;
notices.removeObject(notices.findBy('id', noticeId));
notices.removeObject(notices.findBy("id", noticeId));
}
})
.catch(popupAjaxError);
}
}
},
},
});

Datei anzeigen

@ -21,27 +21,37 @@ export default {
};
withPluginApi("0.8.36", (api) => {
api.modifyClass('route:admin-dashboard', {
api.modifyClass("route:admin-dashboard", {
afterModel() {
return CustomWizardNotice.list().then(result => {
return CustomWizardNotice.list().then((result) => {
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) {
if (this.notices) {
let pluginStatusConnectionError = this.notices.filter(n => n.type === 'plugin_status_connection_error')[0];
let pluginStatusWarning = this.notices.filter(n => n.type === 'plugin_status_warning')[0];
let pluginStatusConnectionError = this.notices.filter(
(n) => n.type === "plugin_status_connection_error"
)[0];
let pluginStatusWarning = this.notices.filter(
(n) => n.type === "plugin_status_warning"
)[0];
if (pluginStatusConnectionError || pluginStatusWarning) {
controller.set('customWizardImportantNotice', pluginStatusConnectionError || pluginStatusWarning);
controller.set(
"customWizardImportantNotice",
pluginStatusConnectionError || pluginStatusWarning
);
}
}
this._super(...arguments);
}
},
});
});
},

Datei anzeigen

@ -230,13 +230,12 @@ export function actionsAvailableWithAdditionalSubscription(
}
}
export function actionsAvailableWithCurrentSubscription(
currentSubscription
) {
export function actionsAvailableWithCurrentSubscription(currentSubscription) {
switch (currentSubscription) {
case "advanced":
return action.actionTypesWithSubscription["advanced"].concat(
action.actionTypesWithSubscription["basic"]);
action.actionTypesWithSubscription["basic"]
);
case "basic":
return action.actionTypesWithSubscription["basic"];
case "none":

Datei anzeigen

@ -6,18 +6,20 @@ const CustomWizardNotice = EmberObject.extend();
CustomWizardNotice.reopen({
dismiss() {
return ajax(`/admin/wizards/notice/${this.id}`, { type: 'PUT' }).then(result => {
if (result.success) {
this.set('dismissed_at', result.dismissed_at);
}
}).catch(popupAjaxError);
}
return ajax(`/admin/wizards/notice/${this.id}`, { type: "PUT" })
.then((result) => {
if (result.success) {
this.set("dismissed_at", result.dismissed_at);
}
})
.catch(popupAjaxError);
},
});
CustomWizardNotice.reopenClass({
list() {
return ajax('/admin/wizards/notice').catch(popupAjaxError);
}
return ajax("/admin/wizards/notice").catch(popupAjaxError);
},
});
export default CustomWizardNotice;

Datei anzeigen

@ -4,17 +4,17 @@ import { A } from "@ember/array";
export default DiscourseRoute.extend({
model() {
return ajax('/admin/wizards');
return ajax("/admin/wizards");
},
setupController(controller, model) {
controller.set('notices', A(model.notices));
controller.set('api_section', model.api_section);
controller.set("notices", A(model.notices));
controller.set("api_section", model.api_section);
},
afterModel(model, transition) {
if (transition.targetName === "adminWizards.index") {
this.transitionTo("adminWizardsWizard");
}
}
},
});

Datei anzeigen

@ -928,7 +928,7 @@
}
.d-icon {
margin-right: .4em;
margin-right: 0.4em;
}
.notice-header {
@ -939,9 +939,9 @@
border: 1px solid var(--primary);
display: inline-flex;
align-items: center;
padding: 0 .5em;
padding: 0 0.5em;
margin-right: 1em;
font-size: .9em;
font-size: 0.9em;
line-height: 25px;
min-height: 25px;
box-sizing: border-box;
@ -967,12 +967,12 @@
.notice-issued,
.notice-resolved {
margin-right: .3em;
margin-right: 0.3em;
}
.notice-message {
p {
margin: .5em 0;
margin: 0.5em 0;
}
p:last-of-type {