Skip to content

Commit

Permalink
Merge 27da384 into c46d66f
Browse files Browse the repository at this point in the history
  • Loading branch information
simonreed authored Aug 19, 2019
2 parents c46d66f + 27da384 commit e6035f5
Show file tree
Hide file tree
Showing 181 changed files with 11,492 additions and 12,543 deletions.
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,5 @@ To run the test suite just call `rails test`. Currently 197 tests and 256 assert
- Test LOC: 1196
- Code to Test Ratio: 1:0.1

## Archivist Realtime
Archivist is both a module within Archivist and an entirely separate
webapp. [Archivist-realtime][realtime] is very slim Node.js app that
provides a communications channel between the [Redis][redis] cache and
all active users via websockets (Socket.io). The purpose of this is to
be able to lock objects while editing them and to update a users
screen as changes are made to an instrument.

[realtime]: https://github.com/CLOSER-Cohorts/archivist-realtime
[redis]: https://redis.io
[heroku]: https://heroku.com
7 changes: 2 additions & 5 deletions app/assets/javascripts/application.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ archivist = angular.module('archivist', [
'archivist.summary',
'archivist.topics',
'archivist.admin',
'archivist.realtime',
'archivist.users',
'archivist.data_manager'
])
Expand Down Expand Up @@ -139,8 +138,8 @@ archivist.directive 'ngFileModel', [
}
]

