Skip to content

Commit

Permalink
Merge tag 'v2.8.2' of https://github.com/genepi/cloudgene into releas…
Browse files Browse the repository at this point in the history
…e/2.8.2-tis
  • Loading branch information
abought committed Mar 21, 2024
2 parents 91a5323 + 689ea97 commit a5cc885
Show file tree
Hide file tree
Showing 28 changed files with 1,743 additions and 1,174 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
java-version: '12'
distribution: 'adopt'
- name: Run JUnit Tests
run: mvn install
run: mvn -B install
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v2
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cloudgene</groupId>
<artifactId>cloudgene</artifactId>
<version>2.7.0</version>
<version>2.8.2</version>

<name>Cloudgene</name>
<url>http://www.cloudgene.io</url>
Expand Down
64 changes: 36 additions & 28 deletions src/main/html/webapp/components/admin/app/list/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,40 +228,48 @@ export default Control.extend({

Group.findAll({},
function(groups) {
var selection = new canMap();
selection.attr('group', application.attr('permission'));
selection.attr('name', '');

bootbox.confirm(templatePermission({
selection: selection,
application: application,
groups: groups
}),

var roles = application.attr('permission').split(',');

var options = '';
groups.forEach(function(group, index) {
if ($.inArray(group.attr('name'), roles) >= 0) {
options = options + '<label class="checkbox"><input type="checkbox" name="role-select" value="' + group.attr('name') + '" checked />';
//options = options + '<option selected>' + group.attr('name') + '</option>';
} else {
//options = options + '<option>' + group.attr('name') + '</option>';
options = options + '<label class="checkbox"><input type="checkbox" name="role-select" value="' + group.attr('name') + '" />';
}
options = options + ' <b>' + group.attr('name') + '</b></label><br>';
});

bootbox.confirm(
'<h4>Edit permission of ' + application.attr('name') + '</h4><hr><form id="role-form">' + options + '</form>',
function(result) {
if (result) {
var group = selection.attr('group');
if (group !== '') {
application.attr('permission', group);
application.save(function(data) {},
function(response) {
showErrorDialog("Operation failed", response);
});
} else {
var name = selection.attr('name');
if (name !== '') {
application.attr('permission', name);
application.save(function(data) {},
function(response) {
showErrorDialog("Operation failed", response);
});

} else {
bootbox.alert("Error: Please enter a name for the new group.")

var boxes = $('#role-form input:checkbox');
var checked = [];
for (var i = 0; boxes[i]; ++i) {
if (boxes[i].checked) {
checked.push(boxes[i].value);
}
}

var text = checked.join(',');
application.attr('permission', text);
application.save(function(data) {},
function(response) {
showErrorDialog("Operation failed", response);
});

}
});
}
);

},
function(response) {
new ErrorPage(element, response);
});

},
Expand Down
38 changes: 33 additions & 5 deletions src/main/html/webapp/components/core/user/profile/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,37 @@ import templateNewTokenDialog from './dialogs/new.stache'
export default Control.extend({

"init": function(element, options) {

this.emailRequired = options.appState.attr('emailRequired');
$(element).hide();
User.findOne({
user: 'me'
}, function(user) {
$(element).html(template({
user: user
user: user,
anonymousAccount: (!options.appState.attr('emailRequired')),
emailProvided: (user.attr('mail') != "" && user.attr('mail') != undefined),
userEmailDescription: options.appState.attr('userEmailDescription'),
userWithoutEmailDescription: options.appState.attr('userWithoutEmailDescription')
}));
options.user = user;
$(element).fadeIn();
});
},

"#anonymous click" : function(){
if (!this.emailRequired){
var anonymousControl = $(this.element).find("[name='anonymous']");
var anonymous = !anonymousControl.is(':checked');
var mail = $(this.element).find("[name='mail']");
if (anonymous){
mail.attr('disabled','disabled');
} else {
mail.removeAttr('disabled');
}
mail.val("");
}
},

'submit': function(element, event) {
event.preventDefault();
var user = new User();
Expand All @@ -38,10 +56,20 @@ export default Control.extend({
var fullnameError = user.checkName(fullname.val());
this.updateControl(fullname, fullnameError);

var anonymous = false;
if (!this.emailRequired){
var anonymousControl = $(this.element).find("[name='anonymous']");
anonymous = !anonymousControl.is(':checked');
}

// mail
var mail = $(element).find("[name='mail']");
var mailError = user.checkMail(mail.val());
this.updateControl(mail, mailError);
if (!anonymous){
var mailError = user.checkMail(mail.val());
this.updateControl(mail, mailError);
} else {
this.updateControl(mail, undefined);
}

// password if password is not empty. else no password update on server side
var newPassword = $(element).find("[name='new-password']");
Expand Down Expand Up @@ -218,4 +246,4 @@ export default Control.extend({

}

});
});
34 changes: 28 additions & 6 deletions src/main/html/webapp/components/core/user/profile/profile.stache
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,34 @@ Please fill out the form below to change your account settings or your password.
<div class="invalid-feedback"></div>
</div>

{{#is(anonymousAccount, false)}}

<div class="form-group">
<label for="mail" class="control-label">E-Mail:</label>
<input id="mail" name="mail" type="text" value="{{user.mail}}" class="form-control col-sm-3">
<div class="invalid-feedback"></div>
</div>

{{else}}
<hr>
<div class="form-group">
<input type="checkbox" id="anonymous" name="anonymous" value="0" {{#emailProvided}}checked{{/emailProvided}}> <label for="anonymous" class="control-label">E-Mail Address</label>
<div class="form-group" style="margin-left: 30px;">
<p>
{{userEmailDescription}}
</p>
<label for="mail" class="control-label">E-Mail:</label>
<input id="mail" name="mail" type="text" class="form-control col-sm-3" autocomplete="off" {{#is(emailProvided, false)}}disabled{{/is}} value="{{user.mail}}">
<div class="invalid-feedback"></div>
<p><br>
{{userWithoutEmailDescription}}
</p>
</div>
</div>
<hr>

{{/is}}

<h4>Change password</h4>

<div class="form-group">
Expand All @@ -41,9 +63,9 @@ Please fill out the form below to change your account settings or your password.

</div>
</form>

<br>
<hr>

<br>
<h3>API Access</h3>

<p>This service provides a rich RestAPI to submit, monitor and download jobs.</p>
Expand All @@ -58,17 +80,17 @@ Please fill out the form below to change your account settings or your password.
<small class="{{#is(../user.apiTokenValid, false)}}text-danger{{#is}}">{{../user.apiTokenMessage}}</small>
{{else}}
<button class="btn btn-primary" id="create_token">Create API Token</button>
Expires in
Expires in
<select id="token_expiration">
<option value="30">30 days</option>
<option value="60">60 days</option>
</select>


{{/user.hasApiToken}}

<br>
<hr>

<br>
<h3>Delete Account</h3>

<p>Once you delete your user account, there is no going back. Please be certain.</p>
Expand All @@ -77,4 +99,4 @@ Please fill out the form below to change your account settings or your password.
<div class="controls">
<button class="btn btn-danger" id="delete_account">Delete Account</button>
</div>
</div>
</div>
53 changes: 50 additions & 3 deletions src/main/html/webapp/components/core/user/signup/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,51 @@ import template from './signup.stache';
export default Control.extend({

"init": function(element, options) {
this.emailRequired = options.appState.attr('emailRequired');
$(element).hide();
$(element).html(template());
$(element).html(template({
emailRequired: options.appState.attr('emailRequired'),
userEmailDescription: options.appState.attr('userEmailDescription'),
userWithoutEmailDescription: options.appState.attr('userWithoutEmailDescription')
}));
$(element).fadeIn();
},

"#anonymous1 click" : function(){
this.updateEmailControl();
},

"#anonymous2 click" : function(){
this.updateEmailControl();
},

"updateEmailControl": function() {
if (!this.emailRequired){
var anonymousControl = $(this.element).find("[name='anonymous']:checked");
var anonymous = (anonymousControl.val() == "1");
var mail = $(this.element).find("[name='mail']");
if (anonymous){
mail.attr('disabled','disabled');
} else {
mail.removeAttr('disabled');
}
}
},

'submit': function(element, event) {
event.preventDefault();

var that = this;
var user = new User();

// anonymous radiobutton
var anonymous = false;

if (!this.emailRequired){
var anonymousControl = $(element).find("[name='anonymous']:checked");
anonymous = (anonymousControl.val() == "1");
}

// username
var username = $(element).find("[name='username']");
var usernameError = user.checkUsername(username.val());
Expand All @@ -32,8 +66,12 @@ export default Control.extend({

// mail
var mail = $(element).find("[name='mail']");
var mailError = user.checkMail(mail.val());
this.updateControl(mail, mailError);
if (!anonymous){
var mailError = user.checkMail(mail.val());
this.updateControl(mail, mailError);
} else {
this.updateControl(mail, undefined);
}

// password
var newPassword = $(element).find("[name='new-password']");
Expand All @@ -55,7 +93,16 @@ export default Control.extend({
success: function(data) {
if (data.success == true) {
// shows success

var message = "";
if (!anonymous){
message = "Well done!</b> An email including the activation code has been sent to your address."
} else {
message = "<b>Well done!</b> Your account is now active. <a href=\"/\">Login now</a>."
}

$('#signon-form').hide();
$('#success-message').html(message);
$('#success-message').show();
} else {
// shows error msg
Expand Down
25 changes: 23 additions & 2 deletions src/main/html/webapp/components/core/user/signup/signup.stache
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<br>

<div class="alert alert-success" id="success-message" style="display: none;">
<b>Well done!</b> An email including the activation code has been sent to your address.
<br>
</div>

<form id="signon-form" class="form-horizontal" autocomplete="off">
Expand All @@ -21,13 +19,36 @@
<div class="invalid-feedback"></div>
</div>

{{#is(emailRequired, true)}}

<div class="form-group">
<label for="mail" class="control-label">E-Mail:</label>
<input id="mail" name="mail" type="text" class="form-control col-sm-3" autocomplete="off">
<div class="invalid-feedback"></div>
</div>

{{else}}
<hr>
<div class="form-group">
<input type="radio" id="anonymous1" name="anonymous" value="0" checked> <label for="anonymous1" class="control-label">E-Mail Address</label>
<div class="form-group" style="margin-left: 30px;">
<p>
{{{userEmailDescription}}}
</p>
<label for="mail" class="control-label">E-Mail:</label>
<input id="mail" name="mail" type="text" class="form-control col-sm-3" autocomplete="off">
<div class="invalid-feedback"></div>
</div>
<input type="radio" id="anonymous2" name="anonymous" value="1"> <label for="anonymous2" class="control-label">I don't want to provide my email address</label>
<div class="form-group" style="margin-left: 30px;">
<p>
{{{userWithoutEmailDescription}}}
</p>
</div>
</div>
<hr>
{{/is}}

<div class="form-group">
<label for="new-password" class="control-label">Password:</label>
<input id="new-password" name="new-password" type="password" class="form-control col-sm-3" autocomplete="off">
Expand Down
2 changes: 2 additions & 0 deletions src/main/html/webapp/helpers/error-page.stache
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<br><br><br>
<div style="margin: 40px">
<h2 class="text-danger text-center">
{{error.statusText}}
</h2>
Expand All @@ -22,4 +23,5 @@
&nbsp;
{{{error.responseText}}}
</h5>
</div>
<br><br><br><br><br><br><br><br><br>
Loading

0 comments on commit a5cc885

Please sign in to comment.