Skip to content

Commit 59198b6

Browse files
committed
Huge refactoring.
- use ES6 syntax for imports and exports - create submodules and split code with components in mind
1 parent b705f0c commit 59198b6

File tree

70 files changed

+608
-484
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+608
-484
lines changed

app/app.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ export default function routing($httpProvider, $routeProvider) {
2828
.otherwise({
2929
redirectTo: '/'
3030
});
31-
}
31+
32+
} // end of export

app/app.js

Lines changed: 11 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,15 @@
1-
require('./utilities/q-all-settled');
2-
3-
var app = angular.module('ldVOWLApp', ['ngRoute', 'ngAnimate', 'ui.bootstrap', 'ngCookies', 'qAllSettled']);
4-
5-
var nodeLinkGraph = require('./components/graph/nodelink-graph.drv.js');
6-
var Slider = require('./directives/slider.drv');
7-
8-
// Controllers
9-
var GraphCtrl = require('./components/graph/graph.ctrl.js');
10-
var HeaderCtrl = require('./components/header/header.ctrl.js');
11-
var StartCtrl = require('./components/start/start.ctrl');
12-
var SettingsCtrl = require('./components/settings/settings.ctrl.js');
13-
14-
// Services
15-
var RequestConfig = require('./services/requests/request-config.srv');
16-
var QueryFactory = require('./services/requests/query-factory.srv');
17-
var RequestCounter = require('./services/requests/request-counter.srv');
18-
19-
var ClassExtractor = require('./services/extractors/class-extractor.srv');
20-
var RelationExtractor = require('./services/extractors/relation-extractor.srv');
21-
var TypeExtractor = require('./services/extractors/type-extractor.srv');
22-
var DetailExtractor = require('./services/extractors/detail-extractor.srv');
23-
24-
var Prefixes = require('./services/model/prefixes.srv');
25-
var Nodes = require('./services/model/nodes.srv');
26-
var Requests = require('./services/model/requests.srv');
27-
var Types = require('./services/model/types.srv'); // TODO unused?
28-
var Properties = require('./services/model/properties.srv');
29-
var Utils = require('./services/utils.srv');
30-
var Filters = require('./services/model/extraction-filters.srv');
31-
32-
var Geometry = require('./services/math/geometry.srv');
33-
34-
// accordion group directives
35-
var EndpointGroup = require('./directives/accordion-groups/endpoint-group.drv');
36-
var NamespaceGroup = require('./directives/accordion-groups/namespace-group.drv');
37-
var GraphSettingsGroup = require('./directives/accordion-groups/graph-settings-group.drv');
38-
var FilterGroup = require('./directives/accordion-groups/filter-group.drv');
39-
var SelectionGroup = require('./directives/accordion-groups/selection-group.drv');
40-
41-
// selection directives
42-
var NoSelection = require('./directives/accordion-groups/selection/no-selection.drv');
43-
var ClassSelection = require('./directives/accordion-groups/selection/class-selection.drv');
44-
var TypeSelection = require('./directives/accordion-groups/selection/type-selection.drv');
45-
var PropertySelection = require('./directives/accordion-groups/selection/prop-selection.drv');
46-
var DatatypePropertySelection = require('./directives/accordion-groups/selection/datatype-prop-selection.drv');
47-
var SubclassPropertySelection = require('./directives/accordion-groups/selection/subclass-prop-selection.drv');
48-
49-
// filters
50-
var HttpLessFilter = require('./filters/http-less');
51-
var UriLabelFilter = require('./filters/uri-label');
52-
53-
// register constants
54-
55-
app.constant('PREFIX', require('./constants/blacklist_prefixes'));
56-
app.constant('PROPERTY_BLACKLIST', require('./constants/blacklist_properties'));
57-
app.constant('CLASS_BLACKLIST', require('./constants/blacklist_classes'));
1+
// import dependencies
2+
import components from './components/components.module';
3+
import filters from './filters/index';
4+
import services from './services/services.module';
5+
import utilities from './utilities/utilities.module';
586

