Skip to content

Commit

Permalink
Version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
nlalonde committed Aug 7, 2018
2 parents 6aecebf + 1fcb5c1 commit 4372f46
Show file tree
Hide file tree
Showing 394 changed files with 7,873 additions and 5,360 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Expand Up @@ -48,6 +48,7 @@
"selectKitSelectRowByValue":true,
"selectKitSelectRowByName":true,
"selectKitSelectRowByIndex":true,
"keyboardHelper":true,
"selectKitSelectNoneRow":true,
"selectKitFillInFilter":true,
"asyncTestDiscourse":true,
Expand Down
3 changes: 3 additions & 0 deletions .travis.yml
Expand Up @@ -29,6 +29,9 @@ addons:

matrix:
fast_finish: true
exclude:
- rvm: 2.4.4
env: "RAILS_MASTER=0 QUNIT_RUN=0 RUN_LINT=1"

rvm:
- 2.5.1
Expand Down
2 changes: 1 addition & 1 deletion Dangerfile
Expand Up @@ -5,7 +5,7 @@ end
prettier_offenses = `prettier --list-different "app/assets/stylesheets/**/*.scss" "app/assets/javascripts/**/*.es6" "test/javascripts/**/*.es6"`.split('\n')
if !prettier_offenses.empty?
fail(%{
This PR has multiple prettier offenses. <a href='https://meta.discourse.org/t/prettier-code-formatting-tool/93212'>Using prettier</a>\n
This PR doesn't match our required code formatting standards, as enforced by prettier.io. <a href='https://meta.discourse.org/t/prettier-code-formatting-tool/93212'>Here's how to set up prettier in your code editor.</a>\n
#{prettier_offenses.map { |o| github.html_link(o) }.join("\n")}
})
end
5 changes: 4 additions & 1 deletion Gemfile
Expand Up @@ -34,7 +34,7 @@ gem 'redis-namespace'

gem 'active_model_serializers', '~> 0.8.3'

gem 'onebox', '1.8.55'
gem 'onebox', '1.8.57'

gem 'http_accept_language', '~>2.0.5', require: false

Expand Down Expand Up @@ -88,6 +88,7 @@ gem 'thor', require: false
gem 'rinku'
gem 'sanitize'
gem 'sidekiq'
gem 'mini_scheduler'

# for sidekiq web
gem 'tilt', require: false
Expand Down Expand Up @@ -180,6 +181,8 @@ gem 'rqrcode'

gem 'sshkey', require: false

gem 'rchardet', require: false

if ENV["IMPORT"] == "1"
gem 'mysql2'
gem 'redcarpet'
Expand Down
10 changes: 7 additions & 3 deletions Gemfile.lock
Expand Up @@ -200,6 +200,7 @@ GEM
mini_portile2 (2.3.0)
mini_racer (0.2.0)
libv8 (>= 6.3)
mini_scheduler (0.8.1)
mini_sql (0.1.10)
mini_suffix (0.3.0)
ffi (~> 1.9)
Expand Down Expand Up @@ -256,7 +257,7 @@ GEM
omniauth-twitter (1.4.0)
omniauth-oauth (~> 1.1)
rack
onebox (1.8.55)
onebox (1.8.57)
htmlentities (~> 4.3)
moneta (~> 1.0)
multi_json (~> 1.11)
Expand Down Expand Up @@ -320,6 +321,7 @@ GEM
ffi (>= 1.0.6)
msgpack (>= 0.4.3)
trollop (>= 1.16.2)
rchardet (1.8.0)
redis (4.0.1)
redis-namespace (1.6.0)
redis (>= 3.0.4)
Expand Down Expand Up @@ -489,6 +491,7 @@ DEPENDENCIES
message_bus
mini_mime
mini_racer
mini_scheduler
mini_sql
mini_suffix
minitest
Expand All @@ -506,7 +509,7 @@ DEPENDENCIES
omniauth-oauth2
omniauth-openid
omniauth-twitter
onebox (= 1.8.55)
onebox (= 1.8.57)
openid-redis-store
pg
pry-nav
Expand All @@ -521,6 +524,7 @@ DEPENDENCIES
rb-fsevent
rb-inotify (~> 0.9)
rbtrace
rchardet
redis
redis-namespace
rinku
Expand Down Expand Up @@ -550,4 +554,4 @@ DEPENDENCIES
webpush

BUNDLED WITH
1.16.2
1.16.3
@@ -0,0 +1,3 @@
export default Ember.Component.extend({
classNames: ["admin-report-counters"]
});
@@ -0,0 +1,18 @@
import computed from "ember-addons/ember-computed-decorators";

