DEV: Update linting setup and fix issues (#179)
This commit is contained in:
@@ -1 +1,3 @@
|
||||
node_modules
|
||||
/gems
|
||||
/auto_generated
|
||||
|
||||
+27
-19
@@ -1,34 +1,42 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
ast (2.4.0)
|
||||
jaro_winkler (1.5.4)
|
||||
parallel (1.19.1)
|
||||
parser (2.7.1.2)
|
||||
ast (~> 2.4.0)
|
||||
rainbow (3.0.0)
|
||||
ast (2.4.2)
|
||||
parallel (1.22.1)
|
||||
parser (3.1.2.0)
|
||||
ast (~> 2.4.1)
|
||||
rainbow (3.1.1)
|
||||
regexp_parser (2.5.0)
|
||||
rexml (3.2.5)
|
||||
rubocop (0.82.0)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
rubocop (1.30.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.7.0.1)
|
||||
parser (>= 3.1.0.0)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
rexml
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml (>= 3.2.5, < 4.0)
|
||||
rubocop-ast (>= 1.18.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
rubocop-discourse (2.1.2)
|
||||
rubocop (>= 0.69.0)
|
||||
rubocop-rspec (>= 1.39.0)
|
||||
rubocop-rspec (1.39.0)
|
||||
rubocop (>= 0.68.1)
|
||||
ruby-progressbar (1.10.1)
|
||||
unicode-display_width (1.7.0)
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.18.0)
|
||||
parser (>= 3.1.1.0)
|
||||
rubocop-discourse (2.5.0)
|
||||
rubocop (>= 1.1.0)
|
||||
rubocop-rspec (>= 2.0.0)
|
||||
rubocop-rspec (2.11.1)
|
||||
rubocop (~> 1.19)
|
||||
ruby-progressbar (1.11.0)
|
||||
unicode-display_width (2.1.0)
|
||||
|
||||
PLATFORMS
|
||||
arm64-darwin-20
|
||||
ruby
|
||||
x86_64-darwin-18
|
||||
x86_64-darwin-19
|
||||
x86_64-darwin-20
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
rubocop-discourse
|
||||
|
||||
BUNDLED WITH
|
||||
2.2.15
|
||||
2.3.10
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import Component from "@ember/component";
|
||||
import loadScript from "discourse/lib/load-script";
|
||||
import { default as computed } from "discourse-common/utils/decorators";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import themeColor from "../lib/themeColor";
|
||||
|
||||
export default Ember.Component.extend({
|
||||
export default Component.extend({
|
||||
barsColor: themeColor("--tertiary"),
|
||||
barsHoverColor: themeColor("--tertiary-high"),
|
||||
gridColor: themeColor("--primary-low"),
|
||||
labelsColor: themeColor("--primary-medium"),
|
||||
chart: null,
|
||||
|
||||
@computed("data", "options")
|
||||
@discourseComputed("data", "options")
|
||||
config(data, options) {
|
||||
return {
|
||||
type: "bar",
|
||||
@@ -18,7 +19,7 @@ export default Ember.Component.extend({
|
||||
};
|
||||
},
|
||||
|
||||
@computed("labels.[]", "values.[]", "datasetName")
|
||||
@discourseComputed("labels.[]", "values.[]", "datasetName")
|
||||
data(labels, values, datasetName) {
|
||||
return {
|
||||
labels,
|
||||
@@ -33,7 +34,7 @@ export default Ember.Component.extend({
|
||||
};
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
options() {
|
||||
return {
|
||||
scales: {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import Component from "@ember/component";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
import { schedule, throttle } from "@ember/runloop";
|
||||
|
||||
export default Ember.Component.extend({
|
||||
export default Component.extend({
|
||||
@observes("hideSchema")
|
||||
_onHideSchema() {
|
||||
this.appEvents.trigger("ace:resize");
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { default as computed } from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
export default Ember.Component.extend({
|
||||
export default Component.extend({
|
||||
tagName: "ol",
|
||||
|
||||
@computed("col.enum")
|
||||
@discourseComputed("col.enum")
|
||||
enuminfo(hash) {
|
||||
let result = [];
|
||||
for (let key in hash) {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import Component from "@ember/component";
|
||||
import { on } from "discourse-common/utils/decorators";
|
||||
import { reads } from "@ember/object/computed";
|
||||
|
||||
export default Ember.Component.extend({
|
||||
export default Component.extend({
|
||||
classNameBindings: [":schema-table", "open"],
|
||||
tagName: "li",
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import {
|
||||
default as computed,
|
||||
observes,
|
||||
} from "discourse-common/utils/decorators";
|
||||
import { debounce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
||||
import discourseDebounce from "discourse-common/lib/debounce";
|
||||
import { isBlank, isEmpty } from "@ember/utils";
|
||||
|
||||
export default Ember.Component.extend({
|
||||
export default Component.extend({
|
||||
actions: {
|
||||
collapseSchema() {
|
||||
this.set("hideSchema", true);
|
||||
},
|
||||
},
|
||||
|
||||
@computed("schema")
|
||||
@discourseComputed("schema")
|
||||
transformedSchema(schema) {
|
||||
for (let key in schema) {
|
||||
if (!schema.hasOwnProperty(key)) {
|
||||
@@ -51,9 +50,9 @@ export default Ember.Component.extend({
|
||||
return schema;
|
||||
},
|
||||
|
||||
@computed("filter")
|
||||
@discourseComputed("filter")
|
||||
rfilter(filter) {
|
||||
if (!Ember.isBlank(filter)) {
|
||||
if (!isBlank(filter)) {
|
||||
return new RegExp(filter);
|
||||
}
|
||||
},
|
||||
@@ -100,7 +99,7 @@ export default Ember.Component.extend({
|
||||
filterCols.push(col);
|
||||
}
|
||||
});
|
||||
if (!Ember.isEmpty(filterCols)) {
|
||||
if (!isEmpty(filterCols)) {
|
||||
tables.push({
|
||||
name: key,
|
||||
columns: filterCols,
|
||||
@@ -114,14 +113,7 @@ export default Ember.Component.extend({
|
||||
|
||||
@observes("filter")
|
||||
triggerFilter() {
|
||||
// TODO: Use discouseDebounce after the 2.7 release.
|
||||
let debounceFunc = debounce;
|
||||
|
||||
try {
|
||||
debounceFunc = require("discourse-common/lib/debounce").default;
|
||||
} catch (_) {}
|
||||
|
||||
debounceFunc(
|
||||
discourseDebounce(
|
||||
this,
|
||||
function () {
|
||||
this.set("filteredTables", this.filterTables(this.transformedSchema));
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import Component from "@ember/component";
|
||||
import I18n from "I18n";
|
||||
import { default as computed } from "discourse-common/utils/decorators";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Category from "discourse/models/category";
|
||||
import { dasherize } from "@ember/string";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { computed } from "@ember/object";
|
||||
|
||||
const layoutMap = {
|
||||
int: "int",
|
||||
@@ -34,7 +37,7 @@ function allowsInputTypeTime() {
|
||||
}
|
||||
}
|
||||
|
||||
export default Ember.Component.extend({
|
||||
export default Component.extend({
|
||||
classNameBindings: ["valid:valid:invalid", ":param"],
|
||||
|
||||
boolTypes: [
|
||||
@@ -52,7 +55,7 @@ export default Ember.Component.extend({
|
||||
}
|
||||
},
|
||||
|
||||
value: Ember.computed("params", "info.identifier", {
|
||||
value: computed("params", "info.identifier", {
|
||||
get() {
|
||||
return this.params[this.get("info.identifier")];
|
||||
},
|
||||
@@ -62,7 +65,7 @@ export default Ember.Component.extend({
|
||||
},
|
||||
}),
|
||||
|
||||
valueBool: Ember.computed("params", "info.identifier", {
|
||||
valueBool: computed("params", "info.identifier", {
|
||||
get() {
|
||||
return this.params[this.get("info.identifier")] !== "false";
|
||||
},
|
||||
@@ -73,9 +76,9 @@ export default Ember.Component.extend({
|
||||
},
|
||||
}),
|
||||
|
||||
@computed("value", "info.type", "info.nullable")
|
||||
@discourseComputed("value", "info.type", "info.nullable")
|
||||
valid(value, type, nullable) {
|
||||
if (Ember.isEmpty(value)) {
|
||||
if (isEmpty(value)) {
|
||||
return nullable;
|
||||
}
|
||||
|
||||
@@ -131,7 +134,7 @@ export default Ember.Component.extend({
|
||||
return true;
|
||||
},
|
||||
|
||||
@computed("info.type")
|
||||
@discourseComputed("info.type")
|
||||
layoutType(type) {
|
||||
if ((type === "time" || type === "date") && !allowsInputTypeTime()) {
|
||||
return "string";
|
||||
@@ -142,7 +145,7 @@ export default Ember.Component.extend({
|
||||
return "generic";
|
||||
},
|
||||
|
||||
@computed("layoutType")
|
||||
@discourseComputed("layoutType")
|
||||
layoutName(layoutType) {
|
||||
return `admin/components/q-params/${layoutType}`;
|
||||
},
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import Component from "@ember/component";
|
||||
import { findRawTemplate } from "discourse-common/lib/raw-templates";
|
||||
import I18n from "I18n";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import getURL from "discourse-common/lib/get-url";
|
||||
import Badge from "discourse/models/badge";
|
||||
import { default as computed } from "discourse-common/utils/decorators";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { capitalize } from "@ember/string";
|
||||
import { alias, mapBy, notEmpty, reads } from "@ember/object/computed";
|
||||
import { schedule } from "@ember/runloop";
|
||||
@@ -28,7 +29,7 @@ function transformedRelTable(table, modelClass) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const QueryResultComponent = Ember.Component.extend({
|
||||
const QueryResultComponent = Component.extend({
|
||||
layoutName: "explorer-query-result",
|
||||
|
||||
rows: alias("content.rows"),
|
||||
@@ -40,7 +41,7 @@ const QueryResultComponent = Ember.Component.extend({
|
||||
chartValues: mapBy("content.rows", "1"),
|
||||
showChart: false,
|
||||
|
||||
@computed("content.result_count")
|
||||
@discourseComputed("content.result_count")
|
||||
resultCount(count) {
|
||||
if (count === this.get("content.default_limit")) {
|
||||
return I18n.t("explorer.max_result_count", { count });
|
||||
@@ -51,14 +52,14 @@ const QueryResultComponent = Ember.Component.extend({
|
||||
|
||||
colCount: reads("content.columns.length"),
|
||||
|
||||
@computed("content.duration")
|
||||
@discourseComputed("content.duration")
|
||||
duration(contentDuration) {
|
||||
return I18n.t("explorer.run_time", {
|
||||
value: I18n.toNumber(contentDuration, { precision: 1 }),
|
||||
});
|
||||
},
|
||||
|
||||
@computed("params.[]")
|
||||
@discourseComputed("params.[]")
|
||||
parameterAry(params) {
|
||||
let arr = [];
|
||||
for (let key in params) {
|
||||
@@ -69,7 +70,7 @@ const QueryResultComponent = Ember.Component.extend({
|
||||
return arr;
|
||||
},
|
||||
|
||||
@computed("content", "columns.[]")
|
||||
@discourseComputed("content", "columns.[]")
|
||||
columnDispNames(content, columns) {
|
||||
if (!columns) {
|
||||
return [];
|
||||
@@ -86,12 +87,12 @@ const QueryResultComponent = Ember.Component.extend({
|
||||
});
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
fallbackTemplate() {
|
||||
return findRawTemplate("javascripts/explorer/text");
|
||||
},
|
||||
|
||||
@computed("content", "columns.[]")
|
||||
@discourseComputed("content", "columns.[]")
|
||||
columnTemplates(content, columns) {
|
||||
if (!columns) {
|
||||
return [];
|
||||
@@ -108,29 +109,29 @@ const QueryResultComponent = Ember.Component.extend({
|
||||
});
|
||||
},
|
||||
|
||||
@computed("content.relations.user")
|
||||
@discourseComputed("content.relations.user")
|
||||
transformedUserTable(contentRelationsUser) {
|
||||
return transformedRelTable(contentRelationsUser);
|
||||
},
|
||||
@computed("content.relations.badge")
|
||||
@discourseComputed("content.relations.badge")
|
||||
transformedBadgeTable(contentRelationsBadge) {
|
||||
return transformedRelTable(contentRelationsBadge, Badge);
|
||||
},
|
||||
@computed("content.relations.post")
|
||||
@discourseComputed("content.relations.post")
|
||||
transformedPostTable(contentRelationsPost) {
|
||||
return transformedRelTable(contentRelationsPost);
|
||||
},
|
||||
@computed("content.relations.topic")
|
||||
@discourseComputed("content.relations.topic")
|
||||
transformedTopicTable(contentRelationsTopic) {
|
||||
return transformedRelTable(contentRelationsTopic);
|
||||
},
|
||||
|
||||
@computed("site.groups")
|
||||
@discourseComputed("site.groups")
|
||||
transformedGroupTable(groups) {
|
||||
return transformedRelTable(groups);
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"rows.[]",
|
||||
"content.colrender.[]",
|
||||
"content.result_count",
|
||||
@@ -147,7 +148,7 @@ const QueryResultComponent = Ember.Component.extend({
|
||||
);
|
||||
},
|
||||
|
||||
@computed("content.rows.[]", "content.colrender.[]")
|
||||
@discourseComputed("content.rows.[]", "content.colrender.[]")
|
||||
chartLabels(rows, colRender) {
|
||||
const labelSelectors = {
|
||||
user: (user) => user.username,
|
||||
|
||||
@@ -1,41 +1,40 @@
|
||||
import Handlebars from "handlebars";
|
||||
import Component from "@ember/component";
|
||||
import { categoryLinkHTML } from "discourse/helpers/category-link";
|
||||
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
|
||||
import { convertIconClass, iconHTML } from "discourse-common/lib/icon-library";
|
||||
import getURL from "discourse-common/lib/get-url";
|
||||
import { capitalize } from "@ember/string";
|
||||
import { htmlSafe } from "@ember/template";
|
||||
import { get } from "@ember/object";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
|
||||
function icon_or_image_replacement(str, ctx) {
|
||||
str = Ember.get(ctx.contexts[0], str);
|
||||
if (Ember.isEmpty(str)) {
|
||||
str = get(ctx.contexts[0], str);
|
||||
if (isEmpty(str)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (str.indexOf("fa-") > -1) {
|
||||
const icon = iconHTML(convertIconClass(str));
|
||||
return new Handlebars.SafeString(icon);
|
||||
return htmlSafe(icon);
|
||||
} else {
|
||||
return new Handlebars.SafeString("<img src='" + str + "'>");
|
||||
return htmlSafe("<img src='" + str + "'>");
|
||||
}
|
||||
}
|
||||
|
||||
function category_badge_replacement(str, ctx) {
|
||||
const category = Ember.get(ctx.contexts[0], str);
|
||||
const category = get(ctx.contexts[0], str);
|
||||
return categoryLinkHTML(category, {
|
||||
allowUncategorized: true,
|
||||
});
|
||||
}
|
||||
|
||||
function bound_date_replacement(str, ctx) {
|
||||
const value = Ember.get(ctx.contexts[0], str);
|
||||
return new Handlebars.SafeString(
|
||||
autoUpdatingRelativeAge(new Date(value), { title: true })
|
||||
);
|
||||
const value = get(ctx.contexts[0], str);
|
||||
return htmlSafe(autoUpdatingRelativeAge(new Date(value), { title: true }));
|
||||
}
|
||||
|
||||
const esc = Handlebars.Utils.escapeExpression;
|
||||
|
||||
// consider moving this elsewhere
|
||||
function guessUrl(t) {
|
||||
let [dest, name] = [t, t];
|
||||
@@ -50,7 +49,7 @@ function guessUrl(t) {
|
||||
return [dest, name];
|
||||
}
|
||||
|
||||
const QueryRowContentComponent = Ember.Component.extend({
|
||||
const QueryRowContentComponent = Component.extend({
|
||||
tagName: "tr",
|
||||
rowContents: null,
|
||||
|
||||
@@ -78,7 +77,7 @@ const QueryRowContentComponent = Ember.Component.extend({
|
||||
if (row[idx] === null) {
|
||||
return "NULL";
|
||||
} else if (t.name === "text") {
|
||||
return esc(row[idx]);
|
||||
return escapeExpression(row[idx]);
|
||||
}
|
||||
|
||||
const lookupFunc = parentView[`lookup${capitalize(t.name)}`];
|
||||
@@ -98,7 +97,7 @@ const QueryRowContentComponent = Ember.Component.extend({
|
||||
}
|
||||
|
||||
try {
|
||||
return new Handlebars.SafeString((t.template || fallback)(ctx, params));
|
||||
return htmlSafe((t.template || fallback)(ctx, params));
|
||||
} catch (e) {
|
||||
return "error";
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import { default as computed, on } from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import discourseComputed, { on } from "discourse-common/utils/decorators";
|
||||
import getURL from "discourse-common/lib/get-url";
|
||||
import { bind } from "@ember/runloop";
|
||||
|
||||
export default Ember.Component.extend({
|
||||
export default Component.extend({
|
||||
classNames: ["share-report"],
|
||||
|
||||
group: null,
|
||||
query: null,
|
||||
visible: false,
|
||||
|
||||
@computed("group", "query")
|
||||
@discourseComputed("group", "query")
|
||||
link() {
|
||||
return getURL(`/g/${this.group}/reports/${this.query.id}`);
|
||||
},
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
import Controller from "@ember/controller";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
import Query from "discourse/plugins/discourse-data-explorer/discourse/models/query";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import {
|
||||
default as computed,
|
||||
observes,
|
||||
} from "discourse-common/utils/decorators";
|
||||
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
||||
import I18n from "I18n";
|
||||
import { Promise } from "rsvp";
|
||||
import bootbox from "bootbox";
|
||||
import { get } from "@ember/object";
|
||||
import { not, reads, sort } from "@ember/object/computed";
|
||||
|
||||
const NoQuery = Query.create({ name: "No queries", fake: true, group_ids: [] });
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
export default Controller.extend({
|
||||
queryParams: { selectedQueryId: "id", params: "params" },
|
||||
selectedQueryId: null,
|
||||
editDisabled: false,
|
||||
@@ -34,17 +33,17 @@ export default Ember.Controller.extend({
|
||||
sortBy: ["last_run_at:desc"],
|
||||
sortedQueries: sort("model", "sortBy"),
|
||||
|
||||
@computed("params")
|
||||
@discourseComputed("params")
|
||||
parsedParams(params) {
|
||||
return params ? JSON.parse(params) : null;
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
acceptedImportFileTypes() {
|
||||
return ["application/json"];
|
||||
},
|
||||
|
||||
@computed("search", "sortBy")
|
||||
@discourseComputed("search", "sortBy")
|
||||
filteredContent(search) {
|
||||
const regexp = new RegExp(search, "i");
|
||||
return this.sortedQueries.filter(
|
||||
@@ -52,12 +51,12 @@ export default Ember.Controller.extend({
|
||||
);
|
||||
},
|
||||
|
||||
@computed("newQueryName")
|
||||
@discourseComputed("newQueryName")
|
||||
createDisabled(newQueryName) {
|
||||
return (newQueryName || "").trim().length === 0;
|
||||
},
|
||||
|
||||
@computed("selectedQueryId")
|
||||
@discourseComputed("selectedQueryId")
|
||||
selectedItem(selectedQueryId) {
|
||||
const id = parseInt(selectedQueryId, 10);
|
||||
const item = this.model.findBy("id", id);
|
||||
@@ -73,7 +72,7 @@ export default Ember.Controller.extend({
|
||||
return item || NoQuery;
|
||||
},
|
||||
|
||||
@computed("selectedItem", "editing")
|
||||
@discourseComputed("selectedItem", "editing")
|
||||
selectedGroupNames() {
|
||||
const groupIds = this.selectedItem.group_ids || [];
|
||||
const groupNames = groupIds.map((id) => {
|
||||
@@ -83,7 +82,7 @@ export default Ember.Controller.extend({
|
||||
return groupNames.join(", ");
|
||||
},
|
||||
|
||||
@computed("groups")
|
||||
@discourseComputed("groups")
|
||||
groupOptions(groups) {
|
||||
return groups
|
||||
.filter((g) => g.id !== 0)
|
||||
@@ -92,7 +91,7 @@ export default Ember.Controller.extend({
|
||||
});
|
||||
},
|
||||
|
||||
@computed("selectedItem", "selectedItem.dirty")
|
||||
@discourseComputed("selectedItem", "selectedItem.dirty")
|
||||
othersDirty(selectedItem) {
|
||||
return !!this.model.find((q) => q !== selectedItem && q.dirty);
|
||||
},
|
||||
@@ -106,7 +105,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
addCreatedRecord(record) {
|
||||
this.model.pushObject(record);
|
||||
this.set("selectedQueryId", Ember.get(record, "id"));
|
||||
this.set("selectedQueryId", get(record, "id"));
|
||||
this.selectedItem.set("dirty", false);
|
||||
this.setProperties({
|
||||
showResults: false,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import Controller from "@ember/controller";
|
||||
import { alias } from "@ember/object/computed";
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
export default Controller.extend({
|
||||
queries: alias("model.queries"),
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import Controller from "@ember/controller";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import Bookmark, {
|
||||
@@ -8,7 +9,7 @@ import { openBookmarkModal } from "discourse/controllers/bookmark";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias, gt } from "@ember/object/computed";
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
export default Controller.extend({
|
||||
showResults: false,
|
||||
explain: false,
|
||||
loading: false,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
default as computed,
|
||||
import discourseComputed, {
|
||||
observes,
|
||||
on,
|
||||
} from "discourse-common/utils/decorators";
|
||||
@@ -59,7 +58,7 @@ const Query = RestModel.extend({
|
||||
this.set("params", newParams);
|
||||
},
|
||||
|
||||
@computed("id")
|
||||
@discourseComputed("id")
|
||||
downloadUrl(id) {
|
||||
// TODO - can we change this to use the store/adapter?
|
||||
return getURL(`/admin/plugins/explorer/queries/${id}.json?export=1`);
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
{{#if info.nullable}}
|
||||
{{combo-box valueAttribute="id" value=value nameProperty="name" content=boolTypes}}
|
||||
{{combo-box
|
||||
valueAttribute="id"
|
||||
value=value
|
||||
nameProperty="name"
|
||||
content=boolTypes
|
||||
}}
|
||||
{{else}}
|
||||
{{input type="checkbox" checked=valueBool}}
|
||||
{{/if}}
|
||||
|
||||
<span class="param-name">{{info.identifier}}</span>
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
{{email-group-user-chooser
|
||||
value=value
|
||||
options=(hash
|
||||
maximum=1
|
||||
)
|
||||
options=(hash maximum=1)
|
||||
onChange=(action (mut value))
|
||||
}}
|
||||
|
||||
<span class="param-name">{{info.identifier}}</span>
|
||||
|
||||
@@ -1,5 +1,2 @@
|
||||
{{email-group-user-chooser
|
||||
value=value
|
||||
onChange=(action (mut value))
|
||||
}}
|
||||
{{email-group-user-chooser value=value onChange=(action (mut value))}}
|
||||
<span class="param-name">{{info.identifier}}</span>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,12 +6,16 @@
|
||||
{{/if}}
|
||||
{{table.name}}
|
||||
</div>
|
||||
|
||||
<div class="schema-table-cols">
|
||||
{{#if open}}
|
||||
<dl>
|
||||
{{#each table.columns as |col|}}
|
||||
<div>
|
||||
<dt class={{if col.sensitive "sensitive"}} title={{if col.sensitive (i18n "explorer.schema.sensitive")}}>
|
||||
<dt
|
||||
class={{if col.sensitive "sensitive"}}
|
||||
title={{if col.sensitive (i18n "explorer.schema.sensitive")}}
|
||||
>
|
||||
{{#if col.sensitive}}
|
||||
{{d-icon "exclamation-triangle"}}
|
||||
{{/if}}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
<div class={{if hideSchema "hidden"}}>
|
||||
<div class="schema-search inline-form full-width">
|
||||
{{text-field value=filter placeholderKey="explorer.schema.filter"}}
|
||||
{{d-button action=(action "collapseSchema") icon="chevron-right" class="no-text"}}
|
||||
{{d-button
|
||||
action=(action "collapseSchema")
|
||||
icon="chevron-right"
|
||||
class="no-text"
|
||||
}}
|
||||
</div>
|
||||
|
||||
{{conditional-loading-spinner condition=loading}}
|
||||
|
||||
<div class="schema-container">
|
||||
<ul>
|
||||
{{#each filteredTables as |table|}}
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
<div class="popup">
|
||||
<label>{{i18n "explorer.link"}} {{group}}</label>
|
||||
<input type="text" value={{link}}>
|
||||
{{d-button action="close" class="btn-flat close" icon="times" aria-label="share.close" title="share.close"}}
|
||||
|
||||
{{d-button
|
||||
action="close"
|
||||
class="btn-flat close"
|
||||
icon="times"
|
||||
aria-label="share.close"
|
||||
title="share.close"
|
||||
}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
@@ -1,13 +1,35 @@
|
||||
<article>
|
||||
<header class="result-header">
|
||||
<div class="result-info">
|
||||
{{d-button action=(action "downloadResultJson") icon="download" label="explorer.download_json" group=group}}
|
||||
{{d-button action=(action "downloadResultCsv") icon="download" label="explorer.download_csv" group=group}}
|
||||
{{d-button
|
||||
action=(action "downloadResultJson")
|
||||
icon="download"
|
||||
label="explorer.download_json"
|
||||
group=group
|
||||
}}
|
||||
|
||||
{{d-button
|
||||
action=(action "downloadResultCsv")
|
||||
icon="download"
|
||||
label="explorer.download_csv"
|
||||
group=group
|
||||
}}
|
||||
|
||||
{{#if canShowChart}}
|
||||
{{#if showChart}}
|
||||
{{d-button action=(action "showTable") icon="table" label="explorer.show_table" group=group}}
|
||||
{{d-button
|
||||
action=(action "showTable")
|
||||
icon="table"
|
||||
label="explorer.show_table"
|
||||
group=group
|
||||
}}
|
||||
{{else}}
|
||||
{{d-button action=(action "showChart") icon="chart-bar" label="explorer.show_graph" group=group}}
|
||||
{{d-button
|
||||
action=(action "showChart")
|
||||
icon="chart-bar"
|
||||
label="explorer.show_graph"
|
||||
group=group
|
||||
}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
@@ -21,8 +43,8 @@
|
||||
|
||||
{{~#if hasExplain}}
|
||||
<pre class="result-explain"><code>
|
||||
{{~content.explain}}
|
||||
</code></pre>
|
||||
{{~content.explain}}
|
||||
</code></pre>
|
||||
{{~/if}}
|
||||
|
||||
<br>
|
||||
@@ -33,7 +55,8 @@
|
||||
{{data-explorer-bar-chart
|
||||
labels=chartLabels
|
||||
values=chartValues
|
||||
datasetName=chartDatasetName}}
|
||||
datasetName=chartDatasetName
|
||||
}}
|
||||
{{else}}
|
||||
<table>
|
||||
<thead>
|
||||
@@ -48,10 +71,11 @@
|
||||
{{query-row-content
|
||||
row=row
|
||||
fallbackTemplate=fallbackTemplate
|
||||
columnTemplates=columnTemplates}}
|
||||
columnTemplates=columnTemplates
|
||||
}}
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{/if}}
|
||||
</section>
|
||||
</article>
|
||||
</article>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
{{! source: badge-button component }}
|
||||
<a href="{{baseuri}}/badges/{{badge.id}}/{{badge.name}}"
|
||||
<a
|
||||
href="{{baseuri}}/badges/{{badge.id}}/{{badge.name}}"
|
||||
class="user-badge {{badge.badgeTypeClassName}}"
|
||||
title={{badge.display_name}}
|
||||
data-badge-name={{badge.name}}>
|
||||
data-badge-name={{badge.name}}
|
||||
>
|
||||
{{icon-or-image badge.icon}}
|
||||
<span class="badge-display-name">{{badge.display_name}}</span>
|
||||
</a>
|
||||
|
||||
@@ -1,16 +1,28 @@
|
||||
{{#if post}}
|
||||
<aside class="quote" data-post={{post.post_number}} data-topic={{post.topic_id}}>
|
||||
<aside
|
||||
class="quote"
|
||||
data-post={{post.post_number}}
|
||||
data-topic={{post.topic_id}}
|
||||
>
|
||||
<div class="title">
|
||||
<div class="quote-controls">
|
||||
<a href="/t/via-quote/{{post.topic_id}}/{{post.post_number}}"
|
||||
{{! template-lint-disable no-invalid-link-text }}
|
||||
<a
|
||||
href="/t/via-quote/{{post.topic_id}}/{{post.post_number}}"
|
||||
title="go to the quoted post"
|
||||
class="quote-other-topic">
|
||||
class="quote-other-topic"
|
||||
>
|
||||
</a>
|
||||
</div>
|
||||
<a class="result-post-link" href="/t/{{post.topic_id}}/{{post.post_number}}">
|
||||
|
||||
<a
|
||||
class="result-post-link"
|
||||
href="/t/{{post.topic_id}}/{{post.post_number}}"
|
||||
>
|
||||
{{avatar post imageSize="tiny"}}{{post.username}}:
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>
|
||||
{{html-safe post.excerpt}}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
{{#if user}}
|
||||
<a href="{{baseuri}}/u/{{user.username}}/activity" data-user-card={{user.username}}>
|
||||
{{avatar user imageSize="tiny"}} {{user.username}}
|
||||
<a
|
||||
href="{{baseuri}}/u/{{user.username}}/activity"
|
||||
data-user-card={{user.username}}
|
||||
>
|
||||
{{avatar user imageSize="tiny"}}
|
||||
{{user.username}}
|
||||
</a>
|
||||
{{else}}
|
||||
{{id}}
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
{{#each queries as |query|}}
|
||||
<tr>
|
||||
<td>
|
||||
{{#link-to "group.reports.show" group.name query.id}}{{query.name}}{{/link-to}}
|
||||
{{#link-to "group.reports.show" group.name query.id}}
|
||||
{{query.name}}
|
||||
{{/link-to}}
|
||||
</td>
|
||||
<td>{{query.description}}</td>
|
||||
<td>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<section class="user-content">
|
||||
<h1>{{model.name}}</h1>
|
||||
<p>{{model.description}}</p>
|
||||
|
||||
<form class="query-run" {{action "run" on="submit"}}>
|
||||
{{#if hasParams}}
|
||||
<div class="query-params">
|
||||
@@ -9,7 +10,14 @@
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{d-button action=(action "run") icon="play" label="explorer.run" class="btn-primary" type="submit"}}
|
||||
|
||||
{{d-button
|
||||
action=(action "run")
|
||||
icon="play"
|
||||
label="explorer.run"
|
||||
class="btn-primary"
|
||||
type="submit"
|
||||
}}
|
||||
|
||||
{{d-button
|
||||
action=(action "toggleBookmark")
|
||||
@@ -17,9 +25,10 @@
|
||||
icon=bookmarkIcon
|
||||
class=bookmarkClassName
|
||||
}}
|
||||
|
||||
</form>
|
||||
|
||||
{{conditional-loading-spinner condition=loading}}
|
||||
|
||||
{{#if results}}
|
||||
<div class="query-results">
|
||||
{{#if showResults}}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
en:
|
||||
site_settings:
|
||||
data_explorer_enabled: "Enable the Data Explorer at /admin/plugins/explorer"
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
pre-commit:
|
||||
parallel: true
|
||||
commands:
|
||||
rubocop:
|
||||
glob: "*.rb"
|
||||
run: bundle exec rubocop --parallel {staged_files}
|
||||
prettier:
|
||||
glob: "*.{scss,js,es6}"
|
||||
include: "test/javascripts|assets/javascripts"
|
||||
run: yarn prettier --list-different {staged_files}
|
||||
eslint-js:
|
||||
glob: "*.{js,es6}"
|
||||
include: "test/javascripts|assets/javascripts"
|
||||
run: yarn eslint --no-error-on-unmatched-pattern -f compact {staged_files}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user