Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] Marketplace integration with Rocket.Chat Cloud #13809

Merged
merged 27 commits into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
32735d1
Add the cloud token to the marketplace calls
graywolf336 Mar 4, 2019
f19e66f
Switch the app downloading to the server
graywolf336 Mar 5, 2019
65569b1
Implement some of the buying an app iframe
graywolf336 Mar 8, 2019
2e94a02
Show when apps are purchased in the list
graywolf336 Mar 18, 2019
e1e268d
Revert the committed change in the marketplace base url
graywolf336 Mar 18, 2019
51abff2
More work on enabling purchasing
graywolf336 Mar 19, 2019
b36e357
Install Apps from marketplace
graywolf336 Mar 20, 2019
8a74ad7
Missing fixes on rebase
rodrigok Mar 20, 2019
55d4790
Improve marketplace design
rodrigok Mar 21, 2019
c93347a
Improve view of app’s logs
rodrigok Mar 21, 2019
4cc37eb
Merge remote-tracking branch 'origin/develop' into marketplace-and-cloud
rodrigok Mar 21, 2019
e8350f8
Move buttons of app details to header
rodrigok Mar 21, 2019
cd8fbe3
Fix mispeling
rodrigok Mar 22, 2019
bc0594a
Fix purchase/download flow
rodrigok Mar 22, 2019
2f65011
Enable checking for updates for an app based upon the version of the …
graywolf336 Mar 25, 2019
2f9cc8f
Disable a possible issue with installation of apps
graywolf336 Mar 26, 2019
8d76c94
Perform app downloads with a special short lived token for app downlo…
geekgonecrazy Mar 26, 2019
06b415b
Merge branch 'marketplace-and-cloud-rebased' of https://github.com/Ro…
geekgonecrazy Mar 26, 2019
26cc524
Merge branch 'develop' into marketplace-and-cloud-rebased
geekgonecrazy Mar 26, 2019
5c83312
Fix imports
rodrigok Mar 27, 2019
fe5e2ab
Fix layout of app details on old chrome and safari
rodrigok Mar 27, 2019
87320d3
Re enable upload button adding a setting for development mode
rodrigok Mar 27, 2019
30885c1
Merge branch 'develop' into marketplace-and-cloud-rebased
d-gubert Mar 27, 2019
2e7f487
Change download encoding to binary
rodrigok Mar 27, 2019
e831db9
Merge branch 'marketplace-and-cloud-rebased' of https://github.com/Ro…
rodrigok Mar 27, 2019
a213b4c
Add iframe loading
rodrigok Mar 27, 2019
490f54e
Fix some UI problems
rodrigok Mar 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 70 additions & 6 deletions app/apps/assets/stylesheets/apps.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
}

.rc-apps-container {
margin-top: 0;
padding-bottom: 15px;
}

Expand All @@ -97,9 +98,20 @@
margin-top: 6px;
} */

