diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 1ec06f8..975817e 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -7800,6 +7800,11 @@ "clipboard": "^2.0.0" } }, + "vue-cookies": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/vue-cookies/-/vue-cookies-1.7.4.tgz", + "integrity": "sha512-mOS5Btr8V9zvAtkmQ7/TfqJIropOx7etDAgBywPCmHjvfJl2gFbH2XgoMghleLoyyMTi5eaJss0mPN7arMoslA==" + }, "vue-good-table": { "version": "2.21.1", "resolved": "https://registry.npmjs.org/vue-good-table/-/vue-good-table-2.21.1.tgz", diff --git a/frontend/package.json b/frontend/package.json index df88b85..ca0b2fa 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,6 +13,7 @@ "axios": "^0.19.2", "vue": "^2.6.12", "vue-clipboard2": "^0.2.1", + "vue-cookies": "^1.7.4", "vue-good-table": "^2.21.1" }, "browserslist": [ diff --git a/frontend/src/main.js b/frontend/src/main.js index b881fb6..baa1696 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -1,5 +1,6 @@ import Vue from 'vue'; import axios from 'axios'; +import VueCookies from 'vue-cookies' import VueClipboard from 'vue-clipboard2' import VueGoodTablePlugin from 'vue-good-table' @@ -7,6 +8,7 @@ import 'vue-good-table/dist/vue-good-table.css' Vue.use(VueClipboard) Vue.use(VueGoodTablePlugin) +Vue.use(VueCookies) var axios_cfg = function(url, data='', type='form') { if (data == '') { @@ -109,7 +111,7 @@ new Vue({ } ], filters: { - hide_revoked: true + hideRevoked: true, }, u: { newUserName: '', @@ -132,10 +134,16 @@ new Vue({ watch: { }, mounted: function () { - this.u_get_data() + this.u_get_data(); + this.filters.hideRevoked = this.$cookies.isKey('hideRevoked') ? (this.$cookies.get('hideRevoked') == "true") : false }, created() { - var _this = this + var _this = this; + +// if (!_this.$cookies.isKey('hideRevoked')) { +// _this.$cookies.set('hideRevoked', true, -1); +// } + _this.$root.$on('u-revoke', function (msg) { var data = new URLSearchParams(); data.append('username', _this.username); @@ -209,15 +217,16 @@ new Vue({ modalShowCcdDisplay: function () { return this.u.modalShowCcdVisible ? {display: 'flex'} : {} }, + revokeFilterText: function() { + return this.filters.hideRevoked ? "Show revoked" : "Hide revoked" + }, filteredRows: function() { - var _this = this; - - if(_this.filters.hide_revoked) { - return _this.rows.filter(function(account) { + if (this.filters.hideRevoked) { + return this.rows.filter(function(account) { return account.AccountStatus === "Active"; }); } else { - return _this.rows; + return this.rows; } } diff --git a/frontend/static/index.html b/frontend/static/index.html index a79406f..0685972 100644 --- a/frontend/static/index.html +++ b/frontend/static/index.html @@ -17,8 +17,7 @@ :search-options="{ enabled: true}" >