Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
Merge branch 'main' into add-logs
Dieser Commit ist enthalten in:
Commit
9e65fcb410
7 geänderte Dateien mit 17 neuen und 13 gelöschten Zeilen
|
@ -7,7 +7,7 @@ import userSearch from "discourse/lib/user-search";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import Handlebars from "handlebars";
|
import Handlebars from "handlebars";
|
||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
import TextField from "@ember/component/text-field";
|
import TextField from "discourse/components/text-field";
|
||||||
|
|
||||||
const template = function (params) {
|
const template = function (params) {
|
||||||
const options = params.options;
|
const options = params.options;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import computed from "discourse-common/utils/decorators";
|
import computed from "discourse-common/utils/decorators";
|
||||||
import { isLTR, isRTL, siteDir } from "discourse/lib/text-direction";
|
import { isLTR, isRTL, siteDir } from "discourse/lib/text-direction";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import TextField from "@ember/component/text-field";
|
import TextField from "discourse/components/text-field";
|
||||||
|
|
||||||
export default TextField.extend({
|
export default TextField.extend({
|
||||||
attributeBindings: [
|
attributeBindings: [
|
||||||
|
|
|
@ -4,6 +4,7 @@ import CustomWizardApi from "../models/custom-wizard-api";
|
||||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||||
import { and, equal, not } from "@ember/object/computed";
|
import { and, equal, not } from "@ember/object/computed";
|
||||||
import { selectKitContent } from "../lib/wizard";
|
import { selectKitContent } from "../lib/wizard";
|
||||||
|
import { underscore } from "@ember/string";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
|
||||||
|
@ -118,7 +119,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
if (authType === "oauth_2") {
|
if (authType === "oauth_2") {
|
||||||
this.set("authorizing", true);
|
this.set("authorizing", true);
|
||||||
ajax(`/admin/wizards/apis/${name.underscore()}/authorize`)
|
ajax(`/admin/wizards/apis/${underscore(name)}/authorize`)
|
||||||
.catch(popupAjaxError)
|
.catch(popupAjaxError)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
@ -187,11 +188,11 @@ export default Controller.extend({
|
||||||
if (!api[rp]) {
|
if (!api[rp]) {
|
||||||
let key = rp.replace("auth", "");
|
let key = rp.replace("auth", "");
|
||||||
error = `${I18n.t(
|
error = `${I18n.t(
|
||||||
`admin.wizard.api.auth.${key.underscore()}`
|
`admin.wizard.api.auth.${underscore(key)}`
|
||||||
)} is required for ${authType}`;
|
)} is required for ${authType}`;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
data[rp.underscore()] = api[rp];
|
data[underscore(rp)] = api[rp];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +222,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
this.set("updating", true);
|
this.set("updating", true);
|
||||||
|
|
||||||
ajax(`/admin/wizards/api/${name.underscore()}`, {
|
ajax(`/admin/wizards/api/${underscore(name)}`, {
|
||||||
type: "PUT",
|
type: "PUT",
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
|
@ -244,7 +245,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
this.set("updating", true);
|
this.set("updating", true);
|
||||||
|
|
||||||
ajax(`/admin/wizards/api/${name.underscore()}`, {
|
ajax(`/admin/wizards/api/${underscore(name)}`, {
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError)
|
.catch(popupAjaxError)
|
||||||
|
@ -262,7 +263,7 @@ export default Controller.extend({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ajax(`/admin/wizards/api/${name.underscore()}/logs`, {
|
ajax(`/admin/wizards/api/${underscore(name)}/logs`, {
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError)
|
.catch(popupAjaxError)
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
getUnsubscribedAdminWizards,
|
getUnsubscribedAdminWizards,
|
||||||
getWizard,
|
getWizard,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
import { Promise } from "rsvp";
|
||||||
|
|
||||||
acceptance("Admin | Custom Fields Unsuscribed", function (needs) {
|
acceptance("Admin | Custom Fields Unsuscribed", function (needs) {
|
||||||
needs.user();
|
needs.user();
|
||||||
|
@ -83,7 +84,7 @@ acceptance("Admin | Custom Fields Unsuscribed", function (needs) {
|
||||||
"View, create, edit and destroy custom fields",
|
"View, create, edit and destroy custom fields",
|
||||||
{ timeout: 15000 }
|
{ timeout: 15000 }
|
||||||
);
|
);
|
||||||
await new Ember.RSVP.Promise((resolve) => setTimeout(resolve, 1000));
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
test("Navigate to custom fields tab", async (assert) => {
|
test("Navigate to custom fields tab", async (assert) => {
|
|
@ -6,6 +6,7 @@ import {
|
||||||
getWizard,
|
getWizard,
|
||||||
getWizardTestingLog,
|
getWizardTestingLog,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
import { Promise } from "rsvp";
|
||||||
|
|
||||||
acceptance("Admin | Manager", function (needs) {
|
acceptance("Admin | Manager", function (needs) {
|
||||||
needs.user();
|
needs.user();
|
||||||
|
@ -52,7 +53,7 @@ acceptance("Admin | Manager", function (needs) {
|
||||||
{ timeout: 15000 }
|
{ timeout: 15000 }
|
||||||
);
|
);
|
||||||
// Wait an additional second after the conditions are met
|
// Wait an additional second after the conditions are met
|
||||||
await new Ember.RSVP.Promise((resolve) => setTimeout(resolve, 1000));
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
test("viewing manager fields content", async (assert) => {
|
test("viewing manager fields content", async (assert) => {
|
||||||
|
|
|
@ -58,7 +58,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
||||||
assert.equal(count, 5, "There should be 5 admin tabs");
|
assert.equal(count, 5, "There should be 5 admin tabs");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("creting a new wizard", async (assert) => {
|
test("creating a new wizard", async (assert) => {
|
||||||
await visit("/admin/wizards/wizard");
|
await visit("/admin/wizards/wizard");
|
||||||
await click(".admin-wizard-controls button");
|
await click(".admin-wizard-controls button");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
|
exists,
|
||||||
query,
|
query,
|
||||||
visible,
|
visible,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
@ -71,7 +72,7 @@ acceptance("Admin | Custom Wizard Unsuscribed", function (needs) {
|
||||||
assert.equal(count, 5, "There should be 5 admin tabs");
|
assert.equal(count, 5, "There should be 5 admin tabs");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("creting a new wizard", async (assert) => {
|
test("creating a new wizard", async (assert) => {
|
||||||
await visit("/admin/wizards/wizard");
|
await visit("/admin/wizards/wizard");
|
||||||
await click(".admin-wizard-controls button");
|
await click(".admin-wizard-controls button");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -441,7 +442,7 @@ acceptance("Admin | Custom Wizard Unsuscribed", function (needs) {
|
||||||
assert.strictEqual(actualResultText, "Result text", "Text is correct");
|
assert.strictEqual(actualResultText, "Result text", "Text is correct");
|
||||||
}
|
}
|
||||||
const fieldsContentSet = [
|
const fieldsContentSet = [
|
||||||
[6, "howto", "10"],
|
[6, "bug", "1"],
|
||||||
[7, "gazelle", "gazelle"],
|
[7, "gazelle", "gazelle"],
|
||||||
];
|
];
|
||||||
for (let [
|
for (let [
|
||||||
|
|
Laden …
In neuem Issue referenzieren