Skip to content

Commit

Permalink
Refactor + align project structure with Angular 2 conventions. (googl…
Browse files Browse the repository at this point in the history
…e#415)

* Add Angular 5.0.0-beta.5 dependency from npm.

* Remove IIFEs that wrap typescript code.

* Rewrite all "var" to "let" and "const" in typescript code.

* Replace per-file AngularJS modules with ES6 exports and imports.

* Wire up AngularJS modules using imports/exports instead of names.

* Add .module suffix to angular module files.

* Remove "components" directory.

* Replace @ultimate/aot-loader with @ngtools/webpack

* Load AngularJS templates with webpack raw-loader.

* Move templates out of timesketch/ui folder.

* Move views out of timesketch/ui folder.

* Move fonts and images to timesketch/static.

* Update configs to reflect recent moving of files.

* Align file names with Angular 2 convention.

* Move to manual angular bootstrap process.
  • Loading branch information
franekp authored and berggren committed Sep 1, 2017
1 parent b5d875a commit 44c4c23
Show file tree
Hide file tree
Showing 101 changed files with 2,356 additions and 2,283 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ignore frontend build related files
node_modules
timesketch/ui/static/dist
timesketch/static/dist

# Ignore data files
*.plaso
Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
recursive-include timesketch/ui/static *
recursive-include timesketch/ui/templates *
recursive-include timesketch/static *
recursive-include timesketch/templates *
include timesketch.conf
include requirements.txt
include requirements.in
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
"lint:watch": ""
},
"dependencies": {
"@angular/common": "5.0.0-beta.5",
"@angular/compiler": "5.0.0-beta.5",
"@angular/compiler-cli": "5.0.0-beta.5",
"@angular/core": "5.0.0-beta.5",
"@angular/platform-browser": "5.0.0-beta.5",
"@angular/platform-browser-dynamic": "5.0.0-beta.5",
"@angular/upgrade": "5.0.0-beta.5",
"@ngtools/webpack": "^1.6.2",
"angular": "1.3.5",
"brace": "^0.10.0",
"chart.js": "2.2.2",
Expand All @@ -28,12 +36,15 @@
"moment": "2.10.3",
"node-sass": "^4.5.3",
"numeral": "2.0.6",
"raw-loader": "^0.5.1",
"rxjs": "^5.4.3",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
"ts-loader": "^2.3.3",
"twitter-bootstrap-3.0.0": "^3.0.0",
"typescript": "^2.4.2",
"url-loader": "^0.5.9",
"webpack": "^3.5.5"
"webpack": "^3.5.5",
"zone.js": "^0.8.17"
}
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def check_before_upload():
"""
this_dir = os.path.dirname(__file__)
frontend_dist_dir = os.path.join(
this_dir, 'timesketch', 'ui', 'static', 'dist',
this_dir, 'timesketch', 'static', 'dist',
)
js = os.path.join(frontend_dist_dir, 'bundle.js')
css = os.path.join(frontend_dist_dir, 'bundle.css')
Expand Down
10 changes: 5 additions & 5 deletions timesketch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
from timesketch.models import init_db
from timesketch.models.sketch import Sketch
from timesketch.models.user import User
from timesketch.ui.views.home import home_views
from timesketch.ui.views.sketch import sketch_views
from timesketch.ui.views.story import story_views
from timesketch.ui.views.user import user_views
from timesketch.views.home import home_views
from timesketch.views.sketch import sketch_views
from timesketch.views.story import story_views
from timesketch.views.user import user_views


def create_app(config=None):
Expand All @@ -67,7 +67,7 @@ def create_app(config=None):
"""
# Setup the Flask app and load the config.
app = Flask(
__name__, template_folder=u'ui/templates', static_folder=u'ui/static')
__name__, template_folder=u'templates', static_folder=u'static')

if not config:
config = u'/etc/timesketch.conf'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
limitations under the License.
-->

<html lang="en" ng-app="timesketch">
<html lang="en">

<head>
<title>Timesketch</title>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 0 additions & 14 deletions timesketch/ui/__init__.py

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import angular from 'angularjs-for-webpack'
import {timesketchApiImplementation} from './api.service'

(function() {
var module = angular.module('timesketch.story', [
'timesketch.story.directive'
]);
})();
export const tsApiModule = angular.module('timesketch.api', [])
.service('timesketchApi', timesketchApiImplementation)
Loading

0 comments on commit 44c4c23

Please sign in to comment.