logster 2.1.2 → 2.2.0
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 +21 -19
- data/.rubocop.yml +1 -1
- data/.travis.yml +16 -16
- data/CHANGELOG.md +224 -172
- 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 +115 -106
- 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 -43
- data/client-app/app/components/env-tab.js +80 -80
- 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/patterns-list.js +109 -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 +22 -6
- data/client-app/app/controllers/show.js +0 -0
- data/client-app/app/helpers/logster-url.js +12 -0
- data/client-app/app/helpers/or.js +7 -0
- data/client-app/app/index.html +30 -29
- data/client-app/app/initializers/app-init.js +67 -67
- data/client-app/app/lib/preload.js +20 -20
- data/client-app/app/lib/utilities.js +150 -149
- data/client-app/app/models/message-collection.js +0 -0
- data/client-app/app/models/message.js +100 -100
- data/client-app/app/models/pattern-item.js +25 -0
- data/client-app/app/resolver.js +0 -0
- data/client-app/app/router.js +1 -0
- data/client-app/app/routes/index.js +2 -9
- data/client-app/app/routes/settings.js +15 -0
- data/client-app/app/routes/show.js +0 -0
- data/client-app/app/styles/app.css +633 -527
- 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/patterns-list.hbs +25 -0
- 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 +65 -58
- data/client-app/app/templates/settings.hbs +26 -0
- 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 +11357 -11365
- data/client-app/package.json +57 -56
- data/client-app/public/assets/images/icon_144x144.png +0 -0
- data/client-app/public/assets/images/icon_64x64.png +0 -0
- 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 +134 -123
- data/client-app/tests/integration/components/message-info-test.js +111 -111
- data/client-app/tests/integration/components/patterns-list-test.js +56 -0
- 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 +59 -54
- data/lib/logster/base_store.rb +169 -141
- data/lib/logster/cache.rb +20 -0
- data/lib/logster/configuration.rb +27 -26
- 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 +297 -222
- data/lib/logster/pattern.rb +95 -0
- data/lib/logster/rails/railtie.rb +63 -63
- data/lib/logster/redis_store.rb +584 -566
- data/lib/logster/scheduler.rb +54 -54
- data/lib/logster/suppression_pattern.rb +17 -0
- 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 +267 -96
- data/test/logster/test_base_store.rb +147 -147
- data/test/logster/test_cache.rb +38 -0
- data/test/logster/test_defer_logger.rb +34 -34
- data/test/logster/test_ignore_pattern.rb +41 -41
- data/test/logster/test_logger.rb +100 -86
- data/test/logster/test_message.rb +119 -119
- data/test/logster/test_pattern.rb +152 -0
- data/test/logster/test_redis_rate_limiter.rb +230 -230
- data/test/logster/test_redis_store.rb +689 -720
- data/test/test_helper.rb +38 -38
- data/vendor/assets/javascripts/logster.js.erb +39 -39
- metadata +24 -7
data/client-app/.travis.yml
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
---
|
|
2
|
-
language: node_js
|
|
3
|
-
node_js:
|
|
4
|
-
- "6"
|
|
5
|
-
|
|
6
|
-
sudo: false
|
|
7
|
-
dist: trusty
|
|
8
|
-
|
|
9
|
-
addons:
|
|
10
|
-
chrome: stable
|
|
11
|
-
|
|
12
|
-
cache:
|
|
13
|
-
directories:
|
|
14
|
-
- $HOME/.npm
|
|
15
|
-
|
|
16
|
-
env:
|
|
17
|
-
global:
|
|
18
|
-
# See https://git.io/vdao3 for details.
|
|
19
|
-
- JOBS=1
|
|
20
|
-
|
|
21
|
-
before_install:
|
|
22
|
-
- npm config set spin false
|
|
23
|
-
|
|
24
|
-
script:
|
|
25
|
-
- npm run lint:hbs
|
|
26
|
-
- npm run lint:js
|
|
27
|
-
- npm test
|
|
1
|
+
---
|
|
2
|
+
language: node_js
|
|
3
|
+
node_js:
|
|
4
|
+
- "6"
|
|
5
|
+
|
|
6
|
+
sudo: false
|
|
7
|
+
dist: trusty
|
|
8
|
+
|
|
9
|
+
addons:
|
|
10
|
+
chrome: stable
|
|
11
|
+
|
|
12
|
+
cache:
|
|
13
|
+
directories:
|
|
14
|
+
- $HOME/.npm
|
|
15
|
+
|
|
16
|
+
env:
|
|
17
|
+
global:
|
|
18
|
+
# See https://git.io/vdao3 for details.
|
|
19
|
+
- JOBS=1
|
|
20
|
+
|
|
21
|
+
before_install:
|
|
22
|
+
- npm config set spin false
|
|
23
|
+
|
|
24
|
+
script:
|
|
25
|
+
- npm run lint:hbs
|
|
26
|
+
- npm run lint:js
|
|
27
|
+
- npm test
|
data/client-app/.watchmanconfig
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"ignore_dirs": ["tmp", "dist"]
|
|
3
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"ignore_dirs": ["tmp", "dist"]
|
|
3
|
+
}
|
data/client-app/README.md
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
# client-app
|
|
2
|
-
|
|
3
|
-
This README outlines the details of collaborating on this Ember application.
|
|
4
|
-
A short introduction of this app could easily go here.
|
|
5
|
-
|
|
6
|
-
## Prerequisites
|
|
7
|
-
|
|
8
|
-
You will need the following things properly installed on your computer.
|
|
9
|
-
|
|
10
|
-
* [Git](https://git-scm.com/)
|
|
11
|
-
* [Node.js](https://nodejs.org/) (with npm)
|
|
12
|
-
* [Ember CLI](https://ember-cli.com/)
|
|
13
|
-
* [Google Chrome](https://google.com/chrome/)
|
|
14
|
-
|
|
15
|
-
## Installation
|
|
16
|
-
|
|
17
|
-
* `git clone <repository-url>` this repository
|
|
18
|
-
* `cd client-app`
|
|
19
|
-
* `npm install`
|
|
20
|
-
|
|
21
|
-
## Running / Development
|
|
22
|
-
|
|
23
|
-
* `ember serve`
|
|
24
|
-
* Visit your app at [http://localhost:4200](http://localhost:4200).
|
|
25
|
-
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).
|
|
26
|
-
|
|
27
|
-
### Code Generators
|
|
28
|
-
|
|
29
|
-
Make use of the many generators for code, try `ember help generate` for more details
|
|
30
|
-
|
|
31
|
-
### Running Tests
|
|
32
|
-
|
|
33
|
-
* `ember test`
|
|
34
|
-
* `ember test --server`
|
|
35
|
-
|
|
36
|
-
### Linting
|
|
37
|
-
|
|
38
|
-
* `npm run lint:hbs`
|
|
39
|
-
* `npm run lint:js`
|
|
40
|
-
* `npm run lint:js -- --fix`
|
|
41
|
-
|
|
42
|
-
### Building
|
|
43
|
-
|
|
44
|
-
* `ember build` (development)
|
|
45
|
-
* `ember build --environment production` (production)
|
|
46
|
-
|
|
47
|
-
### Deploying
|
|
48
|
-
|
|
49
|
-
Specify what it takes to deploy your app.
|
|
50
|
-
|
|
51
|
-
## Further Reading / Useful Links
|
|
52
|
-
|
|
53
|
-
* [ember.js](https://emberjs.com/)
|
|
54
|
-
* [ember-cli](https://ember-cli.com/)
|
|
55
|
-
* Development Browser Extensions
|
|
56
|
-
* [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
|
|
57
|
-
* [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
|
|
1
|
+
# client-app
|
|
2
|
+
|
|
3
|
+
This README outlines the details of collaborating on this Ember application.
|
|
4
|
+
A short introduction of this app could easily go here.
|
|
5
|
+
|
|
6
|
+
## Prerequisites
|
|
7
|
+
|
|
8
|
+
You will need the following things properly installed on your computer.
|
|
9
|
+
|
|
10
|
+
* [Git](https://git-scm.com/)
|
|
11
|
+
* [Node.js](https://nodejs.org/) (with npm)
|
|
12
|
+
* [Ember CLI](https://ember-cli.com/)
|
|
13
|
+
* [Google Chrome](https://google.com/chrome/)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
* `git clone <repository-url>` this repository
|
|
18
|
+
* `cd client-app`
|
|
19
|
+
* `npm install`
|
|
20
|
+
|
|
21
|
+
## Running / Development
|
|
22
|
+
|
|
23
|
+
* `ember serve`
|
|
24
|
+
* Visit your app at [http://localhost:4200](http://localhost:4200).
|
|
25
|
+
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).
|
|
26
|
+
|
|
27
|
+
### Code Generators
|
|
28
|
+
|
|
29
|
+
Make use of the many generators for code, try `ember help generate` for more details
|
|
30
|
+
|
|
31
|
+
### Running Tests
|
|
32
|
+
|
|
33
|
+
* `ember test`
|
|
34
|
+
* `ember test --server`
|
|
35
|
+
|
|
36
|
+
### Linting
|
|
37
|
+
|
|
38
|
+
* `npm run lint:hbs`
|
|
39
|
+
* `npm run lint:js`
|
|
40
|
+
* `npm run lint:js -- --fix`
|
|
41
|
+
|
|
42
|
+
### Building
|
|
43
|
+
|
|
44
|
+
* `ember build` (development)
|
|
45
|
+
* `ember build --environment production` (production)
|
|
46
|
+
|
|
47
|
+
### Deploying
|
|
48
|
+
|
|
49
|
+
Specify what it takes to deploy your app.
|
|
50
|
+
|
|
51
|
+
## Further Reading / Useful Links
|
|
52
|
+
|
|
53
|
+
* [ember.js](https://emberjs.com/)
|
|
54
|
+
* [ember-cli](https://ember-cli.com/)
|
|
55
|
+
* Development Browser Extensions
|
|
56
|
+
* [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
|
|
57
|
+
* [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
|
data/client-app/app/app.js
CHANGED
|
File without changes
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import Component from "@ember/component";
|
|
2
|
-
import { observer } from "@ember/object";
|
|
3
|
-
|
|
4
|
-
export default Component.extend({
|
|
5
|
-
showMenu: false,
|
|
6
|
-
tagName: "span",
|
|
7
|
-
|
|
8
|
-
init() {
|
|
9
|
-
this._super(...arguments);
|
|
10
|
-
this.bindingFunction = this.bindingFunction.bind(this);
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
bindingFunction(event) {
|
|
14
|
-
const context = this.$()[0];
|
|
15
|
-
if (!Em.$.contains(context, event.target) && context !== event.target) {
|
|
16
|
-
this.set("showMenu", false);
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
bindDocument: observer("showMenu", function() {
|
|
21
|
-
const $document = Em.$(document);
|
|
22
|
-
if (this.get("showMenu")) {
|
|
23
|
-
$document.on("click", this.get("bindingFunction"));
|
|
24
|
-
} else {
|
|
25
|
-
$document.off("click", this.get("bindingFunction"));
|
|
26
|
-
}
|
|
27
|
-
}),
|
|
28
|
-
|
|
29
|
-
willDestroyElement() {
|
|
30
|
-
this._super(...arguments);
|
|
31
|
-
const $document = Em.$(document);
|
|
32
|
-
$document.off("click", this.get("bindingFunction"));
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
actions: {
|
|
36
|
-
expandMenu() {
|
|
37
|
-
this.toggleProperty("showMenu");
|
|
38
|
-
},
|
|
39
|
-
share() {
|
|
40
|
-
this.share();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
});
|
|
1
|
+
import Component from "@ember/component";
|
|
2
|
+
import { observer } from "@ember/object";
|
|
3
|
+
|
|
4
|
+
export default Component.extend({
|
|
5
|
+
showMenu: false,
|
|
6
|
+
tagName: "span",
|
|
7
|
+
|
|
8
|
+
init() {
|
|
9
|
+
this._super(...arguments);
|
|
10
|
+
this.bindingFunction = this.bindingFunction.bind(this);
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
bindingFunction(event) {
|
|
14
|
+
const context = this.$()[0];
|
|
15
|
+
if (!Em.$.contains(context, event.target) && context !== event.target) {
|
|
16
|
+
this.set("showMenu", false);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
bindDocument: observer("showMenu", function() {
|
|
21
|
+
const $document = Em.$(document);
|
|
22
|
+
if (this.get("showMenu")) {
|
|
23
|
+
$document.on("click", this.get("bindingFunction"));
|
|
24
|
+
} else {
|
|
25
|
+
$document.off("click", this.get("bindingFunction"));
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
|
|
29
|
+
willDestroyElement() {
|
|
30
|
+
this._super(...arguments);
|
|
31
|
+
const $document = Em.$(document);
|
|
32
|
+
$document.off("click", this.get("bindingFunction"));
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
actions: {
|
|
36
|
+
expandMenu() {
|
|
37
|
+
this.toggleProperty("showMenu");
|
|
38
|
+
},
|
|
39
|
+
share() {
|
|
40
|
+
this.share();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import Component from "@ember/component";
|
|
2
|
-
import { computed } from "@ember/object";
|
|
3
|
-
import { buildHashString } from "client-app/lib/utilities";
|
|
4
|
-
import Preload from "client-app/lib/preload";
|
|
5
|
-
|
|
6
|
-
export default Component.extend({
|
|
7
|
-
current: 1,
|
|
8
|
-
|
|
9
|
-
didUpdateAttrs() {
|
|
10
|
-
this.setProperties({
|
|
11
|
-
current: 1,
|
|
12
|
-
expanded: null
|
|
13
|
-
});
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
isEnvArray: computed("message.env", function() {
|
|
17
|
-
return Array.isArray(this.get("message.env"));
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
html: computed("isEnvArray", "current", "expanded.[]", function() {
|
|
21
|
-
if (!this.get("isEnvArray")) {
|
|
22
|
-
return buildHashString(this.get("message.env"));
|
|
23
|
-
} else {
|
|
24
|
-
const currentEnv = Em.$.extend(
|
|
25
|
-
{},
|
|
26
|
-
this.get("message.env")[this.get("current") - 1]
|
|
27
|
-
);
|
|
28
|
-
const expandableKeys = Preload.get("env_expandable_keys") || [];
|
|
29
|
-
expandableKeys.forEach(key => {
|
|
30
|
-
if (currentEnv.hasOwnProperty(key) && !Array.isArray(currentEnv[key])) {
|
|
31
|
-
const list = [currentEnv[key]];
|
|
32
|
-
this.get("message.env").forEach(env => {
|
|
33
|
-
if (env[key] && list.indexOf(env[key]) === -1) {
|
|
34
|
-
list.push(env[key]);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
currentEnv[key] = list.length > 1 ? list : list[0];
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
return buildHashString(currentEnv, false, this.get("expanded") || []);
|
|
41
|
-
}
|
|
42
|
-
}),
|
|
43
|
-
|
|
44
|
-
click(e) {
|
|
45
|
-
const $elem = Em.$(e.target);
|
|
46
|
-
const dataKey = $elem.attr("data-key");
|
|
47
|
-
const expandableKeys = Preload.get("env_expandable_keys") || [];
|
|
48
|
-
if (
|
|
49
|
-
expandableKeys.indexOf(dataKey) !== -1 &&
|
|
50
|
-
$elem.hasClass("expand-list")
|
|
51
|
-
) {
|
|
52
|
-
e.preventDefault();
|
|
53
|
-
if (!this.get("expanded")) {
|
|
54
|
-
this.set("expanded", [dataKey]);
|
|
55
|
-
} else {
|
|
56
|
-
this.get("expanded").pushObject(dataKey);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
disableBackButtons: computed("current", function() {
|
|
62
|
-
return this.get("current") === 1;
|
|
63
|
-
}),
|
|
64
|
-
|
|
65
|
-
disableForwardButtons: computed("current", "message.env.length", function() {
|
|
66
|
-
return this.get("current") === this.get("message.env.length");
|
|
67
|
-
}),
|
|
68
|
-
|
|
69
|
-
actions: {
|
|
70
|
-
takeStep(dir) {
|
|
71
|
-
const amount = dir === "back" ? -1 : 1;
|
|
72
|
-
this.set("current", this.get("current") + amount);
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
bigJump(dir) {
|
|
76
|
-
const newCurrent = dir === "back" ? 1 : this.get("message.env.length");
|
|
77
|
-
this.set("current", newCurrent);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
});
|
|
1
|
+
import Component from "@ember/component";
|
|
2
|
+
import { computed } from "@ember/object";
|
|
3
|
+
import { buildHashString } from "client-app/lib/utilities";
|
|
4
|
+
import Preload from "client-app/lib/preload";
|
|
5
|
+
|
|
6
|
+
export default Component.extend({
|
|
7
|
+
current: 1,
|
|
8
|
+
|
|
9
|
+
didUpdateAttrs() {
|
|
10
|
+
this.setProperties({
|
|
11
|
+
current: 1,
|
|
12
|
+
expanded: null
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
isEnvArray: computed("message.env", function() {
|
|
17
|
+
return Array.isArray(this.get("message.env"));
|
|
18
|
+
}),
|
|
19
|
+
|
|
20
|
+
html: computed("isEnvArray", "current", "expanded.[]", function() {
|
|
21
|
+
if (!this.get("isEnvArray")) {
|
|
22
|
+
return buildHashString(this.get("message.env"));
|
|
23
|
+
} else {
|
|
24
|
+
const currentEnv = Em.$.extend(
|
|
25
|
+
{},
|
|
26
|
+
this.get("message.env")[this.get("current") - 1]
|
|
27
|
+
);
|
|
28
|
+
const expandableKeys = Preload.get("env_expandable_keys") || [];
|
|
29
|
+
expandableKeys.forEach(key => {
|
|
30
|
+
if (currentEnv.hasOwnProperty(key) && !Array.isArray(currentEnv[key])) {
|
|
31
|
+
const list = [currentEnv[key]];
|
|
32
|
+
this.get("message.env").forEach(env => {
|
|
33
|
+
if (env[key] && list.indexOf(env[key]) === -1) {
|
|
34
|
+
list.push(env[key]);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
currentEnv[key] = list.length > 1 ? list : list[0];
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return buildHashString(currentEnv, false, this.get("expanded") || []);
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
43
|
+
|
|
44
|
+
click(e) {
|
|
45
|
+
const $elem = Em.$(e.target);
|
|
46
|
+
const dataKey = $elem.attr("data-key");
|
|
47
|
+
const expandableKeys = Preload.get("env_expandable_keys") || [];
|
|
48
|
+
if (
|
|
49
|
+
expandableKeys.indexOf(dataKey) !== -1 &&
|
|
50
|
+
$elem.hasClass("expand-list")
|
|
51
|
+
) {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
if (!this.get("expanded")) {
|
|
54
|
+
this.set("expanded", [dataKey]);
|
|
55
|
+
} else {
|
|
56
|
+
this.get("expanded").pushObject(dataKey);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
disableBackButtons: computed("current", function() {
|
|
62
|
+
return this.get("current") === 1;
|
|
63
|
+
}),
|
|
64
|
+
|
|
65
|
+
disableForwardButtons: computed("current", "message.env.length", function() {
|
|
66
|
+
return this.get("current") === this.get("message.env.length");
|
|
67
|
+
}),
|
|
68
|
+
|
|
69
|
+
actions: {
|
|
70
|
+
takeStep(dir) {
|
|
71
|
+
const amount = dir === "back" ? -1 : 1;
|
|
72
|
+
this.set("current", this.get("current") + amount);
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
bigJump(dir) {
|
|
76
|
+
const newCurrent = dir === "back" ? 1 : this.get("message.env.length");
|
|
77
|
+
this.set("current", newCurrent);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import Component from "@ember/component";
|
|
2
|
+
import { not } from "@ember/object/computed";
|
|
3
|
+
import { computed } from "@ember/object";
|
|
4
|
+
import Pattern from "client-app/models/pattern-item";
|
|
5
|
+
import { ajax } from "client-app/lib/utilities";
|
|
6
|
+
|
|
7
|
+
export default Component.extend({
|
|
8
|
+
immutable: not("mutable"),
|
|
9
|
+
|
|
10
|
+
init() {
|
|
11
|
+
this._super(...arguments);
|
|
12
|
+
if (this.get("patterns.length") < 1 && this.get("mutable")) {
|
|
13
|
+
this.send("create");
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
allPatterns: computed("patterns.[]", "newPatterns.[]", function() {
|
|
18
|
+
const patterns = this.get("patterns").map(pattern =>
|
|
19
|
+
Pattern.create({ value: pattern })
|
|
20
|
+
);
|
|
21
|
+
const newPatterns = this.get("newPatterns") || [];
|
|
22
|
+
return [...newPatterns.reverse(), ...patterns.reverse()];
|
|
23
|
+
}),
|
|
24
|
+
|
|
25
|
+
makeAPICall(data = {}) {
|
|
26
|
+
const { method } = data;
|
|
27
|
+
delete data.method;
|
|
28
|
+
|
|
29
|
+
return ajax(`/patterns/${this.get("key")}.json`, { method, data });
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
alwaysBlock(pattern) {
|
|
33
|
+
pattern.set("saving", false);
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
catchBlock(pattern, response) {
|
|
37
|
+
if (response.responseText) {
|
|
38
|
+
pattern.set("error", response.responseText);
|
|
39
|
+
} else {
|
|
40
|
+
pattern.set("error", "Unkown error occured. Please see dev console.");
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
requestInit(pattern) {
|
|
45
|
+
pattern.setProperties({
|
|
46
|
+
saving: true,
|
|
47
|
+
error: null
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
actions: {
|
|
52
|
+
create() {
|
|
53
|
+
if (!this.get("newPatterns")) {
|
|
54
|
+
this.set("newPatterns", []);
|
|
55
|
+
}
|
|
56
|
+
this.get("newPatterns").pushObject(Pattern.create({ isNew: true }));
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
trash(pattern) {
|
|
60
|
+
if (pattern.get("isNew")) {
|
|
61
|
+
this.get("newPatterns").removeObject(pattern);
|
|
62
|
+
pattern.destroy();
|
|
63
|
+
} else {
|
|
64
|
+
this.requestInit(pattern);
|
|
65
|
+
this.makeAPICall({
|
|
66
|
+
method: "DELETE",
|
|
67
|
+
pattern: pattern.get("value")
|
|
68
|
+
})
|
|
69
|
+
.then(() => {
|
|
70
|
+
this.get("patterns").removeObject(pattern.get("value"));
|
|
71
|
+
pattern.destroy();
|
|
72
|
+
})
|
|
73
|
+
.catch(response => this.catchBlock(pattern, response))
|
|
74
|
+
.always(() => this.alwaysBlock(pattern));
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
save(pattern) {
|
|
79
|
+
this.requestInit(pattern);
|
|
80
|
+
let promise;
|
|
81
|
+
if (pattern.get("isNew")) {
|
|
82
|
+
promise = this.makeAPICall({
|
|
83
|
+
method: "POST",
|
|
84
|
+
pattern: pattern.get("valueBuffer")
|
|
85
|
+
}).then(response => {
|
|
86
|
+
pattern.updateValue(response.pattern);
|
|
87
|
+
pattern.set("isNew", false);
|
|
88
|
+
this.get("patterns").pushObject(pattern.get("value"));
|
|
89
|
+
this.get("newPatterns").removeObject(pattern);
|
|
90
|
+
});
|
|
91
|
+
} else {
|
|
92
|
+
promise = this.makeAPICall({
|
|
93
|
+
method: "PUT",
|
|
94
|
+
pattern: pattern.get("value"),
|
|
95
|
+
new_pattern: pattern.get("valueBuffer")
|
|
96
|
+
}).then(response => {
|
|
97
|
+
const index = this.get("patterns").indexOf(pattern.get("value"));
|
|
98
|
+
pattern.updateValue(response.pattern);
|
|
99
|
+
this.get("patterns")[index] = pattern.get("value");
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
promise
|
|
103
|
+
.catch(response => {
|
|
104
|
+
this.catchBlock(pattern, response);
|
|
105
|
+
})
|
|
106
|
+
.always(() => this.alwaysBlock(pattern));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|