.rc-header .rc-button {
min-height: 0;
margin: 0;
.content {
/* display: block !important; */
padding: 0 !important;

> .rc-apps-container {
display: block;
overflow-y: scroll;

padding: 0 !important;
}

> .rc-apps-details {
display: block;
}
}

.rc-apps-category {
Expand Down Expand Up @@ -146,23 +158,75 @@
margin: 0 7px;
}

.rc-app-price {
position: relative;
top: -3px;
}

.rc-table-td--medium {
width: 300px;
}

.rc-table td {
padding: 0.5rem 0;

padding-right: 10px;
}

td.rc-apps-marketplace-price {
text-align: right;

button {
font-weight: 600;
}

.rc-icon {
color: #3582f3;
}
}

th.rc-apps-marketplace-price {
width: 100px;
}

&__wrap-actions {
& > .rc-icon--loading {
& > .loading {
display: none;
}

&.loading {
& > .rc-icon--loading {
& > .loading {
display: block;

animation: spin 1s linear infinite;
font-size: 11px;
font-weight: 600;

& > .rc-icon--loading {
animation: spin 1s linear infinite;
}
}

& > .apps-installer {
display: none;
}
}
}

.arrow-up {
transform: rotate(180deg);
}

&.page-settings {
.section {
padding: 0 !important;

border-bottom: none !important;

&:hover {
background-color: var(--rc-color-primary-lightest);
}
}
}
}

@keyframes play90 {
Expand Down
51 changes: 18 additions & 33 deletions app/apps/client/admin/appLogs.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
<template name="appLogs">
{{#with app}}
<section class="page-container page-list page-settings flex-tab-main-content">
<header class="fixed-title">
{{> burger}}
<a href="{{pathFor "app-manage" appId=id}}" title="{{_ "Back_to_Manage_Apps"}}">
<i class="icon-left-open"></i>
</a> &nbsp;
<section class="page-container page-list page-settings flex-tab-main-content rc-apps-marketplace">
{{# header rawSectionName=title fixedHeight=true hideHelp=true fullpage=true}}
<div class="rc-header__block rc-header__block-action">
<button class="rc-button rc-button--primary js-refresh">
{{> icon icon="reload" block="rc-icon--default-size"}} {{_ "Refresh"}}
</button>
<button class="rc-button rc-button--nude js-cancel">{{> icon icon="cross"}}</button>

{{#if isReady}}
<h2>
<span class="room-title">{{_ "View_the_Logs_for" name=name}}</span>
</h2>
{{/if}}
</div>
{{/header}}
<div class="content">
{{#if hasError}}
<h2>
<span class="room-title">{{ theError }}</span>
</h2>
{{/if}}
</header>
<div class="content">
{{#if isReady}}
<div class="rocket-form">
{{#each log in logs}}
Expand All @@ -28,30 +25,18 @@ <h2>
{{formatDate log._createdAt}}: "{{log.method}}" ({{log.totalTime}}ms)
</div>
<div class="section-title-right">
<button class="button primary expand">
<span>{{_ "Expand"}}</span>
<button class="rc-button rc-button--nude button-down">
{{> icon icon="arrow-down" block="rc-icon--default-size"}}
</button>
</div>
</div>
<div class="section-content">
<h4>General Information</h4>
<ul>
<li>Method: {{ log.method }}</li>
<li>Start Time: {{ log.startTime }}</li>
<li>End Time: {{ log.endTime }}</li>
<li>Total Time: {{ log.totalTime }}ms</li>
<li>Log Entries: {{ log.entries.length }}</li>
</ul>

<h4>Log Entries</h4>
<ul>
{{#each entry in log.entries}}
<li>Timestamp: {{ entry.timestamp }}</li>
<li>Severity: {{ entry.severity }}</li>
<li>Caller: {{ entry.caller }}</li>
<li>Arguments: <pre><code class="code-colors hljs json">{{{ jsonStringify entry.args }}}</code></pre></li>
{{/each}}
</ul>
{{#each entry in log.entries}}
<div>{{ entry.severity }}: {{ entry.timestamp }} (Caller: {{ entry.caller }})</div>
<div>
<pre><code class="code-colors hljs json">{{{ jsonStringify entry.args }}}</code></pre>
</div>
{{/each}}
</div>
</div>
{{/each}}
Expand Down
55 changes: 35 additions & 20 deletions app/apps/client/admin/appLogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,32 @@ import { APIClient } from '../../../utils';
import moment from 'moment';
import hljs from 'highlight.js';

Template.appLogs.onCreated(function() {
const instance = this;
this.id = new ReactiveVar(FlowRouter.getParam('appId'));
this.ready = new ReactiveVar(false);
this.hasError = new ReactiveVar(false);
this.theError = new ReactiveVar('');
this.app = new ReactiveVar({});
this.logs = new ReactiveVar([]);

const id = this.id.get();

const loadData = (instance) => {
Promise.all([
APIClient.get(`apps/${ id }`),
APIClient.get(`apps/${ id }/logs`),
APIClient.get(`apps/${ instance.id.get() }`),
APIClient.get(`apps/${ instance.id.get() }/logs`),
]).then((results) => {

instance.app.set(results[0].app);
instance.logs.set(results[1].logs);

this.ready.set(true);
instance.ready.set(true);
}).catch((e) => {
instance.hasError.set(true);
instance.theError.set(e.message);
});
};

Template.appLogs.onCreated(function() {
const instance = this;
this.id = new ReactiveVar(FlowRouter.getParam('appId'));
this.ready = new ReactiveVar(false);
this.hasError = new ReactiveVar(false);
this.theError = new ReactiveVar('');
this.app = new ReactiveVar({});
this.logs = new ReactiveVar([]);

loadData(instance);
});

Template.appLogs.helpers({
Expand Down Expand Up @@ -76,16 +78,29 @@ Template.appLogs.helpers({

return value.replace(/\\\\n/g, '<br>');
},
title() {
return TAPi18n.__('View_the_Logs_for', { name: Template.instance().app.get().name });
},
});

Template.appLogs.events({
'click .expand': (e) => {
$(e.currentTarget).closest('.section').removeClass('section-collapsed');
$(e.currentTarget).closest('button').removeClass('expand').addClass('collapse').find('span').text(TAPi18n.__('Collapse'));
'click .section-collapsed .section-title': (e) => {
$(e.currentTarget).closest('.section').removeClass('section-collapsed').addClass('section-expanded');
$(e.currentTarget).find('.button-down').addClass('arrow-up');
},

'click .section-expanded .section-title': (e) => {
$(e.currentTarget).closest('.section').removeClass('section-expanded').addClass('section-collapsed');
$(e.currentTarget).find('.button-down').removeClass('arrow-up');
},

'click .js-cancel': (e, t) => {
FlowRouter.go('app-manage', { appId: t.app.get().id }, { version: FlowRouter.getQueryParam('version') });
},

'click .collapse': (e) => {
$(e.currentTarget).closest('.section').addClass('section-collapsed');
$(e.currentTarget).closest('button').addClass('expand').removeClass('collapse').find('span').text(TAPi18n.__('Expand'));
'click .js-refresh': (e, t) => {
t.ready.set(false);
t.logs.set([]);
loadData(t);
},
});
23 changes: 17 additions & 6 deletions app/apps/client/admin/appManage.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
{{#with app}}
<section class="page-container page-home page-static page-settings rc-apps-marketplace">
{{# header sectionName='App_Details' fixedHeight=true hideHelp=true fullpage=true}}
<div class="rc-header__section-button">
{{#unless disabled}}
<button class="rc-button rc-button--cancel js-cancel-editing">{{_ "Cancel" }}</button>
{{/unless}}
<button class="rc-button rc-button--primary js-save {{#if saving}} loading{{/if}}" disabled='{{disabled}}'>{{_ "Save_changes" }}</button>
</div>

<div class="rc-header__block rc-header__block-action">
<button class="rc-button rc-button--nude js-cancel">{{> icon icon="cross"}}</button>
</div>
Expand All @@ -18,7 +25,7 @@
<div class="rc-apps-details">
<div class="rc-apps-container rc-apps-container__header">
{{#if iconFileData}}
<div class="rc-apps-details__photo" style="background-image:url(data:image/png;base64,{{iconFileData}})"></div>
<div class="rc-apps-details__photo" style="background-image:url(data:image/png;base64,{{iconFileData}})"></div>
{{else}}
<div class="rc-apps-details__photo" style="background-image:url({{iconFileContent}})"></div>
{{/if}}
Expand All @@ -44,7 +51,15 @@ <h1>{{name}}</h1>
{{/if}}
<button class="rc-button rc-button--nude js-view-logs">{{> icon icon="list-alt"}} {{_ "View_Logs" }}</button>
{{else}}
<button class="rc-button rc-button--primary js-install">{{> icon icon="circled-arrow-down"}} {{_ "Install"}}</button>
{{#if hasPurchased}}
<button class="rc-button rc-button--primary js-install">{{> icon icon="download"}} {{_ "Purchased"}}</button>
{{else}}
{{#if $eq price 0}}
<button class="rc-button rc-button--primary js-purchase">{{> icon icon="circled-arrow-down"}} {{_ "Free"}}</button>
{{else}}
<button class="rc-button rc-button--primary js-purchase">{{> icon icon="circled-arrow-down"}} {{displayPrice}}</button>
{{/if}}
{{/if}}
{{/if}}
</div>
</div>
Expand Down Expand Up @@ -454,10 +469,6 @@ <h2> {{_ "Settings"}} </h2>

</div>
{{/each}}
<div class="rc-button-group">
<button class="rc-button rc-button--outline js-cancel-editing" disabled='{{disabled}}'>{{_ "Cancel" }}</button>
<button class="rc-button rc-button--primary js-save {{#if saving}} loading{{/if}}" disabled='{{disabled}}'>{{_ "Save" }}</button>
</div>
</div>
{{/if}}
</div>
Expand Down
Loading