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

update subscription modal for ClusterSubscription info #236

Merged
merged 7 commits into from
Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions imports/startup/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,4 +407,15 @@ Template.registerHelper('org', () => {
return Orgs.findOne({ name: FlowRouter.getParam('baseOrgName') });
});

Template.registerHelper('apiUrl', () => {
let apiUrl = 'RAZEE_API';
if(Meteor.settings.public.RAZEEDASH_API_URL){
apiUrl = Meteor.settings.public.RAZEEDASH_API_URL;
if(apiUrl.substr(-1) !== '/') {
apiUrl += '/';
}
}
return apiUrl;
});

import './routes.js';
16 changes: 7 additions & 9 deletions imports/ui/pages/deployables/apiHelp.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<template name="api_example">
<span>
Use the RazeeDash api to upload a version. For example,
<pre>
<code>
curl --url "{{apiUrl}}api/v1/channels/${CHANNEL}/version" \
<pre class="mb-0 bg-light">
<code>curl --url "{{apiUrl}}api/v1/channels/${CHANNEL}/version" \
--header "content-type: text/yaml" \
--header "razee-org-key: {{firstOrgKey org}}" \
--header "resource-name: ${VERSION}" \
--header "x-api-key: ${X_API_KEY}" \
--header "x-user-id: ${X_USER_ID}" \
--data-binary @resource.yaml
</code>
--header "resource-name: ${VERSION}" \</code>
{{#if currentUser.apiKey}}<code>--header "x-api-key: </code>{{currentUser.apiKey}}<code>" \</code>
{{else}}<code>--header "x-api-key: </code><a href="" class="js-generate-key">Generate api key</a><code>" \</code>
{{/if}}<code>--header "x-user-id: {{currentUser._id}}" \
--data-binary @resource.yaml</code>
</pre>
<div><code>CHANNEL</code> is the channel name you defined in RazeeDash</div>
<div><code>VERSION</code> is a unique verison representing your resource, e.g., <code>master-001</code></div>
<div><code>x-api-key</code> and <code>x-user-id</code> are found on the RazeeDash user profile page</div>
</span>
</template>
2 changes: 1 addition & 1 deletion imports/ui/pages/deployables/channels/helpModal.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template name="ChannelsHelpModal">
<div class="modal js-resource-help-modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Channels help</h5>
Expand Down
38 changes: 8 additions & 30 deletions imports/ui/pages/deployables/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,11 @@ import './subscriptions/index.js';
import './channels/index.js';
import './page.html';
import './apiHelp.html';

import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { Orgs } from '/imports/api/org/orgs';
import { FlowRouter } from 'meteor/kadira:flow-router';

Template.Channels.onCreated(function() {
this.autorun(()=>{
Meteor.subscribe('channels', Session.get('currentOrgId'));
});
});

Template.api_example.helpers({
apiUrl() {
let apiUrl = 'RAZEE_API';
if(Meteor.settings.public.RAZEEDASH_API_URL){
apiUrl = Meteor.settings.public.RAZEEDASH_API_URL;
if(apiUrl.substr(-1) !== '/') {
apiUrl += '/';
}
}
return apiUrl;
},
org() {
const orgName = FlowRouter.getParam('baseOrgName');
const org = Orgs.findOne({ name: orgName });
return org;
}
});
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';

Template.api_example.events({
'click .js-generate-key': function() {
Meteor.call('generateApikey');
}
});
20 changes: 19 additions & 1 deletion imports/ui/pages/deployables/subscriptions/helpModal.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template name="SubscriptionsHelpModal">
<div class="modal js-group-help-modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Subscriptions help</h5>
Expand Down Expand Up @@ -28,6 +28,24 @@ <h5 class="modal-title">Subscriptions help</h5>
<dd>{{> api_example }}</dd>

</dl>
<div class="mt-3"><a href="https://github.com/razee-io/ClusterSubscription" target="_blank">ClusterSubscription</a> can be used on any cluster that you want
to subscribe to an uploaded resource. Your cluster(s) can subscribe by first creating a <code>clustersubscription</code> config map and then installing ClusterSubscription on your cluster
<div>
<pre class="bg-light">
kubectl create cm clustersubscription \
--from-literal=RAZEE_API='{{apiUrl}}' \
--from-literal=RAZEE_ORG_KEY='{{firstOrgKey org}}' \
--from-literal=RAZEE_TAGS='comma-separated-tags-go-here'
</pre>
</div>
<div>
<pre class="bg-light">

kubectl apply -f https://github.com/razee-io/RazeeDeploy-delta/releases/latest/download/resource.yaml
kubectl apply -f https://github.com/razee-io/ClusterSubscription/releases/latest/download/resource.yaml
</pre>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link" data-dismiss="modal">Close</button>
Expand Down