-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02eeb08
commit 88c9f79
Showing
8 changed files
with
138 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import Ember from 'ember'; | ||
|
||
const { Component, inject: { service } } = Ember; | ||
|
||
export default Component.extend({ | ||
classNames: ['card', 'mb-3'], | ||
campaignAnalytics: service(), | ||
|
||
campaignId: null, | ||
form: null, | ||
loading: false, | ||
|
||
report: null, | ||
|
||
init() { | ||
this._super(...arguments); | ||
this.send('loadAnalytics'); | ||
}, | ||
|
||
actions: { | ||
loadAnalytics() { | ||
this.set('loading', true); | ||
this.get('campaignAnalytics').retrieve(this.get('campaignId'), this.get('form.identifier')) | ||
.then((report) => { | ||
this.set('report', report); | ||
console.info(report); | ||
}) | ||
.finally(() => this.set('loading', false)) | ||
; | ||
}, | ||
}, | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Ember from 'ember'; | ||
import promisify from 'admin/utils/wrap-ajax'; | ||
|
||
const { Service, inject: { service }, $ } = Ember; | ||
|
||
export default Service.extend({ | ||
errorProcessor: service(), | ||
|
||
retrieve(campaignId, formId) { | ||
return promisify($.ajax(`/analytics/campaign/${campaignId}/${formId}`, { | ||
method: 'GET', | ||
})) | ||
.then((response) => response.response.data) | ||
.catch((json) => this.get('errorProcessor').notify(json.errors || [])) | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<div class="card-header"> | ||
{{form.name}} | ||
</div> | ||
|
||
<div class="card-block"> | ||
{{#if loading}} | ||
<small class="text-muted">Loading data, please wait...</small> | ||
{{#-bs/progress}} | ||
{{-bs/progress/bar value=100 animated=true}} | ||
{{/-bs/progress}} | ||
{{else}} | ||
<div class="card-deck"> | ||
<div class="card mb-3"> | ||
<div class="card-block"> | ||
<p class="mb-0"><span class="display-4">{{ report.actions.render.count }}</span><br>Inserted</p> | ||
</div> | ||
</div> | ||
<div class="card mb-3"> | ||
<div class="card-block"> | ||
<p class="mb-0"><span class="display-4">{{ report.actions.view.count }}</span><br>Viewed</p> | ||
</div> | ||
</div> | ||
<div class="card mb-3"> | ||
<div class="card-block"> | ||
<p class="mb-0"><span class="display-4">{{ report.actions.focus.count }}</span><br>Focused</p> | ||
</div> | ||
</div> | ||
<div class="card mb-3"> | ||
<div class="card-block"> | ||
<p class="mb-0"><span class="display-4">{{ report.actions.submit.count }}</span><br>Submitted</p> | ||
</div> | ||
</div> | ||
{{!-- <div class="card mb-3"> | ||
<div class="card-block"> | ||
<p class="mb-0"><span class="display-4">{{ report.conversion }}</span> C/R</p> | ||
</div> | ||
</div> --}} | ||
</div> | ||
{{#if report.submissions.length}} | ||
<div class="table-responsive"> | ||
<table class="table table-bordered table-sm mb-0"> | ||
<thead> | ||
<tr> | ||
<th>Date</th> | ||
{{#each report.labels as |label|}} | ||
<th>{{ label }}</th> | ||
{{/each}} | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{#each report.submissions as |submission|}} | ||
<tr> | ||
<td>{{ submission.date }}</td> | ||
{{#each report.labels as |label|}} | ||
<td>{{ get submission.values label }}</td> | ||
{{/each}} | ||
</tr> | ||
{{/each}} | ||
</tbody> | ||
</table> | ||
</div> | ||
{{/if}} | ||
{{/if}} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters