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

Apply prettier to recent changes

Dieser Commit ist enthalten in:
angusmcleod 2021-04-12 16:12:20 +10:00
Ursprung c02ae44a82
Commit 54c00f1784
13 geänderte Dateien mit 84 neuen und 33 gelöschten Zeilen

Datei anzeigen

@ -67,16 +67,22 @@ export default Component.extend({
"field.serializers"
)
saveDisabled(saving) {
if (saving) {return true;}
if (saving) {
return true;
}
const originalField = this.originalField;
if (!originalField) {return false;}
if (!originalField) {
return false;
}
return ["name", "klass", "type", "serializers"].every((attr) => {
let current = this.get(attr);
let original = originalField[attr];
if (!current) {return false;}
if (!current) {
return false;
}
if (attr === "serializers") {
return this.compareArrays(current, original);

Datei anzeigen

@ -7,7 +7,9 @@ export default Component.extend({
@discourseComputed("showAdvanced")
toggleClass(showAdvanced) {
let classes = "btn";
if (showAdvanced) {classes += " btn-primary";}
if (showAdvanced) {
classes += " btn-primary";
}
return classes;
},

Datei anzeigen

@ -91,7 +91,9 @@ export default Component.extend(UndoChanges, {
@discourseComputed("apis", "action.api")
availableEndpoints(apis, api) {
if (!api) {return [];}
if (!api) {
return [];
}
return apis.find((a) => a.name === api).endpoints;
},
});

Datei anzeigen

@ -53,7 +53,9 @@ export default Component.extend({
"items.@each.title"
)
links(current, items) {
if (!items) {return;}
if (!items) {
return;
}
return items.map((item) => {
if (item) {

Datei anzeigen

@ -2,7 +2,7 @@ import { alias, gt, or } from "@ember/object/computed";
import { computed } from "@ember/object";
import {
default as discourseComputed,
observes
observes,
} from "discourse-common/utils/decorators";
import { getOwner } from "discourse-common/lib/get-owner";
import { defaultSelectionType, selectionTypes } from "../lib/wizard-mapper";
@ -134,7 +134,9 @@ export default Component.extend({
},
documentClick(e) {
if (this._state === "destroying") {return;}
if (this._state === "destroying") {
return;
}
let $target = $(e.target);
if (!$target.parents(".type-selector").length && this.showTypes) {
@ -274,11 +276,17 @@ export default Component.extend({
optionEnabled(type) {
const options = this.options;
if (!options) {return false;}
if (!options) {
return false;
}
const option = options[type];
if (option === true) {return true;}
if (typeof option !== "string") {return false;}
if (option === true) {
return true;
}
if (typeof option !== "string") {
return false;
}
return option.split(",").filter((o) => {
return [this.selectorType, this.inputType].indexOf(o) !== -1;

Datei anzeigen

@ -19,7 +19,9 @@ export default Component.extend({
init() {
this._super(...arguments);
if (!this.validations) {return;}
if (!this.validations) {
return;
}
if (!this.field.validations) {
const validations = {};

Datei anzeigen

@ -63,9 +63,12 @@ export default Controller.extend({
clientSecret,
threeLeggedOauth
) {
if (saveDisabled || !authType || !tokenUrl || !clientId || !clientSecret)
{return true;}
if (threeLeggedOauth) {return !authUrl;}
if (saveDisabled || !authType || !tokenUrl || !clientId || !clientSecret) {
return true;
}
if (threeLeggedOauth) {
return !authUrl;
}
return false;
},
@ -149,13 +152,17 @@ export default Controller.extend({
let refreshList = false; // eslint-disable-line
let error;
if (!name || !authType) {return;}
if (!name || !authType) {
return;
}
let data = {
auth_type: authType,
};
if (api.title) {data["title"] = api.title;}
if (api.title) {
data["title"] = api.title;
}
const originalTitle = this.get("api.originalTitle");
if (api.get("isNew") || (originalTitle && api.title !== originalTitle)) {
@ -232,7 +239,9 @@ export default Controller.extend({
remove() {
const name = this.get("api.name");
if (!name) {return;}
if (!name) {
return;
}
this.set("updating", true);
@ -250,7 +259,9 @@ export default Controller.extend({
clearLogs() {
const name = this.get("api.name");
if (!name) {return;}
if (!name) {
return;
}
ajax(`/admin/wizards/api/${name.underscore()}/logs`, {
type: "DELETE",

Datei anzeigen

@ -11,7 +11,9 @@ export default Controller.extend({
logs: [],
loadLogs() {
if (!this.canLoadMore) {return;}
if (!this.canLoadMore) {
return;
}
this.set("refreshing", true);

Datei anzeigen

@ -1,6 +1,6 @@
import {
default as discourseComputed,
observes
observes,
} from "discourse-common/utils/decorators";
import { notEmpty } from "@ember/object/computed";
import showModal from "discourse/lib/show-modal";

Datei anzeigen

@ -5,7 +5,9 @@ export default {
initialize(container) {
const siteSettings = container.lookup("site-settings:main");
if (!siteSettings.custom_wizard_enabled) {return;}
if (!siteSettings.custom_wizard_enabled) {
return;
}
const existing = DiscourseURL.routeTo;
DiscourseURL.routeTo = function (path, opts) {

Datei anzeigen

@ -8,7 +8,9 @@ export default {
const messageBus = container.lookup("message-bus:main");
const siteSettings = container.lookup("site-settings:main");
if (!siteSettings.custom_wizard_enabled || !messageBus) {return;}
if (!siteSettings.custom_wizard_enabled || !messageBus) {
return;
}
messageBus.subscribe("/redirect_to_wizard", function (wizardId) {
const wizardUrl = window.location.origin + "/w/" + wizardId;

Datei anzeigen

@ -5,10 +5,10 @@ import I18n from "I18n";
// Inputs
const selectableInputTypes = [
'conditional',
'assignment',
'association',
'validation'
"conditional",
"assignment",
"association",
"validation",
];
function defaultInputType(options = {}) {
@ -50,13 +50,23 @@ function defaultConnector(connectorType, inputType, options = {}) {
return defaultInputType(options);
}
if (connectorType === "pair") {
if (inputType === "conditional") {return "equal";}
if (inputType === "association") {return "association";}
if (inputType === "validation") {return "equal";}
if (inputType === "conditional") {
return "equal";
}
if (inputType === "association") {
return "association";
}
if (inputType === "validation") {
return "equal";
}
}
if (connectorType === "output") {
if (inputType === "conditional") {return "then";}
if (inputType === "assignment") {return "set";}
if (inputType === "conditional") {
return "then";
}
if (inputType === "assignment") {
return "set";
}
}
return "equal";
}

Datei anzeigen

@ -132,7 +132,9 @@ const CustomWizard = EmberObject.extend({
},
buildMappedJson(inputs) {
if (!inputs || !inputs.length) {return false;}
if (!inputs || !inputs.length) {
return false;
}
let result = [];