diff --git a/.gitignore b/.gitignore index 3c3629e..74cad9d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ node_modules +/gems +/auto_generated diff --git a/Gemfile.lock b/Gemfile.lock index 9205aec..80f9054 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 diff --git a/assets/javascripts/discourse/components/data-explorer-bar-chart.js b/assets/javascripts/discourse/components/data-explorer-bar-chart.js index a6fa2c8..6a74afc 100644 --- a/assets/javascripts/discourse/components/data-explorer-bar-chart.js +++ b/assets/javascripts/discourse/components/data-explorer-bar-chart.js @@ -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: { diff --git a/assets/javascripts/discourse/components/explorer-container.js b/assets/javascripts/discourse/components/explorer-container.js index b396ed7..34c4891 100644 --- a/assets/javascripts/discourse/components/explorer-container.js +++ b/assets/javascripts/discourse/components/explorer-container.js @@ -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"); diff --git a/assets/javascripts/discourse/components/explorer-schema-enuminfo.js b/assets/javascripts/discourse/components/explorer-schema-enuminfo.js index d5a652a..0b52895 100644 --- a/assets/javascripts/discourse/components/explorer-schema-enuminfo.js +++ b/assets/javascripts/discourse/components/explorer-schema-enuminfo.js @@ -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) { diff --git a/assets/javascripts/discourse/components/explorer-schema-onetable.js b/assets/javascripts/discourse/components/explorer-schema-onetable.js index a7234c4..d0fde1e 100644 --- a/assets/javascripts/discourse/components/explorer-schema-onetable.js +++ b/assets/javascripts/discourse/components/explorer-schema-onetable.js @@ -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", diff --git a/assets/javascripts/discourse/components/explorer-schema.js b/assets/javascripts/discourse/components/explorer-schema.js index 85a0d38..40e48da 100644 --- a/assets/javascripts/discourse/components/explorer-schema.js +++ b/assets/javascripts/discourse/components/explorer-schema.js @@ -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)); diff --git a/assets/javascripts/discourse/components/param-input.js b/assets/javascripts/discourse/components/param-input.js index bc11b82..31f7768 100644 --- a/assets/javascripts/discourse/components/param-input.js +++ b/assets/javascripts/discourse/components/param-input.js @@ -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}`; }, diff --git a/assets/javascripts/discourse/components/query-result.js b/assets/javascripts/discourse/components/query-result.js index 47a605a..610d698 100644 --- a/assets/javascripts/discourse/components/query-result.js +++ b/assets/javascripts/discourse/components/query-result.js @@ -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, diff --git a/assets/javascripts/discourse/components/query-row-content.js b/assets/javascripts/discourse/components/query-row-content.js index 95a4bdb..d8a174f 100644 --- a/assets/javascripts/discourse/components/query-row-content.js +++ b/assets/javascripts/discourse/components/query-row-content.js @@ -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(""); + return htmlSafe(""); } } 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"; } diff --git a/assets/javascripts/discourse/components/share-report.js b/assets/javascripts/discourse/components/share-report.js index 1b231d6..121275c 100644 --- a/assets/javascripts/discourse/components/share-report.js +++ b/assets/javascripts/discourse/components/share-report.js @@ -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}`); }, diff --git a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js index 8423003..7da6a4e 100644 --- a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js +++ b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js @@ -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, diff --git a/assets/javascripts/discourse/controllers/group-reports-index.js b/assets/javascripts/discourse/controllers/group-reports-index.js index 1c17e4a..671157b 100644 --- a/assets/javascripts/discourse/controllers/group-reports-index.js +++ b/assets/javascripts/discourse/controllers/group-reports-index.js @@ -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"), }); diff --git a/assets/javascripts/discourse/controllers/group-reports-show.js b/assets/javascripts/discourse/controllers/group-reports-show.js index 5e636f0..0c63683 100644 --- a/assets/javascripts/discourse/controllers/group-reports-show.js +++ b/assets/javascripts/discourse/controllers/group-reports-show.js @@ -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, diff --git a/assets/javascripts/discourse/models/query.js b/assets/javascripts/discourse/models/query.js index 962c21c..fbfffc8 100644 --- a/assets/javascripts/discourse/models/query.js +++ b/assets/javascripts/discourse/models/query.js @@ -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`); diff --git a/assets/javascripts/discourse/templates/admin/components/q-params/boolean.hbs b/assets/javascripts/discourse/templates/admin/components/q-params/boolean.hbs index 6031cd0..f375e36 100644 --- a/assets/javascripts/discourse/templates/admin/components/q-params/boolean.hbs +++ b/assets/javascripts/discourse/templates/admin/components/q-params/boolean.hbs @@ -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}} + {{info.identifier}} diff --git a/assets/javascripts/discourse/templates/admin/components/q-params/user_id.hbs b/assets/javascripts/discourse/templates/admin/components/q-params/user_id.hbs index 66bf83a..efc8f52 100644 --- a/assets/javascripts/discourse/templates/admin/components/q-params/user_id.hbs +++ b/assets/javascripts/discourse/templates/admin/components/q-params/user_id.hbs @@ -1,8 +1,7 @@ {{email-group-user-chooser value=value - options=(hash - maximum=1 - ) + options=(hash maximum=1) onChange=(action (mut value)) }} + {{info.identifier}} diff --git a/assets/javascripts/discourse/templates/admin/components/q-params/user_list.hbs b/assets/javascripts/discourse/templates/admin/components/q-params/user_list.hbs index 3697b60..141edc6 100644 --- a/assets/javascripts/discourse/templates/admin/components/q-params/user_list.hbs +++ b/assets/javascripts/discourse/templates/admin/components/q-params/user_list.hbs @@ -1,5 +1,2 @@ -{{email-group-user-chooser - value=value - onChange=(action (mut value)) -}} +{{email-group-user-chooser value=value onChange=(action (mut value))}} {{info.identifier}} diff --git a/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs b/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs index ec5d7e8..d9b1961 100644 --- a/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs +++ b/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs @@ -5,20 +5,33 @@ {{#unless selectedQueryId}}
{{text-field value=search placeholderKey="explorer.search_placeholder"}} - {{d-button action=(action "showCreate") icon="plus" class="no-text btn-right"}} + {{d-button + action=(action "showCreate") + icon="plus" + class="no-text btn-right" + }} {{pick-files-button class="import-btn" label="explorer.import.label" icon="upload" acceptedFormatsOverride=acceptedImportFileTypes showButton=true - onFilesPicked=(action "import")}} + onFilesPicked=(action "import") + }}
{{#if showCreate}}
- {{text-field value=newQueryName placeholderKey="explorer.create_placeholder"}} - {{d-button action=(action "create") disabled=createDisabled label="explorer.create" icon="plus"}} + {{text-field + value=newQueryName + placeholderKey="explorer.create_placeholder" + }} + {{d-button + action=(action "create") + disabled=createDisabled + label="explorer.create" + icon="plus" + }}
{{/if}} @@ -36,25 +49,40 @@ {{#if selectedItem}} {{#if editing}}
- {{d-button action=(action "goHome") icon="chevron-left" class="previous"}} + {{d-button + action=(action "goHome") + icon="chevron-left" + class="previous" + }}
{{text-field value=selectedItem.name}}
-
- {{textarea value=selectedItem.description placeholder=(i18n "explorer.description_placeholder")}} -
+
+ {{textarea + value=selectedItem.description + placeholder=(i18n "explorer.description_placeholder") + }} +
{{else}}
- {{d-button action=(action "goHome") icon="chevron-left" class="previous"}} + {{d-button + action=(action "goHome") + icon="chevron-left" + class="previous" + }} +

{{selectedItem.name}} {{#unless editDisabled}} - {{d-icon "pencil-alt"}} + + {{d-icon "pencil-alt"}} + {{/unless}}

+
{{selectedItem.description}}
@@ -71,11 +99,20 @@ onSelect=(action (mut selectedItem.group_ids)) }} + {{#if runDisabled}} {{#unless editing}} - {{d-button class="ok" action=(action "save") icon="check"}} - {{d-button class="cancel" action=(action "discard") icon="times"}} + {{d-button + class="ok" + action=(action "save") + icon="check" + }} + {{d-button + class="cancel" + action=(action "discard") + icon="times" + }} {{/unless}} {{/if}} @@ -91,10 +128,16 @@
{{ace-editor content=selectedItem.sql mode="sql"}}
+
{{#if hideSchema}} - {{d-button action=(action "expandSchema") icon="chevron-left" class="no-text unhide"}} + {{d-button + action=(action "expandSchema") + icon="chevron-left" + class="no-text unhide" + }} {{/if}} +
{{explorer-schema schema=schema hideSchema=hideSchema}}
@@ -117,26 +160,61 @@
{{#if everEditing}} - {{d-button action=(action "save") label="explorer.save" disabled=saveDisable}} + {{d-button + action=(action "save") + label="explorer.save" + disabled=saveDisable + }} {{else}} {{#unless editDisabled}} - {{d-button action=(action "editName") label="explorer.edit" icon="pencil-alt"}} + {{d-button + action=(action "editName") + label="explorer.edit" + icon="pencil-alt" + }} {{/unless}} {{/if}} - {{d-button action=(action "download") label="explorer.export" disabled=runDisabled icon="download"}} + + {{d-button + action=(action "download") + label="explorer.export" + disabled=runDisabled + icon="download" + }} + {{#if everEditing}} - {{d-button action=(action "showHelpModal") label="explorer.help.label" icon="question-circle"}} + {{d-button + action=(action "showHelpModal") + label="explorer.help.label" + icon="question-circle" + }} {{/if}}
{{#if selectedItem.destroyed}} - {{d-button action=(action "recover") class="" icon="undo" label="explorer.recover"}} + {{d-button + action=(action "recover") + class="" + icon="undo" + label="explorer.recover" + }} {{else}} {{#if everEditing}} - {{d-button action=(action "discard") icon="undo" label="explorer.undo" disabled=saveDisabled}} + {{d-button + action=(action "discard") + icon="undo" + label="explorer.undo" + disabled=saveDisabled + }} {{/if}} - {{d-button action=(action "destroy") class="btn-danger" icon="trash-alt" label="explorer.delete"}} + + {{d-button + action=(action "destroy") + class="btn-danger" + icon="trash-alt" + label="explorer.delete" + }} {{/if}}
@@ -159,15 +237,34 @@ {{#if runDisabled}} {{#if saveDisabled}} - {{d-button label="explorer.run" disabled="true" class="btn-primary"}} + {{d-button + label="explorer.run" + disabled="true" + class="btn-primary" + }} {{else}} - {{d-button action=(action "saverun") icon="play" label="explorer.saverun" class="btn-primary"}} + {{d-button + action=(action "saverun") + icon="play" + label="explorer.saverun" + class="btn-primary" + }} {{/if}} {{else}} - {{d-button action=(action "run") icon="play" label="explorer.run" disabled=runDisabled class="btn-primary" type="submit"}} + {{d-button + action=(action "run") + icon="play" + label="explorer.run" + disabled=runDisabled + class="btn-primary" + type="submit" + }} {{/if}} - +
@@ -194,13 +291,33 @@ @@ -218,7 +345,10 @@ {{#each filteredContent as |query|}} {{else}}
- {{i18n "explorer.no_search_results"}} + + {{i18n "explorer.no_search_results"}} + {{/each}}
-
- {{table-header-toggle field="name" labelKey="explorer.query_name" order=order asc=asc automatic=true}} +
+ {{table-header-toggle + field="name" + labelKey="explorer.query_name" + order=order + asc=asc + automatic=true + }}
-
- {{table-header-toggle field="username" labelKey="explorer.query_user" order=order asc=asc automatic=true}} +
+ {{table-header-toggle + field="username" + labelKey="explorer.query_user" + order=order + asc=asc + automatic=true + }}
@@ -209,8 +326,18 @@ -
- {{table-header-toggle field="last_run_at" labelKey="explorer.query_time" order=order asc=asc automatic=true}} +
+ {{table-header-toggle + field="last_run_at" + labelKey="explorer.query_time" + order=order + asc=asc + automatic=true + }}
- + {{query.name}} {{query.description}} @@ -249,7 +379,9 @@
diff --git a/assets/javascripts/discourse/templates/components/explorer-schema-onetable.hbs b/assets/javascripts/discourse/templates/components/explorer-schema-onetable.hbs index 6af967c..7b2a866 100644 --- a/assets/javascripts/discourse/templates/components/explorer-schema-onetable.hbs +++ b/assets/javascripts/discourse/templates/components/explorer-schema-onetable.hbs @@ -6,12 +6,16 @@ {{/if}} {{table.name}}
+
{{#if open}}
{{#each table.columns as |col|}}
-
+
{{#if col.sensitive}} {{d-icon "exclamation-triangle"}} {{/if}} diff --git a/assets/javascripts/discourse/templates/components/explorer-schema.hbs b/assets/javascripts/discourse/templates/components/explorer-schema.hbs index ee38002..ab1fa54 100644 --- a/assets/javascripts/discourse/templates/components/explorer-schema.hbs +++ b/assets/javascripts/discourse/templates/components/explorer-schema.hbs @@ -1,9 +1,15 @@
+ {{conditional-loading-spinner condition=loading}} +
    {{#each filteredTables as |table|}} diff --git a/assets/javascripts/discourse/templates/components/share-report.hbs b/assets/javascripts/discourse/templates/components/share-report.hbs index 711c4ac..3c03002 100644 --- a/assets/javascripts/discourse/templates/components/share-report.hbs +++ b/assets/javascripts/discourse/templates/components/share-report.hbs @@ -7,6 +7,13 @@ {{/if}} diff --git a/assets/javascripts/discourse/templates/explorer-query-result.hbs b/assets/javascripts/discourse/templates/explorer-query-result.hbs index 983367e..455aba3 100644 --- a/assets/javascripts/discourse/templates/explorer-query-result.hbs +++ b/assets/javascripts/discourse/templates/explorer-query-result.hbs @@ -1,13 +1,35 @@
    - {{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}}
    @@ -21,8 +43,8 @@ {{~#if hasExplain}}
    
    -        {{~content.explain}}
    -      
    + {{~content.explain}} + {{~/if}}
    @@ -33,7 +55,8 @@ {{data-explorer-bar-chart labels=chartLabels values=chartValues - datasetName=chartDatasetName}} + datasetName=chartDatasetName + }} {{else}} @@ -48,10 +71,11 @@ {{query-row-content row=row fallbackTemplate=fallbackTemplate - columnTemplates=columnTemplates}} + columnTemplates=columnTemplates + }} {{/each}}
    {{/if}} -
    \ No newline at end of file + diff --git a/assets/javascripts/discourse/templates/explorer/badge.raw.hbs b/assets/javascripts/discourse/templates/explorer/badge.raw.hbs index da138e7..ffa64cd 100644 --- a/assets/javascripts/discourse/templates/explorer/badge.raw.hbs +++ b/assets/javascripts/discourse/templates/explorer/badge.raw.hbs @@ -1,8 +1,10 @@ {{! source: badge-button component }} - + data-badge-name={{badge.name}} +> {{icon-or-image badge.icon}} {{badge.display_name}} diff --git a/assets/javascripts/discourse/templates/explorer/post.raw.hbs b/assets/javascripts/discourse/templates/explorer/post.raw.hbs index ef3238f..9a31fc1 100644 --- a/assets/javascripts/discourse/templates/explorer/post.raw.hbs +++ b/assets/javascripts/discourse/templates/explorer/post.raw.hbs @@ -1,16 +1,28 @@ {{#if post}} -