Skip to content

Commit

Permalink
Merge pull request #1 from wso2/release-2.0.0
Browse files Browse the repository at this point in the history
sync with upstream
  • Loading branch information
thusithak committed May 12, 2015
2 parents 7da6c5b + fbe4412 commit f0d112c
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ require('/modules/publisher.js').exec(function(ctx) {
}
}

if(!api.subscribersCount || api.subscribersCount==0){
api.subs=false;
}else{
api.subs=true;
}
if(api.visibility == 'public') {
api.publicVisibility = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ $(function () {
var designer = APIDesigner();
if ($("#resource_url_pattern").val() == "" || $('#inputResource').val() == "") {
//jagg.message({content:"URL pattern & Resource cannot be empty.",type:"error"});
BootstrapDialog.show({
type: 'BootstrapDialog.TYPE_DANGER',
title: 'Message type: ' + type,
BootstrapDialog.show({
type: BootstrapDialog.TYPE_DANGER,
title: 'Error',
message: 'URL pattern & Resource cannot be empty.'
});
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ $(document).ready(function(){

$('#go_to_implement').click(function(e){
//TODO
//$("body").unbind("api_saved");
//$("body").on("api_saved" , function(e){
$("body").unbind("api_saved");
$("body").on("api_saved" , function(e){
location.href = caramel.context + "/asts/api/implement/"+store.publisher.api.id;
//});
//$("#design_form").submit();
});
$("#form-asset-create").submit();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ $(function () {
var EV_UPDATE_DOMAIN = 'eventUpdateDomain';
var EV_GENERATE_PROD_TOKEN = 'eventGenerateProductionToken';
var EV_GENERATE_SAND_TOKEN = 'eventGenerateSandboxToken';
var EV_RGEN_PROD_TOKEN='eventRegenerateProductionToken';
var EV_RGEN_SAND_TOKEN='eventRegenerateSandboxToken';
var EV_RGEN_PROD_TOKEN = 'eventRegenerateProductionToken';
var EV_RGEN_SAND_TOKEN = 'eventRegenerateSandboxToken';

var APP_STORE = {};

/*
This function generate the location of the templates used in the rendering
*/
var getSubscriptionAPI = function(appName){
var getSubscriptionAPI = function (appName) {
return caramel.context + '/apis/application/' + appName + '/subscriptions';
};

Expand Down Expand Up @@ -79,7 +79,7 @@ $(function () {
*/
var updateMetadata = function (appName, newDetails, environment) {
var appData = findAppDetails(appName);
if (environment == 'Production'){
if (environment == 'Production') {

appData.prodKeyScope = newDetails.tokenScope;
appData.prodValidityTime = newDetails.validityTime;
Expand Down Expand Up @@ -238,17 +238,17 @@ $(function () {
/*
The function is used to attach the logic which will regenerate the Production token
*/
var attachRegenerateProductionToken=function(){
$('#btn-refresh-Production-token').on('click',function(){
var attachRegenerateProductionToken = function () {
$('#btn-refresh-Production-token').on('click', function () {
console.info('The user wants to regenerate the Production token');
});
};

/*
The function is used to attach the logic which will regenerate the Sandbox token
*/
var attachRegenerateSandboxToken=function(){
$('#btn-refresh-Sandbox-token').on('click',function(){
var attachRegenerateSandboxToken = function () {
$('#btn-refresh-Sandbox-token').on('click', function () {
console.info('The user wants to regenerate the Sandbox token');
});
};
Expand All @@ -275,10 +275,13 @@ $(function () {
container: PROD_KEYS_CONTAINER,
partial: 'sub-keys-generate-prod',
beforeRender: function (data) {
data['environment'] = Views.translate('Production');
data.environment = Views.translate('Production');
if (data.appName == null) {
data.isAppNameAvailable = Views.translate('false');
}
},
resolveRender:function(){
if(APP_STORE.productionKeys){
resolveRender: function () {
if (APP_STORE.productionKeys) {
return false;
}
return true;
Expand All @@ -290,14 +293,14 @@ $(function () {
Views.extend('defaultProductionKeyView', {
id: 'visibleProductionKeyView',
partial: 'sub-keys-visible-prod',
subscriptions: [EV_APP_SELECT,EV_SHOW_KEYS, EV_GENERATE_PROD_TOKEN],
subscriptions: [EV_APP_SELECT, EV_SHOW_KEYS, EV_GENERATE_PROD_TOKEN],
resolveRender: function (data) {
//alert('Resolve rendering!');
if(!APP_STORE.showKeys){
if (!APP_STORE.showKeys) {
return false;
}

if(!APP_STORE.productionKeys){
if (!APP_STORE.productionKeys) {
return false;
}

Expand All @@ -313,15 +316,15 @@ $(function () {

Views.extend('defaultProductionKeyView', {
id: 'hiddenProductionKeyView',
subscriptions: [EV_APP_SELECT,EV_SHOW_KEYS, EV_HIDE_KEYS, EV_GENERATE_PROD_TOKEN],
subscriptions: [EV_APP_SELECT, EV_SHOW_KEYS, EV_HIDE_KEYS, EV_GENERATE_PROD_TOKEN],
partial: 'sub-keys-hidden-prod',
resolveRender: function (data) {
//Determine if the keys need to be visible
if (APP_STORE.showKeys) {
return false;
}

if(!APP_STORE.productionKeys){
if (!APP_STORE.productionKeys) {
return false;
}

Expand All @@ -337,10 +340,13 @@ $(function () {
container: SAND_KEYS_CONTAINER,
partial: 'sub-keys-generate-prod',
beforeRender: function (data) {
data['environment'] = Views.translate('Sandbox');
data.environment = Views.translate('Sandbox');
if (data.appName == null) {
data.isAppNameAvailable = Views.translate('false');
}
},
resolveRender:function(){
if(APP_STORE.sandboxKeys){
resolveRender: function () {
if (APP_STORE.sandboxKeys) {
return false;
}
return true;
Expand All @@ -354,10 +360,10 @@ $(function () {
partial: 'sub-keys-visible-prod',
resolveRender: function (data) {

if(!APP_STORE.sandboxKeys){
if (!APP_STORE.sandboxKeys) {
return false;
}
if(!APP_STORE.showKeys){
if (!APP_STORE.showKeys) {
return false;
}
//Only render the view if sandbox keys are present
Expand All @@ -377,11 +383,11 @@ $(function () {
resolveRender: function (data) {
console.info(APP_STORE.sandboxKeys);
//Determine if the keys need to be visible
if(APP_STORE.showKeys){
if (APP_STORE.showKeys) {
return false;
}

if(!APP_STORE.sandboxKeys){
if (!APP_STORE.sandboxKeys) {
return false;
}

Expand All @@ -405,9 +411,12 @@ $(function () {
container: PROD_DOMAIN_CONTAINER,
partial: 'sub-domain-token-prod',
beforeRender: function (data) {
data['environment'] = Views.translate('Production');
data['allowedDomains'] = Views.translate('ALL');
data['validityTime'] = Views.translate('3600');
data.environment = Views.translate('Production');
data.allowedDomains = Views.translate('ALL');
data.validityTime = Views.translate('3600');
if (data.appName == null) {
data.isAppNameAvailable = Views.translate('false');
}
},
subscriptions: [EV_APP_SELECT],
afterRender: function () {
Expand All @@ -426,9 +435,12 @@ $(function () {
id: 'defaultSandboxDomainView',
container: SAND_DOMAIN_CONTAINER,
beforeRender: function (data) {
data['environment'] = Views.translate('Sandbox');
data['allowedDomains'] = Views.translate('ALL');
data['validityTime'] = Views.translate('3600');
data.environment = Views.translate('Sandbox');
data.allowedDomains = Views.translate('ALL');
data.validityTime = Views.translate('3600');
if (data.appName == null) {
data.isAppNameAvailable = Views.translate('false');
}
},
afterRender: function () {
}
Expand All @@ -450,7 +462,7 @@ $(function () {
partial: 'sub-listing',
beforeRender: function (data) {
var appName = data.appName;
data['subscriptions'] = findSubscriptionDetails(appName);
data.subscriptions = findSubscriptionDetails(appName);
},
subscriptions: [EV_APP_SELECT],
afterRender: function () {
Expand All @@ -475,7 +487,7 @@ $(function () {
The function returns the Production Keys of the given application
*/
var findProdKeys = function (details) {
if(!details.prodKey){
if (!details || !details.prodKey) {
return null;
}
var keys = {};
Expand All @@ -492,7 +504,7 @@ $(function () {
The function returns the Sandbox Keys of the given application
*/
var findSandKeys = function (details) {
if(!details.sandboxKey){
if (!details || !details.sandboxKey) {
return null;
}
var keys = {};
Expand All @@ -505,7 +517,7 @@ $(function () {
return keys;
};

var populateAppStore = function(appName){
var populateAppStore = function (appName) {
var details = findAppDetails(appName);
APP_STORE.appName = appName;
APP_STORE.appDetails = details;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

<select id='subscription_selection'>
{{#each appsWithSubs}}
<option>{{name}}</option>
{{#if subscriptions}}
<option>{{name}}</option>
{{/if}}
{{/each}}
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
<!-- Domain token view
The view is used to display the domain details
-->
<form>
{{#if isAppNameAvailable}}
<fieldset>
<h5>Allowed Domains</h5>
<textarea class='input-xlarge' id='input-{{ environment }}-allowedDomains'>{{allowedDomains}}</textarea>
<span class='help-block'>Leaving empty or filling with ALL will allow all domains</span>
<span class='help-block'>Please subscribe to APIs to view domain information</span>
</fieldset>
</form>

<!--View # 1: Token data-->
<h5>Token Validity</h5>
<form class='form form-inline'>
<fieldset>
<input type='text' class='input-small' id='input-{{ environment }}-validityTime' value='{{validityTime}}'/>
<label>seconds</label>
</fieldset>
</form>
{{else}}
<form>
<fieldset>
<h5>Allowed Domains</h5>
<textarea class='input-xlarge' id='input-{{ environment }}-allowedDomains'>{{allowedDomains}}</textarea>
<span class='help-block'>Leaving empty or filling with ALL will allow all domains</span>
</fieldset>
</form>

<!--View # 1: Token data-->
<h5>Token Validity</h5>
<form class='form form-inline'>
<fieldset>
<input type='text' class='input-small' id='input-{{ environment }}-validityTime' value='{{validityTime}}'/>
<label>seconds</label>
</fieldset>
</form>
{{/if}}
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
<!-- Domain update view
-->
<form>
{{#if isAppNameAvailable}}
<fieldset>
<h5>Allowed Domains</h5>
<textarea class='input-xlarge' id='input-{{ environment }}-allowedDomains'>{{allowedDomains}}</textarea>
<span class='help-block'>Leaving empty or filling with ALL will allow all domains</span>
<span class='help-block'>Please subscribe to APIs to view domain information</span>
</fieldset>
</form>
{{else}}
<form>
<fieldset>
<h5>Allowed Domains</h5>
<textarea class='input-xlarge' id='input-{{ environment }}-allowedDomains'>{{allowedDomains}}</textarea>
<span class='help-block'>Leaving empty or filling with ALL will allow all domains</span>
</fieldset>
</form>

<form>
<fieldset>
<input type='button' class='btn btn-primary btn-block' value='Update Domains' id='btn-{{ environment }}-updateDomains'>
</fieldset>
</form>
<form>
<fieldset>
<input type='button' class='btn btn-primary btn-block' value='Update Domains'
id='btn-{{ environment }}-updateDomains'>
</fieldset>
</form>
{{/if}}
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<!--Key generation view
This view is shown when a key has not been generated
-->
<form>
{{#if isAppNameAvailable}}
<fieldset>
<span class='help-block'>{{ environment }} keys are not yet generated for this app </span>
<input type='button' class='btn btn-primary' value='Generate ' id='btn-generate-{{ environment }}-token'/>
<span class='help-block'>Please subscribe to APIs to view tokens</span>
</fieldset>
</form>
{{else}}
<form>
<fieldset>
<span class='help-block'>{{ environment }} keys are not yet generated for this app </span>
<input type='button' class='btn btn-primary' value='Generate ' id='btn-generate-{{ environment }}-token'/>
</fieldset>
</form>
{{/if}}

0 comments on commit f0d112c

Please sign in to comment.