activity_notification 2.4.1 → 2.5.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/README.md +4 -2
- data/app/jobs/activity_notification/cascading_notification_job.rb +123 -0
- data/docs/Functions.md +197 -1
- data/lib/activity_notification/apis/cascading_notification_api.rb +208 -0
- data/lib/activity_notification/apis/notification_api.rb +3 -0
- data/lib/activity_notification/config.rb +10 -0
- data/lib/activity_notification/mailers/helpers.rb +27 -1
- data/lib/activity_notification/version.rb +1 -1
- data/lib/generators/templates/activity_notification.rb +8 -0
- metadata +5 -441
- data/.codeclimate.yml +0 -33
- data/.coveralls.yml +0 -1
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -22
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
- data/.github/pull_request_template.md +0 -13
- data/.github/workflows/build.yml +0 -100
- data/.gitignore +0 -74
- data/.rspec +0 -3
- data/.rubocop.yml +0 -1157
- data/.yardopts +0 -6
- data/CHANGELOG.md +0 -452
- data/Gemfile +0 -31
- data/Procfile +0 -2
- data/Rakefile +0 -28
- data/activity_notification.gemspec +0 -44
- data/ai-curated-specs/issues/172/design.md +0 -220
- data/ai-curated-specs/issues/172/tasks.md +0 -326
- data/ai-curated-specs/issues/188/design.md +0 -227
- data/ai-curated-specs/issues/188/requirements.md +0 -78
- data/ai-curated-specs/issues/188/tasks.md +0 -203
- data/ai-curated-specs/issues/188/upstream-contributions.md +0 -592
- data/ai-curated-specs/issues/50/design.md +0 -235
- data/ai-curated-specs/issues/50/requirements.md +0 -49
- data/ai-curated-specs/issues/50/tasks.md +0 -232
- data/bin/_dynamodblocal +0 -4
- data/bin/bundle_update.sh +0 -7
- data/bin/deploy_on_heroku.sh +0 -16
- data/bin/install_dynamodblocal.sh +0 -5
- data/bin/start_dynamodblocal.sh +0 -47
- data/bin/stop_dynamodblocal.sh +0 -34
- data/gemfiles/Gemfile.rails-5.0 +0 -25
- data/gemfiles/Gemfile.rails-5.1 +0 -25
- data/gemfiles/Gemfile.rails-5.2 +0 -24
- data/gemfiles/Gemfile.rails-6.0 +0 -23
- data/gemfiles/Gemfile.rails-6.1 +0 -22
- data/gemfiles/Gemfile.rails-7.0 +0 -25
- data/gemfiles/Gemfile.rails-7.1 +0 -23
- data/gemfiles/Gemfile.rails-7.2 +0 -23
- data/gemfiles/Gemfile.rails-8.0 +0 -24
- data/package.json +0 -8
- data/spec/channels/notification_api_channel_shared_examples.rb +0 -59
- data/spec/channels/notification_api_channel_spec.rb +0 -49
- data/spec/channels/notification_api_with_devise_channel_spec.rb +0 -76
- data/spec/channels/notification_channel_shared_examples.rb +0 -59
- data/spec/channels/notification_channel_spec.rb +0 -48
- data/spec/channels/notification_with_devise_channel_spec.rb +0 -97
- data/spec/concerns/apis/notification_api_spec.rb +0 -1627
- data/spec/concerns/apis/subscription_api_spec.rb +0 -474
- data/spec/concerns/common_spec.rb +0 -213
- data/spec/concerns/models/group_spec.rb +0 -61
- data/spec/concerns/models/notifiable_spec.rb +0 -782
- data/spec/concerns/models/notifier_spec.rb +0 -71
- data/spec/concerns/models/subscriber_spec.rb +0 -800
- data/spec/concerns/models/target_spec.rb +0 -1285
- data/spec/concerns/renderable_spec.rb +0 -129
- data/spec/config_spec.rb +0 -85
- data/spec/controllers/common_controller_spec.rb +0 -25
- data/spec/controllers/controller_spec_utility.rb +0 -100
- data/spec/controllers/dummy_common_controller.rb +0 -5
- data/spec/controllers/notifications_api_controller_shared_examples.rb +0 -619
- data/spec/controllers/notifications_api_controller_spec.rb +0 -19
- data/spec/controllers/notifications_api_with_devise_controller_spec.rb +0 -60
- data/spec/controllers/notifications_controller_shared_examples.rb +0 -743
- data/spec/controllers/notifications_controller_spec.rb +0 -11
- data/spec/controllers/notifications_with_devise_controller_spec.rb +0 -97
- data/spec/controllers/subscriptions_api_controller_shared_examples.rb +0 -750
- data/spec/controllers/subscriptions_api_controller_spec.rb +0 -19
- data/spec/controllers/subscriptions_api_with_devise_controller_spec.rb +0 -60
- data/spec/controllers/subscriptions_controller_shared_examples.rb +0 -946
- data/spec/controllers/subscriptions_controller_spec.rb +0 -11
- data/spec/controllers/subscriptions_with_devise_controller_spec.rb +0 -97
- data/spec/factories/admins.rb +0 -5
- data/spec/factories/articles.rb +0 -5
- data/spec/factories/comments.rb +0 -6
- data/spec/factories/dummy/dummy_group.rb +0 -4
- data/spec/factories/dummy/dummy_notifiable.rb +0 -4
- data/spec/factories/dummy/dummy_notifier.rb +0 -4
- data/spec/factories/dummy/dummy_subscriber.rb +0 -4
- data/spec/factories/dummy/dummy_target.rb +0 -4
- data/spec/factories/notifications.rb +0 -7
- data/spec/factories/subscriptions.rb +0 -8
- data/spec/factories/users.rb +0 -11
- data/spec/generators/controllers_generator_spec.rb +0 -85
- data/spec/generators/install_generator_spec.rb +0 -43
- data/spec/generators/migration/migration_generator_spec.rb +0 -80
- data/spec/generators/models_generator_spec.rb +0 -96
- data/spec/generators/views_generator_spec.rb +0 -195
- data/spec/helpers/polymorphic_helpers_spec.rb +0 -89
- data/spec/helpers/view_helpers_spec.rb +0 -547
- data/spec/jobs/notification_resilience_job_spec.rb +0 -167
- data/spec/jobs/notify_all_job_spec.rb +0 -23
- data/spec/jobs/notify_job_spec.rb +0 -23
- data/spec/jobs/notify_to_job_spec.rb +0 -23
- data/spec/mailers/mailer_spec.rb +0 -214
- data/spec/mailers/notification_resilience_spec.rb +0 -263
- data/spec/models/dummy/dummy_group_spec.rb +0 -10
- data/spec/models/dummy/dummy_notifiable_spec.rb +0 -10
- data/spec/models/dummy/dummy_notifier_spec.rb +0 -10
- data/spec/models/dummy/dummy_subscriber_spec.rb +0 -8
- data/spec/models/dummy/dummy_target_spec.rb +0 -10
- data/spec/models/notification_spec.rb +0 -472
- data/spec/models/subscription_spec.rb +0 -215
- data/spec/optional_targets/action_cable_api_channel_spec.rb +0 -34
- data/spec/optional_targets/action_cable_channel_spec.rb +0 -41
- data/spec/optional_targets/amazon_sns_spec.rb +0 -47
- data/spec/optional_targets/base_spec.rb +0 -45
- data/spec/optional_targets/slack_spec.rb +0 -44
- data/spec/orm/dynamoid_spec.rb +0 -115
- data/spec/rails_app/Rakefile +0 -15
- data/spec/rails_app/app/assets/config/manifest.js +0 -3
- data/spec/rails_app/app/assets/images/.keep +0 -0
- data/spec/rails_app/app/assets/javascripts/application.js +0 -3
- data/spec/rails_app/app/assets/javascripts/cable.js +0 -12
- data/spec/rails_app/app/assets/stylesheets/application.css +0 -15
- data/spec/rails_app/app/assets/stylesheets/reset.css +0 -85
- data/spec/rails_app/app/assets/stylesheets/style.css +0 -244
- data/spec/rails_app/app/controllers/admins_controller.rb +0 -21
- data/spec/rails_app/app/controllers/application_controller.rb +0 -5
- data/spec/rails_app/app/controllers/articles_controller.rb +0 -67
- data/spec/rails_app/app/controllers/comments_controller.rb +0 -36
- data/spec/rails_app/app/controllers/concerns/.keep +0 -0
- data/spec/rails_app/app/controllers/spa_controller.rb +0 -7
- data/spec/rails_app/app/controllers/users/notifications_controller.rb +0 -2
- data/spec/rails_app/app/controllers/users/notifications_with_devise_controller.rb +0 -2
- data/spec/rails_app/app/controllers/users/subscriptions_controller.rb +0 -2
- data/spec/rails_app/app/controllers/users/subscriptions_with_devise_controller.rb +0 -2
- data/spec/rails_app/app/controllers/users_controller.rb +0 -26
- data/spec/rails_app/app/helpers/application_helper.rb +0 -2
- data/spec/rails_app/app/helpers/devise_helper.rb +0 -2
- data/spec/rails_app/app/javascript/App.vue +0 -40
- data/spec/rails_app/app/javascript/components/DeviseTokenAuth.vue +0 -82
- data/spec/rails_app/app/javascript/components/Top.vue +0 -98
- data/spec/rails_app/app/javascript/components/notifications/Index.vue +0 -200
- data/spec/rails_app/app/javascript/components/notifications/Notification.vue +0 -133
- data/spec/rails_app/app/javascript/components/notifications/NotificationContent.vue +0 -122
- data/spec/rails_app/app/javascript/components/subscriptions/Index.vue +0 -279
- data/spec/rails_app/app/javascript/components/subscriptions/NewSubscription.vue +0 -112
- data/spec/rails_app/app/javascript/components/subscriptions/NotificationKey.vue +0 -141
- data/spec/rails_app/app/javascript/components/subscriptions/Subscription.vue +0 -226
- data/spec/rails_app/app/javascript/config/development.js +0 -5
- data/spec/rails_app/app/javascript/config/environment.js +0 -7
- data/spec/rails_app/app/javascript/config/production.js +0 -5
- data/spec/rails_app/app/javascript/config/test.js +0 -5
- data/spec/rails_app/app/javascript/packs/application.js +0 -18
- data/spec/rails_app/app/javascript/packs/spa.js +0 -14
- data/spec/rails_app/app/javascript/router/index.js +0 -73
- data/spec/rails_app/app/javascript/store/index.js +0 -37
- data/spec/rails_app/app/mailers/.keep +0 -0
- data/spec/rails_app/app/mailers/custom_notification_mailer.rb +0 -5
- data/spec/rails_app/app/models/admin.rb +0 -35
- data/spec/rails_app/app/models/article.rb +0 -54
- data/spec/rails_app/app/models/comment.rb +0 -81
- data/spec/rails_app/app/models/dummy/dummy_base.rb +0 -11
- data/spec/rails_app/app/models/dummy/dummy_group.rb +0 -23
- data/spec/rails_app/app/models/dummy/dummy_notifiable.rb +0 -15
- data/spec/rails_app/app/models/dummy/dummy_notifiable_target.rb +0 -27
- data/spec/rails_app/app/models/dummy/dummy_notifier.rb +0 -15
- data/spec/rails_app/app/models/dummy/dummy_subscriber.rb +0 -14
- data/spec/rails_app/app/models/dummy/dummy_target.rb +0 -16
- data/spec/rails_app/app/models/user.rb +0 -73
- data/spec/rails_app/app/views/activity_notification/mailer/dummy_subscribers/test_key.text.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/default/article/_update.html.erb +0 -146
- data/spec/rails_app/app/views/activity_notification/notifications/default/custom/_path_test.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/default/custom/_test.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/users/_custom_index.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/users/custom/_test.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/notifications/users/overridden/custom/_test.html.erb +0 -1
- data/spec/rails_app/app/views/activity_notification/optional_targets/admins/amazon_sns/comment/_default.text.erb +0 -10
- data/spec/rails_app/app/views/articles/_form.html.erb +0 -24
- data/spec/rails_app/app/views/articles/edit.html.erb +0 -8
- data/spec/rails_app/app/views/articles/index.html.erb +0 -113
- data/spec/rails_app/app/views/articles/new.html.erb +0 -7
- data/spec/rails_app/app/views/articles/show.html.erb +0 -49
- data/spec/rails_app/app/views/layouts/_header.html.erb +0 -46
- data/spec/rails_app/app/views/layouts/application.html.erb +0 -15
- data/spec/rails_app/app/views/spa/index.html.erb +0 -2
- data/spec/rails_app/babel.config.js +0 -72
- data/spec/rails_app/bin/bundle +0 -3
- data/spec/rails_app/bin/rails +0 -4
- data/spec/rails_app/bin/rake +0 -4
- data/spec/rails_app/bin/setup +0 -29
- data/spec/rails_app/bin/webpack +0 -18
- data/spec/rails_app/bin/webpack-dev-server +0 -18
- data/spec/rails_app/config/application.rb +0 -54
- data/spec/rails_app/config/boot.rb +0 -5
- data/spec/rails_app/config/cable.yml +0 -8
- data/spec/rails_app/config/database.yml +0 -36
- data/spec/rails_app/config/dynamoid.rb +0 -13
- data/spec/rails_app/config/environment.rb +0 -26
- data/spec/rails_app/config/environments/development.rb +0 -60
- data/spec/rails_app/config/environments/production.rb +0 -85
- data/spec/rails_app/config/environments/test.rb +0 -53
- data/spec/rails_app/config/initializers/activity_notification.rb +0 -104
- data/spec/rails_app/config/initializers/assets.rb +0 -11
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/rails_app/config/initializers/cookies_serializer.rb +0 -3
- data/spec/rails_app/config/initializers/copy_it.aws.rb.template +0 -6
- data/spec/rails_app/config/initializers/devise.rb +0 -278
- data/spec/rails_app/config/initializers/devise_token_auth.rb +0 -55
- data/spec/rails_app/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/rails_app/config/initializers/inflections.rb +0 -16
- data/spec/rails_app/config/initializers/mime_types.rb +0 -4
- data/spec/rails_app/config/initializers/mysql.rb +0 -9
- data/spec/rails_app/config/initializers/session_store.rb +0 -3
- data/spec/rails_app/config/initializers/wrap_parameters.rb +0 -14
- data/spec/rails_app/config/initializers/zeitwerk.rb +0 -10
- data/spec/rails_app/config/locales/activity_notification.en.yml +0 -26
- data/spec/rails_app/config/locales/devise.en.yml +0 -62
- data/spec/rails_app/config/mongoid.yml +0 -13
- data/spec/rails_app/config/routes.rb +0 -50
- data/spec/rails_app/config/secrets.yml +0 -22
- data/spec/rails_app/config/webpack/development.js +0 -5
- data/spec/rails_app/config/webpack/environment.js +0 -7
- data/spec/rails_app/config/webpack/loaders/vue.js +0 -6
- data/spec/rails_app/config/webpack/production.js +0 -5
- data/spec/rails_app/config/webpack/test.js +0 -5
- data/spec/rails_app/config/webpacker.yml +0 -97
- data/spec/rails_app/config.ru +0 -4
- data/spec/rails_app/db/migrate/20160716000000_create_test_tables.rb +0 -42
- data/spec/rails_app/db/migrate/20181209000000_create_activity_notification_tables.rb +0 -33
- data/spec/rails_app/db/migrate/20191201000000_add_tokens_to_users.rb +0 -10
- data/spec/rails_app/db/schema.rb +0 -98
- data/spec/rails_app/db/seeds.rb +0 -95
- data/spec/rails_app/lib/custom_optional_targets/console_output.rb +0 -16
- data/spec/rails_app/lib/custom_optional_targets/raise_error.rb +0 -14
- data/spec/rails_app/lib/custom_optional_targets/wrong_target.rb +0 -13
- data/spec/rails_app/lib/mailer_previews/mailer_preview.rb +0 -29
- data/spec/rails_app/package.json +0 -23
- data/spec/rails_app/postcss.config.js +0 -12
- data/spec/rails_app/public/404.html +0 -67
- data/spec/rails_app/public/422.html +0 -67
- data/spec/rails_app/public/500.html +0 -66
- data/spec/rails_app/public/favicon.ico +0 -0
- data/spec/roles/acts_as_group_spec.rb +0 -30
- data/spec/roles/acts_as_notifiable_spec.rb +0 -432
- data/spec/roles/acts_as_notifier_spec.rb +0 -30
- data/spec/roles/acts_as_target_spec.rb +0 -36
- data/spec/spec_helper.rb +0 -56
- data/spec/version_spec.rb +0 -31
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="subscription_wrapper">
|
|
3
|
-
<div class="subscription_header">
|
|
4
|
-
<h1>Subscriptions for {{ currentTarget.printable_target_name }}</h1>
|
|
5
|
-
</div>
|
|
6
|
-
|
|
7
|
-
<div v-if="subscriptions">
|
|
8
|
-
<div class="subscription_header">
|
|
9
|
-
<h2>Configured subscriptions</h2>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="subscriptions" id="subscriptions">
|
|
12
|
-
<div v-if="subscriptions.length" class="fields_area">
|
|
13
|
-
<div v-for="subscription in subscriptions" :key="`${subscription.id}_${subscription.updated_at}`">
|
|
14
|
-
<subscription :targetSubscription="subscription" :targetApiPath="targetApiPath" @getSubscriptions="getSubscriptions" />
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
<div v-else class="fields_area">
|
|
18
|
-
<div class="fields_wrapper">
|
|
19
|
-
No subscriptions are available.
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<div v-if="notificationKeys">
|
|
26
|
-
<div class="subscription_header">
|
|
27
|
-
<h2>Unconfigured notification keys</h2>
|
|
28
|
-
</div>
|
|
29
|
-
<div class="notification_keys" id="notification_keys">
|
|
30
|
-
<div v-if="notificationKeys.length" class="fields_area">
|
|
31
|
-
<div v-for="notificationKey in notificationKeys" :key="notificationKey">
|
|
32
|
-
<notification-key :notificationKey="notificationKey" :targetApiPath="targetApiPath" @getSubscriptions="getSubscriptions" />
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
<div v-else class="fields_area">
|
|
36
|
-
<div class="fields_wrapper">
|
|
37
|
-
No notification keys are available.
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<div class="subscription_header">
|
|
44
|
-
<h2>Create a new subscription</h2>
|
|
45
|
-
</div>
|
|
46
|
-
<div class="subscription_form" id="subscription_form">
|
|
47
|
-
<div class="fields_area">
|
|
48
|
-
<new-subscription :targetApiPath="targetApiPath" @getSubscriptions="getSubscriptions" />
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
|
53
|
-
|
|
54
|
-
<script>
|
|
55
|
-
import axios from 'axios'
|
|
56
|
-
import Subscription from './Subscription.vue'
|
|
57
|
-
import NotificationKey from './NotificationKey.vue'
|
|
58
|
-
import NewSubscription from './NewSubscription.vue'
|
|
59
|
-
|
|
60
|
-
export default {
|
|
61
|
-
name: 'SubscriptionsIndex',
|
|
62
|
-
components: {
|
|
63
|
-
Subscription,
|
|
64
|
-
NotificationKey,
|
|
65
|
-
NewSubscription
|
|
66
|
-
},
|
|
67
|
-
props: {
|
|
68
|
-
target_type: {
|
|
69
|
-
type: String
|
|
70
|
-
},
|
|
71
|
-
target_id: {
|
|
72
|
-
type: [String, Number]
|
|
73
|
-
},
|
|
74
|
-
targetApiPath: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: function () {
|
|
77
|
-
if (this.target_type && this.target_id) {
|
|
78
|
-
return '/' + this.target_type + '/' + this.target_id;
|
|
79
|
-
} else {
|
|
80
|
-
return '';
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
target: {
|
|
85
|
-
type: Object
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
data () {
|
|
89
|
-
return {
|
|
90
|
-
currentTarget: { printable_target_name: '' },
|
|
91
|
-
subscriptions: [],
|
|
92
|
-
notificationKeys: []
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
mounted () {
|
|
96
|
-
if (this.target) {
|
|
97
|
-
this.currentTarget = this.target;
|
|
98
|
-
} else {
|
|
99
|
-
this.getCurrentTarget();
|
|
100
|
-
}
|
|
101
|
-
this.getSubscriptions();
|
|
102
|
-
},
|
|
103
|
-
methods: {
|
|
104
|
-
getCurrentTarget () {
|
|
105
|
-
axios
|
|
106
|
-
.get(this.targetApiPath)
|
|
107
|
-
.then(response => (this.currentTarget = response.data))
|
|
108
|
-
},
|
|
109
|
-
getSubscriptions () {
|
|
110
|
-
axios
|
|
111
|
-
.get(this.targetApiPath + '/subscriptions')
|
|
112
|
-
.then(response => {
|
|
113
|
-
this.subscriptions = response.data.subscriptions;
|
|
114
|
-
this.notificationKeys = response.data.unconfigured_notification_keys;
|
|
115
|
-
})
|
|
116
|
-
.catch (error => {
|
|
117
|
-
if (error.response.status == 401) {
|
|
118
|
-
this.$router.push('/logout');
|
|
119
|
-
}
|
|
120
|
-
})
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
</script>
|
|
125
|
-
|
|
126
|
-
<style scoped>
|
|
127
|
-
.subscription_header h1 {
|
|
128
|
-
margin-bottom: 30px;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.fields_area {
|
|
132
|
-
border: 1px solid #e5e5e5;
|
|
133
|
-
width: 600px;
|
|
134
|
-
box-sizing: border-box;
|
|
135
|
-
margin-bottom: 30px;
|
|
136
|
-
}
|
|
137
|
-
</style>
|
|
138
|
-
|
|
139
|
-
<style>
|
|
140
|
-
.fields_area .fields_wrapper {
|
|
141
|
-
position: relative;
|
|
142
|
-
background-color: #fff;
|
|
143
|
-
padding: 20px;
|
|
144
|
-
box-sizing: border-box;
|
|
145
|
-
border-bottom: 1px solid #e5e5e5;
|
|
146
|
-
}
|
|
147
|
-
.fields_area .fields_wrapper.configured {
|
|
148
|
-
background-color: #f8f9fb;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.fields_area .fields_wrapper .fields_title_wrapper {
|
|
152
|
-
margin-bottom: 16px;
|
|
153
|
-
border-bottom: none;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.fields_area .fields_wrapper .fields_title_wrapper .fields_title {
|
|
157
|
-
font-size: 16px;
|
|
158
|
-
font-weight: bold;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.fields_area .fields_wrapper .fields_title_wrapper p {
|
|
162
|
-
position: absolute;
|
|
163
|
-
top: 15px;
|
|
164
|
-
right: 15px;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.fields_area .fields_wrapper .field_wrapper {
|
|
168
|
-
margin-bottom: 16px;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.fields_area .fields_wrapper .field_wrapper:last-child {
|
|
172
|
-
margin-bottom: 0;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.fields_area .fields_wrapper .field_wrapper.hidden {
|
|
176
|
-
display: none;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.fields_area .fields_wrapper .field_wrapper .field_label {
|
|
180
|
-
margin-bottom: 8px;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.fields_area .fields_wrapper .field_wrapper .field_label label {
|
|
184
|
-
font-size: 14px;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.ui label {
|
|
188
|
-
font-size: 14px;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/* button */
|
|
192
|
-
.ui.button button,
|
|
193
|
-
.ui.button .button {
|
|
194
|
-
cursor: pointer;
|
|
195
|
-
color: #4f4f4f;
|
|
196
|
-
font-weight: bold;
|
|
197
|
-
font-size: 12px;
|
|
198
|
-
padding: 10px 14px;
|
|
199
|
-
margin-left: 10px;
|
|
200
|
-
border: 1px solid #e5e5e5;
|
|
201
|
-
background-color: #fafafa;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.ui.button button:first-child,
|
|
205
|
-
.ui.button .button:first-child {
|
|
206
|
-
margin-left: 0;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.ui.text_field input {
|
|
210
|
-
margin: 0;
|
|
211
|
-
outline: 0;
|
|
212
|
-
padding: 10px;
|
|
213
|
-
font-size: 14px;
|
|
214
|
-
border: 1px solid #e5e5e5;
|
|
215
|
-
border-radius: 3px;
|
|
216
|
-
box-shadow: 0 0 0 0 transparent inset;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/* checkbox */
|
|
220
|
-
.ui.checkbox {
|
|
221
|
-
position: relative;
|
|
222
|
-
left: 300px;
|
|
223
|
-
margin-top: -26px;
|
|
224
|
-
width: 40px;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.ui.checkbox input {
|
|
228
|
-
position: absolute;
|
|
229
|
-
margin-left: -9999px;
|
|
230
|
-
visibility: hidden;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.ui.checkbox .slider {
|
|
234
|
-
display: block;
|
|
235
|
-
position: relative;
|
|
236
|
-
cursor: pointer;
|
|
237
|
-
outline: none;
|
|
238
|
-
user-select: none;
|
|
239
|
-
|
|
240
|
-
padding: 2px;
|
|
241
|
-
width: 36px;
|
|
242
|
-
height: 20px;
|
|
243
|
-
background-color: #dddddd;
|
|
244
|
-
border-radius: 20px;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.ui.checkbox .slider:before,
|
|
248
|
-
.ui.checkbox .slider:after {
|
|
249
|
-
display: block;
|
|
250
|
-
position: absolute;
|
|
251
|
-
top: 1px;
|
|
252
|
-
left: 1px;
|
|
253
|
-
bottom: 1px;
|
|
254
|
-
content: "";
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.ui.checkbox .slider:before {
|
|
258
|
-
right: 1px;
|
|
259
|
-
background-color: #f1f1f1;
|
|
260
|
-
border-radius: 20px;
|
|
261
|
-
transition: background 0.4s;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
.ui.checkbox .slider:after {
|
|
265
|
-
width: 20px;
|
|
266
|
-
background-color: #fff;
|
|
267
|
-
border-radius: 100%;
|
|
268
|
-
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
|
|
269
|
-
transition: margin 0.4s;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.ui.checkbox input:checked + .slider:before {
|
|
273
|
-
background-color: #8ce196;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
.ui.checkbox input:checked + .slider:after {
|
|
277
|
-
margin-left: 18px;
|
|
278
|
-
}
|
|
279
|
-
</style>
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="fields_wrapper">
|
|
3
|
-
<form class="new_subscription" @submit.prevent="createSubscription">
|
|
4
|
-
<div class="field_wrapper subscribing">
|
|
5
|
-
<div class="field_label">
|
|
6
|
-
<label>
|
|
7
|
-
Notification key
|
|
8
|
-
</label>
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-
<div class="field">
|
|
12
|
-
<div class="ui text_field">
|
|
13
|
-
<input type="text" v-model="subscriptionParams.key" placeholder="Notification key" />
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
<div class="field_wrapper subscribing">
|
|
19
|
-
<div class="field_label">
|
|
20
|
-
<label>
|
|
21
|
-
Notification
|
|
22
|
-
</label>
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<div class="field">
|
|
26
|
-
<div class="ui checkbox">
|
|
27
|
-
<label>
|
|
28
|
-
<input type="checkbox" v-model="subscriptionParams.subscribing" v-on:click="arrangeSubscription()" />
|
|
29
|
-
<div class="slider" />
|
|
30
|
-
</label>
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
|
|
35
|
-
<div v-bind:class="[subscriptionParams.subscribing ? '' : 'hidden', 'field_wrapper subscribing_to_email']">
|
|
36
|
-
<div class="field_label">
|
|
37
|
-
<label>
|
|
38
|
-
Email notification
|
|
39
|
-
</label>
|
|
40
|
-
</div>
|
|
41
|
-
<div class="field">
|
|
42
|
-
<div class="ui checkbox">
|
|
43
|
-
<label>
|
|
44
|
-
<input type="checkbox" v-model="subscriptionParams.subscribing_to_email" />
|
|
45
|
-
<div class="slider" />
|
|
46
|
-
</label>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<div class="ui button">
|
|
52
|
-
<button type="submit">Create subscription</button>
|
|
53
|
-
</div>
|
|
54
|
-
</form>
|
|
55
|
-
</div>
|
|
56
|
-
</template>
|
|
57
|
-
|
|
58
|
-
<script>
|
|
59
|
-
import axios from 'axios'
|
|
60
|
-
|
|
61
|
-
export default {
|
|
62
|
-
name: 'Subscription',
|
|
63
|
-
props: {
|
|
64
|
-
targetApiPath: {
|
|
65
|
-
type: String,
|
|
66
|
-
required: true
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
data () {
|
|
70
|
-
return {
|
|
71
|
-
baseURL: axios.defaults.baseURL + this.targetApiPath,
|
|
72
|
-
subscriptionParams: {
|
|
73
|
-
key: "",
|
|
74
|
-
subscribing: true,
|
|
75
|
-
subscribing_to_email: true,
|
|
76
|
-
optional_targets: {}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
methods: {
|
|
81
|
-
createSubscription () {
|
|
82
|
-
axios
|
|
83
|
-
.post(this.targetApiPath + '/subscriptions', { subscription: this.subscriptionParams })
|
|
84
|
-
.then(response => {
|
|
85
|
-
if (response.status == 201) {
|
|
86
|
-
this.$emit('getSubscriptions');
|
|
87
|
-
this.resetSubscriptionParams();
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
.catch (error => {
|
|
91
|
-
if (error.response.status == 401) {
|
|
92
|
-
this.$router.push('/logout');
|
|
93
|
-
}
|
|
94
|
-
})
|
|
95
|
-
},
|
|
96
|
-
arrangeSubscription () {
|
|
97
|
-
this.subscriptionParams.subscribing_to_email = !this.subscriptionParams.subscribing;
|
|
98
|
-
},
|
|
99
|
-
resetSubscriptionParams () {
|
|
100
|
-
this.subscriptionParams = {
|
|
101
|
-
key: "",
|
|
102
|
-
subscribing: true,
|
|
103
|
-
subscribing_to_email: true,
|
|
104
|
-
optional_targets: {}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
</script>
|
|
110
|
-
|
|
111
|
-
<style scoped>
|
|
112
|
-
</style>
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="fields_wrapper">
|
|
3
|
-
<form class="new_subscription" @submit.prevent="createSubscription">
|
|
4
|
-
<div class="fields_title_wrapper">
|
|
5
|
-
<h3 class="fields_title">
|
|
6
|
-
{{ notificationKey }}
|
|
7
|
-
</h3>
|
|
8
|
-
|
|
9
|
-
<p>
|
|
10
|
-
<router-link v-bind:to="{ path : $route.path.replace('subscriptions', 'notifications') + '?filtered_by_key=' + notificationKey }">Notifications</router-link>
|
|
11
|
-
</p>
|
|
12
|
-
</div>
|
|
13
|
-
|
|
14
|
-
<div class="field_wrapper subscribing">
|
|
15
|
-
<div class="field_label">
|
|
16
|
-
<label>
|
|
17
|
-
Notification
|
|
18
|
-
</label>
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
<div class="field">
|
|
22
|
-
<div class="ui checkbox">
|
|
23
|
-
<label>
|
|
24
|
-
<input type="checkbox" v-model="subscriptionParams.subscribing" v-on:click="arrangeSubscription()" />
|
|
25
|
-
<div class="slider" />
|
|
26
|
-
</label>
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<div v-bind:class="[subscriptionParams.subscribing ? '' : 'hidden', 'field_wrapper subscribing_to_email']">
|
|
32
|
-
<div class="field_label">
|
|
33
|
-
<label>
|
|
34
|
-
Email notification
|
|
35
|
-
</label>
|
|
36
|
-
</div>
|
|
37
|
-
<div class="field">
|
|
38
|
-
<div class="ui checkbox">
|
|
39
|
-
<label>
|
|
40
|
-
<input type="checkbox" v-model="subscriptionParams.subscribing_to_email" />
|
|
41
|
-
<div class="slider" />
|
|
42
|
-
</label>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
<div v-bind:class="[subscriptionParams.subscribing ? '' : 'hidden', 'field_wrapper subscribing_to_optional_targets']">
|
|
48
|
-
<div v-for="optionalTargetName in configuredOptionalTargetNames" :key="optionalTargetName">
|
|
49
|
-
<div class="field_label">
|
|
50
|
-
<label>
|
|
51
|
-
Optional tagret ({{ optionalTargetName }})
|
|
52
|
-
</label>
|
|
53
|
-
</div>
|
|
54
|
-
<div class="field">
|
|
55
|
-
<div class="ui checkbox">
|
|
56
|
-
<label>
|
|
57
|
-
<input type="checkbox" v-model="subscriptionParams.optional_targets[optionalTargetName].subscribing" />
|
|
58
|
-
<div class="slider" />
|
|
59
|
-
</label>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
|
|
65
|
-
<div class="ui button">
|
|
66
|
-
<button type="submit">Configure subscription</button>
|
|
67
|
-
</div>
|
|
68
|
-
</form>
|
|
69
|
-
</div>
|
|
70
|
-
</template>
|
|
71
|
-
|
|
72
|
-
<script>
|
|
73
|
-
import axios from 'axios'
|
|
74
|
-
|
|
75
|
-
export default {
|
|
76
|
-
name: 'Subscription',
|
|
77
|
-
props: {
|
|
78
|
-
notificationKey: {
|
|
79
|
-
type: String,
|
|
80
|
-
required: true
|
|
81
|
-
},
|
|
82
|
-
targetApiPath: {
|
|
83
|
-
type: String,
|
|
84
|
-
required: true
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
data () {
|
|
88
|
-
return {
|
|
89
|
-
baseURL: axios.defaults.baseURL + this.targetApiPath,
|
|
90
|
-
configuredOptionalTargetNames: [],
|
|
91
|
-
subscriptionParams: {
|
|
92
|
-
key: this.notificationKey,
|
|
93
|
-
subscribing: true,
|
|
94
|
-
subscribing_to_email: true,
|
|
95
|
-
optional_targets: {}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
mounted () {
|
|
100
|
-
axios
|
|
101
|
-
.get(this.targetApiPath + '/subscriptions/optional_target_names?key=' + this.notificationKey)
|
|
102
|
-
.then(response => {
|
|
103
|
-
this.configuredOptionalTargetNames = response.data.optional_target_names;
|
|
104
|
-
for (let optionalTargetName of this.configuredOptionalTargetNames) {
|
|
105
|
-
this.subscriptionParams.optional_targets[optionalTargetName] = {};
|
|
106
|
-
this.subscriptionParams.optional_targets[optionalTargetName].subscribing = true;
|
|
107
|
-
}
|
|
108
|
-
})
|
|
109
|
-
.catch (error => {
|
|
110
|
-
if (error.response.status == 401) {
|
|
111
|
-
this.$router.push('/logout');
|
|
112
|
-
}
|
|
113
|
-
})
|
|
114
|
-
},
|
|
115
|
-
methods: {
|
|
116
|
-
createSubscription () {
|
|
117
|
-
axios
|
|
118
|
-
.post(this.targetApiPath + '/subscriptions', { subscription: this.subscriptionParams })
|
|
119
|
-
.then(response => {
|
|
120
|
-
if (response.status == 201) {
|
|
121
|
-
this.$emit('getSubscriptions');
|
|
122
|
-
}
|
|
123
|
-
})
|
|
124
|
-
.catch (error => {
|
|
125
|
-
if (error.response.status == 401) {
|
|
126
|
-
this.$router.push('/logout');
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
},
|
|
130
|
-
arrangeSubscription () {
|
|
131
|
-
this.subscriptionParams.subscribing_to_email = !this.subscriptionParams.subscribing;
|
|
132
|
-
for (let optionalTargetName of this.configuredOptionalTargetNames) {
|
|
133
|
-
this.subscriptionParams.optional_targets[optionalTargetName].subscribing = !this.subscriptionParams.subscribing;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
</script>
|
|
139
|
-
|
|
140
|
-
<style scoped>
|
|
141
|
-
</style>
|