export default Ember.Component.extend({
tagName: "td",
classNames: ["admin-report-table-cell"],
classNameBindings: ["type", "property"],
options: null,

@computed("label", "data", "options")
computedLabel(label, data, options) {
return label.compute(data, options || {});
},

type: Ember.computed.alias("label.type"),
property: Ember.computed.alias("label.mainProperty"),
formatedValue: Ember.computed.alias("computedLabel.formatedValue"),
value: Ember.computed.alias("computedLabel.value")
});
Expand Up @@ -3,10 +3,10 @@ import computed from "ember-addons/ember-computed-decorators";
export default Ember.Component.extend({
tagName: "th",
classNames: ["admin-report-table-header"],
classNameBindings: ["label.property", "isCurrentSort"],
classNameBindings: ["label.mainProperty", "label.type", "isCurrentSort"],
attributeBindings: ["label.title:title"],

@computed("currentSortLabel.sort_property", "label.sort_property")
@computed("currentSortLabel.sortProperty", "label.sortProperty")
isCurrentSort(currentSortField, labelSortField) {
return currentSortField === labelSortField;
},
Expand Down
@@ -1,13 +1,5 @@
import computed from "ember-addons/ember-computed-decorators";

export default Ember.Component.extend({
tagName: "tr",
classNames: ["admin-report-table-row"],

@computed("data", "labels")
cells(row, labels) {
return labels.map(label => {
return label.compute(row);
});
}
options: null
});
@@ -1,6 +1,5 @@
import computed from "ember-addons/ember-computed-decorators";
import { registerTooltip, unregisterTooltip } from "discourse/lib/tooltip";
import { isNumeric } from "discourse/lib/utilities";

const PAGES_LIMIT = 8;

Expand Down Expand Up @@ -67,14 +66,16 @@ export default Ember.Component.extend({
const computedLabel = label.compute(row);
const value = computedLabel.value;

if (computedLabel.type === "link" || (value && !isNumeric(value))) {
return undefined;
if (!["seconds", "number", "percent"].includes(label.type)) {
return;
} else {
return sum + value;
return sum + Math.round(value || 0);
}
};

totalsRow[label.property] = rows.reduce(reducer, 0);
const total = rows.reduce(reducer, 0);
totalsRow[label.mainProperty] =
label.type === "percent" ? Math.round(total / rows.length) : total;
});

return totalsRow;
Expand Down
54 changes: 28 additions & 26 deletions app/assets/javascripts/admin/components/admin-report.js.es6
Expand Up @@ -2,14 +2,15 @@ import Category from "discourse/models/category";
import { exportEntity } from "discourse/lib/export-csv";
import { outputExportResult } from "discourse/lib/export-result";
import { ajax } from "discourse/lib/ajax";
import Report from "admin/models/report";
import { SCHEMA_VERSION, default as Report } from "admin/models/report";
import computed from "ember-addons/ember-computed-decorators";
import { registerTooltip, unregisterTooltip } from "discourse/lib/tooltip";

const TABLE_OPTIONS = {
perPage: 8,
total: true,
limit: 20
limit: 20,
formatNumbers: true
};

const CHART_OPTIONS = {};
Expand Down Expand Up @@ -50,9 +51,10 @@ export default Ember.Component.extend({
reportOptions: null,
forcedModes: null,
showAllReportsLink: false,
filters: null,
startDate: null,
endDate: null,
categoryId: null,
category: null,
groupId: null,
showTrend: false,
showHeader: true,
Expand All @@ -77,7 +79,7 @@ export default Ember.Component.extend({
didReceiveAttrs() {
this._super(...arguments);

const state = this.get("filteringState") || {};
const state = this.get("filters") || {};
this.setProperties({
category: Category.findById(state.categoryId),
groupId: state.groupId,
Expand Down Expand Up @@ -109,7 +111,9 @@ export default Ember.Component.extend({
unregisterTooltip($(".info[data-tooltip]"));
},

showTimeoutError: Ember.computed.alias("model.timeout"),
showError: Ember.computed.or("showTimeoutError", "showExceptionError"),
showTimeoutError: Ember.computed.equal("model.error", "timeout"),
showExceptionError: Ember.computed.equal("model.error", "exception"),

hasData: Ember.computed.notEmpty("model.data"),

Expand All @@ -129,6 +133,8 @@ export default Ember.Component.extend({
return displayedModesLength > 1;
},

categoryId: Ember.computed.alias("category.id"),

@computed("currentMode", "model.modes", "forcedModes")
displayedModes(currentMode, reportModes, forcedModes) {
const modes = forcedModes ? forcedModes.split(",") : reportModes;
Expand Down Expand Up @@ -186,32 +192,28 @@ export default Ember.Component.extend({
reportKey(dataSourceName, categoryId, groupId, startDate, endDate) {
if (!dataSourceName || !startDate || !endDate) return null;

let reportKey = `reports:${dataSourceName}`;

if (categoryId && categoryId !== "all") {
reportKey += `:${categoryId}`;
} else {
reportKey += `:`;
}

reportKey += `:${startDate.replace(/-/g, "")}`;
reportKey += `:${endDate.replace(/-/g, "")}`;

if (groupId && groupId !== "all") {
reportKey += `:${groupId}`;
} else {
reportKey += `:`;
}

reportKey += `:`;
let reportKey = "reports:";
reportKey += [
dataSourceName,
categoryId,
startDate.replace(/-/g, ""),
endDate.replace(/-/g, ""),
groupId,
"[:prev_period]",
this.get("reportOptions.table.limit"),
SCHEMA_VERSION
]
.filter(x => x)
.map(x => x.toString())
.join(":");

return reportKey;
},

actions: {
refreshReport() {
this.attrs.onRefresh({
categoryId: this.get("category.id"),
categoryId: this.get("categoryId"),
groupId: this.get("groupId"),
startDate: this.get("startDate"),
endDate: this.get("endDate")
Expand Down Expand Up @@ -346,12 +348,12 @@ export default Ember.Component.extend({
if (mode === "table") {
const tableOptions = JSON.parse(JSON.stringify(TABLE_OPTIONS));
return Ember.Object.create(
_.assign(tableOptions, this.get("reportOptions.table") || {})
Object.assign(tableOptions, this.get("reportOptions.table") || {})
);
} else {
const chartOptions = JSON.parse(JSON.stringify(CHART_OPTIONS));
return Ember.Object.create(
_.assign(chartOptions, this.get("reportOptions.chart") || {})
Object.assign(chartOptions, this.get("reportOptions.chart") || {})
);
}
},
Expand Down

0 comments on commit 4372f46

Please sign in to comment.