@projectcaluma/ember-analytics 14.7.0 → 14.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/addon/components/ca-field-form.js +4 -2
- package/addon/components/ca-field-select.js +4 -5
- package/addon/components/ca-field-selector-list/ca-field-alias-input.js +5 -6
- package/addon/components/ca-field-selector-list/ca-field-function-select.js +8 -11
- package/addon/components/ca-field-selector-list.js +12 -11
- package/addon/components/ca-filter-modal.js +4 -2
- package/addon/components/ca-report-builder.js +5 -6
- package/addon/components/ca-report-preview.js +5 -7
- package/addon/controllers/reports/edit/index.js +2 -3
- package/addon/controllers/reports/edit.js +6 -8
- package/addon/tasks/get-analytics-table.js +2 -2
- package/addon/tasks/save-analytics-field.js +2 -2
- package/package.json +4 -4
|
@@ -5,7 +5,7 @@ import { tracked } from "@glimmer/tracking";
|
|
|
5
5
|
import { queryManager } from "ember-apollo-client";
|
|
6
6
|
import { Changeset } from "ember-changeset";
|
|
7
7
|
import lookupValidator from "ember-changeset-validations";
|
|
8
|
-
import {
|
|
8
|
+
import { task } from "ember-concurrency";
|
|
9
9
|
|
|
10
10
|
import CaToggleSwitchComponent from "@projectcaluma/ember-analytics/components/ca-toggle-switch";
|
|
11
11
|
import saveAnalyticsField from "@projectcaluma/ember-analytics/tasks/save-analytics-field";
|
|
@@ -27,7 +27,9 @@ export default class CaFieldFormComponent extends Component {
|
|
|
27
27
|
@tracked isValueField = false;
|
|
28
28
|
@tracked showForm = false;
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
saveField = task({ enqueue: true }, async (input) =>
|
|
31
|
+
saveAnalyticsField(input),
|
|
32
|
+
);
|
|
31
33
|
|
|
32
34
|
toggleComponent = CaToggleSwitchComponent;
|
|
33
35
|
|
|
@@ -4,7 +4,7 @@ import { inject as service } from "@ember/service";
|
|
|
4
4
|
import Component from "@glimmer/component";
|
|
5
5
|
import { tracked } from "@glimmer/tracking";
|
|
6
6
|
import { queryManager } from "ember-apollo-client";
|
|
7
|
-
import {
|
|
7
|
+
import { task } from "ember-concurrency";
|
|
8
8
|
|
|
9
9
|
import getAvailableFieldsForFieldQuery from "@projectcaluma/ember-analytics/gql/queries/get-available-fields-for-field.graphql";
|
|
10
10
|
|
|
@@ -71,14 +71,13 @@ export default class CaFieldSelectComponent extends Component {
|
|
|
71
71
|
this.args.onSelect(this._selectedOption);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
*fetchOptions() {
|
|
74
|
+
fetchOptions = task({ restartable: true }, async () => {
|
|
76
75
|
try {
|
|
77
76
|
if (
|
|
78
77
|
!this.fetchedFor ||
|
|
79
78
|
(!this.isRoot && this.fetchedFor !== this.args.parentPath)
|
|
80
79
|
) {
|
|
81
|
-
const options =
|
|
80
|
+
const options = await this.apollo.query(
|
|
82
81
|
{
|
|
83
82
|
query: getAvailableFieldsForFieldQuery,
|
|
84
83
|
fetchPolicy: "no-cache",
|
|
@@ -98,7 +97,7 @@ export default class CaFieldSelectComponent extends Component {
|
|
|
98
97
|
this.intl.t("caluma.analytics.notification.fetch-error"),
|
|
99
98
|
);
|
|
100
99
|
}
|
|
101
|
-
}
|
|
100
|
+
});
|
|
102
101
|
|
|
103
102
|
firstSegment(path) {
|
|
104
103
|
if (!path) return "";
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { macroCondition, isTesting } from "@embroider/macros";
|
|
2
2
|
import Component from "@glimmer/component";
|
|
3
|
-
import {
|
|
3
|
+
import { task, timeout } from "ember-concurrency";
|
|
4
4
|
|
|
5
5
|
export default class CaFieldSelectorListCaFieldAliasInputComponent extends Component {
|
|
6
|
-
|
|
7
|
-
*debounceInput(event) {
|
|
6
|
+
debounceInput = task({ restartable: true }, async (event) => {
|
|
8
7
|
if (macroCondition(isTesting())) {
|
|
9
8
|
// no timeout
|
|
10
9
|
} else {
|
|
11
|
-
|
|
10
|
+
await timeout(500);
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
}
|
|
13
|
+
await this.args.onInput(event.target.value);
|
|
14
|
+
});
|
|
16
15
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { inject as service } from "@ember/service";
|
|
2
2
|
import Component from "@glimmer/component";
|
|
3
|
-
import { tracked } from "@glimmer/tracking";
|
|
4
3
|
import { queryManager } from "ember-apollo-client";
|
|
5
4
|
import { task } from "ember-concurrency";
|
|
6
5
|
import { trackedTask } from "reactiveweb/ember-concurrency";
|
|
@@ -12,19 +11,12 @@ export default class CaFieldSelectorListCaFieldFunctionSelectComponent extends C
|
|
|
12
11
|
@service notification;
|
|
13
12
|
@service intl;
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
this,
|
|
17
|
-
this.getAggregationFunctions,
|
|
18
|
-
() => [this.args.field, this.args.tableSlug],
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
@task
|
|
22
|
-
*getAggregationFunctions() {
|
|
14
|
+
getAggregationFunctions = task(async () => {
|
|
23
15
|
try {
|
|
24
16
|
// Get the base path without the field so we can fetch the necessary fields later on.
|
|
25
17
|
const pathList = this.args.field.dataSource.split(".");
|
|
26
18
|
const prefix = pathList.slice(0, -1).join(".");
|
|
27
|
-
const options =
|
|
19
|
+
const options = await this.apollo.query(
|
|
28
20
|
{
|
|
29
21
|
query: getAvailableFieldsForFieldQuery,
|
|
30
22
|
variables: {
|
|
@@ -45,5 +37,10 @@ export default class CaFieldSelectorListCaFieldFunctionSelectComponent extends C
|
|
|
45
37
|
this.intl.t("caluma.analytics.notification.fetch-error"),
|
|
46
38
|
);
|
|
47
39
|
}
|
|
48
|
-
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
aggregationFunctions = trackedTask(this, this.getAggregationFunctions, () => [
|
|
43
|
+
this.args.field,
|
|
44
|
+
this.args.tableSlug,
|
|
45
|
+
]);
|
|
49
46
|
}
|
|
@@ -3,7 +3,7 @@ import { inject as service } from "@ember/service";
|
|
|
3
3
|
import Component from "@glimmer/component";
|
|
4
4
|
import { tracked } from "@glimmer/tracking";
|
|
5
5
|
import { queryManager, getObservable } from "ember-apollo-client";
|
|
6
|
-
import {
|
|
6
|
+
import { task } from "ember-concurrency";
|
|
7
7
|
|
|
8
8
|
import removeAnalyticsFieldMutation from "@projectcaluma/ember-analytics/gql/mutations/remove-analytics-field.graphql";
|
|
9
9
|
import reorderAnalyticsFieldsMutation from "@projectcaluma/ember-analytics/gql/mutations/reorder-analytics-fields.graphql";
|
|
@@ -14,7 +14,10 @@ export default class CaFieldSelectorListComponent extends Component {
|
|
|
14
14
|
@service notification;
|
|
15
15
|
@service intl;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
saveField = task({ enqueue: true }, async (input) =>
|
|
18
|
+
saveAnalyticsField(input),
|
|
19
|
+
);
|
|
20
|
+
|
|
18
21
|
@tracked _fields;
|
|
19
22
|
|
|
20
23
|
get fields() {
|
|
@@ -40,28 +43,26 @@ export default class CaFieldSelectorListComponent extends Component {
|
|
|
40
43
|
});
|
|
41
44
|
}
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
*removeAnalyticsField(id) {
|
|
46
|
+
removeAnalyticsField = task({ enqueue: true }, async (id) => {
|
|
45
47
|
try {
|
|
46
|
-
|
|
48
|
+
await this.apollo.mutate({
|
|
47
49
|
mutation: removeAnalyticsFieldMutation,
|
|
48
50
|
variables: { input: { id } },
|
|
49
51
|
});
|
|
50
52
|
const observableQuery = getObservable(this.args.analyticsTable);
|
|
51
|
-
|
|
53
|
+
await observableQuery.refetch();
|
|
52
54
|
} catch (error) {
|
|
53
55
|
console.error(error);
|
|
54
56
|
this.notification.danger(
|
|
55
57
|
this.intl.t("caluma.analytics.notification.delete-error"),
|
|
56
58
|
);
|
|
57
59
|
}
|
|
58
|
-
}
|
|
60
|
+
});
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
*reorderFields(fields) {
|
|
62
|
+
reorderFields = task({ restartable: true }, async (fields) => {
|
|
62
63
|
this._fields = fields;
|
|
63
64
|
try {
|
|
64
|
-
|
|
65
|
+
await this.apollo.mutate({
|
|
65
66
|
mutation: reorderAnalyticsFieldsMutation,
|
|
66
67
|
variables: {
|
|
67
68
|
input: {
|
|
@@ -80,5 +81,5 @@ export default class CaFieldSelectorListComponent extends Component {
|
|
|
80
81
|
this.intl.t("caluma.analytics.notification.reorder-error"),
|
|
81
82
|
);
|
|
82
83
|
}
|
|
83
|
-
}
|
|
84
|
+
});
|
|
84
85
|
}
|
|
@@ -3,7 +3,7 @@ import { inject as service } from "@ember/service";
|
|
|
3
3
|
import Component from "@glimmer/component";
|
|
4
4
|
import { tracked } from "@glimmer/tracking";
|
|
5
5
|
import { queryManager } from "ember-apollo-client";
|
|
6
|
-
import {
|
|
6
|
+
import { task } from "ember-concurrency";
|
|
7
7
|
import UkButtonComponent from "ember-uikit/components/uk-button";
|
|
8
8
|
|
|
9
9
|
import saveAnalyticsField from "@projectcaluma/ember-analytics/tasks/save-analytics-field";
|
|
@@ -17,7 +17,9 @@ export default class CaFilterModalComponent extends Component {
|
|
|
17
17
|
@tracked newFilter;
|
|
18
18
|
@tracked filters;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
saveField = task({ enqueue: true }, async (input) =>
|
|
21
|
+
saveAnalyticsField(input),
|
|
22
|
+
);
|
|
21
23
|
|
|
22
24
|
buttonComponent = UkButtonComponent;
|
|
23
25
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { inject as service } from "@ember/service";
|
|
2
2
|
import Component from "@glimmer/component";
|
|
3
3
|
import { queryManager } from "ember-apollo-client";
|
|
4
|
-
import {
|
|
4
|
+
import { task } from "ember-concurrency";
|
|
5
5
|
|
|
6
6
|
import saveAnalyticsTableMutation from "@projectcaluma/ember-analytics/gql/mutations/save-analytics-table.graphql";
|
|
7
7
|
|
|
@@ -29,8 +29,7 @@ export default class CaReportBuilderComponent extends Component {
|
|
|
29
29
|
];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
*createTable() {
|
|
32
|
+
createTable = task({ drop: true }, async () => {
|
|
34
33
|
try {
|
|
35
34
|
this.args.analyticsTable.execute();
|
|
36
35
|
const data = this.args.analyticsTable.data;
|
|
@@ -39,7 +38,7 @@ export default class CaReportBuilderComponent extends Component {
|
|
|
39
38
|
name: data.name,
|
|
40
39
|
startingObject: data.startingObject,
|
|
41
40
|
};
|
|
42
|
-
|
|
41
|
+
await this.apollo.mutate(
|
|
43
42
|
{
|
|
44
43
|
mutation: saveAnalyticsTableMutation,
|
|
45
44
|
fetchPolicy: "network-only",
|
|
@@ -49,7 +48,7 @@ export default class CaReportBuilderComponent extends Component {
|
|
|
49
48
|
},
|
|
50
49
|
"saveAnalyticsTable.analyticsTable",
|
|
51
50
|
);
|
|
52
|
-
|
|
51
|
+
await this.args.onAdd?.(
|
|
53
52
|
this.args.analyticsTable.slug,
|
|
54
53
|
this.args.analyticsTable.startingObject,
|
|
55
54
|
);
|
|
@@ -60,5 +59,5 @@ export default class CaReportBuilderComponent extends Component {
|
|
|
60
59
|
this.intl.t(`caluma.analytics.notification.create-error`),
|
|
61
60
|
);
|
|
62
61
|
}
|
|
63
|
-
}
|
|
62
|
+
});
|
|
64
63
|
}
|
|
@@ -2,7 +2,6 @@ import { action } from "@ember/object";
|
|
|
2
2
|
import { next } from "@ember/runloop";
|
|
3
3
|
import { inject as service } from "@ember/service";
|
|
4
4
|
import Component from "@glimmer/component";
|
|
5
|
-
import { tracked } from "@glimmer/tracking";
|
|
6
5
|
import { queryManager } from "ember-apollo-client";
|
|
7
6
|
import { task } from "ember-concurrency";
|
|
8
7
|
import { trackedTask } from "reactiveweb/ember-concurrency";
|
|
@@ -15,13 +14,10 @@ export default class CaReportPreviewComponent extends Component {
|
|
|
15
14
|
@service notification;
|
|
16
15
|
@service intl;
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@task
|
|
21
|
-
*fetchData() {
|
|
17
|
+
fetchData = task(async () => {
|
|
22
18
|
if (this.args.slug) {
|
|
23
19
|
try {
|
|
24
|
-
const result =
|
|
20
|
+
const result = await this.apollo.watchQuery(
|
|
25
21
|
{
|
|
26
22
|
query: getAnalyticsResultsQuery,
|
|
27
23
|
fetchPolicy: "no-cache",
|
|
@@ -60,7 +56,9 @@ export default class CaReportPreviewComponent extends Component {
|
|
|
60
56
|
}
|
|
61
57
|
}
|
|
62
58
|
return null;
|
|
63
|
-
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
data = trackedTask(this, this.fetchData, () => [this.args.slug]);
|
|
64
62
|
|
|
65
63
|
@action
|
|
66
64
|
exportTable() {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Controller from "@ember/controller";
|
|
2
2
|
import { inject as service } from "@ember/service";
|
|
3
|
-
import { tracked } from "@glimmer/tracking";
|
|
4
3
|
import { queryManager } from "ember-apollo-client";
|
|
5
4
|
import { task } from "ember-concurrency";
|
|
6
5
|
import { trackedTask } from "reactiveweb/ember-concurrency";
|
|
@@ -12,6 +11,6 @@ export default class ReportsEditIndexController extends Controller {
|
|
|
12
11
|
@service notification;
|
|
13
12
|
@queryManager apollo;
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
getTable = task(async (slug) => getAnalyticsTable(slug));
|
|
15
|
+
data = trackedTask(this, this.getTable, () => [this.model]);
|
|
17
16
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import Controller from "@ember/controller";
|
|
2
2
|
import { inject as service } from "@ember/service";
|
|
3
|
-
import { tracked } from "@glimmer/tracking";
|
|
4
3
|
import { queryManager } from "ember-apollo-client";
|
|
5
|
-
import {
|
|
4
|
+
import { task } from "ember-concurrency";
|
|
6
5
|
import { trackedTask } from "reactiveweb/ember-concurrency";
|
|
7
6
|
|
|
8
7
|
import removeAnalyticsTableMutation from "@projectcaluma/ember-analytics/gql/mutations/remove-analytics-table.graphql";
|
|
@@ -14,17 +13,16 @@ export default class ReportsEditController extends Controller {
|
|
|
14
13
|
@service router;
|
|
15
14
|
@queryManager apollo;
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
getTable = task(async (slug) => getAnalyticsTable(slug));
|
|
17
|
+
data = trackedTask(this, this.getTable, () => [this.model]);
|
|
19
18
|
|
|
20
19
|
get currentRoute() {
|
|
21
20
|
return this.router.currentRouteName.split(".").pop();
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
*deleteTable() {
|
|
23
|
+
deleteTable = task({ drop: true }, async () => {
|
|
26
24
|
try {
|
|
27
|
-
|
|
25
|
+
await this.apollo.mutate({
|
|
28
26
|
mutation: removeAnalyticsTableMutation,
|
|
29
27
|
fetchPolicy: "network-only",
|
|
30
28
|
variables: {
|
|
@@ -40,5 +38,5 @@ export default class ReportsEditController extends Controller {
|
|
|
40
38
|
this.intl.t(`caluma.analytics.notification.delete-error`),
|
|
41
39
|
);
|
|
42
40
|
}
|
|
43
|
-
}
|
|
41
|
+
});
|
|
44
42
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import getAnalyticsTableQuery from "@projectcaluma/ember-analytics/gql/queries/get-analytics-table.graphql";
|
|
2
2
|
|
|
3
|
-
export default function
|
|
3
|
+
export default async function getAnalyticsTable(slug) {
|
|
4
4
|
try {
|
|
5
|
-
return
|
|
5
|
+
return await this.apollo.watchQuery(
|
|
6
6
|
{
|
|
7
7
|
query: getAnalyticsTableQuery,
|
|
8
8
|
fetchPolicy: "cache-and-network",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import saveAnalyticsFieldMutation from "@projectcaluma/ember-analytics/gql/mutations/save-analytics-field.graphql";
|
|
2
2
|
|
|
3
|
-
export default function
|
|
3
|
+
export default async function (input) {
|
|
4
4
|
try {
|
|
5
|
-
const mutation =
|
|
5
|
+
const mutation = await this.apollo.mutate({
|
|
6
6
|
mutation: saveAnalyticsFieldMutation,
|
|
7
7
|
variables: { input },
|
|
8
8
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@projectcaluma/ember-analytics",
|
|
3
|
-
"version": "14.7.
|
|
3
|
+
"version": "14.7.1",
|
|
4
4
|
"description": "Ember addon for Caluma analytics.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"ember-cli-babel": "^8.2.0",
|
|
21
21
|
"ember-cli-htmlbars": "^6.3.0",
|
|
22
22
|
"ember-composable-helpers": "^5.0.0",
|
|
23
|
-
"ember-concurrency": "^4.0.2",
|
|
23
|
+
"ember-concurrency": "^4.0.2 || ^5.1.0",
|
|
24
24
|
"ember-engines-router-service": "^0.6.0",
|
|
25
25
|
"ember-intl": "^7.1.1",
|
|
26
26
|
"ember-load-initializers": "^2.1.2 || ^3.0.1",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"graphql": "^15.10.1",
|
|
34
34
|
"reactiveweb": "^1.3.0",
|
|
35
35
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz",
|
|
36
|
-
"@projectcaluma/ember-core": "^14.7.
|
|
36
|
+
"@projectcaluma/ember-core": "^14.7.1"
|
|
37
37
|
},
|
|
38
38
|
"//": [
|
|
39
39
|
"TODO: remove obsolete dependency to `ember-data` which is only necessary",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"sass": "1.97.3",
|
|
72
72
|
"uikit": "3.25.6",
|
|
73
73
|
"webpack": "5.104.1",
|
|
74
|
-
"@projectcaluma/ember-testing": "14.7.
|
|
74
|
+
"@projectcaluma/ember-testing": "14.7.1"
|
|
75
75
|
},
|
|
76
76
|
"peerDependency": {
|
|
77
77
|
"ember-engines": "^0.11.0",
|