-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
almost ready for a release and publish
- Loading branch information
Showing
37 changed files
with
530 additions
and
218 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 |
---|---|---|
@@ -1,16 +1,12 @@ | ||
<button | ||
type="button" | ||
class="rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm w-40 hover:opacity-50 {{@buttonClass}}" | ||
...attributes | ||
{{on "click" this.onClick}} | ||
{{did-update this.onExtensionUpdated @extension}} | ||
> | ||
<div class="flex items-center justify-center rounded-t-lg w-full h-36 {{@iconWrapperClass}}" {{background-url @extension.icon_url overlay=true}}> | ||
<Image src={{@extension.icon_url}} class="w-full h-36 rounded-t-lg {{@iconClass}}" alt={{@extension.name}} @fallbackSrc={{config "defaultValues.extensionIcon"}} /> | ||
<button type="button" class="extension-card-container hover:opacity-50 {{@buttonClass}}" ...attributes {{on "click" this.onClick}} {{did-update this.onExtensionUpdated @extension}}> | ||
<div class="extension-card-icon-container {{@iconWrapperClass}}"> | ||
<Image src={{@extension.icon_url}} class={{@iconClass}} alt={{@extension.name}} @fallbackSrc={{config "defaultValues.extensionIcon"}} /> | ||
</div> | ||
<div class="text-left px-3 py-2 rounded-b-lg bg-white border-t border-gray-200 dark:border-gray-700 dark:bg-gray-900 {{@detailsWrapperClass}}"> | ||
<span class="font-semibold text-sm block {{@nameTextClass}}">{{@extension.name}}</span> | ||
<p class="text-xs {{@descriptionTextClass}}">{{n-a @extension.description}}</p> | ||
<div class="extension-card-body-container {{@detailsWrapperClass}}"> | ||
<div class="flex flex-col"> | ||
<div class="font-semibold text-sm block {{@nameTextClass}}">{{@extension.name}}</div> | ||
<div class="text-xs {{@descriptionTextClass}}">{{n-a @extension.description}}</div> | ||
</div> | ||
{{yield @extension}} | ||
</div> | ||
</button> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { action } from '@ember/object'; | ||
|
||
export default class ExtensionModalTitleComponent extends Component { | ||
@tracked extension; | ||
@tracked detailsContainerClass = 'mb-4'; | ||
|
||
constructor(owner, { options, detailsContainerClass }) { | ||
constructor(owner, { options, extension = null, detailsContainerClass = 'mb-4' }) { | ||
super(...arguments); | ||
this.extension = options.extension; | ||
this.detailsContainerClass = detailsContainerClass ?? 'mb-4'; | ||
this.extension = options ? options.extension : extension; | ||
this.detailsContainerClass = detailsContainerClass; | ||
} | ||
|
||
@action handleExtensionChanged(el, [extension]) { | ||
if (extension) { | ||
this.extension = extension; | ||
} | ||
} | ||
} |
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,26 @@ | ||
import Controller from '@ember/controller'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { action } from '@ember/object'; | ||
import { inject as service } from '@ember/service'; | ||
import { task } from 'ember-concurrency'; | ||
|
||
export default class DevelopersAnalyticsController extends Controller { | ||
@service fetch; | ||
@service notifications; | ||
@tracked selectedExtension; | ||
@tracked extensions = []; | ||
@tracked metrics = {}; | ||
|
||
@action selectExtension(extension) { | ||
this.selectedExtension = extension; | ||
this.getExtensionAnalytics.perform(extension); | ||
} | ||
|
||
@task *getExtensionAnalytics(extension) { | ||
try { | ||
this.metrics = yield this.fetch.get('registry-extensions/analytics', { id: extension.id }, { namespace: '~registry/v1' }); | ||
} catch (error) { | ||
this.notifications.serverError(error); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Controller from '@ember/controller'; | ||
import { inject as service } from '@ember/service'; | ||
import { action } from '@ember/object'; | ||
|
||
export default class PurchasedController extends Controller { | ||
@service modalsManager; | ||
|
||
@action about(extension) { | ||
this.modalsManager.show('modals/extension-details', { | ||
titleComponent: 'extension-modal-title', | ||
modalClass: 'flb--extension-modal modal-lg', | ||
modalHeaderClass: 'flb--extension-modal-header', | ||
acceptButtonText: 'Done', | ||
hideDeclineButton: true, | ||
extension, | ||
}); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,10 @@ | ||
import Route from '@ember/routing/route'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
export default class DevelopersAnalyticsRoute extends Route {} | ||
export default class DevelopersAnalyticsRoute extends Route { | ||
@service store; | ||
|
||
model() { | ||
return this.store.query('registry-extension', { is_author: 1 }); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Route from '@ember/routing/route'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
export default class PurchasedRoute extends Route { | ||
@service fetch; | ||
|
||
model(params = {}) { | ||
return this.fetch.get('registry-extensions/purchased', params, { namespace: '~registry/v1', normalizeToEmberData: true, modelType: 'registry-extension' }); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,83 @@ | ||
{{outlet}} | ||
<Layout::Section::Header @title="Analytics"> | ||
<DropdownButton | ||
class="h-8" | ||
@text={{if this.selectedExtension this.selectedExtension.name "Select Extension"}} | ||
@textClass="text-sm mr-2" | ||
@buttonClass="flex-row-reverse w-44 justify-between" | ||
@icon="caret-down" | ||
@iconClass="mr-0i" | ||
@size="xs" | ||
@iconPrefix="fas" | ||
@triggerClass="hidden md:flex" | ||
as |dd| | ||
> | ||
<div class="next-dd-menu mt-1 mx-0" aria-labelledby="user-menu"> | ||
<div class="p-1"> | ||
{{#each @model as |extension|}} | ||
<a href="javascript:;" class="next-dd-item" {{on "click" (dropdown-fn dd this.selectExtension extension)}}> | ||
<div class="flex-1 flex flex-row items-center"> | ||
<div class="w-6"> | ||
<FaIcon @icon="box-archive" /> | ||
</div> | ||
<span>{{extension.name}}</span> | ||
</div> | ||
<div> | ||
{{#if (eq this.selectedExtension.id extension.id)}} | ||
<FaIcon @icon="check" class="text-green-500" /> | ||
{{/if}} | ||
</div> | ||
</a> | ||
{{/each}} | ||
</div> | ||
</div> | ||
</DropdownButton> | ||
</Layout::Section::Header> | ||
|
||
<Layout::Section::Body class="overflow-y-scroll h-full"> | ||
<div class="container"> | ||
<div class="max-w-3xl mx-auto mt-4"> | ||
<div class="content"> | ||
<div class="h-10"> | ||
{{#if this.getExtensionAnalytics.isRunning}} | ||
<div class="flex items-center justify-center"> | ||
<Spinner | ||
@loadingMessage={{concat "Loading analytical metrics for " this.selectedExtension.name}} | ||
@loadingMessageClass="ml-2 text-black dark:text-white" | ||
@wrapperClass="flex flex-row items-center" | ||
/> | ||
</div> | ||
{{/if}} | ||
</div> | ||
{{#if this.selectedExtension}} | ||
<ExtensionModalTitle @extension={{this.selectedExtension}} class="mb-6" /> | ||
<div class="grid grid-cols-2 lg:grid-cols-4 gap-4"> | ||
{{#each-in this.metrics as |key value|}} | ||
<StatWidget @title={{humanize key}} @value={{value}} /> | ||
{{/each-in}} | ||
</div> | ||
{{else}} | ||
<div class="flex items-center justify-center flex-col mb-12"> | ||
<h1 class="text-black dark:text-white text-lg font-semibold mb-2">Extension Analytics Viewer</h1> | ||
<p class="text-gray-600 dark:text-gray-400">Please select an extension from the list to load and display its associated analytics. Once selected, detailed performance metrics and data | ||
insights will be rendered here.</p> | ||
</div> | ||
<div class="extension-card-grid-container"> | ||
{{#each @model as |extension|}} | ||
<button type="button" class="extension-card-container hover:opacity-50" {{on "click" (fn this.selectExtension extension)}}> | ||
<div class="extension-card-icon-container"> | ||
<Image src={{extension.icon_url}} class="w-full h-36 rounded-t-lg" alt={{extension.name}} @fallbackSrc={{config "defaultValues.extensionIcon"}} /> | ||
</div> | ||
<div class="extension-card-body-container"> | ||
<div class="flex flex-col"> | ||
<div class="font-semibold text-sm block">{{extension.name}}</div> | ||
<div class="text-xs truncate">{{n-a extension.description}}</div> | ||
</div> | ||
</div> | ||
</button> | ||
{{/each}} | ||
</div> | ||
{{/if}} | ||
</div> | ||
</div> | ||
</div> | ||
</Layout::Section::Body> |
Oops, something went wrong.