7+
// Configuration
598
import routing from './app.config';
609
import runBlock from './app.run';
6110

62-
runBlock.$inject = ['$rootScope'];
63-
64-
app.config(routing);
65-
app.run(runBlock);
66-
67-
// FILTER
68-
69-
app.filter('uriLabel', UriLabelFilter);
70-
app.filter('httpLess', HttpLessFilter);
71-
72-
// register directives
73-
74-
app.directive('nodeLinkGraph', ['$window', '$log', 'Properties', 'Nodes', 'Prefixes', 'Filters', 'Geometry', 'Utils',
75-
nodeLinkGraph]);
76-
app.directive('slider', Slider);
77-
78-
app.directive('endpointGroup', EndpointGroup);
79-
app.directive('namespaceGroup', NamespaceGroup);
80-
app.directive('graphSettingsGroup', GraphSettingsGroup);
81-
app.directive('filterGroup', FilterGroup);
82-
app.directive('selectionGroup', SelectionGroup);
83-
84-
app.directive('noSelection', NoSelection);
85-
app.directive('classSelection', ClassSelection);
86-
app.directive('typeSelection', TypeSelection);
87-
app.directive('propSelection', PropertySelection);
88-
app.directive('datatypePropSelection', DatatypePropertySelection);
89-
app.directive('subclassPropSelection', SubclassPropertySelection);
90-
91-
// register services
92-
93-
app.service('RequestConfig', ['$cookies', RequestConfig]);
94-
app.factory('QueryFactory', QueryFactory);
95-
app.factory('RequestCounter', ['$q', 'Requests', RequestCounter]);
96-
97-
app.service('Prefixes', ['$rootScope', '$log', Prefixes]);
98-
app.service('Nodes', ['$log', 'Properties', 'Prefixes', Nodes]);
99-
app.service('Properties', ['$interval', '$log', Properties]);
100-
app.service('Types', Types);
101-
app.service('Requests', ['$rootScope', Requests]);
102-
app.service('Utils', Utils);
103-
app.service('Filters', ['$cookies', '$log', Filters]);
104-
105-
app.service('ClassExtractor', ['$http', '$q', '$log', 'PREFIX', 'CLASS_BLACKLIST', 'RequestConfig',
106-
'QueryFactory', 'Nodes', ClassExtractor]);
107-
app.service('RelationExtractor', ['$http', '$q', '$log', 'PREFIX', 'PROPERTY_BLACKLIST', 'QueryFactory',
108-
'RequestConfig', 'Nodes', 'Properties', RelationExtractor]);
109-
app.service('TypeExtractor', ['$http', '$log', 'RequestConfig', 'QueryFactory', 'Nodes', 'Properties',
110-
'RelationExtractor', TypeExtractor]);
111-
app.service('DetailExtractor', ['$http', '$log', 'QueryFactory', 'RequestConfig', 'Nodes', DetailExtractor]);
112-
113-
app.service('Geometry', ['Utils', Geometry]);
114-
115-
// register controllers
116-
117-
app.controller('GraphCtrl', ['$scope', '$q', '$log', 'Filters', 'ClassExtractor', 'RelationExtractor',
118-
'TypeExtractor', 'DetailExtractor', 'RequestConfig', 'Requests', 'Prefixes', GraphCtrl]);
119-
app.controller('HeaderCtrl', ['$scope', '$location', HeaderCtrl]);
120-
app.controller('StartCtrl', ['$log','$location', 'Nodes', 'Properties', 'Requests', 'RequestConfig', StartCtrl]);
121-
app.controller('SettingsCtrl', ['PREFIX', 'PROPERTY_BLACKLIST', 'CLASS_BLACKLIST',
122-
'RequestConfig', 'Nodes', 'Properties', 'Requests', 'ClassExtractor', 'RelationExtractor', SettingsCtrl]);
123-
124-
module.exports = app;
11+
// create main app module
12+
module.exports = angular.module('ldVOWLApp', ['ngRoute', 'ngAnimate', 'ui.bootstrap', 'ngCookies', components, filters,
13+
services, utilities])
14+
.config(routing)
15+
.run(runBlock);

