From 7d4d60074a202d615fb063d3f27fa8d70910509a Mon Sep 17 00:00:00 2001 From: Dario Date: Tue, 27 Jun 2023 17:40:19 +0200 Subject: [PATCH] Fix/error on default sort (#11364) * Fix error when resetting on default sort * Lint * Fix error on default sort (2) * Lint --- themes-default/slim/src/components/history-compact.vue | 3 +++ themes-default/slim/src/components/history-detailed.vue | 3 +++ themes-default/slim/src/mixins/manage-cookie.js | 2 +- themes/dark/assets/js/medusa-runtime.js | 6 +++--- themes/light/assets/js/medusa-runtime.js | 6 +++--- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/themes-default/slim/src/components/history-compact.vue b/themes-default/slim/src/components/history-compact.vue index 801305fb25..19c04d2795 100644 --- a/themes-default/slim/src/components/history-compact.vue +++ b/themes-default/slim/src/components/history-compact.vue @@ -218,6 +218,9 @@ export default { const { getCookie } = this; const sort = getCookie('sort'); // From manage-cookie.js mixin if (sort) { + if (sort[0].type === 'none') { + sort[0].type = 'desc'; + } return sort; } return [{ field: 'date', type: 'desc' }]; diff --git a/themes-default/slim/src/components/history-detailed.vue b/themes-default/slim/src/components/history-detailed.vue index 6b6de4a24a..36de1e7763 100644 --- a/themes-default/slim/src/components/history-detailed.vue +++ b/themes-default/slim/src/components/history-detailed.vue @@ -283,6 +283,9 @@ export default { const { getCookie } = this; const sort = getCookie('sort'); // From manage-cookie.js mixin if (sort) { + if (sort[0].type === 'none') { + sort[0].type = 'desc'; + } return sort; } return [{ field: 'date', type: 'desc' }]; diff --git a/themes-default/slim/src/mixins/manage-cookie.js b/themes-default/slim/src/mixins/manage-cookie.js index 94d9562ac7..1b1cafc934 100644 --- a/themes-default/slim/src/mixins/manage-cookie.js +++ b/themes-default/slim/src/mixins/manage-cookie.js @@ -15,7 +15,7 @@ export const manageCookieMixin = cookiePrefix => { try { return JSON.parse(cookie); } catch { - return cookie === 'none' ? null : cookie; + return cookie; } }, setCookie(key, value) { diff --git a/themes/dark/assets/js/medusa-runtime.js b/themes/dark/assets/js/medusa-runtime.js index 4d1e937b0e..ba039cc700 100644 --- a/themes/dark/assets/js/medusa-runtime.js +++ b/themes/dark/assets/js/medusa-runtime.js @@ -719,7 +719,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n/* harmony import */ var vue_good_table__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! vue-good-table */ \"./node_modules/vue-good-table/dist/vue-good-table.esm.js\");\n/* harmony import */ var _utils_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/core */ \"./src/utils/core.js\");\n/* harmony import */ var _mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mixins/manage-cookie */ \"./src/mixins/manage-cookie.js\");\n/* harmony import */ var _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers/quality-pill.vue */ \"./src/components/helpers/quality-pill.vue\");\n/* harmony import */ var _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers/app-link.vue */ \"./src/components/helpers/app-link.vue\");\n/* harmony import */ var v_tooltip__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! v-tooltip */ \"./node_modules/v-tooltip/dist/v-tooltip.esm.js\");\n/* harmony import */ var date_fns_parse__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! date-fns/parse */ \"./node_modules/date-fns/esm/parse/index.js\");\n/* harmony import */ var date_fns_format__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! date-fns/format */ \"./node_modules/date-fns/esm/format/index.js\");\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n name: 'history-compact',\n components: {\n AppLink: _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n QualityPill: _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_3__[\"default\"],\n VueGoodTable: vue_good_table__WEBPACK_IMPORTED_MODULE_6__.VueGoodTable\n },\n directives: {\n tooltip: v_tooltip__WEBPACK_IMPORTED_MODULE_5__.VTooltip\n },\n mixins: [(0,_mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__.manageCookieMixin)('historyCompact')],\n data() {\n const {\n getCookie\n } = this;\n const perPageDropdown = [25, 50, 100, 250, 500, 1000];\n const columns = [{\n label: 'Time',\n field: 'actionDate',\n dateInputFormat: 'yyyyMMddHHmmss',\n // E.g. 07-09-2017 19:16:25\n dateOutputFormat: 'yyyy-MM-dd HH:mm:ss',\n type: 'date',\n hidden: getCookie('Date')\n }, {\n label: 'Episode',\n field: 'episodeTitle',\n sortable: false,\n filterOptions: {\n enabled: true,\n customFilter: true\n },\n hidden: getCookie('Status')\n }, {\n label: 'Snatched',\n field: 'snatched',\n type: 'number',\n sortable: false,\n hidden: getCookie('Quality')\n }, {\n label: 'Downloaded',\n field: 'downloaded',\n sortable: false,\n hidden: getCookie('Provider/Group')\n }, {\n label: 'Subtitled',\n field: 'subtitled',\n hidden: getCookie('Release')\n }, {\n label: 'Quality',\n field: 'quality',\n hidden: getCookie('Release')\n }];\n return {\n columns,\n selectedClientStatusValue: [],\n perPageDropdown\n };\n },\n mounted() {\n const {\n getCookie,\n getSortFromCookie\n } = this;\n\n // Get per-page pagination from cookie\n const perPage = getCookie('pagination-perpage-history');\n if (perPage) {\n this.remoteHistory.perPage = perPage;\n }\n this.remoteHistory.sort = getSortFromCookie();\n },\n created() {\n this.loadItemsDebounced = lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default()(this.loadItems, 500);\n },\n computed: {\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapState)({\n layout: state => state.config.layout,\n remoteHistory: state => state.history.remoteCompact,\n consts: state => state.config.consts\n }),\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapGetters)({\n fuzzyParseDateTime: 'fuzzyParseDateTime'\n }),\n serverParams() {\n return {\n page: this.remoteHistory.page,\n // What page I want to show\n perPage: this.remoteHistory.perPage,\n // How many items I'm showing per page\n sort: this.remoteHistory.sort,\n filter: this.remoteHistory.filter,\n compact: true\n };\n },\n qualityOptions() {\n const {\n consts\n } = this;\n return consts.qualities.values.map(quality => {\n return {\n value: quality.value,\n text: quality.name\n };\n });\n }\n },\n methods: {\n humanFileSize: _utils_core__WEBPACK_IMPORTED_MODULE_1__.humanFileSize,\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapActions)({\n getHistory: 'getHistory',\n checkHistory: 'checkHistory',\n setStoreLayout: 'setStoreLayout'\n }),\n getSortFromCookie() {\n const {\n getCookie\n } = this;\n const sort = getCookie('sort'); // From manage-cookie.js mixin\n if (sort) {\n return sort;\n }\n return [{\n field: 'date',\n type: 'desc'\n }];\n },\n sortDate(rows) {\n const cloneRows = [...rows];\n return cloneRows.sort(x => x.actionDate).reverse();\n },\n getFileBaseName(path) {\n if (path) {\n return path.split(/[/\\\\]/).pop();\n }\n return path;\n },\n close() {\n this.$emit('close');\n // Destroy the vue listeners, etc\n this.$destroy();\n // Remove the element from the DOM\n this.$el.remove();\n },\n updatePaginationPerPage(pageLimit) {\n const {\n setStoreLayout\n } = this;\n setStoreLayout({\n key: 'historyLimit',\n value: pageLimit\n });\n },\n onPageChange(params) {\n this.remoteHistory.page = params.currentPage;\n this.loadItemsDebounced();\n },\n onPerPageChange(params) {\n this.setCookie('pagination-perpage-history', params.currentPerPage);\n this.remoteHistory.perPage = params.currentPerPage;\n this.loadItemsDebounced();\n },\n onSortChange(params) {\n this.setCookie('sort', params);\n this.remoteHistory.sort = params.filter(item => item.type !== 'none');\n this.loadItemsDebounced();\n },\n onColumnFilter(params) {\n this.remoteHistory.filter = params;\n this.loadItemsDebounced();\n },\n updateClientStatusFilter(event) {\n const combinedStatus = event.reduce((result, item) => {\n return result | item.value;\n }, 0);\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.selectedClientStatusValue = event;\n this.remoteHistory.filter.columnFilters.clientStatus = combinedStatus;\n this.loadItemsDebounced();\n },\n updateQualityFilter(quality) {\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.quality = quality.currentTarget.value;\n this.loadItemsDebounced();\n },\n updateResource(resource) {\n resource = resource.currentTarget.value;\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.resource = resource;\n this.loadItemsDebounced();\n },\n // Load items is what brings back the rows from server\n loadItems() {\n const {\n getHistory\n } = this;\n console.log(this.serverParams);\n getHistory(this.serverParams);\n },\n /**\n * Re-format date.\n * @param {number} date - Date formatted as a number.\n * @returns {string} - Formatted date as a string.\n */\n convertDateFormat(date) {\n const dateObj = (0,date_fns_parse__WEBPACK_IMPORTED_MODULE_8__[\"default\"])(date, 'yyyyMMddHHmmss', new Date()); // Example: 20210813162256\n return (0,date_fns_format__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(dateObj, 'yyyy-MM-dd HH:mm:ss');\n }\n }\n});\n\n//# sourceURL=webpack://slim/./src/components/history-compact.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-1!./node_modules/vue-loader/lib/index.js??vue-loader-options"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n/* harmony import */ var vue_good_table__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! vue-good-table */ \"./node_modules/vue-good-table/dist/vue-good-table.esm.js\");\n/* harmony import */ var _utils_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/core */ \"./src/utils/core.js\");\n/* harmony import */ var _mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mixins/manage-cookie */ \"./src/mixins/manage-cookie.js\");\n/* harmony import */ var _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers/quality-pill.vue */ \"./src/components/helpers/quality-pill.vue\");\n/* harmony import */ var _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers/app-link.vue */ \"./src/components/helpers/app-link.vue\");\n/* harmony import */ var v_tooltip__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! v-tooltip */ \"./node_modules/v-tooltip/dist/v-tooltip.esm.js\");\n/* harmony import */ var date_fns_parse__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! date-fns/parse */ \"./node_modules/date-fns/esm/parse/index.js\");\n/* harmony import */ var date_fns_format__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! date-fns/format */ \"./node_modules/date-fns/esm/format/index.js\");\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n name: 'history-compact',\n components: {\n AppLink: _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n QualityPill: _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_3__[\"default\"],\n VueGoodTable: vue_good_table__WEBPACK_IMPORTED_MODULE_6__.VueGoodTable\n },\n directives: {\n tooltip: v_tooltip__WEBPACK_IMPORTED_MODULE_5__.VTooltip\n },\n mixins: [(0,_mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__.manageCookieMixin)('historyCompact')],\n data() {\n const {\n getCookie\n } = this;\n const perPageDropdown = [25, 50, 100, 250, 500, 1000];\n const columns = [{\n label: 'Time',\n field: 'actionDate',\n dateInputFormat: 'yyyyMMddHHmmss',\n // E.g. 07-09-2017 19:16:25\n dateOutputFormat: 'yyyy-MM-dd HH:mm:ss',\n type: 'date',\n hidden: getCookie('Date')\n }, {\n label: 'Episode',\n field: 'episodeTitle',\n sortable: false,\n filterOptions: {\n enabled: true,\n customFilter: true\n },\n hidden: getCookie('Status')\n }, {\n label: 'Snatched',\n field: 'snatched',\n type: 'number',\n sortable: false,\n hidden: getCookie('Quality')\n }, {\n label: 'Downloaded',\n field: 'downloaded',\n sortable: false,\n hidden: getCookie('Provider/Group')\n }, {\n label: 'Subtitled',\n field: 'subtitled',\n hidden: getCookie('Release')\n }, {\n label: 'Quality',\n field: 'quality',\n hidden: getCookie('Release')\n }];\n return {\n columns,\n selectedClientStatusValue: [],\n perPageDropdown\n };\n },\n mounted() {\n const {\n getCookie,\n getSortFromCookie\n } = this;\n\n // Get per-page pagination from cookie\n const perPage = getCookie('pagination-perpage-history');\n if (perPage) {\n this.remoteHistory.perPage = perPage;\n }\n this.remoteHistory.sort = getSortFromCookie();\n },\n created() {\n this.loadItemsDebounced = lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default()(this.loadItems, 500);\n },\n computed: {\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapState)({\n layout: state => state.config.layout,\n remoteHistory: state => state.history.remoteCompact,\n consts: state => state.config.consts\n }),\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapGetters)({\n fuzzyParseDateTime: 'fuzzyParseDateTime'\n }),\n serverParams() {\n return {\n page: this.remoteHistory.page,\n // What page I want to show\n perPage: this.remoteHistory.perPage,\n // How many items I'm showing per page\n sort: this.remoteHistory.sort,\n filter: this.remoteHistory.filter,\n compact: true\n };\n },\n qualityOptions() {\n const {\n consts\n } = this;\n return consts.qualities.values.map(quality => {\n return {\n value: quality.value,\n text: quality.name\n };\n });\n }\n },\n methods: {\n humanFileSize: _utils_core__WEBPACK_IMPORTED_MODULE_1__.humanFileSize,\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapActions)({\n getHistory: 'getHistory',\n checkHistory: 'checkHistory',\n setStoreLayout: 'setStoreLayout'\n }),\n getSortFromCookie() {\n const {\n getCookie\n } = this;\n const sort = getCookie('sort'); // From manage-cookie.js mixin\n if (sort) {\n if (sort[0].type === 'none') {\n sort[0].type = 'desc';\n }\n return sort;\n }\n return [{\n field: 'date',\n type: 'desc'\n }];\n },\n sortDate(rows) {\n const cloneRows = [...rows];\n return cloneRows.sort(x => x.actionDate).reverse();\n },\n getFileBaseName(path) {\n if (path) {\n return path.split(/[/\\\\]/).pop();\n }\n return path;\n },\n close() {\n this.$emit('close');\n // Destroy the vue listeners, etc\n this.$destroy();\n // Remove the element from the DOM\n this.$el.remove();\n },\n updatePaginationPerPage(pageLimit) {\n const {\n setStoreLayout\n } = this;\n setStoreLayout({\n key: 'historyLimit',\n value: pageLimit\n });\n },\n onPageChange(params) {\n this.remoteHistory.page = params.currentPage;\n this.loadItemsDebounced();\n },\n onPerPageChange(params) {\n this.setCookie('pagination-perpage-history', params.currentPerPage);\n this.remoteHistory.perPage = params.currentPerPage;\n this.loadItemsDebounced();\n },\n onSortChange(params) {\n this.setCookie('sort', params);\n this.remoteHistory.sort = params.filter(item => item.type !== 'none');\n this.loadItemsDebounced();\n },\n onColumnFilter(params) {\n this.remoteHistory.filter = params;\n this.loadItemsDebounced();\n },\n updateClientStatusFilter(event) {\n const combinedStatus = event.reduce((result, item) => {\n return result | item.value;\n }, 0);\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.selectedClientStatusValue = event;\n this.remoteHistory.filter.columnFilters.clientStatus = combinedStatus;\n this.loadItemsDebounced();\n },\n updateQualityFilter(quality) {\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.quality = quality.currentTarget.value;\n this.loadItemsDebounced();\n },\n updateResource(resource) {\n resource = resource.currentTarget.value;\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.resource = resource;\n this.loadItemsDebounced();\n },\n // Load items is what brings back the rows from server\n loadItems() {\n const {\n getHistory\n } = this;\n console.log(this.serverParams);\n getHistory(this.serverParams);\n },\n /**\n * Re-format date.\n * @param {number} date - Date formatted as a number.\n * @returns {string} - Formatted date as a string.\n */\n convertDateFormat(date) {\n const dateObj = (0,date_fns_parse__WEBPACK_IMPORTED_MODULE_8__[\"default\"])(date, 'yyyyMMddHHmmss', new Date()); // Example: 20210813162256\n return (0,date_fns_format__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(dateObj, 'yyyy-MM-dd HH:mm:ss');\n }\n }\n});\n\n//# sourceURL=webpack://slim/./src/components/history-compact.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-1!./node_modules/vue-loader/lib/index.js??vue-loader-options"); /***/ }), @@ -730,7 +730,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n/* harmony import */ var vue_good_table__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! vue-good-table */ \"./node_modules/vue-good-table/dist/vue-good-table.esm.js\");\n/* harmony import */ var _utils_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/core */ \"./src/utils/core.js\");\n/* harmony import */ var _mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mixins/manage-cookie */ \"./src/mixins/manage-cookie.js\");\n/* harmony import */ var _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers/app-link.vue */ \"./src/components/helpers/app-link.vue\");\n/* harmony import */ var _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers/quality-pill.vue */ \"./src/components/helpers/quality-pill.vue\");\n/* harmony import */ var _fortawesome_vue_fontawesome__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @fortawesome/vue-fontawesome */ \"./node_modules/@fortawesome/vue-fontawesome/index.es.js\");\n/* harmony import */ var v_tooltip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! v-tooltip */ \"./node_modules/v-tooltip/dist/v-tooltip.esm.js\");\n/* harmony import */ var vue_multiselect__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vue-multiselect */ \"./node_modules/vue-multiselect/dist/vue-multiselect.min.js\");\n/* harmony import */ var vue_multiselect__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(vue_multiselect__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var vue_multiselect_dist_vue_multiselect_min_css__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! vue-multiselect/dist/vue-multiselect.min.css */ \"./node_modules/vue-multiselect/dist/vue-multiselect.min.css\");\n\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n name: 'history-detailed',\n components: {\n AppLink: _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_3__[\"default\"],\n FontAwesomeIcon: _fortawesome_vue_fontawesome__WEBPACK_IMPORTED_MODULE_5__.FontAwesomeIcon,\n QualityPill: _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n VueGoodTable: vue_good_table__WEBPACK_IMPORTED_MODULE_9__.VueGoodTable,\n Multiselect: (vue_multiselect__WEBPACK_IMPORTED_MODULE_7___default())\n },\n directives: {\n tooltip: v_tooltip__WEBPACK_IMPORTED_MODULE_6__.VTooltip\n },\n mixins: [(0,_mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__.manageCookieMixin)('history-detailed')],\n data() {\n const {\n getCookie\n } = this;\n const perPageDropdown = [25, 50, 100, 250, 500, 1000];\n const statusNames = [{\n value: -1,\n text: 'Unset'\n }, {\n value: 1,\n text: 'Unaired'\n }, {\n value: 5,\n text: 'Skipped'\n }, {\n value: 3,\n text: 'Wanted'\n }, {\n value: 2,\n text: 'Snatched'\n }, {\n value: 9,\n text: 'Snatched (Proper)'\n }, {\n value: 12,\n text: 'Snatched (Best)'\n }, {\n value: 4,\n text: 'Downloaded'\n }, {\n value: 6,\n text: 'Archived'\n }, {\n value: 7,\n text: 'Ignored'\n }, {\n value: 10,\n text: 'Subtitled'\n }, {\n value: 11,\n text: 'Failed'\n }];\n const columns = [{\n label: 'Date',\n field: 'actionDate',\n dateInputFormat: 'yyyyMMddHHmmss',\n // E.g. 07-09-2017 19:16:25\n dateOutputFormat: 'yyyy-MM-dd HH:mm:ss',\n type: 'date',\n hidden: getCookie('Date')\n }, {\n label: 'Episode',\n field: 'episodeTitle',\n sortable: false,\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Episode')\n }, {\n label: 'Action',\n field: 'statusName',\n filterOptions: {\n enabled: true,\n filterDropdownItems: statusNames\n },\n hidden: getCookie('Action')\n }, {\n label: 'Quality',\n field: 'quality',\n type: 'number',\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Quality')\n }, {\n label: 'Provider',\n field: 'provider.id',\n filterOptions: {\n enabled: true\n },\n hidden: getCookie('Provider')\n }, {\n label: 'Size',\n field: 'size',\n tdClass: 'align-center-span',\n formatFn: _utils_core__WEBPACK_IMPORTED_MODULE_1__.humanFileSize,\n type: 'number',\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Size')\n }, {\n label: 'Client Status',\n field: 'clientStatus',\n type: 'number',\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Client Status')\n }];\n return {\n columns,\n selectedClientStatusValue: [],\n perPageDropdown\n };\n },\n mounted() {\n const {\n getCookie,\n getSortFromCookie\n } = this;\n this.loadItems();\n\n // Get per-page pagination from cookie\n const perPage = getCookie('pagination-perpage-history');\n if (perPage) {\n this.remoteHistory.perPage = perPage;\n }\n this.remoteHistory.sort = getSortFromCookie();\n },\n created() {\n this.loadItemsDebounced = lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default()(this.loadItems, 500);\n },\n computed: {\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapState)({\n layout: state => state.config.layout,\n remoteHistory: state => state.history.remote,\n consts: state => state.config.consts\n }),\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapGetters)({\n fuzzyParseDateTime: 'fuzzyParseDateTime'\n }),\n serverParams() {\n return {\n page: this.remoteHistory.page,\n // What page I want to show\n perPage: this.remoteHistory.perPage,\n // How many items I'm showing per page\n sort: this.remoteHistory.sort,\n filter: this.remoteHistory.filter\n };\n },\n qualityOptions() {\n const {\n consts\n } = this;\n return consts.qualities.values.map(quality => {\n return {\n value: quality.value,\n text: quality.name\n };\n });\n }\n },\n methods: {\n humanFileSize: _utils_core__WEBPACK_IMPORTED_MODULE_1__.humanFileSize,\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapActions)({\n getHistory: 'getHistory',\n setStoreLayout: 'setStoreLayout'\n }),\n getSortFromCookie() {\n const {\n getCookie\n } = this;\n const sort = getCookie('sort'); // From manage-cookie.js mixin\n if (sort) {\n return sort;\n }\n return [{\n field: 'date',\n type: 'desc'\n }];\n },\n rowStyleClassFn(row) {\n return `${row.statusName.toLowerCase()} status` || 'skipped status';\n },\n close() {\n this.$emit('close');\n // Destroy the vue listeners, etc\n this.$destroy();\n // Remove the element from the DOM\n this.$el.remove();\n },\n onPageChange(params) {\n console.log('page change called');\n console.log(params);\n this.remoteHistory.page = params.currentPage;\n this.loadItemsDebounced();\n },\n onPerPageChange(params) {\n console.log('per page change called');\n this.setCookie('pagination-perpage-history', params.currentPerPage);\n this.remoteHistory.perPage = params.currentPerPage;\n this.loadItemsDebounced();\n },\n onSortChange(params) {\n this.setCookie('sort', params);\n this.remoteHistory.sort = params.filter(item => item.type !== 'none');\n this.loadItemsDebounced();\n },\n onColumnFilter(params) {\n this.setCookie('filter', params);\n this.remoteHistory.filter = params;\n this.loadItemsDebounced();\n },\n updateClientStatusFilter(event) {\n const combinedStatus = event.reduce((result, item) => {\n return result | item.value;\n }, 0);\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.selectedClientStatusValue = event;\n this.remoteHistory.filter.columnFilters.clientStatus = combinedStatus;\n this.loadItemsDebounced();\n },\n updateQualityFilter(quality) {\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.quality = quality.currentTarget.value;\n this.loadItemsDebounced();\n },\n /**\n * Update the size filter.\n * As a specific size filter is useless. I've choosen to use a > or < operator.\n * The backend will parse these into queries.\n * @param {string} size - Operator with size in MB.\n */\n updateSizeFilter(size) {\n // Check for valid syntax, and pass along.\n size = size.currentTarget.value;\n if (!size) {\n this.remoteHistory.filter.columnFilters.size = size;\n this.loadItemsDebounced();\n return;\n }\n const validSizeRegex = /[<>] \\d{2,6}/;\n if (size.match(validSizeRegex)) {\n this.invalidSizeMessage = '';\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.size = size;\n this.loadItemsDebounced();\n }\n },\n updateResource(resource) {\n resource = resource.currentTarget.value;\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.resource = resource;\n this.loadItemsDebounced();\n },\n // Load items is what brings back the rows from server\n loadItems() {\n const {\n getHistory\n } = this;\n console.log(this.serverParams);\n getHistory(this.serverParams);\n }\n }\n});\n\n//# sourceURL=webpack://slim/./src/components/history-detailed.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-1!./node_modules/vue-loader/lib/index.js??vue-loader-options"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n/* harmony import */ var vue_good_table__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! vue-good-table */ \"./node_modules/vue-good-table/dist/vue-good-table.esm.js\");\n/* harmony import */ var _utils_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/core */ \"./src/utils/core.js\");\n/* harmony import */ var _mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mixins/manage-cookie */ \"./src/mixins/manage-cookie.js\");\n/* harmony import */ var _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers/app-link.vue */ \"./src/components/helpers/app-link.vue\");\n/* harmony import */ var _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers/quality-pill.vue */ \"./src/components/helpers/quality-pill.vue\");\n/* harmony import */ var _fortawesome_vue_fontawesome__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @fortawesome/vue-fontawesome */ \"./node_modules/@fortawesome/vue-fontawesome/index.es.js\");\n/* harmony import */ var v_tooltip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! v-tooltip */ \"./node_modules/v-tooltip/dist/v-tooltip.esm.js\");\n/* harmony import */ var vue_multiselect__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vue-multiselect */ \"./node_modules/vue-multiselect/dist/vue-multiselect.min.js\");\n/* harmony import */ var vue_multiselect__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(vue_multiselect__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var vue_multiselect_dist_vue_multiselect_min_css__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! vue-multiselect/dist/vue-multiselect.min.css */ \"./node_modules/vue-multiselect/dist/vue-multiselect.min.css\");\n\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n name: 'history-detailed',\n components: {\n AppLink: _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_3__[\"default\"],\n FontAwesomeIcon: _fortawesome_vue_fontawesome__WEBPACK_IMPORTED_MODULE_5__.FontAwesomeIcon,\n QualityPill: _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n VueGoodTable: vue_good_table__WEBPACK_IMPORTED_MODULE_9__.VueGoodTable,\n Multiselect: (vue_multiselect__WEBPACK_IMPORTED_MODULE_7___default())\n },\n directives: {\n tooltip: v_tooltip__WEBPACK_IMPORTED_MODULE_6__.VTooltip\n },\n mixins: [(0,_mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__.manageCookieMixin)('history-detailed')],\n data() {\n const {\n getCookie\n } = this;\n const perPageDropdown = [25, 50, 100, 250, 500, 1000];\n const statusNames = [{\n value: -1,\n text: 'Unset'\n }, {\n value: 1,\n text: 'Unaired'\n }, {\n value: 5,\n text: 'Skipped'\n }, {\n value: 3,\n text: 'Wanted'\n }, {\n value: 2,\n text: 'Snatched'\n }, {\n value: 9,\n text: 'Snatched (Proper)'\n }, {\n value: 12,\n text: 'Snatched (Best)'\n }, {\n value: 4,\n text: 'Downloaded'\n }, {\n value: 6,\n text: 'Archived'\n }, {\n value: 7,\n text: 'Ignored'\n }, {\n value: 10,\n text: 'Subtitled'\n }, {\n value: 11,\n text: 'Failed'\n }];\n const columns = [{\n label: 'Date',\n field: 'actionDate',\n dateInputFormat: 'yyyyMMddHHmmss',\n // E.g. 07-09-2017 19:16:25\n dateOutputFormat: 'yyyy-MM-dd HH:mm:ss',\n type: 'date',\n hidden: getCookie('Date')\n }, {\n label: 'Episode',\n field: 'episodeTitle',\n sortable: false,\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Episode')\n }, {\n label: 'Action',\n field: 'statusName',\n filterOptions: {\n enabled: true,\n filterDropdownItems: statusNames\n },\n hidden: getCookie('Action')\n }, {\n label: 'Quality',\n field: 'quality',\n type: 'number',\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Quality')\n }, {\n label: 'Provider',\n field: 'provider.id',\n filterOptions: {\n enabled: true\n },\n hidden: getCookie('Provider')\n }, {\n label: 'Size',\n field: 'size',\n tdClass: 'align-center-span',\n formatFn: _utils_core__WEBPACK_IMPORTED_MODULE_1__.humanFileSize,\n type: 'number',\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Size')\n }, {\n label: 'Client Status',\n field: 'clientStatus',\n type: 'number',\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Client Status')\n }];\n return {\n columns,\n selectedClientStatusValue: [],\n perPageDropdown\n };\n },\n mounted() {\n const {\n getCookie,\n getSortFromCookie\n } = this;\n this.loadItems();\n\n // Get per-page pagination from cookie\n const perPage = getCookie('pagination-perpage-history');\n if (perPage) {\n this.remoteHistory.perPage = perPage;\n }\n this.remoteHistory.sort = getSortFromCookie();\n },\n created() {\n this.loadItemsDebounced = lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default()(this.loadItems, 500);\n },\n computed: {\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapState)({\n layout: state => state.config.layout,\n remoteHistory: state => state.history.remote,\n consts: state => state.config.consts\n }),\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapGetters)({\n fuzzyParseDateTime: 'fuzzyParseDateTime'\n }),\n serverParams() {\n return {\n page: this.remoteHistory.page,\n // What page I want to show\n perPage: this.remoteHistory.perPage,\n // How many items I'm showing per page\n sort: this.remoteHistory.sort,\n filter: this.remoteHistory.filter\n };\n },\n qualityOptions() {\n const {\n consts\n } = this;\n return consts.qualities.values.map(quality => {\n return {\n value: quality.value,\n text: quality.name\n };\n });\n }\n },\n methods: {\n humanFileSize: _utils_core__WEBPACK_IMPORTED_MODULE_1__.humanFileSize,\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapActions)({\n getHistory: 'getHistory',\n setStoreLayout: 'setStoreLayout'\n }),\n getSortFromCookie() {\n const {\n getCookie\n } = this;\n const sort = getCookie('sort'); // From manage-cookie.js mixin\n if (sort) {\n if (sort[0].type === 'none') {\n sort[0].type = 'desc';\n }\n return sort;\n }\n return [{\n field: 'date',\n type: 'desc'\n }];\n },\n rowStyleClassFn(row) {\n return `${row.statusName.toLowerCase()} status` || 'skipped status';\n },\n close() {\n this.$emit('close');\n // Destroy the vue listeners, etc\n this.$destroy();\n // Remove the element from the DOM\n this.$el.remove();\n },\n onPageChange(params) {\n console.log('page change called');\n console.log(params);\n this.remoteHistory.page = params.currentPage;\n this.loadItemsDebounced();\n },\n onPerPageChange(params) {\n console.log('per page change called');\n this.setCookie('pagination-perpage-history', params.currentPerPage);\n this.remoteHistory.perPage = params.currentPerPage;\n this.loadItemsDebounced();\n },\n onSortChange(params) {\n this.setCookie('sort', params);\n this.remoteHistory.sort = params.filter(item => item.type !== 'none');\n this.loadItemsDebounced();\n },\n onColumnFilter(params) {\n this.setCookie('filter', params);\n this.remoteHistory.filter = params;\n this.loadItemsDebounced();\n },\n updateClientStatusFilter(event) {\n const combinedStatus = event.reduce((result, item) => {\n return result | item.value;\n }, 0);\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.selectedClientStatusValue = event;\n this.remoteHistory.filter.columnFilters.clientStatus = combinedStatus;\n this.loadItemsDebounced();\n },\n updateQualityFilter(quality) {\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.quality = quality.currentTarget.value;\n this.loadItemsDebounced();\n },\n /**\n * Update the size filter.\n * As a specific size filter is useless. I've choosen to use a > or < operator.\n * The backend will parse these into queries.\n * @param {string} size - Operator with size in MB.\n */\n updateSizeFilter(size) {\n // Check for valid syntax, and pass along.\n size = size.currentTarget.value;\n if (!size) {\n this.remoteHistory.filter.columnFilters.size = size;\n this.loadItemsDebounced();\n return;\n }\n const validSizeRegex = /[<>] \\d{2,6}/;\n if (size.match(validSizeRegex)) {\n this.invalidSizeMessage = '';\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.size = size;\n this.loadItemsDebounced();\n }\n },\n updateResource(resource) {\n resource = resource.currentTarget.value;\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.resource = resource;\n this.loadItemsDebounced();\n },\n // Load items is what brings back the rows from server\n loadItems() {\n const {\n getHistory\n } = this;\n console.log(this.serverParams);\n getHistory(this.serverParams);\n }\n }\n});\n\n//# sourceURL=webpack://slim/./src/components/history-detailed.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-1!./node_modules/vue-loader/lib/index.js??vue-loader-options"); /***/ }), @@ -2545,7 +2545,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ manageCookieMixin: () => (/* binding */ manageCookieMixin)\n/* harmony export */ });\n/**\n * Vue Cookie handler for the vue-good-tables enable/disable columns feature.\n * @param {String} cookiePrefix String used to specify the specific table.\n * @example - Prefix `Home` with the column Label `title` will result in the cookie key `Home-title`\n * @returns {void}\n */\nconst manageCookieMixin = cookiePrefix => {\n return {\n methods: {\n getCookie(key) {\n if (key.includes(cookiePrefix)) {\n return key;\n }\n const cookie = this.$cookies.get(`${cookiePrefix}-${key}`);\n try {\n return JSON.parse(cookie);\n } catch {\n return cookie === 'none' ? null : cookie;\n }\n },\n setCookie(key, value) {\n return this.$cookies.set(`${cookiePrefix}-${key}`, JSON.stringify(value));\n },\n /**\n * Save vue-good-table sort field and sort order (desc/asc)\n * @param {*} evt - Vue good table sorting event (triggered by the `on-sort-change` event)\n */\n saveSorting(evt) {\n const {\n setCookie\n } = this;\n // Store cookies, for sort field and type (asc/desc)\n setCookie('sort-field', evt.map(item => item.field));\n setCookie('sort-type', evt.map(item => item.type));\n },\n /**\n * Get vue-good-table sort field and sort order.\n * @param {string} defaultField - default vue good table field to sort by.\n * @param {string} defaultType - default vue good table sort order (ascending / descending).\n * @returns {object} - Object with the field and type properties.\n */\n getSortBy() {\n let defaultField = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'title';\n let defaultType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'asc';\n const {\n getCookie\n } = this;\n // Try to get cookies, for sort field and type (asc/desc)\n const sortField = getCookie('sort-field');\n const sortType = getCookie('sort-type');\n const sort = [];\n if (Array.isArray(sortField) && sortField.length === 2) {\n sortField.forEach((_, index) => {\n sort.push({\n field: sortField[index] || defaultField,\n type: sortType[index] || defaultType\n });\n });\n return sort;\n }\n if (sortField === null || sortType === null) {\n return {\n field: defaultField,\n type: defaultType\n };\n }\n return {\n field: sortField[0] || defaultField,\n type: sortType[0] || defaultType\n };\n }\n },\n created() {\n // Watch the columns property on the VM. This is the default named property for the vue-good-tables columns.\n this.$watch(() => this.columns, columns => {\n // Monitor the columns, to update the cookies, when changed.\n const {\n setCookie\n } = this;\n for (const column of columns) {\n if (column) {\n setCookie(column.label, column.hidden);\n }\n }\n }, {\n deep: true\n });\n }\n };\n};\n\n//# sourceURL=webpack://slim/./src/mixins/manage-cookie.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ manageCookieMixin: () => (/* binding */ manageCookieMixin)\n/* harmony export */ });\n/**\n * Vue Cookie handler for the vue-good-tables enable/disable columns feature.\n * @param {String} cookiePrefix String used to specify the specific table.\n * @example - Prefix `Home` with the column Label `title` will result in the cookie key `Home-title`\n * @returns {void}\n */\nconst manageCookieMixin = cookiePrefix => {\n return {\n methods: {\n getCookie(key) {\n if (key.includes(cookiePrefix)) {\n return key;\n }\n const cookie = this.$cookies.get(`${cookiePrefix}-${key}`);\n try {\n return JSON.parse(cookie);\n } catch {\n return cookie;\n }\n },\n setCookie(key, value) {\n return this.$cookies.set(`${cookiePrefix}-${key}`, JSON.stringify(value));\n },\n /**\n * Save vue-good-table sort field and sort order (desc/asc)\n * @param {*} evt - Vue good table sorting event (triggered by the `on-sort-change` event)\n */\n saveSorting(evt) {\n const {\n setCookie\n } = this;\n // Store cookies, for sort field and type (asc/desc)\n setCookie('sort-field', evt.map(item => item.field));\n setCookie('sort-type', evt.map(item => item.type));\n },\n /**\n * Get vue-good-table sort field and sort order.\n * @param {string} defaultField - default vue good table field to sort by.\n * @param {string} defaultType - default vue good table sort order (ascending / descending).\n * @returns {object} - Object with the field and type properties.\n */\n getSortBy() {\n let defaultField = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'title';\n let defaultType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'asc';\n const {\n getCookie\n } = this;\n // Try to get cookies, for sort field and type (asc/desc)\n const sortField = getCookie('sort-field');\n const sortType = getCookie('sort-type');\n const sort = [];\n if (Array.isArray(sortField) && sortField.length === 2) {\n sortField.forEach((_, index) => {\n sort.push({\n field: sortField[index] || defaultField,\n type: sortType[index] || defaultType\n });\n });\n return sort;\n }\n if (sortField === null || sortType === null) {\n return {\n field: defaultField,\n type: defaultType\n };\n }\n return {\n field: sortField[0] || defaultField,\n type: sortType[0] || defaultType\n };\n }\n },\n created() {\n // Watch the columns property on the VM. This is the default named property for the vue-good-tables columns.\n this.$watch(() => this.columns, columns => {\n // Monitor the columns, to update the cookies, when changed.\n const {\n setCookie\n } = this;\n for (const column of columns) {\n if (column) {\n setCookie(column.label, column.hidden);\n }\n }\n }, {\n deep: true\n });\n }\n };\n};\n\n//# sourceURL=webpack://slim/./src/mixins/manage-cookie.js?"); /***/ }), diff --git a/themes/light/assets/js/medusa-runtime.js b/themes/light/assets/js/medusa-runtime.js index 4d1e937b0e..ba039cc700 100644 --- a/themes/light/assets/js/medusa-runtime.js +++ b/themes/light/assets/js/medusa-runtime.js @@ -719,7 +719,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n/* harmony import */ var vue_good_table__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! vue-good-table */ \"./node_modules/vue-good-table/dist/vue-good-table.esm.js\");\n/* harmony import */ var _utils_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/core */ \"./src/utils/core.js\");\n/* harmony import */ var _mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mixins/manage-cookie */ \"./src/mixins/manage-cookie.js\");\n/* harmony import */ var _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers/quality-pill.vue */ \"./src/components/helpers/quality-pill.vue\");\n/* harmony import */ var _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers/app-link.vue */ \"./src/components/helpers/app-link.vue\");\n/* harmony import */ var v_tooltip__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! v-tooltip */ \"./node_modules/v-tooltip/dist/v-tooltip.esm.js\");\n/* harmony import */ var date_fns_parse__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! date-fns/parse */ \"./node_modules/date-fns/esm/parse/index.js\");\n/* harmony import */ var date_fns_format__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! date-fns/format */ \"./node_modules/date-fns/esm/format/index.js\");\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n name: 'history-compact',\n components: {\n AppLink: _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n QualityPill: _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_3__[\"default\"],\n VueGoodTable: vue_good_table__WEBPACK_IMPORTED_MODULE_6__.VueGoodTable\n },\n directives: {\n tooltip: v_tooltip__WEBPACK_IMPORTED_MODULE_5__.VTooltip\n },\n mixins: [(0,_mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__.manageCookieMixin)('historyCompact')],\n data() {\n const {\n getCookie\n } = this;\n const perPageDropdown = [25, 50, 100, 250, 500, 1000];\n const columns = [{\n label: 'Time',\n field: 'actionDate',\n dateInputFormat: 'yyyyMMddHHmmss',\n // E.g. 07-09-2017 19:16:25\n dateOutputFormat: 'yyyy-MM-dd HH:mm:ss',\n type: 'date',\n hidden: getCookie('Date')\n }, {\n label: 'Episode',\n field: 'episodeTitle',\n sortable: false,\n filterOptions: {\n enabled: true,\n customFilter: true\n },\n hidden: getCookie('Status')\n }, {\n label: 'Snatched',\n field: 'snatched',\n type: 'number',\n sortable: false,\n hidden: getCookie('Quality')\n }, {\n label: 'Downloaded',\n field: 'downloaded',\n sortable: false,\n hidden: getCookie('Provider/Group')\n }, {\n label: 'Subtitled',\n field: 'subtitled',\n hidden: getCookie('Release')\n }, {\n label: 'Quality',\n field: 'quality',\n hidden: getCookie('Release')\n }];\n return {\n columns,\n selectedClientStatusValue: [],\n perPageDropdown\n };\n },\n mounted() {\n const {\n getCookie,\n getSortFromCookie\n } = this;\n\n // Get per-page pagination from cookie\n const perPage = getCookie('pagination-perpage-history');\n if (perPage) {\n this.remoteHistory.perPage = perPage;\n }\n this.remoteHistory.sort = getSortFromCookie();\n },\n created() {\n this.loadItemsDebounced = lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default()(this.loadItems, 500);\n },\n computed: {\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapState)({\n layout: state => state.config.layout,\n remoteHistory: state => state.history.remoteCompact,\n consts: state => state.config.consts\n }),\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapGetters)({\n fuzzyParseDateTime: 'fuzzyParseDateTime'\n }),\n serverParams() {\n return {\n page: this.remoteHistory.page,\n // What page I want to show\n perPage: this.remoteHistory.perPage,\n // How many items I'm showing per page\n sort: this.remoteHistory.sort,\n filter: this.remoteHistory.filter,\n compact: true\n };\n },\n qualityOptions() {\n const {\n consts\n } = this;\n return consts.qualities.values.map(quality => {\n return {\n value: quality.value,\n text: quality.name\n };\n });\n }\n },\n methods: {\n humanFileSize: _utils_core__WEBPACK_IMPORTED_MODULE_1__.humanFileSize,\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapActions)({\n getHistory: 'getHistory',\n checkHistory: 'checkHistory',\n setStoreLayout: 'setStoreLayout'\n }),\n getSortFromCookie() {\n const {\n getCookie\n } = this;\n const sort = getCookie('sort'); // From manage-cookie.js mixin\n if (sort) {\n return sort;\n }\n return [{\n field: 'date',\n type: 'desc'\n }];\n },\n sortDate(rows) {\n const cloneRows = [...rows];\n return cloneRows.sort(x => x.actionDate).reverse();\n },\n getFileBaseName(path) {\n if (path) {\n return path.split(/[/\\\\]/).pop();\n }\n return path;\n },\n close() {\n this.$emit('close');\n // Destroy the vue listeners, etc\n this.$destroy();\n // Remove the element from the DOM\n this.$el.remove();\n },\n updatePaginationPerPage(pageLimit) {\n const {\n setStoreLayout\n } = this;\n setStoreLayout({\n key: 'historyLimit',\n value: pageLimit\n });\n },\n onPageChange(params) {\n this.remoteHistory.page = params.currentPage;\n this.loadItemsDebounced();\n },\n onPerPageChange(params) {\n this.setCookie('pagination-perpage-history', params.currentPerPage);\n this.remoteHistory.perPage = params.currentPerPage;\n this.loadItemsDebounced();\n },\n onSortChange(params) {\n this.setCookie('sort', params);\n this.remoteHistory.sort = params.filter(item => item.type !== 'none');\n this.loadItemsDebounced();\n },\n onColumnFilter(params) {\n this.remoteHistory.filter = params;\n this.loadItemsDebounced();\n },\n updateClientStatusFilter(event) {\n const combinedStatus = event.reduce((result, item) => {\n return result | item.value;\n }, 0);\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.selectedClientStatusValue = event;\n this.remoteHistory.filter.columnFilters.clientStatus = combinedStatus;\n this.loadItemsDebounced();\n },\n updateQualityFilter(quality) {\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.quality = quality.currentTarget.value;\n this.loadItemsDebounced();\n },\n updateResource(resource) {\n resource = resource.currentTarget.value;\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.resource = resource;\n this.loadItemsDebounced();\n },\n // Load items is what brings back the rows from server\n loadItems() {\n const {\n getHistory\n } = this;\n console.log(this.serverParams);\n getHistory(this.serverParams);\n },\n /**\n * Re-format date.\n * @param {number} date - Date formatted as a number.\n * @returns {string} - Formatted date as a string.\n */\n convertDateFormat(date) {\n const dateObj = (0,date_fns_parse__WEBPACK_IMPORTED_MODULE_8__[\"default\"])(date, 'yyyyMMddHHmmss', new Date()); // Example: 20210813162256\n return (0,date_fns_format__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(dateObj, 'yyyy-MM-dd HH:mm:ss');\n }\n }\n});\n\n//# sourceURL=webpack://slim/./src/components/history-compact.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-1!./node_modules/vue-loader/lib/index.js??vue-loader-options"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n/* harmony import */ var vue_good_table__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! vue-good-table */ \"./node_modules/vue-good-table/dist/vue-good-table.esm.js\");\n/* harmony import */ var _utils_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/core */ \"./src/utils/core.js\");\n/* harmony import */ var _mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mixins/manage-cookie */ \"./src/mixins/manage-cookie.js\");\n/* harmony import */ var _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers/quality-pill.vue */ \"./src/components/helpers/quality-pill.vue\");\n/* harmony import */ var _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers/app-link.vue */ \"./src/components/helpers/app-link.vue\");\n/* harmony import */ var v_tooltip__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! v-tooltip */ \"./node_modules/v-tooltip/dist/v-tooltip.esm.js\");\n/* harmony import */ var date_fns_parse__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! date-fns/parse */ \"./node_modules/date-fns/esm/parse/index.js\");\n/* harmony import */ var date_fns_format__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! date-fns/format */ \"./node_modules/date-fns/esm/format/index.js\");\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n name: 'history-compact',\n components: {\n AppLink: _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n QualityPill: _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_3__[\"default\"],\n VueGoodTable: vue_good_table__WEBPACK_IMPORTED_MODULE_6__.VueGoodTable\n },\n directives: {\n tooltip: v_tooltip__WEBPACK_IMPORTED_MODULE_5__.VTooltip\n },\n mixins: [(0,_mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__.manageCookieMixin)('historyCompact')],\n data() {\n const {\n getCookie\n } = this;\n const perPageDropdown = [25, 50, 100, 250, 500, 1000];\n const columns = [{\n label: 'Time',\n field: 'actionDate',\n dateInputFormat: 'yyyyMMddHHmmss',\n // E.g. 07-09-2017 19:16:25\n dateOutputFormat: 'yyyy-MM-dd HH:mm:ss',\n type: 'date',\n hidden: getCookie('Date')\n }, {\n label: 'Episode',\n field: 'episodeTitle',\n sortable: false,\n filterOptions: {\n enabled: true,\n customFilter: true\n },\n hidden: getCookie('Status')\n }, {\n label: 'Snatched',\n field: 'snatched',\n type: 'number',\n sortable: false,\n hidden: getCookie('Quality')\n }, {\n label: 'Downloaded',\n field: 'downloaded',\n sortable: false,\n hidden: getCookie('Provider/Group')\n }, {\n label: 'Subtitled',\n field: 'subtitled',\n hidden: getCookie('Release')\n }, {\n label: 'Quality',\n field: 'quality',\n hidden: getCookie('Release')\n }];\n return {\n columns,\n selectedClientStatusValue: [],\n perPageDropdown\n };\n },\n mounted() {\n const {\n getCookie,\n getSortFromCookie\n } = this;\n\n // Get per-page pagination from cookie\n const perPage = getCookie('pagination-perpage-history');\n if (perPage) {\n this.remoteHistory.perPage = perPage;\n }\n this.remoteHistory.sort = getSortFromCookie();\n },\n created() {\n this.loadItemsDebounced = lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default()(this.loadItems, 500);\n },\n computed: {\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapState)({\n layout: state => state.config.layout,\n remoteHistory: state => state.history.remoteCompact,\n consts: state => state.config.consts\n }),\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapGetters)({\n fuzzyParseDateTime: 'fuzzyParseDateTime'\n }),\n serverParams() {\n return {\n page: this.remoteHistory.page,\n // What page I want to show\n perPage: this.remoteHistory.perPage,\n // How many items I'm showing per page\n sort: this.remoteHistory.sort,\n filter: this.remoteHistory.filter,\n compact: true\n };\n },\n qualityOptions() {\n const {\n consts\n } = this;\n return consts.qualities.values.map(quality => {\n return {\n value: quality.value,\n text: quality.name\n };\n });\n }\n },\n methods: {\n humanFileSize: _utils_core__WEBPACK_IMPORTED_MODULE_1__.humanFileSize,\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapActions)({\n getHistory: 'getHistory',\n checkHistory: 'checkHistory',\n setStoreLayout: 'setStoreLayout'\n }),\n getSortFromCookie() {\n const {\n getCookie\n } = this;\n const sort = getCookie('sort'); // From manage-cookie.js mixin\n if (sort) {\n if (sort[0].type === 'none') {\n sort[0].type = 'desc';\n }\n return sort;\n }\n return [{\n field: 'date',\n type: 'desc'\n }];\n },\n sortDate(rows) {\n const cloneRows = [...rows];\n return cloneRows.sort(x => x.actionDate).reverse();\n },\n getFileBaseName(path) {\n if (path) {\n return path.split(/[/\\\\]/).pop();\n }\n return path;\n },\n close() {\n this.$emit('close');\n // Destroy the vue listeners, etc\n this.$destroy();\n // Remove the element from the DOM\n this.$el.remove();\n },\n updatePaginationPerPage(pageLimit) {\n const {\n setStoreLayout\n } = this;\n setStoreLayout({\n key: 'historyLimit',\n value: pageLimit\n });\n },\n onPageChange(params) {\n this.remoteHistory.page = params.currentPage;\n this.loadItemsDebounced();\n },\n onPerPageChange(params) {\n this.setCookie('pagination-perpage-history', params.currentPerPage);\n this.remoteHistory.perPage = params.currentPerPage;\n this.loadItemsDebounced();\n },\n onSortChange(params) {\n this.setCookie('sort', params);\n this.remoteHistory.sort = params.filter(item => item.type !== 'none');\n this.loadItemsDebounced();\n },\n onColumnFilter(params) {\n this.remoteHistory.filter = params;\n this.loadItemsDebounced();\n },\n updateClientStatusFilter(event) {\n const combinedStatus = event.reduce((result, item) => {\n return result | item.value;\n }, 0);\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.selectedClientStatusValue = event;\n this.remoteHistory.filter.columnFilters.clientStatus = combinedStatus;\n this.loadItemsDebounced();\n },\n updateQualityFilter(quality) {\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.quality = quality.currentTarget.value;\n this.loadItemsDebounced();\n },\n updateResource(resource) {\n resource = resource.currentTarget.value;\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.resource = resource;\n this.loadItemsDebounced();\n },\n // Load items is what brings back the rows from server\n loadItems() {\n const {\n getHistory\n } = this;\n console.log(this.serverParams);\n getHistory(this.serverParams);\n },\n /**\n * Re-format date.\n * @param {number} date - Date formatted as a number.\n * @returns {string} - Formatted date as a string.\n */\n convertDateFormat(date) {\n const dateObj = (0,date_fns_parse__WEBPACK_IMPORTED_MODULE_8__[\"default\"])(date, 'yyyyMMddHHmmss', new Date()); // Example: 20210813162256\n return (0,date_fns_format__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(dateObj, 'yyyy-MM-dd HH:mm:ss');\n }\n }\n});\n\n//# sourceURL=webpack://slim/./src/components/history-compact.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-1!./node_modules/vue-loader/lib/index.js??vue-loader-options"); /***/ }), @@ -730,7 +730,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n/* harmony import */ var vue_good_table__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! vue-good-table */ \"./node_modules/vue-good-table/dist/vue-good-table.esm.js\");\n/* harmony import */ var _utils_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/core */ \"./src/utils/core.js\");\n/* harmony import */ var _mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mixins/manage-cookie */ \"./src/mixins/manage-cookie.js\");\n/* harmony import */ var _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers/app-link.vue */ \"./src/components/helpers/app-link.vue\");\n/* harmony import */ var _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers/quality-pill.vue */ \"./src/components/helpers/quality-pill.vue\");\n/* harmony import */ var _fortawesome_vue_fontawesome__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @fortawesome/vue-fontawesome */ \"./node_modules/@fortawesome/vue-fontawesome/index.es.js\");\n/* harmony import */ var v_tooltip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! v-tooltip */ \"./node_modules/v-tooltip/dist/v-tooltip.esm.js\");\n/* harmony import */ var vue_multiselect__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vue-multiselect */ \"./node_modules/vue-multiselect/dist/vue-multiselect.min.js\");\n/* harmony import */ var vue_multiselect__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(vue_multiselect__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var vue_multiselect_dist_vue_multiselect_min_css__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! vue-multiselect/dist/vue-multiselect.min.css */ \"./node_modules/vue-multiselect/dist/vue-multiselect.min.css\");\n\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n name: 'history-detailed',\n components: {\n AppLink: _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_3__[\"default\"],\n FontAwesomeIcon: _fortawesome_vue_fontawesome__WEBPACK_IMPORTED_MODULE_5__.FontAwesomeIcon,\n QualityPill: _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n VueGoodTable: vue_good_table__WEBPACK_IMPORTED_MODULE_9__.VueGoodTable,\n Multiselect: (vue_multiselect__WEBPACK_IMPORTED_MODULE_7___default())\n },\n directives: {\n tooltip: v_tooltip__WEBPACK_IMPORTED_MODULE_6__.VTooltip\n },\n mixins: [(0,_mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__.manageCookieMixin)('history-detailed')],\n data() {\n const {\n getCookie\n } = this;\n const perPageDropdown = [25, 50, 100, 250, 500, 1000];\n const statusNames = [{\n value: -1,\n text: 'Unset'\n }, {\n value: 1,\n text: 'Unaired'\n }, {\n value: 5,\n text: 'Skipped'\n }, {\n value: 3,\n text: 'Wanted'\n }, {\n value: 2,\n text: 'Snatched'\n }, {\n value: 9,\n text: 'Snatched (Proper)'\n }, {\n value: 12,\n text: 'Snatched (Best)'\n }, {\n value: 4,\n text: 'Downloaded'\n }, {\n value: 6,\n text: 'Archived'\n }, {\n value: 7,\n text: 'Ignored'\n }, {\n value: 10,\n text: 'Subtitled'\n }, {\n value: 11,\n text: 'Failed'\n }];\n const columns = [{\n label: 'Date',\n field: 'actionDate',\n dateInputFormat: 'yyyyMMddHHmmss',\n // E.g. 07-09-2017 19:16:25\n dateOutputFormat: 'yyyy-MM-dd HH:mm:ss',\n type: 'date',\n hidden: getCookie('Date')\n }, {\n label: 'Episode',\n field: 'episodeTitle',\n sortable: false,\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Episode')\n }, {\n label: 'Action',\n field: 'statusName',\n filterOptions: {\n enabled: true,\n filterDropdownItems: statusNames\n },\n hidden: getCookie('Action')\n }, {\n label: 'Quality',\n field: 'quality',\n type: 'number',\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Quality')\n }, {\n label: 'Provider',\n field: 'provider.id',\n filterOptions: {\n enabled: true\n },\n hidden: getCookie('Provider')\n }, {\n label: 'Size',\n field: 'size',\n tdClass: 'align-center-span',\n formatFn: _utils_core__WEBPACK_IMPORTED_MODULE_1__.humanFileSize,\n type: 'number',\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Size')\n }, {\n label: 'Client Status',\n field: 'clientStatus',\n type: 'number',\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Client Status')\n }];\n return {\n columns,\n selectedClientStatusValue: [],\n perPageDropdown\n };\n },\n mounted() {\n const {\n getCookie,\n getSortFromCookie\n } = this;\n this.loadItems();\n\n // Get per-page pagination from cookie\n const perPage = getCookie('pagination-perpage-history');\n if (perPage) {\n this.remoteHistory.perPage = perPage;\n }\n this.remoteHistory.sort = getSortFromCookie();\n },\n created() {\n this.loadItemsDebounced = lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default()(this.loadItems, 500);\n },\n computed: {\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapState)({\n layout: state => state.config.layout,\n remoteHistory: state => state.history.remote,\n consts: state => state.config.consts\n }),\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapGetters)({\n fuzzyParseDateTime: 'fuzzyParseDateTime'\n }),\n serverParams() {\n return {\n page: this.remoteHistory.page,\n // What page I want to show\n perPage: this.remoteHistory.perPage,\n // How many items I'm showing per page\n sort: this.remoteHistory.sort,\n filter: this.remoteHistory.filter\n };\n },\n qualityOptions() {\n const {\n consts\n } = this;\n return consts.qualities.values.map(quality => {\n return {\n value: quality.value,\n text: quality.name\n };\n });\n }\n },\n methods: {\n humanFileSize: _utils_core__WEBPACK_IMPORTED_MODULE_1__.humanFileSize,\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapActions)({\n getHistory: 'getHistory',\n setStoreLayout: 'setStoreLayout'\n }),\n getSortFromCookie() {\n const {\n getCookie\n } = this;\n const sort = getCookie('sort'); // From manage-cookie.js mixin\n if (sort) {\n return sort;\n }\n return [{\n field: 'date',\n type: 'desc'\n }];\n },\n rowStyleClassFn(row) {\n return `${row.statusName.toLowerCase()} status` || 'skipped status';\n },\n close() {\n this.$emit('close');\n // Destroy the vue listeners, etc\n this.$destroy();\n // Remove the element from the DOM\n this.$el.remove();\n },\n onPageChange(params) {\n console.log('page change called');\n console.log(params);\n this.remoteHistory.page = params.currentPage;\n this.loadItemsDebounced();\n },\n onPerPageChange(params) {\n console.log('per page change called');\n this.setCookie('pagination-perpage-history', params.currentPerPage);\n this.remoteHistory.perPage = params.currentPerPage;\n this.loadItemsDebounced();\n },\n onSortChange(params) {\n this.setCookie('sort', params);\n this.remoteHistory.sort = params.filter(item => item.type !== 'none');\n this.loadItemsDebounced();\n },\n onColumnFilter(params) {\n this.setCookie('filter', params);\n this.remoteHistory.filter = params;\n this.loadItemsDebounced();\n },\n updateClientStatusFilter(event) {\n const combinedStatus = event.reduce((result, item) => {\n return result | item.value;\n }, 0);\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.selectedClientStatusValue = event;\n this.remoteHistory.filter.columnFilters.clientStatus = combinedStatus;\n this.loadItemsDebounced();\n },\n updateQualityFilter(quality) {\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.quality = quality.currentTarget.value;\n this.loadItemsDebounced();\n },\n /**\n * Update the size filter.\n * As a specific size filter is useless. I've choosen to use a > or < operator.\n * The backend will parse these into queries.\n * @param {string} size - Operator with size in MB.\n */\n updateSizeFilter(size) {\n // Check for valid syntax, and pass along.\n size = size.currentTarget.value;\n if (!size) {\n this.remoteHistory.filter.columnFilters.size = size;\n this.loadItemsDebounced();\n return;\n }\n const validSizeRegex = /[<>] \\d{2,6}/;\n if (size.match(validSizeRegex)) {\n this.invalidSizeMessage = '';\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.size = size;\n this.loadItemsDebounced();\n }\n },\n updateResource(resource) {\n resource = resource.currentTarget.value;\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.resource = resource;\n this.loadItemsDebounced();\n },\n // Load items is what brings back the rows from server\n loadItems() {\n const {\n getHistory\n } = this;\n console.log(this.serverParams);\n getHistory(this.serverParams);\n }\n }\n});\n\n//# sourceURL=webpack://slim/./src/components/history-detailed.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-1!./node_modules/vue-loader/lib/index.js??vue-loader-options"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n/* harmony import */ var vue_good_table__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! vue-good-table */ \"./node_modules/vue-good-table/dist/vue-good-table.esm.js\");\n/* harmony import */ var _utils_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/core */ \"./src/utils/core.js\");\n/* harmony import */ var _mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mixins/manage-cookie */ \"./src/mixins/manage-cookie.js\");\n/* harmony import */ var _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers/app-link.vue */ \"./src/components/helpers/app-link.vue\");\n/* harmony import */ var _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers/quality-pill.vue */ \"./src/components/helpers/quality-pill.vue\");\n/* harmony import */ var _fortawesome_vue_fontawesome__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @fortawesome/vue-fontawesome */ \"./node_modules/@fortawesome/vue-fontawesome/index.es.js\");\n/* harmony import */ var v_tooltip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! v-tooltip */ \"./node_modules/v-tooltip/dist/v-tooltip.esm.js\");\n/* harmony import */ var vue_multiselect__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vue-multiselect */ \"./node_modules/vue-multiselect/dist/vue-multiselect.min.js\");\n/* harmony import */ var vue_multiselect__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(vue_multiselect__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var vue_multiselect_dist_vue_multiselect_min_css__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! vue-multiselect/dist/vue-multiselect.min.css */ \"./node_modules/vue-multiselect/dist/vue-multiselect.min.css\");\n\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n name: 'history-detailed',\n components: {\n AppLink: _helpers_app_link_vue__WEBPACK_IMPORTED_MODULE_3__[\"default\"],\n FontAwesomeIcon: _fortawesome_vue_fontawesome__WEBPACK_IMPORTED_MODULE_5__.FontAwesomeIcon,\n QualityPill: _helpers_quality_pill_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n VueGoodTable: vue_good_table__WEBPACK_IMPORTED_MODULE_9__.VueGoodTable,\n Multiselect: (vue_multiselect__WEBPACK_IMPORTED_MODULE_7___default())\n },\n directives: {\n tooltip: v_tooltip__WEBPACK_IMPORTED_MODULE_6__.VTooltip\n },\n mixins: [(0,_mixins_manage_cookie__WEBPACK_IMPORTED_MODULE_2__.manageCookieMixin)('history-detailed')],\n data() {\n const {\n getCookie\n } = this;\n const perPageDropdown = [25, 50, 100, 250, 500, 1000];\n const statusNames = [{\n value: -1,\n text: 'Unset'\n }, {\n value: 1,\n text: 'Unaired'\n }, {\n value: 5,\n text: 'Skipped'\n }, {\n value: 3,\n text: 'Wanted'\n }, {\n value: 2,\n text: 'Snatched'\n }, {\n value: 9,\n text: 'Snatched (Proper)'\n }, {\n value: 12,\n text: 'Snatched (Best)'\n }, {\n value: 4,\n text: 'Downloaded'\n }, {\n value: 6,\n text: 'Archived'\n }, {\n value: 7,\n text: 'Ignored'\n }, {\n value: 10,\n text: 'Subtitled'\n }, {\n value: 11,\n text: 'Failed'\n }];\n const columns = [{\n label: 'Date',\n field: 'actionDate',\n dateInputFormat: 'yyyyMMddHHmmss',\n // E.g. 07-09-2017 19:16:25\n dateOutputFormat: 'yyyy-MM-dd HH:mm:ss',\n type: 'date',\n hidden: getCookie('Date')\n }, {\n label: 'Episode',\n field: 'episodeTitle',\n sortable: false,\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Episode')\n }, {\n label: 'Action',\n field: 'statusName',\n filterOptions: {\n enabled: true,\n filterDropdownItems: statusNames\n },\n hidden: getCookie('Action')\n }, {\n label: 'Quality',\n field: 'quality',\n type: 'number',\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Quality')\n }, {\n label: 'Provider',\n field: 'provider.id',\n filterOptions: {\n enabled: true\n },\n hidden: getCookie('Provider')\n }, {\n label: 'Size',\n field: 'size',\n tdClass: 'align-center-span',\n formatFn: _utils_core__WEBPACK_IMPORTED_MODULE_1__.humanFileSize,\n type: 'number',\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Size')\n }, {\n label: 'Client Status',\n field: 'clientStatus',\n type: 'number',\n filterOptions: {\n customFilter: true\n },\n hidden: getCookie('Client Status')\n }];\n return {\n columns,\n selectedClientStatusValue: [],\n perPageDropdown\n };\n },\n mounted() {\n const {\n getCookie,\n getSortFromCookie\n } = this;\n this.loadItems();\n\n // Get per-page pagination from cookie\n const perPage = getCookie('pagination-perpage-history');\n if (perPage) {\n this.remoteHistory.perPage = perPage;\n }\n this.remoteHistory.sort = getSortFromCookie();\n },\n created() {\n this.loadItemsDebounced = lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default()(this.loadItems, 500);\n },\n computed: {\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapState)({\n layout: state => state.config.layout,\n remoteHistory: state => state.history.remote,\n consts: state => state.config.consts\n }),\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapGetters)({\n fuzzyParseDateTime: 'fuzzyParseDateTime'\n }),\n serverParams() {\n return {\n page: this.remoteHistory.page,\n // What page I want to show\n perPage: this.remoteHistory.perPage,\n // How many items I'm showing per page\n sort: this.remoteHistory.sort,\n filter: this.remoteHistory.filter\n };\n },\n qualityOptions() {\n const {\n consts\n } = this;\n return consts.qualities.values.map(quality => {\n return {\n value: quality.value,\n text: quality.name\n };\n });\n }\n },\n methods: {\n humanFileSize: _utils_core__WEBPACK_IMPORTED_MODULE_1__.humanFileSize,\n ...(0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapActions)({\n getHistory: 'getHistory',\n setStoreLayout: 'setStoreLayout'\n }),\n getSortFromCookie() {\n const {\n getCookie\n } = this;\n const sort = getCookie('sort'); // From manage-cookie.js mixin\n if (sort) {\n if (sort[0].type === 'none') {\n sort[0].type = 'desc';\n }\n return sort;\n }\n return [{\n field: 'date',\n type: 'desc'\n }];\n },\n rowStyleClassFn(row) {\n return `${row.statusName.toLowerCase()} status` || 'skipped status';\n },\n close() {\n this.$emit('close');\n // Destroy the vue listeners, etc\n this.$destroy();\n // Remove the element from the DOM\n this.$el.remove();\n },\n onPageChange(params) {\n console.log('page change called');\n console.log(params);\n this.remoteHistory.page = params.currentPage;\n this.loadItemsDebounced();\n },\n onPerPageChange(params) {\n console.log('per page change called');\n this.setCookie('pagination-perpage-history', params.currentPerPage);\n this.remoteHistory.perPage = params.currentPerPage;\n this.loadItemsDebounced();\n },\n onSortChange(params) {\n this.setCookie('sort', params);\n this.remoteHistory.sort = params.filter(item => item.type !== 'none');\n this.loadItemsDebounced();\n },\n onColumnFilter(params) {\n this.setCookie('filter', params);\n this.remoteHistory.filter = params;\n this.loadItemsDebounced();\n },\n updateClientStatusFilter(event) {\n const combinedStatus = event.reduce((result, item) => {\n return result | item.value;\n }, 0);\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.selectedClientStatusValue = event;\n this.remoteHistory.filter.columnFilters.clientStatus = combinedStatus;\n this.loadItemsDebounced();\n },\n updateQualityFilter(quality) {\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.quality = quality.currentTarget.value;\n this.loadItemsDebounced();\n },\n /**\n * Update the size filter.\n * As a specific size filter is useless. I've choosen to use a > or < operator.\n * The backend will parse these into queries.\n * @param {string} size - Operator with size in MB.\n */\n updateSizeFilter(size) {\n // Check for valid syntax, and pass along.\n size = size.currentTarget.value;\n if (!size) {\n this.remoteHistory.filter.columnFilters.size = size;\n this.loadItemsDebounced();\n return;\n }\n const validSizeRegex = /[<>] \\d{2,6}/;\n if (size.match(validSizeRegex)) {\n this.invalidSizeMessage = '';\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.size = size;\n this.loadItemsDebounced();\n }\n },\n updateResource(resource) {\n resource = resource.currentTarget.value;\n if (!this.remoteHistory.filter) {\n this.remoteHistory.filter = {\n columnFilters: {}\n };\n }\n this.remoteHistory.filter.columnFilters.resource = resource;\n this.loadItemsDebounced();\n },\n // Load items is what brings back the rows from server\n loadItems() {\n const {\n getHistory\n } = this;\n console.log(this.serverParams);\n getHistory(this.serverParams);\n }\n }\n});\n\n//# sourceURL=webpack://slim/./src/components/history-detailed.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-1!./node_modules/vue-loader/lib/index.js??vue-loader-options"); /***/ }), @@ -2545,7 +2545,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ manageCookieMixin: () => (/* binding */ manageCookieMixin)\n/* harmony export */ });\n/**\n * Vue Cookie handler for the vue-good-tables enable/disable columns feature.\n * @param {String} cookiePrefix String used to specify the specific table.\n * @example - Prefix `Home` with the column Label `title` will result in the cookie key `Home-title`\n * @returns {void}\n */\nconst manageCookieMixin = cookiePrefix => {\n return {\n methods: {\n getCookie(key) {\n if (key.includes(cookiePrefix)) {\n return key;\n }\n const cookie = this.$cookies.get(`${cookiePrefix}-${key}`);\n try {\n return JSON.parse(cookie);\n } catch {\n return cookie === 'none' ? null : cookie;\n }\n },\n setCookie(key, value) {\n return this.$cookies.set(`${cookiePrefix}-${key}`, JSON.stringify(value));\n },\n /**\n * Save vue-good-table sort field and sort order (desc/asc)\n * @param {*} evt - Vue good table sorting event (triggered by the `on-sort-change` event)\n */\n saveSorting(evt) {\n const {\n setCookie\n } = this;\n // Store cookies, for sort field and type (asc/desc)\n setCookie('sort-field', evt.map(item => item.field));\n setCookie('sort-type', evt.map(item => item.type));\n },\n /**\n * Get vue-good-table sort field and sort order.\n * @param {string} defaultField - default vue good table field to sort by.\n * @param {string} defaultType - default vue good table sort order (ascending / descending).\n * @returns {object} - Object with the field and type properties.\n */\n getSortBy() {\n let defaultField = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'title';\n let defaultType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'asc';\n const {\n getCookie\n } = this;\n // Try to get cookies, for sort field and type (asc/desc)\n const sortField = getCookie('sort-field');\n const sortType = getCookie('sort-type');\n const sort = [];\n if (Array.isArray(sortField) && sortField.length === 2) {\n sortField.forEach((_, index) => {\n sort.push({\n field: sortField[index] || defaultField,\n type: sortType[index] || defaultType\n });\n });\n return sort;\n }\n if (sortField === null || sortType === null) {\n return {\n field: defaultField,\n type: defaultType\n };\n }\n return {\n field: sortField[0] || defaultField,\n type: sortType[0] || defaultType\n };\n }\n },\n created() {\n // Watch the columns property on the VM. This is the default named property for the vue-good-tables columns.\n this.$watch(() => this.columns, columns => {\n // Monitor the columns, to update the cookies, when changed.\n const {\n setCookie\n } = this;\n for (const column of columns) {\n if (column) {\n setCookie(column.label, column.hidden);\n }\n }\n }, {\n deep: true\n });\n }\n };\n};\n\n//# sourceURL=webpack://slim/./src/mixins/manage-cookie.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ manageCookieMixin: () => (/* binding */ manageCookieMixin)\n/* harmony export */ });\n/**\n * Vue Cookie handler for the vue-good-tables enable/disable columns feature.\n * @param {String} cookiePrefix String used to specify the specific table.\n * @example - Prefix `Home` with the column Label `title` will result in the cookie key `Home-title`\n * @returns {void}\n */\nconst manageCookieMixin = cookiePrefix => {\n return {\n methods: {\n getCookie(key) {\n if (key.includes(cookiePrefix)) {\n return key;\n }\n const cookie = this.$cookies.get(`${cookiePrefix}-${key}`);\n try {\n return JSON.parse(cookie);\n } catch {\n return cookie;\n }\n },\n setCookie(key, value) {\n return this.$cookies.set(`${cookiePrefix}-${key}`, JSON.stringify(value));\n },\n /**\n * Save vue-good-table sort field and sort order (desc/asc)\n * @param {*} evt - Vue good table sorting event (triggered by the `on-sort-change` event)\n */\n saveSorting(evt) {\n const {\n setCookie\n } = this;\n // Store cookies, for sort field and type (asc/desc)\n setCookie('sort-field', evt.map(item => item.field));\n setCookie('sort-type', evt.map(item => item.type));\n },\n /**\n * Get vue-good-table sort field and sort order.\n * @param {string} defaultField - default vue good table field to sort by.\n * @param {string} defaultType - default vue good table sort order (ascending / descending).\n * @returns {object} - Object with the field and type properties.\n */\n getSortBy() {\n let defaultField = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'title';\n let defaultType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'asc';\n const {\n getCookie\n } = this;\n // Try to get cookies, for sort field and type (asc/desc)\n const sortField = getCookie('sort-field');\n const sortType = getCookie('sort-type');\n const sort = [];\n if (Array.isArray(sortField) && sortField.length === 2) {\n sortField.forEach((_, index) => {\n sort.push({\n field: sortField[index] || defaultField,\n type: sortType[index] || defaultType\n });\n });\n return sort;\n }\n if (sortField === null || sortType === null) {\n return {\n field: defaultField,\n type: defaultType\n };\n }\n return {\n field: sortField[0] || defaultField,\n type: sortType[0] || defaultType\n };\n }\n },\n created() {\n // Watch the columns property on the VM. This is the default named property for the vue-good-tables columns.\n this.$watch(() => this.columns, columns => {\n // Monitor the columns, to update the cookies, when changed.\n const {\n setCookie\n } = this;\n for (const column of columns) {\n if (column) {\n setCookie(column.label, column.hidden);\n }\n }\n }, {\n deep: true\n });\n }\n };\n};\n\n//# sourceURL=webpack://slim/./src/mixins/manage-cookie.js?"); /***/ }),