-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into SWIK-2103-Support-for-NV3D-charts-in-front…
…-end
- Loading branch information
Showing
415 changed files
with
16,630 additions
and
5,429 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const log = require('../log/clog'); | ||
import serviceUnavailable from '../error/serviceUnavailable'; | ||
import UserProfileStore from '../../stores/UserProfileStore'; | ||
|
||
export default function addDeckToCollection(context, payload, done) { | ||
log.info(context); | ||
|
||
// enrich payload with jwt | ||
payload.jwt = context.getStore(UserProfileStore).jwt; | ||
|
||
// define operation | ||
payload.op = 'add'; | ||
|
||
context.service.update('deckgroups.updateDecksOfCollection', payload, {timeout: 20 * 1000}, (err, res) => { | ||
if (err) { | ||
log.error(context, {filepath: __filename, message: err.message}); | ||
context.dispatch('ADD_DECK_TO_COLLECTION_FAILURE', err); | ||
} else { | ||
context.dispatch('ADD_DECK_TO_COLLECTION_SUCCESS', payload.collection); | ||
} | ||
|
||
done(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import async from 'async'; | ||
const log = require('../log/clog'); | ||
import serviceUnavailable from '../error/serviceUnavailable'; | ||
import notFoundError from '../error/notFoundError'; | ||
import loadDeckCollections from './loadDeckCollections'; | ||
import loadUserCollections from './loadUserCollections'; | ||
import UserProfileStore from '../../stores/UserProfileStore'; | ||
|
||
// loads collection for a deck and the user collection options | ||
export default function loadCollectionsTab(context, payload, done) { | ||
log.info(context); | ||
|
||
// load required actions in parallel | ||
async.parallel([ | ||
(callback) => { | ||
context.executeAction(loadDeckCollections, payload, callback); | ||
}, | ||
(callback) => { | ||
// if logged in, then request collections that the user has edit rights | ||
if (context.getStore(UserProfileStore).userid) { | ||
context.executeAction(loadUserCollections, payload, callback); | ||
} else { | ||
callback(); | ||
} | ||
} | ||
], (err, results) => { | ||
if (err) { | ||
log.error(context, {filepath: __filename}); | ||
context.executeAction(serviceUnavailable, payload, done); | ||
return; | ||
} | ||
|
||
done(); | ||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,28 @@ | ||
const log = require('../log/clog'); | ||
import log from '../log/clog'; | ||
import serviceUnavailable from '../error/serviceUnavailable'; | ||
import UserProfileStore from '../../stores/UserProfileStore'; | ||
|
||
// loads deck groups assigned by the current user to a deck | ||
// loads deck collections assigned to a deck | ||
export default function loadDeckCollections(context, payload, done) { | ||
log.info(context); | ||
|
||
// enrich payload with user id | ||
if(payload.params){ | ||
payload.params.userId = context.getStore(UserProfileStore).userid; | ||
payload.params.jwt = context.getStore(UserProfileStore).jwt; | ||
} else { | ||
payload.userId = context.getStore(UserProfileStore).userid; | ||
payload.jwt = context.getStore(UserProfileStore).jwt; | ||
} | ||
|
||
context.dispatch('UPDATE_COLLECTIONS_LOADING', true); | ||
let args = (payload.params) ? payload.params : payload; | ||
args.countOnly = false; | ||
|
||
// first get user groups that the user is member of | ||
context.service.read('usergroup.member', payload, {timeout: 20 * 1000}, (err, usergroups) => { | ||
if(err){ | ||
log.error(context, {filepath: __filename}); | ||
done(); | ||
// then get deck collection options | ||
context.service.read('deckgroups.forDeck', args, {timeout: 20 * 1000}, (err, res) => { | ||
if (err) { | ||
log.error(context, {filepath: __filename, message: err.message}); | ||
context.dispatch('LOAD_DECK_COLLECTIONS_FAILURE', err); | ||
} else { | ||
|
||
// then get deck collection options | ||
payload.usergroups = usergroups; | ||
context.service.read('deckgroups.forDeck', payload, {timeout: 20 * 1000}, (err, res) => { | ||
if (err) { | ||
log.error(context, {filepath: __filename}); | ||
context.dispatch('LOAD_COLLECTIONS_FAILURE', err); | ||
} else { | ||
context.dispatch('LOAD_COLLECTIONS_SUCCESS', res); | ||
} | ||
|
||
context.dispatch('UPDATE_COLLECTIONS_LOADING', false); | ||
|
||
done(); | ||
context.dispatch('LOAD_DECK_COLLECTIONS_SUCCESS', { | ||
selector: payload.params, | ||
collections: res | ||
}); | ||
context.dispatch('LOAD_PLAYLISTS_COUNT', res.length); | ||
context.dispatch('UPDATE_MODULE_TYPE_SUCCESS', { moduleType: 'playlists' }); | ||
} | ||
}); | ||
|
||
done(); | ||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const log = require('../log/clog'); | ||
|
||
// loads user group collections | ||
export default function loadGroupCollections(context, payload, done) { | ||
log.info(context); | ||
|
||
context.dispatch('SET_COLLECTIONS_LOADING'); // show loading indicator | ||
let params = (payload.params) ? payload.params : payload; | ||
|
||
context.service.read('deckgroups.forGroup', params, {timeout: 20 * 1000}, (err, res) => { | ||
if (err) { | ||
log.error(context, {filepath: __filename, message: err.message}); | ||
context.dispatch('LOAD_USER_COLLECTIONS_FAILURE', err); | ||
} else { | ||
context.dispatch('LOAD_USER_COLLECTIONS_SUCCESS', res); | ||
} | ||
|
||
done(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import log from '../log/clog'; | ||
import serviceUnavailable from '../error/serviceUnavailable'; | ||
|
||
// loads count of deck collections assigned to a deck | ||
export default function loadPlaylistsCount(context, payload, done) { | ||
log.info(context); | ||
|
||
let args = (payload.params) ? payload.params : payload; | ||
args.countOnly = true; | ||
|
||
context.service.read('deckgroups.forDeck', args, {timeout: 20 * 1000}, (err, res) => { | ||
if (err) { | ||
log.error(context, {filepath: __filename, message: err.message}); | ||
context.dispatch('LOAD_PLAYLISTS_COUNT_FAILURE', err); | ||
} else { | ||
context.dispatch('LOAD_PLAYLISTS_COUNT', res); | ||
} | ||
|
||
done(); | ||
}); | ||
|
||
} |
Oops, something went wrong.