logster 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +19 -19
- data/.rubocop.yml +1 -1
- data/.travis.yml +16 -16
- data/CHANGELOG.md +172 -169
- data/Gemfile +4 -4
- data/Guardfile +8 -8
- data/LICENSE.txt +22 -22
- data/README.md +99 -99
- data/Rakefile +21 -21
- data/assets/fonts/FontAwesome.otf +0 -0
- data/assets/fonts/fontawesome-webfont.eot +0 -0
- data/assets/fonts/fontawesome-webfont.svg +639 -639
- data/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/assets/fonts/fontawesome-webfont.woff +0 -0
- data/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/assets/images/Icon-144_rounded.png +0 -0
- data/assets/images/Icon-144_square.png +0 -0
- data/assets/images/icon_144x144.png +0 -0
- data/assets/images/icon_64x64.png +0 -0
- data/assets/javascript/client-app.js +106 -100
- data/assets/stylesheets/client-app.css +1 -1
- data/build_client_app.sh +0 -0
- data/client-app/.editorconfig +20 -20
- data/client-app/.ember-cli +9 -9
- data/client-app/.eslintignore +19 -19
- data/client-app/.eslintrc.js +46 -46
- data/client-app/.gitignore +23 -23
- data/client-app/.travis.yml +27 -27
- data/client-app/.watchmanconfig +3 -3
- data/client-app/README.md +57 -57
- data/client-app/app/app.js +0 -0
- data/client-app/app/components/actions-menu.js +43 -37
- data/client-app/app/components/env-tab.js +80 -44
- data/client-app/app/components/message-info.js +0 -0
- data/client-app/app/components/message-row.js +0 -0
- data/client-app/app/components/panel-resizer.js +0 -0
- data/client-app/app/components/tab-contents.js +27 -27
- data/client-app/app/components/tabbed-section.js +0 -0
- data/client-app/app/components/time-formatter.js +0 -0
- data/client-app/app/components/update-time.js +0 -0
- data/client-app/app/controllers/index.js +0 -0
- data/client-app/app/controllers/show.js +0 -0
- data/client-app/app/index.html +29 -29
- data/client-app/app/initializers/app-init.js +67 -72
- data/client-app/app/lib/preload.js +20 -14
- data/client-app/app/lib/utilities.js +149 -140
- data/client-app/app/models/message-collection.js +0 -0
- data/client-app/app/models/message.js +100 -100
- data/client-app/app/resolver.js +0 -0
- data/client-app/app/router.js +0 -0
- data/client-app/app/routes/index.js +0 -0
- data/client-app/app/routes/show.js +0 -0
- data/client-app/app/styles/app.css +527 -521
- data/client-app/app/templates/application.hbs +2 -2
- data/client-app/app/templates/components/actions-menu.hbs +12 -12
- data/client-app/app/templates/components/env-tab.hbs +10 -10
- data/client-app/app/templates/components/message-info.hbs +41 -41
- data/client-app/app/templates/components/message-row.hbs +15 -15
- data/client-app/app/templates/components/panel-resizer.hbs +3 -3
- data/client-app/app/templates/components/tabbed-section.hbs +10 -10
- data/client-app/app/templates/components/time-formatter.hbs +1 -1
- data/client-app/app/templates/index.hbs +58 -58
- data/client-app/app/templates/show.hbs +7 -7
- data/client-app/config/environment.js +51 -51
- data/client-app/config/optional-features.json +3 -3
- data/client-app/config/targets.js +18 -18
- data/client-app/ember-cli-build.js +29 -29
- data/client-app/package-lock.json +11365 -11365
- data/client-app/package.json +56 -56
- data/client-app/testem.js +25 -25
- data/client-app/tests/index.html +34 -34
- data/client-app/tests/integration/components/env-tab-test.js +123 -73
- data/client-app/tests/integration/components/message-info-test.js +111 -26
- data/client-app/tests/test-helper.js +8 -8
- data/client-app/tests/unit/controllers/index-test.js +12 -12
- data/client-app/tests/unit/controllers/show-test.js +12 -12
- data/client-app/tests/unit/initializers/app-init-test.js +31 -31
- data/client-app/tests/unit/routes/index-test.js +11 -11
- data/client-app/tests/unit/routes/show-test.js +11 -11
- data/lib/examples/sidekiq_logster_reporter.rb +21 -21
- data/lib/logster.rb +54 -54
- data/lib/logster/base_store.rb +141 -141
- data/lib/logster/configuration.rb +26 -25
- data/lib/logster/defer_logger.rb +14 -14
- data/lib/logster/ignore_pattern.rb +65 -65
- data/lib/logster/logger.rb +113 -113
- data/lib/logster/message.rb +212 -212
- data/lib/logster/middleware/debug_exceptions.rb +26 -26
- data/lib/logster/middleware/reporter.rb +55 -55
- data/lib/logster/middleware/viewer.rb +222 -221
- data/lib/logster/rails/railtie.rb +63 -63
- data/lib/logster/redis_store.rb +566 -566
- data/lib/logster/scheduler.rb +54 -54
- data/lib/logster/version.rb +3 -3
- data/lib/logster/web.rb +14 -14
- data/logster.gemspec +35 -35
- data/test/examples/test_sidekiq_reporter_example.rb +46 -46
- data/test/fake_data/Gemfile +4 -4
- data/test/fake_data/generate.rb +10 -10
- data/test/logster/middleware/test_reporter.rb +19 -19
- data/test/logster/middleware/test_viewer.rb +96 -96
- data/test/logster/test_base_store.rb +147 -147
- data/test/logster/test_defer_logger.rb +34 -34
- data/test/logster/test_ignore_pattern.rb +41 -41
- data/test/logster/test_logger.rb +86 -86
- data/test/logster/test_message.rb +119 -119
- data/test/logster/test_redis_rate_limiter.rb +230 -230
- data/test/logster/test_redis_store.rb +720 -720
- data/test/test_helper.rb +38 -38
- data/vendor/assets/javascripts/logster.js.erb +39 -39
- metadata +1 -10
- data/client-app/app/components/tab-link.js +0 -5
- data/client-app/tests/integration/components/actions-menu-test.js +0 -26
- data/client-app/tests/integration/components/message-row-test.js +0 -26
- data/client-app/tests/integration/components/panel-resizer-test.js +0 -26
- data/client-app/tests/integration/components/tab-contents-test.js +0 -26
- data/client-app/tests/integration/components/tab-link-test.js +0 -26
- data/client-app/tests/integration/components/tabbed-section-test.js +0 -26
- data/client-app/tests/integration/components/time-formatter-test.js +0 -26
- data/client-app/tests/integration/components/update-time-test.js +0 -26
data/client-app/package.json
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "client-app",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"description": "Logging framework and viewer",
|
|
6
|
-
"repository": "https://github.com/discourse/logster/",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"author": "Sam Saffron",
|
|
9
|
-
"directories": {
|
|
10
|
-
"doc": "doc",
|
|
11
|
-
"test": "tests"
|
|
12
|
-
},
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "ember build",
|
|
15
|
-
"lint:hbs": "ember-template-lint .",
|
|
16
|
-
"lint:js": "eslint .",
|
|
17
|
-
"start": "ember serve",
|
|
18
|
-
"test": "ember test"
|
|
19
|
-
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@ember/jquery": "^0.5.2",
|
|
22
|
-
"@ember/optional-features": "^0.6.3",
|
|
23
|
-
"broccoli-asset-rev": "^2.7.0",
|
|
24
|
-
"ember-ajax": "^3.1.0",
|
|
25
|
-
"ember-cli": "~3.5.0",
|
|
26
|
-
"ember-cli-app-version": "^3.2.0",
|
|
27
|
-
"ember-cli-babel": "^6.16.0",
|
|
28
|
-
"ember-cli-dependency-checker": "^3.0.0",
|
|
29
|
-
"ember-cli-eslint": "^4.2.3",
|
|
30
|
-
"ember-cli-htmlbars": "^3.0.0",
|
|
31
|
-
"ember-cli-htmlbars-inline-precompile": "^1.0.3",
|
|
32
|
-
"ember-cli-inject-live-reload": "^1.8.2",
|
|
33
|
-
"ember-cli-sri": "^2.1.1",
|
|
34
|
-
"ember-cli-template-lint": "^1.0.0-beta.1",
|
|
35
|
-
"ember-cli-uglify": "^2.1.0",
|
|
36
|
-
"ember-data": "~3.5.0",
|
|
37
|
-
"ember-export-application-global": "^2.0.0",
|
|
38
|
-
"ember-font-awesome": "^4.0.0-rc.4",
|
|
39
|
-
"ember-load-initializers": "^1.1.0",
|
|
40
|
-
"ember-maybe-import-regenerator": "^0.1.6",
|
|
41
|
-
"ember-qunit": "^3.4.1",
|
|
42
|
-
"ember-resolver": "^5.0.1",
|
|
43
|
-
"ember-source": "~3.5.0",
|
|
44
|
-
"ember-welcome-page": "^3.2.0",
|
|
45
|
-
"eslint-plugin-ember": "^5.2.0",
|
|
46
|
-
"loader.js": "^4.7.0",
|
|
47
|
-
"qunit-dom": "^0.8.0"
|
|
48
|
-
},
|
|
49
|
-
"engines": {
|
|
50
|
-
"node": "6.* || 8.* || >= 10.*"
|
|
51
|
-
},
|
|
52
|
-
"dependencies": {
|
|
53
|
-
"lodash": "~4.17.11",
|
|
54
|
-
"moment": "~2.22.2"
|
|
55
|
-
}
|
|
56
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "client-app",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Logging framework and viewer",
|
|
6
|
+
"repository": "https://github.com/discourse/logster/",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "Sam Saffron",
|
|
9
|
+
"directories": {
|
|
10
|
+
"doc": "doc",
|
|
11
|
+
"test": "tests"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "ember build",
|
|
15
|
+
"lint:hbs": "ember-template-lint .",
|
|
16
|
+
"lint:js": "eslint .",
|
|
17
|
+
"start": "ember serve",
|
|
18
|
+
"test": "ember test"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@ember/jquery": "^0.5.2",
|
|
22
|
+
"@ember/optional-features": "^0.6.3",
|
|
23
|
+
"broccoli-asset-rev": "^2.7.0",
|
|
24
|
+
"ember-ajax": "^3.1.0",
|
|
25
|
+
"ember-cli": "~3.5.0",
|
|
26
|
+
"ember-cli-app-version": "^3.2.0",
|
|
27
|
+
"ember-cli-babel": "^6.16.0",
|
|
28
|
+
"ember-cli-dependency-checker": "^3.0.0",
|
|
29
|
+
"ember-cli-eslint": "^4.2.3",
|
|
30
|
+
"ember-cli-htmlbars": "^3.0.0",
|
|
31
|
+
"ember-cli-htmlbars-inline-precompile": "^1.0.3",
|
|
32
|
+
"ember-cli-inject-live-reload": "^1.8.2",
|
|
33
|
+
"ember-cli-sri": "^2.1.1",
|
|
34
|
+
"ember-cli-template-lint": "^1.0.0-beta.1",
|
|
35
|
+
"ember-cli-uglify": "^2.1.0",
|
|
36
|
+
"ember-data": "~3.5.0",
|
|
37
|
+
"ember-export-application-global": "^2.0.0",
|
|
38
|
+
"ember-font-awesome": "^4.0.0-rc.4",
|
|
39
|
+
"ember-load-initializers": "^1.1.0",
|
|
40
|
+
"ember-maybe-import-regenerator": "^0.1.6",
|
|
41
|
+
"ember-qunit": "^3.4.1",
|
|
42
|
+
"ember-resolver": "^5.0.1",
|
|
43
|
+
"ember-source": "~3.5.0",
|
|
44
|
+
"ember-welcome-page": "^3.2.0",
|
|
45
|
+
"eslint-plugin-ember": "^5.2.0",
|
|
46
|
+
"loader.js": "^4.7.0",
|
|
47
|
+
"qunit-dom": "^0.8.0"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": "6.* || 8.* || >= 10.*"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"lodash": "~4.17.11",
|
|
54
|
+
"moment": "~2.22.2"
|
|
55
|
+
}
|
|
56
|
+
}
|
data/client-app/testem.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
test_page: 'tests/index.html?hidepassed',
|
|
3
|
-
disable_watching: true,
|
|
4
|
-
launch_in_ci: [
|
|
5
|
-
'Chrome'
|
|
6
|
-
],
|
|
7
|
-
launch_in_dev: [
|
|
8
|
-
'Chrome'
|
|
9
|
-
],
|
|
10
|
-
browser_args: {
|
|
11
|
-
Chrome: {
|
|
12
|
-
ci: [
|
|
13
|
-
// --no-sandbox is needed when running Chrome inside a container
|
|
14
|
-
process.env.CI ? '--no-sandbox' : null,
|
|
15
|
-
'--headless',
|
|
16
|
-
'--disable-gpu',
|
|
17
|
-
'--disable-dev-shm-usage',
|
|
18
|
-
'--disable-software-rasterizer',
|
|
19
|
-
'--mute-audio',
|
|
20
|
-
'--remote-debugging-port=0',
|
|
21
|
-
'--window-size=1440,900'
|
|
22
|
-
].filter(Boolean)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
test_page: 'tests/index.html?hidepassed',
|
|
3
|
+
disable_watching: true,
|
|
4
|
+
launch_in_ci: [
|
|
5
|
+
'Chrome'
|
|
6
|
+
],
|
|
7
|
+
launch_in_dev: [
|
|
8
|
+
'Chrome'
|
|
9
|
+
],
|
|
10
|
+
browser_args: {
|
|
11
|
+
Chrome: {
|
|
12
|
+
ci: [
|
|
13
|
+
// --no-sandbox is needed when running Chrome inside a container
|
|
14
|
+
process.env.CI ? '--no-sandbox' : null,
|
|
15
|
+
'--headless',
|
|
16
|
+
'--disable-gpu',
|
|
17
|
+
'--disable-dev-shm-usage',
|
|
18
|
+
'--disable-software-rasterizer',
|
|
19
|
+
'--mute-audio',
|
|
20
|
+
'--remote-debugging-port=0',
|
|
21
|
+
'--window-size=1440,900'
|
|
22
|
+
].filter(Boolean)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
data/client-app/tests/index.html
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
-
<title>ClientApp Tests</title>
|
|
7
|
-
<meta name="description" content="">
|
|
8
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
-
<meta id="preloaded-data" data-root-path="/logs" data-preloaded="{}">
|
|
10
|
-
|
|
11
|
-
{{content-for "head"}}
|
|
12
|
-
{{content-for "test-head"}}
|
|
13
|
-
|
|
14
|
-
<link rel="stylesheet" href="{{rootURL}}assets/vendor.css">
|
|
15
|
-
<link rel="stylesheet" href="{{rootURL}}assets/client-app.css">
|
|
16
|
-
<link rel="stylesheet" href="{{rootURL}}assets/test-support.css">
|
|
17
|
-
|
|
18
|
-
{{content-for "head-footer"}}
|
|
19
|
-
{{content-for "test-head-footer"}}
|
|
20
|
-
</head>
|
|
21
|
-
<body>
|
|
22
|
-
{{content-for "body"}}
|
|
23
|
-
{{content-for "test-body"}}
|
|
24
|
-
|
|
25
|
-
<script src="/testem.js" integrity=""></script>
|
|
26
|
-
<script src="{{rootURL}}assets/vendor.js"></script>
|
|
27
|
-
<script src="{{rootURL}}assets/test-support.js"></script>
|
|
28
|
-
<script src="{{rootURL}}assets/client-app.js"></script>
|
|
29
|
-
<script src="{{rootURL}}assets/tests.js"></script>
|
|
30
|
-
|
|
31
|
-
{{content-for "body-footer"}}
|
|
32
|
-
{{content-for "test-body-footer"}}
|
|
33
|
-
</body>
|
|
34
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<title>ClientApp Tests</title>
|
|
7
|
+
<meta name="description" content="">
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
+
<meta id="preloaded-data" data-root-path="/logs" data-preloaded="{"env_expandable_keys":[]}">
|
|
10
|
+
|
|
11
|
+
{{content-for "head"}}
|
|
12
|
+
{{content-for "test-head"}}
|
|
13
|
+
|
|
14
|
+
<link rel="stylesheet" href="{{rootURL}}assets/vendor.css">
|
|
15
|
+
<link rel="stylesheet" href="{{rootURL}}assets/client-app.css">
|
|
16
|
+
<link rel="stylesheet" href="{{rootURL}}assets/test-support.css">
|
|
17
|
+
|
|
18
|
+
{{content-for "head-footer"}}
|
|
19
|
+
{{content-for "test-head-footer"}}
|
|
20
|
+
</head>
|
|
21
|
+
<body>
|
|
22
|
+
{{content-for "body"}}
|
|
23
|
+
{{content-for "test-body"}}
|
|
24
|
+
|
|
25
|
+
<script src="/testem.js" integrity=""></script>
|
|
26
|
+
<script src="{{rootURL}}assets/vendor.js"></script>
|
|
27
|
+
<script src="{{rootURL}}assets/test-support.js"></script>
|
|
28
|
+
<script src="{{rootURL}}assets/client-app.js"></script>
|
|
29
|
+
<script src="{{rootURL}}assets/tests.js"></script>
|
|
30
|
+
|
|
31
|
+
{{content-for "body-footer"}}
|
|
32
|
+
{{content-for "test-body-footer"}}
|
|
33
|
+
</body>
|
|
34
|
+
</html>
|
|
@@ -1,73 +1,123 @@
|
|
|
1
|
-
import { module, test } from
|
|
2
|
-
import { setupRenderingTest } from
|
|
3
|
-
import { render, find, findAll, click } from
|
|
4
|
-
import hbs from
|
|
5
|
-
import Message from "client-app/models/message";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
assert.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
assert.
|
|
49
|
-
assert.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
assert.equal(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
assert.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
1
|
+
import { module, test } from "qunit";
|
|
2
|
+
import { setupRenderingTest } from "ember-qunit";
|
|
3
|
+
import { render, find, findAll, click } from "@ember/test-helpers";
|
|
4
|
+
import hbs from "htmlbars-inline-precompile";
|
|
5
|
+
import Message from "client-app/models/message";
|
|
6
|
+
import { init } from "client-app/lib/preload";
|
|
7
|
+
|
|
8
|
+
const message = Message.create({
|
|
9
|
+
env: [{ a: "aa", b: "bb" }, { c: "cc", d: "dd" }]
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const message2 = Message.create({
|
|
13
|
+
env: { e: "ee", f: "ff" }
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const message3 = Message.create({
|
|
17
|
+
env: [
|
|
18
|
+
{ env_key_2: "an_env_value", notExpanded: "dsdcz" },
|
|
19
|
+
{ env_key_2: "anotherthing", notExpanded: "cxc" }
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
function reduceToContent(node) {
|
|
24
|
+
return Array.from(node.childNodes).reduce(
|
|
25
|
+
(ac, cr) => `${ac.textContent}: ${cr.textContent}`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module("Integration | Component | env-tab", function(hooks) {
|
|
30
|
+
setupRenderingTest(hooks);
|
|
31
|
+
|
|
32
|
+
test("it renders", async function(assert) {
|
|
33
|
+
this.set("message", message);
|
|
34
|
+
await render(hbs`{{env-tab message=message}}`);
|
|
35
|
+
|
|
36
|
+
assert.equal(
|
|
37
|
+
find(".env-number").textContent,
|
|
38
|
+
"1/2",
|
|
39
|
+
"shows the current over the total number of env objects"
|
|
40
|
+
);
|
|
41
|
+
let trs = findAll("tr");
|
|
42
|
+
assert.equal(trs.length, 2);
|
|
43
|
+
assert.equal(reduceToContent(trs[0]), "a: aa", "has the right content");
|
|
44
|
+
assert.equal(reduceToContent(trs[1]), "b: bb", "has the right content");
|
|
45
|
+
|
|
46
|
+
const buttons = findAll("button.nav-btn");
|
|
47
|
+
// at first page, you can't go back
|
|
48
|
+
assert.ok(buttons[0].disabled, "back buttons are disabled");
|
|
49
|
+
assert.ok(buttons[1].disabled, "back buttons are disabled");
|
|
50
|
+
|
|
51
|
+
assert.notOk(buttons[2].disabled, "forward buttons are not disabled");
|
|
52
|
+
assert.notOk(buttons[3].disabled, "forward buttons are not disabled");
|
|
53
|
+
|
|
54
|
+
this.set("message", message2);
|
|
55
|
+
assert.dom("button").doesNotExist("doesn't show buttons for non-array env");
|
|
56
|
+
|
|
57
|
+
trs = findAll("tr");
|
|
58
|
+
assert.equal(trs.length, 2);
|
|
59
|
+
assert.equal(reduceToContent(trs[0]), "e: ee", "has the right content");
|
|
60
|
+
assert.equal(reduceToContent(trs[1]), "f: ff", "has the right content");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("it works correctly", async function(assert) {
|
|
64
|
+
this.set("message", message);
|
|
65
|
+
await render(hbs`{{env-tab message=message}}`);
|
|
66
|
+
|
|
67
|
+
const buttons = findAll("button.nav-btn");
|
|
68
|
+
await click(buttons[2]);
|
|
69
|
+
|
|
70
|
+
assert.equal(
|
|
71
|
+
find(".env-number").textContent,
|
|
72
|
+
"2/2",
|
|
73
|
+
"shows the current over the total number of env objects"
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const trs = findAll("tr");
|
|
77
|
+
assert.equal(trs.length, 2);
|
|
78
|
+
assert.equal(reduceToContent(trs[0]), "c: cc", "has the right content");
|
|
79
|
+
assert.equal(reduceToContent(trs[1]), "d: dd", "has the right content");
|
|
80
|
+
|
|
81
|
+
// at last page, you can't go forward but you can go back
|
|
82
|
+
assert.notOk(buttons[0].disabled, "back buttons are not disabled");
|
|
83
|
+
assert.notOk(buttons[1].disabled, "back buttons are not disabled");
|
|
84
|
+
|
|
85
|
+
assert.ok(buttons[2].disabled, "forward buttons are disabled");
|
|
86
|
+
assert.ok(buttons[3].disabled, "forward buttons are disabled");
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("expandable env keys", async function(assert) {
|
|
90
|
+
document.getElementById(
|
|
91
|
+
"preloaded-data"
|
|
92
|
+
).dataset.preloaded = JSON.stringify({
|
|
93
|
+
env_expandable_keys: ["env_key_2"]
|
|
94
|
+
});
|
|
95
|
+
init();
|
|
96
|
+
this.set("message", message3);
|
|
97
|
+
await render(hbs`{{env-tab message=message}}`);
|
|
98
|
+
|
|
99
|
+
const expandable = find(".env-table tr");
|
|
100
|
+
assert.equal(
|
|
101
|
+
expandable.children[1].textContent.trim(),
|
|
102
|
+
"an_env_value, 1 more",
|
|
103
|
+
"expandable env keys shown correctly"
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
assert.equal(
|
|
107
|
+
findAll("a.expand-list").length,
|
|
108
|
+
1,
|
|
109
|
+
"only whitelisted env keys are expandable"
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const expandBtn = find("a.expand-list");
|
|
113
|
+
assert.equal(expandBtn.textContent.trim(), "1 more");
|
|
114
|
+
await click(expandBtn);
|
|
115
|
+
|
|
116
|
+
const expanded = find(".env-table tr");
|
|
117
|
+
assert.equal(
|
|
118
|
+
expanded.children[1].textContent.trim(),
|
|
119
|
+
"[an_env_value, anotherthing]",
|
|
120
|
+
"expanded env keys shown correctly"
|
|
121
|
+
);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
@@ -1,26 +1,111 @@
|
|
|
1
|
-
import { module, test } from
|
|
2
|
-
import { setupRenderingTest } from
|
|
3
|
-
import { render } from
|
|
4
|
-
import hbs from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import { module, test } from "qunit";
|
|
2
|
+
import { setupRenderingTest } from "ember-qunit";
|
|
3
|
+
import { render, find, findAll, click } from "@ember/test-helpers";
|
|
4
|
+
import hbs from "htmlbars-inline-precompile";
|
|
5
|
+
import Message from "client-app/models/message";
|
|
6
|
+
|
|
7
|
+
const backtrace = "test backtrace:26";
|
|
8
|
+
const messageTitle = "This Is Title";
|
|
9
|
+
|
|
10
|
+
const message = Message.create({
|
|
11
|
+
backtrace,
|
|
12
|
+
message: messageTitle,
|
|
13
|
+
env: { c: "cc", d: "dd" }
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
module("Integration | Component | message-info", function(hooks) {
|
|
17
|
+
setupRenderingTest(hooks);
|
|
18
|
+
|
|
19
|
+
test("it renders", async function(assert) {
|
|
20
|
+
this.setProperties({
|
|
21
|
+
actionsInMenu: true,
|
|
22
|
+
showTitle: false,
|
|
23
|
+
message
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
await render(
|
|
27
|
+
hbs`{{message-info currentMessage=message showTitle=showTitle actionsInMenu=actionsInMenu}}`
|
|
28
|
+
);
|
|
29
|
+
let activeTab = find(".message-info .content.active pre");
|
|
30
|
+
assert.equal(
|
|
31
|
+
activeTab.textContent,
|
|
32
|
+
backtrace,
|
|
33
|
+
"default active tab is backtrace"
|
|
34
|
+
);
|
|
35
|
+
assert.dom(".message-info .content h3").doesNotExist("no titles are shown");
|
|
36
|
+
assert.equal(findAll(".tabs a").length, 3, "3 tabs shown");
|
|
37
|
+
assert.equal(
|
|
38
|
+
find(".tabs a.active").textContent.trim(),
|
|
39
|
+
"backtrace",
|
|
40
|
+
"default active tab is backtrace"
|
|
41
|
+
);
|
|
42
|
+
assert.equal(
|
|
43
|
+
findAll(".message-actions button").length,
|
|
44
|
+
2,
|
|
45
|
+
"2 buttons shown when `actionsInMenu` is true"
|
|
46
|
+
);
|
|
47
|
+
assert
|
|
48
|
+
.dom(".message-actions button.expand.no-text")
|
|
49
|
+
.exists("menu expand button is shown");
|
|
50
|
+
assert.dom(".message-actions button.share").exists("share button is shown");
|
|
51
|
+
|
|
52
|
+
await click(find(".message-actions button.expand.no-text"));
|
|
53
|
+
assert.equal(
|
|
54
|
+
findAll(".actions-menu button").length,
|
|
55
|
+
2,
|
|
56
|
+
"extra buttons shown inside a menu"
|
|
57
|
+
);
|
|
58
|
+
assert
|
|
59
|
+
.dom(".actions-menu button.remove")
|
|
60
|
+
.exists("remove button inside the menu");
|
|
61
|
+
assert
|
|
62
|
+
.dom(".actions-menu button.protect")
|
|
63
|
+
.exists("protect button inside the menu");
|
|
64
|
+
|
|
65
|
+
this.setProperties({
|
|
66
|
+
showTitle: true,
|
|
67
|
+
actionsInMenu: false
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
assert.equal(
|
|
71
|
+
findAll(".message-info .content h3").length,
|
|
72
|
+
3,
|
|
73
|
+
"titles are shown"
|
|
74
|
+
);
|
|
75
|
+
assert
|
|
76
|
+
.dom(".message-actions button.expand.no-text")
|
|
77
|
+
.doesNotExist("menu expand button is not shown");
|
|
78
|
+
assert.equal(
|
|
79
|
+
findAll(".message-actions button").length,
|
|
80
|
+
3,
|
|
81
|
+
"all actions buttons are shown inline when `actionsInMenu` is false"
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
await click(findAll(".tabs a")[0]);
|
|
85
|
+
activeTab = find(".message-info .content.active pre");
|
|
86
|
+
assert.equal(activeTab.textContent, messageTitle, "can switch tabs");
|
|
87
|
+
|
|
88
|
+
assert
|
|
89
|
+
.dom(".message-actions button.solve")
|
|
90
|
+
.doesNotExist(
|
|
91
|
+
"no solve button when there is no application_version in env"
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
message.set("env.application_version", "fddfsdfdsf");
|
|
95
|
+
this.set("message", message);
|
|
96
|
+
assert
|
|
97
|
+
.dom(".message-actions button.solve")
|
|
98
|
+
.exists("solve button is shown when there is application_version in env");
|
|
99
|
+
|
|
100
|
+
message.set("env", [
|
|
101
|
+
{ sd: "dx", application_version: "fsfdsf" },
|
|
102
|
+
{ vcv: "dxc" }
|
|
103
|
+
]);
|
|
104
|
+
this.set("message", message);
|
|
105
|
+
assert
|
|
106
|
+
.dom(".message-actions button.solve")
|
|
107
|
+
.exists(
|
|
108
|
+
"solve button is shown when there is application_version in env (array)"
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
});
|