2017-10-14 20:24:18 +00:00
|
|
|
/*jslint es6: true, this: true*/
|
|
|
|
/*global window, Vue*/
|
2017-10-12 19:00:04 +00:00
|
|
|
(function () {
|
2017-10-14 20:24:18 +00:00
|
|
|
"use strict";
|
2017-10-12 19:00:04 +00:00
|
|
|
|
2017-10-14 04:23:49 +00:00
|
|
|
const standardsDefaults = window.WEB_API_MANAGER.defaults;
|
|
|
|
|
2017-10-12 19:00:04 +00:00
|
|
|
Vue.component("web-api-standards", {
|
2017-10-14 18:52:56 +00:00
|
|
|
props: ["standards", "selectedStandards", "selectedDomain"],
|
2017-10-12 19:00:04 +00:00
|
|
|
template: `
|
|
|
|
<div class="web-api-standards-container">
|
2017-10-14 18:52:56 +00:00
|
|
|
<h3>Pattern: <code>{{ selectedDomain }}</code></h3>
|
|
|
|
|
|
|
|
<div class="panel panel-default form-horizontal">
|
|
|
|
<div class="panel-heading">
|
|
|
|
Default configurations
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="panel-body">
|
2017-10-14 04:23:49 +00:00
|
|
|
<button @click="onConservativeClicked">
|
|
|
|
Use Conservative Settings
|
|
|
|
</button>
|
|
|
|
<button @click="onAggressiveClicked">
|
|
|
|
Use Aggressive Settings
|
|
|
|
</button>
|
2017-10-14 21:16:24 +00:00
|
|
|
<button @click="onClearClicked">
|
|
|
|
Clear Settings
|
|
|
|
</button>
|
|
|
|
<button @click="onAllClicked">
|
|
|
|
Block All
|
|
|
|
</button>
|
|
|
|
|
2017-10-14 04:23:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2017-10-14 18:52:56 +00:00
|
|
|
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">Blocked standards</div>
|
|
|
|
|
|
|
|
<ul class="list-group">
|
|
|
|
<li class="list-group-item" v-for="standard in standards">
|
|
|
|
<span v-if="standard.info.url" class="badge">
|
|
|
|
<a href="{{ standard.info.url }}">info</a>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<input type="checkbox"
|
|
|
|
:value="standard.info.idenitifer"
|
|
|
|
v-model="selectedStandards"
|
|
|
|
@change="onStandardChecked">
|
|
|
|
{{ standard.info.idenitifer }}
|
|
|
|
</li>
|
|
|
|
</ul>
|
2017-10-12 19:00:04 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
`,
|
|
|
|
methods: {
|
|
|
|
onStandardChecked: function () {
|
|
|
|
this.$root.$data.setSelectedStandards(this.selectedStandards);
|
2017-10-14 04:23:49 +00:00
|
|
|
},
|
|
|
|
onConservativeClicked: function () {
|
|
|
|
this.$root.$data.setSelectedStandards(standardsDefaults.conservative);
|
|
|
|
},
|
|
|
|
onAggressiveClicked: function () {
|
|
|
|
this.$root.$data.setSelectedStandards(standardsDefaults.aggressive);
|
2017-10-14 21:16:24 +00:00
|
|
|
},
|
|
|
|
onClearClicked: function () {
|
|
|
|
this.$root.$data.setSelectedStandards([]);
|
|
|
|
},
|
|
|
|
onAllClicked: function () {
|
|
|
|
const allStandards = Object.keys(this.standards)
|
|
|
|
.map(aStdName => this.standards[aStdName].info.idenitifer);
|
|
|
|
this.$root.$data.setSelectedStandards(allStandards);
|
2017-10-12 19:00:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}());
|