Skip to content

Commit e2f0384

Browse files
authored
New frontend (#848)
* Initial scaffolding of new frontend * Make new frontend available via setting * Make old frontend the default one * Turn into SPA, add routes and store management. Some refactor. * Add search * Refactor view * Make new UI off by default
1 parent 127080a commit e2f0384

Some content is hidden

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

58 files changed

+6843
-5
lines changed

docker/timesketch-dev-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ services:
2323
- NEO4J_PORT=7474
2424
- TIMESKETCH_USER=dev
2525
- TIMESKETCH_PASSWORD=dev
26+
- CHOKIDAR_USEPOLLING=true
2627
restart: always
2728
volumes:
2829
- ../:/usr/local/src/timesketch/

timesketch/__init__.py

+22-4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
from timesketch.views.home import home_views
3737
from timesketch.views.sketch import sketch_views
3838
from timesketch.views.auth import auth_views
39+
from timesketch.views.spa import spa_views
40+
41+
# Set to true to use the new Vue.js based frontend.
42+
USE_NEW_FRONTEND = False
3943

4044

4145
def create_app(config=None):
@@ -49,7 +53,18 @@ def create_app(config=None):
4953
Application object (instance of flask.Flask).
5054
"""
5155
# Setup the Flask app and load the config.
52-
app = Flask(__name__, template_folder='templates', static_folder='static')
56+
template_folder = 'templates'
57+
static_folder = 'static'
58+
59+
if USE_NEW_FRONTEND:
60+
template_folder = 'frontend/dist'
61+
static_folder = 'frontend/dist'
62+
63+
app = Flask(
64+
__name__,
65+
template_folder=template_folder,
66+
static_folder=static_folder
67+
)
5368

5469
if not config:
5570
config = '/etc/timesketch.conf'
@@ -94,9 +109,12 @@ def create_app(config=None):
94109
# Register blueprints. Blueprints are a way to organize your Flask
95110
# Flask application. See this for more information:
96111
# http://flask.pocoo.org/docs/latest/blueprints/
97-
app.register_blueprint(auth_views)
98-
app.register_blueprint(home_views)
99-
app.register_blueprint(sketch_views)
112+
if USE_NEW_FRONTEND:
113+
app.register_blueprint(spa_views)
114+
else:
115+
app.register_blueprint(auth_views)
116+
app.register_blueprint(home_views)
117+
app.register_blueprint(sketch_views)
100118

101119
# Setup URL routes for the API.
102120
api_v1 = Api(app, prefix='/api/v1')

timesketch/api/v1/resources.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,9 @@ def get(self, sketch_id):
345345
meta = dict(
346346
views=[{
347347
'name': view.name,
348-
'id': view.id
348+
'id': view.id,
349+
'created_at': view.created_at,
350+
'updated_at': view.updated_at
349351
} for view in sketch.get_named_views],
350352
searchtemplates=[{
351353
'name': searchtemplate.name,

timesketch/frontend/.browserslistrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
> 1%
2+
last 2 versions
3+
not ie <= 8

timesketch/frontend/.editorconfig

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[*.{js,jsx,ts,tsx,vue}]
2+
indent_style = space
3+
indent_size = 2
4+
trim_trailing_whitespace = true
5+
insert_final_newline = true

timesketch/frontend/.eslintrc.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
Copyright 2019 Google Inc. All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
module.exports = {
17+
root: true,
18+
env: {
19+
node: true
20+
},
21+
'extends': [
22+
'plugin:vue/essential',
23+
'@vue/standard'
24+
],
25+
rules: {
26+
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
27+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
28+
},
29+
parserOptions: {
30+
parser: 'babel-eslint'
31+
}
32+
}

timesketch/frontend/README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Timesketch web frontend
2+
3+
## Project setup
4+
```
5+
yarn install
6+
```
7+
8+
### Compiles and hot-reloads for development
9+
```
10+
yarn run serve
11+
```
12+
13+
### Compiles and minifies for production
14+
```
15+
yarn run build
16+
```
17+
18+
### Run your tests
19+
```
20+
yarn run test
21+
```
22+
23+
### Lints and fixes files
24+
```
25+
yarn run lint
26+
```
27+
28+
### Run your unit tests
29+
```
30+
yarn run test:unit
31+
```
32+
33+
### Customize configuration
34+
See [Configuration Reference](https://cli.vuejs.org/config/).

timesketch/frontend/babel.config.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
Copyright 2019 Google Inc. All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
module.exports = {
17+
presets: [
18+
'@vue/app'
19+
]
20+
}

timesketch/frontend/dist/css/app.2334801b.css

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

timesketch/frontend/dist/favicon.ico

2.19 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

timesketch/frontend/dist/img/fa-solid-900.82905d8d.svg

+4,516
Loading

timesketch/frontend/dist/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!DOCTYPE html><html lang=en><head><meta name=csrf-token content="{{ csrf_token() }}"><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/dist/favicon.ico><title>Timesketch</title><link href=/dist/css/app.2334801b.css rel=preload as=style><link href=/dist/js/app.870b2c78.js rel=preload as=script><link href=/dist/js/chunk-vendors.3bf7e5ac.js rel=preload as=script><link href=/dist/css/app.2334801b.css rel=stylesheet></head><body><div id=app></div><script src=/dist/js/chunk-vendors.3bf7e5ac.js></script><script src=/dist/js/app.870b2c78.js></script></body></html>

timesketch/frontend/dist/js/app.870b2c78.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

timesketch/frontend/dist/js/app.870b2c78.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

timesketch/frontend/dist/js/chunk-vendors.3bf7e5ac.js

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

timesketch/frontend/dist/js/chunk-vendors.3bf7e5ac.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Loading

0 commit comments

Comments
 (0)