app/app.run.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
module.exports = function ($rootScope) {
1+
runBlock.$inject = ['$rootScope'];
2+
3+
function runBlock($rootScope) {
4+
25
$rootScope.$on('$routeChangeSuccess', function (event, current, previous) {
36
$rootScope.title = current.$$route.title;
47
});
5-
};
8+
9+
}
10+
11+
export default runBlock;

app/components/components.module.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import angular from 'angular';
2+
3+
import graph from './graph/graph.module';
4+
import header from './header/header.module';
5+
import settings from './settings/settings.module';
6+
import sidebar from './sidebar/sidebar.module';
7+
import start from './start/start.module';
8+
9+
export default angular.module('components', [graph, header, settings, sidebar, start])
10+
.name;

app/components/graph/graph.ctrl.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
'use strict';
22

3-
module.exports = function ($scope, $q, $log, Filters, ClassExtractor, RelationExtractor, TypeExtractor, DetailExtractor,
3+
graphCtrl.$inject = ['$scope', '$q', '$log', 'Filters', 'ClassExtractor', 'RelationExtractor', 'TypeExtractor',
4+
'DetailExtractor', 'RequestConfig', 'Requests', 'Prefixes'];
5+
6+
function graphCtrl($scope, $q, $log, Filters, ClassExtractor, RelationExtractor, TypeExtractor, DetailExtractor,
47
RequestConfig, Requests, Prefixes) {
58

69
var vm = this;
@@ -187,4 +190,6 @@ module.exports = function ($scope, $q, $log, Filters, ClassExtractor, RelationEx
187190

188191
vm.startLoading();
189192

190-
};
193+
}
194+
195+
export default graphCtrl;

app/components/graph/graph.module.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import angular from 'angular';
2+
3+
import GraphCtrl from './graph.ctrl';
4+
import nodeLinkGraph from './nodelink-graph.drv';
5+
6+
export default angular.module('components.graph', [])
7+
.controller('GraphCtrl', GraphCtrl)
8+
.directive('nodeLinkGraph', nodeLinkGraph)
9+
.name;

app/components/graph/nodelink-graph.drv.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
'use strict';
22

3-
var d3 = require('d3');
3+
import angular from 'angular';
4+
import d3 from 'd3';
5+
6+
7+
NodeLinkGraph.$inject = ['$window', '$log', 'Properties', 'Nodes', 'Prefixes', 'Filters', 'Geometry', 'Utils'];
48

59
/**
6-
* @Name nodeLinkGraph
10+
* @Name NodeLinkGraph
711
*
812
* @param $window
913
* @param $log
@@ -16,7 +20,7 @@ var d3 = require('d3');
1620
*
1721
* @returns {{restrict: string, scope: {data: string, onClick: string}, link: link}}
1822
*/
19-
module.exports = function ($window, $log, Properties, Nodes, Prefixes, Filters, Geometry, Utils) {
23+
function NodeLinkGraph($window, $log, Properties, Nodes, Prefixes, Filters, Geometry, Utils) {
2024
return {
2125
restrict: 'EA',
2226
scope: {
@@ -774,4 +778,6 @@ module.exports = function ($window, $log, Properties, Nodes, Prefixes, Filters,
774778
}; // end of scope.render()
775779
} // end of link()
776780
}; // end of directive
777-
}; // end of module.exports
781+
}
782+
783+
export default NodeLinkGraph;

app/components/header/header.ctrl.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @param $scope
66
* @param $location
77
*/
8-
module.exports = function ($scope, $location) {
8+
function HeaderCtrl($scope, $location) {
99

1010
/**
1111
* Returns true if the given view location is the current one, false otherwise.
@@ -17,4 +17,8 @@ module.exports = function ($scope, $location) {
1717
return viewLocation === $location.path();
1818
};
1919

20-
};
20+
}
21+
22+
HeaderCtrl.$inject = ['$scope', '$location'];
23+
24+
export default HeaderCtrl;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import angular from 'angular';
2+
3+
import HeaderCtrl from './header.ctrl';
4+
5+
export default angular.module('components.header', [])
6+
.controller('HeaderCtrl', HeaderCtrl)
7+
.name;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import angular from 'angular';
2+
3+
import BlacklistPrefixes from './blacklist_prefixes';
4+
import BlacklistProperties from './blacklist_properties';
5+
import BlacklistClasses from './blacklist_classes';
6+
7+
export default angular.module('constants', [])
8+
.constant('PREFIX', BlacklistPrefixes)
9+
.constant('PROPERTY_BLACKLIST', BlacklistProperties)
10+
.constant('CLASS_BLACKLIST', BlacklistClasses)
11+
.name;

app/components/settings/settings.ctrl.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
'use strict';
22

3-
module.exports = function (PREFIX, PROPERTY_BLACKLIST, CLASS_BLACKLIST, RequestConfig, Nodes, Properties, Requests,
3+
settingsCtrl.$inject = ['PREFIX', 'PROPERTY_BLACKLIST', 'CLASS_BLACKLIST', 'RequestConfig', 'Nodes', 'Properties',
4+
'Requests', 'ClassExtractor', 'RelationExtractor'];
5+
6+
7+
function settingsCtrl(PREFIX, PROPERTY_BLACKLIST, CLASS_BLACKLIST, RequestConfig, Nodes, Properties, Requests,
48
ClassExtractor, RelationExtractor) {
59

610
var vm = this;
@@ -82,4 +86,6 @@ module.exports = function (PREFIX, PROPERTY_BLACKLIST, CLASS_BLACKLIST, RequestC
8286

8387
vm.initialize();
8488

85-
};
89+
}
90+
91+
export default settingsCtrl;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import angular from 'angular';
2+
3+
import SettingsCtrl from './settings.ctrl';
4+
import blacklist from './blacklist/blacklist.module.js';
5+
6+
export default angular.module('components.settings', [blacklist])
7+
.controller('SettingsCtrl', SettingsCtrl)
8+
.name;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import endpointGroupTemplate from './endpoint-group.html';
2+
3+
export default function endpointGroup() {
4+
5+
return {
6+
restrict: 'E',
7+
template: endpointGroupTemplate
8+
};
9+
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import filterGroupTemplate from './filter-group.html';
2+
3+
export default function filterGroup() {
4+
5+
return {
6+
restrict: 'E',
7+
template: filterGroupTemplate
8+
};
9+
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import graphSettingsGroupTemplate from './graph-settings-group.html';
2+
3+
export default function graphSettingsGroup() {
4+
5+
return {
6+
restrict: 'E',
7+
template: graphSettingsGroupTemplate
8+
};
9+
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import namespaceGroupTemplate from './namespace-group.html';
2+
3+
export default function namespaceGroup() {
4+
5+
return {
6+
restrict: 'E',
7+
template: namespaceGroupTemplate
8+
};
9+
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import selectionGroupTemplate from './selection-group.html';
2+
3+
export default function selectionGroup() {
4+
5+
return {
6+
restrict: 'E',
7+
template: selectionGroupTemplate
8+
};
9+
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import classSelectionTemplate from './class-selection.html';
2+
3+
export default function classSelection() {
4+
5+
return {
6+
restrict: 'E',
7+
template: classSelectionTemplate
8+
};
9+
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import datatypePropSelectionTemplate from './datatype-prop-selection.html';
2+
3+
export default function datatypePropertySelection() {
4+
5+
return {
6+
restrict: 'E',
7+
template: datatypePropSelectionTemplate
8+
};
9+
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import noSelectionTemplate from './no-selection.html';
2+
3+
export default function noSelection() {
4+
5+
return {
6+
restrict: 'E',
7+
template: noSelectionTemplate
8+
};
9+
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import propSelectionTemplate from './prop-selection.html';
2+
3+
export default function propertySelection() {
4+
5+
return {
6+
restrict: 'E',
7+
template: propSelectionTemplate
8+
};
9+
10+
}

0 commit comments

Comments
 (0)