archivist.run(['$rootScope', 'Flash', 'RealTimeConnection', 'bsLoadingOverlayService',
($rootScope, Flash, RealTimeConnection, bsLoadingOverlayService)->
archivist.run(['$rootScope', 'Flash', 'bsLoadingOverlayService',
($rootScope, Flash, bsLoadingOverlayService)->
bsLoadingOverlayService.setGlobalConfig {
templateUrl: 'bsLoadingOverlaySpinJs',
activeClass: 'loading'
Expand Down Expand Up @@ -237,8 +236,6 @@ archivist.run(['$rootScope', 'Flash', 'RealTimeConnection', 'bsLoadingOverlaySer

$rootScope.page = {title: 'Home'}

$rootScope.realtimeStatus = false

$rootScope.range = (i)->
(num for num in [1..i])
])
Expand Down
49 changes: 0 additions & 49 deletions app/assets/javascripts/lib/data_manager.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ data_manager = angular.module(
'archivist.data_manager.stats',
'archivist.data_manager.topics',
'archivist.data_manager.auth',
'archivist.realtime',
'archivist.resource'
]
)
Expand All @@ -31,7 +30,6 @@ data_manager.factory(
'ResponseUnits',
'ResponseDomains',
'ResolutionService',
'RealTimeListener',
'GetResource',
'ApplicationStats',
'Topics',
Expand All @@ -50,7 +48,6 @@ data_manager.factory(
ResponseUnits,
ResponseDomains,
ResolutionService,
RealTimeListener,
GetResource,
ApplicationStats,
Topics,
Expand Down Expand Up @@ -424,52 +421,6 @@ data_manager.factory(
)
DataManager.GroupResolver.resolve()

DataManager.listener = RealTimeListener (event, message)->
console.log "Rt update"
if message.data?
reresolve_constructs = false
reresolve_questions = false
for row in message.data
try
obj = Map.find(DataManager.Data, row.type).select_resource_by_id row.id
if obj?
if obj['type'] == 'question'
old_q_id = obj['question_id']
old_q_type = obj['question_type']
for key, value of row
if ['id','type'].indexOf(key) == -1
if ['children','fchildren'].indexOf(key) != -1
old_children = obj['children']
old_fchildren = obj['fchildren']
obj[key] = row[key]
if ['children','fchildren'].indexOf(key) != -1 && (old_children != obj['children'] || old_fchildren != obj['fchildren'])
reresolve_constructs = true
if obj['type'] == 'question' && (old_q_id != obj['question_id'] || old_q_type != obj['question_type'])
obj.base = null
reresolve_questions = true
else if row.type != "Instrument" && row.action? && row.action == "ADD"
if row.instrument_id? && row.instrument_id == DataManager.Data.Instrument.id
arr = Map.find(DataManager.Data, row.type)
resource = Map.find(DataManager, row.type).resource
obj = new resource({})
console.log obj
for key, value of row
obj[key] = row[key]
if ['CcLoop','CcCondition','CcQuestion','CcStatement','CcSequence'].indexOf(obj.type) != -1
obj.type = Map.translate(obj.type)
console.log obj
arr.push obj

if row.type == 'Instrument' and row.id == DataManager.Data.Instrument.id
for key, value of row
if ['id','type'].indexOf(key) == -1
DataManager.Data.Instrument[key] = row[key]

if reresolve_questions
DataManager.resolveQuestions()
if reresolve_constructs
DataManager.resolveConstructs()

DataManager
]
)
90 changes: 0 additions & 90 deletions app/assets/javascripts/lib/realtime.coffee

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ angular.module('archivist.build').controller(
'$timeout',
'Flash',
'DataManager',
'RealTimeListener',
'RealTimeLocking',
($scope, $routeParams, $location, $timeout, Flash, DataManager, RealTimeListener, RealTimeLocking)->
($scope, $routeParams, $location, $timeout, Flash, DataManager)->

$scope.page['title'] = $scope.title
$scope.underscored = $scope.title.toLowerCase().replaceAll(' ','_')
Expand Down Expand Up @@ -73,16 +71,12 @@ angular.module('archivist.build').controller(
$scope.startEditMode = () ->
$scope.editMode = true
console.log $scope.current
RealTimeLocking.lock({type: $scope.current.type, id: $scope.current.id})
null

if !$scope.change_panel?
$scope.change_panel = (obj) ->
localStorage.setItem 'sidebar_scroll', jQuery('.sidebar').scrollTop()
$location.url $scope.edit_path obj

$scope.listener = RealTimeListener (event, message)->
if !$scope.editMode
$scope.reset()
]
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ angular.module('archivist.build').controller(
'$timeout'
'Flash',
'DataManager',
'RealTimeListener',
'RealTimeLocking',
($controller, $scope, $routeParams, $location, $filter, $timeout, Flash, DataManager, RealTimeListener, RealTimeLocking)->
($controller, $scope, $routeParams, $location, $filter, $timeout, Flash, DataManager)->

console.log 'called code_list controller'

Expand Down Expand Up @@ -92,8 +90,6 @@ angular.module('archivist.build').controller(
if not isNaN($routeParams.code_list_id)
$scope.current = angular.copy $scope.instrument.CodeLists.select_resource_by_id parseInt $routeParams.code_list_id
$scope.editMode = false
if $scope.current?
RealTimeLocking.unlock({type: $scope.current.type, id: $scope.current.id})
if $routeParams.code_list_id == 'new'
$scope.editMode = true
$scope.current = new DataManager.Codes.CodeLists.resource({codes: []});
Expand Down Expand Up @@ -154,9 +150,7 @@ angular.module('archivist.build').controller(
$routeParams: $routeParams,
$location: $location,
Flash: Flash,
DataManager: DataManager,
RealTimeListener: RealTimeListener,
RealTimeLocking: RealTimeLocking
DataManager: DataManager
}
)
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ angular.module('archivist.build').controller(
'bsLoadingOverlayService',
'Flash',
'DataManager',
'RealTimeListener',
'RealTimeLocking',
($controller, $scope, $routeParams, $location, $filter, $http, $timeout, bsLoadingOverlayService, Flash, DataManager, RealTimeListener, RealTimeLocking )->
($controller, $scope, $routeParams, $location, $filter, $http, $timeout, bsLoadingOverlayService, Flash, DataManager )->
console.time 'end to end'
$scope.title = 'Constructs'
$scope.details_bar = true
Expand Down Expand Up @@ -244,9 +242,7 @@ angular.module('archivist.build').controller(
$routeParams: $routeParams,
$location: $location,
Flash: Flash,
DataManager: DataManager,
RealTimeListener: RealTimeListener,
RealTimeLocking: RealTimeLocking
DataManager: DataManager
}
)
console.timeEnd 'load base'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,15 @@ angular.module('archivist.build').controller(
'$location',
'$timeout',
'Flash',
'DataManager',
'RealTimeListener',
'RealTimeLocking',
'DataManager'
(
$controller,
$scope,
$routeParams,
$location,
$timeout
Flash,
DataManager,
RealTimeListener,
RealTimeLocking
DataManager
) ->

$scope.load_sidebar = ->
Expand Down Expand Up @@ -121,8 +117,6 @@ angular.module('archivist.build').controller(
$scope.current = angular.copy $scope.instrument.Questions.Grids.select_resource_by_id parseInt $routeParams.question_id
$scope.title = 'Question Grid'
$scope.editMode = false
if $scope.current?
RealTimeLocking.unlock({type: $scope.current.type, id: $scope.current.id})



Expand Down Expand Up @@ -161,10 +155,8 @@ angular.module('archivist.build').controller(
$location: $location,
$timeout: $timeout,
Flash: Flash,
DataManager: DataManager,
RealTimeListener: RealTimeListener,
RealTimeLocking: RealTimeLocking
DataManager: DataManager
}
)
]
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ angular.module('archivist.build').controller(
'Flash',
'DataManager',
'Map',
'RealTimeListener',
'RealTimeLocking',
($controller, $scope, $routeParams, $location, $filter, $timeout, Flash, DataManager, Map, RealTimeListener, RealTimeLocking)->
($controller, $scope, $routeParams, $location, $filter, $timeout, Flash, DataManager, Map)->

$scope.load_sidebar = ->
$scope.sidebar_objs = $filter('excludeRDC')($scope.instrument.ResponseDomains).sort_by_property()
Expand Down Expand Up @@ -94,8 +92,6 @@ angular.module('archivist.build').controller(

$scope.current = angular.copy rd
$scope.editMode = false
if $scope.current?
RealTimeLocking.unlock({type: $scope.current.type, id: $scope.current.id})
break
if $routeParams.response_domain_type == 'new'
$scope.editMode = true
Expand All @@ -121,10 +117,8 @@ angular.module('archivist.build').controller(
$location: $location,
$timeout: $timeout,
Flash: Flash,
DataManager: DataManager,
RealTimeListener: RealTimeListener,
RealTimeLocking: RealTimeLocking
DataManager: DataManager
}
)
]
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ build = angular.module('archivist.build', [
'templates',
'ngRoute',
'archivist.flash',
'archivist.data_manager',
'archivist.realtime'
'archivist.data_manager'
])

build.config(['$routeProvider', 'treeConfig'
Expand Down Expand Up @@ -36,4 +35,4 @@ build.config(['$routeProvider', 'treeConfig'
treeConfig.placeholderClass = 'a-tree-placeholder a-construct list-group-item'
treeConfig.hiddenClass = 'a-tree-hidden'
treeConfig.dragClass = 'a-tree-drag'
])
])
Loading

0 comments on commit e6035f5

Please sign in to comment.