Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/genepi/cloudgene into rel…
Browse files Browse the repository at this point in the history
…ease-2.6.3-tis
  • Loading branch information
abought committed Jul 31, 2023
2 parents b067526 + f195c0d commit da44c78
Show file tree
Hide file tree
Showing 21 changed files with 174 additions and 329 deletions.
235 changes: 0 additions & 235 deletions files/cloudgene-daemon

This file was deleted.

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.5.7</version>
<version>2.6.3</version>

<name>Cloudgene</name>
<url>http://www.cloudgene.io</url>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h4>API Token</h4>
Make sure to copy your personal access token now. <b>You won’t be able to see it again</b>:<br><br>
<textarea style="width:100%;height:100px;">{{token}}</textarea>
14 changes: 11 additions & 3 deletions src/main/html/webapp/components/core/user/profile/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import UserProfile from 'models/user-profile';

import template from './profile.stache';
import templateDeleteDialog from './dialogs/delete.stache';

import templateNewTokenDialog from './dialogs/new.stache'

export default Control.extend({

Expand Down Expand Up @@ -99,17 +99,25 @@ export default Control.extend({
callback: function(result) {
if (result) {

var token_expiration = $('#token_expiration').val();

var user = that.options.user;

var userToken = new UserToken();
userToken.attr('user', user.attr('username'));
userToken.attr('expiration', token_expiration);

userToken.save(function(responseText) {
user.attr('hasApiToken', true);
user.attr('apiTokenValid', true);
user.attr('apiTokenMessage', "");
bootbox.alert('<h4>API Token</h4>Your token for this service is:<br><textarea style="width:100%;height:100px;">' + responseText.token + '</textarea>');

bootbox.alert({
message: templateNewTokenDialog({
token: responseText.token
})
});

}, function(message) {
bootbox.alert('<h4>API Token</h4>Error: ' + message);
});
Expand Down Expand Up @@ -210,4 +218,4 @@ export default Control.extend({

}

});
});
13 changes: 7 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 @@ -50,18 +50,19 @@ Please fill out the form below to change your account settings or your password.
<p>You need a access token to use the API. <a href="https://imputationbot.readthedocs.io/en/latest/getting-started/">Learn more</a>.</p>

{{#user.hasApiToken}}

<div class="control-group">
<div class="controls">
<button class="btn btn-primary" id="show_token">Show API Token</button>
<button class="btn btn-danger" id="revoke_token">Revoke API Token</button>
</div>
</div>
<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>

<button class="btn btn-primary" id="create_token">Create API Token</button>
Expires in
<select id="token_expiration">
<option value="30">30 days</option>
<option value="60">60 days</option>
</select>


{{/user.hasApiToken}}
Expand All @@ -76,4 +77,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>
2 changes: 1 addition & 1 deletion src/main/html/webapp/models/user-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import Model from 'can-connect/can/model/model';

export default Model.extend({
findOne: 'GET /api/v2/users/{user}/api-token',
create: 'POST /api/v2/users/{user}/api-token',
create: 'POST /api/v2/users/{user}/api-token?expiration={expiration}',
destroy: 'DELETE /api/v2/users/{user}/api-token',
}, {});
2 changes: 1 addition & 1 deletion src/main/html/webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/main/html/webapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cloudgene",
"version": "2.5.6",
"version": "2.6.3",
"description": "Cloudgene web client",
"homepage": "http://www.cloudgene.io",
"author": "Lukas Forer <[email protected] (http://www.forer.it)",
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cloudgene/mapred/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

public class Main {

public static final String VERSION = "2.5.7";
public static final String VERSION = "2.6.3";

private Database database;

Expand Down
11 changes: 2 additions & 9 deletions src/main/java/cloudgene/mapred/api/v2/admin/GetAllJobs.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ public Representation getJobs() {
case "current":

jobs = dao.findAllNotRetiredJobs();
List<AbstractJob> toRemove = new Vector<AbstractJob>();
for (AbstractJob job : jobs) {
if (engine.isInQueue(job)) {
toRemove.add(job);
}
}
jobs.removeAll(toRemove);
break;

case "retired":
Expand Down Expand Up @@ -99,15 +92,15 @@ public Representation getJobs() {
int running = 0;

for (AbstractJob job : jobs) {

String workspace = getSettings().getLocalWorkspace();
String folder = FileUtil.path(workspace, job.getId());
File file = new File(folder);
if (file.exists()) {
long size = FileUtils.sizeOfDirectory(file);
job.setWorkspaceSize(FileUtils.byteCountToDisplaySize(size));
}

if (job.getState() == AbstractJob.STATE_EXPORTING || job.getState() == AbstractJob.STATE_RUNNING) {
running++;
}
Expand Down
Loading

0 comments on commit da44c78

Please sign in to comment.