From 8375e7b24da3e603696e8e3f06ed4e40225776f4 Mon Sep 17 00:00:00 2001 From: Vladislav Korenkov Date: Thu, 10 Nov 2022 17:02:17 +1000 Subject: [PATCH 1/2] Fix: Refactor code according to vstutils frontend updates --- .gitlab-ci.yml | 6 + doc/api_schema.yaml | 121 ++- doc/contribute.rst | 12 + doc/gui.rst | 12 + frontend_src/.eslintrc.js | 2 +- frontend_src/Home.vue | 50 +- frontend_src/TasksChart.vue | 3 + frontend_src/history/OldLinesMixin.js | 7 +- frontend_src/history/OutputLines.vue | 2 +- frontend_src/history/index.js | 121 ++- frontend_src/index.js | 64 +- frontend_src/inventory/InventoryFieldEdit.vue | 6 +- frontend_src/periodic_task/index.js | 79 +- frontend_src/project/detail/RunPlaybook.vue | 8 +- frontend_src/project/detail/index.js | 2 +- frontend_src/project/detail/style.scss | 13 +- frontend_src/templates/index.js | 54 +- package.json | 8 +- polemarch/__init__.py | 2 +- polemarch/api/v3/views.py | 5 + polemarch/main/models/utils.py | 2 +- polemarch/main/utils.py | 2 +- requirements-doc.txt | 2 +- requirements.txt | 2 +- tox.ini | 8 + tox_build.ini | 2 +- webpack.config.js | 1 + yarn.lock | 721 +++++++++--------- 28 files changed, 713 insertions(+), 604 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 77f801f9..cbea6828 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,6 +59,12 @@ code_style: variables: TOX_ENVS: "flake,pylint" +js_style: + <<: *branch_tests + stage: code_standarts + variables: + TOX_ENVS: "js_style" + py38-coverage: <<: *branch_tests variables: diff --git a/doc/api_schema.yaml b/doc/api_schema.yaml index 3fcf5b8d..4cce3d68 100644 --- a/doc/api_schema.yaml +++ b/doc/api_schema.yaml @@ -24,9 +24,9 @@ info: url: https://gitlab.com/vstconsulting/polemarch.git Request: - name: Question - url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Ask&issue%5Btitle%5D=Ask%20about%20version%202.0.1 + url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Ask&issue%5Btitle%5D=Ask%20about%20version%202.1.2 - name: Bug report - url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Bug&issue%5Btitle%5D=Bug%20in%20version%202.0.1 + url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Bug&issue%5Btitle%5D=Bug%20in%20version%202.1.2 - name: Feature request url: https://gitlab.com/vstconsulting/polemarch/issues/new?issuable_template%5D=Feature%20request&issue%5Btitle%5D= x-menu: @@ -65,13 +65,14 @@ info: time_zone: UTC logout_url: /account/logout/ login_url: /account/login/ + x-subscriptions-prefix: polemarch.update x-versions: - application: 2.0.1 - library: 2.0.1 - vstutils: 5.0.13 - django: 3.2.15 - djangorestframework: 3.13.1 - drf_yasg: 1.21.3 + application: 2.1.2 + library: 2.1.2 + vstutils: 5.1.1 + django: 3.2.16 + djangorestframework: 3.14.0 + drf_yasg: 1.21.4 ansible: 2.9.27 version: v3 host: localhost:8080 @@ -153,6 +154,7 @@ paths: - community_template x-subscribe-labels: - main.ProjectTemplate + x-list: true parameters: [] /community_template/{id}/: get: @@ -168,6 +170,7 @@ paths: - community_template x-subscribe-labels: - main.ProjectTemplate + x-list: false parameters: - name: id in: path @@ -306,6 +309,7 @@ paths: x-subscribe-labels: - main.Group x-deep-nested-view: groups + x-list: true post: operationId: group_add description: Create a new group. @@ -338,6 +342,7 @@ paths: x-subscribe-labels: - main.Group x-deep-nested-view: groups + x-list: false put: operationId: group_update description: Update a group. @@ -514,6 +519,7 @@ paths: - group x-subscribe-labels: - main.Group + x-list: true post: operationId: group_groups_add description: Create a new group. @@ -551,6 +557,7 @@ paths: - group x-subscribe-labels: - main.Group + x-list: false put: operationId: group_groups_update description: Update a group. @@ -737,6 +744,7 @@ paths: - group x-subscribe-labels: - main.Host + x-list: true post: operationId: group_groups_hosts_add description: Create a new host. @@ -779,6 +787,7 @@ paths: - group x-subscribe-labels: - main.Host + x-list: false put: operationId: group_groups_hosts_update description: Update a host. @@ -998,6 +1007,7 @@ paths: - group x-subscribe-labels: - main.Variable + x-list: true post: operationId: group_groups_hosts_variables_add description: Create a new variable of instance. @@ -1045,6 +1055,7 @@ paths: - group x-subscribe-labels: - main.Variable + x-list: false put: operationId: group_groups_hosts_variables_update description: Update variable value. @@ -1232,6 +1243,7 @@ paths: - group x-subscribe-labels: - main.Variable + x-list: true post: operationId: group_groups_variables_add description: Create a new variable of instance. @@ -1274,6 +1286,7 @@ paths: - group x-subscribe-labels: - main.Variable + x-list: false put: operationId: group_groups_variables_update description: Update variable value. @@ -1438,6 +1451,7 @@ paths: - group x-subscribe-labels: - main.Host + x-list: true post: operationId: group_hosts_add description: Create a new host. @@ -1475,6 +1489,7 @@ paths: - group x-subscribe-labels: - main.Host + x-list: false put: operationId: group_hosts_update description: Update a host. @@ -1679,6 +1694,7 @@ paths: - group x-subscribe-labels: - main.Variable + x-list: true post: operationId: group_hosts_variables_add description: Create a new variable of instance. @@ -1721,6 +1737,7 @@ paths: - group x-subscribe-labels: - main.Variable + x-list: false put: operationId: group_hosts_variables_update description: Update variable value. @@ -1898,6 +1915,7 @@ paths: - group x-subscribe-labels: - main.Variable + x-list: true post: operationId: group_variables_add description: Create a new variable of instance. @@ -1935,6 +1953,7 @@ paths: - group x-subscribe-labels: - main.Variable + x-list: false put: operationId: group_variables_update description: Update variable value. @@ -2125,6 +2144,7 @@ paths: - history x-subscribe-labels: - main.History + x-list: true parameters: [] /history/{id}/: get: @@ -2140,6 +2160,7 @@ paths: - history x-subscribe-labels: - main.History + x-list: false delete: operationId: history_remove description: Remove an existing history record. @@ -2200,7 +2221,7 @@ paths: type: integer /history/{id}/facts/: get: - operationId: history_facts_get + operationId: history_facts description: Get compilated history facts (only for execution 'module' with module 'setup'). parameters: [] @@ -2213,6 +2234,7 @@ paths: - history x-subscribe-labels: - main.History + x-list: false parameters: - name: id in: path @@ -2326,6 +2348,7 @@ paths: - hook x-subscribe-labels: - main.Hook + x-list: true post: operationId: hook_add description: Create a new hook. @@ -2357,6 +2380,7 @@ paths: - hook x-subscribe-labels: - main.Hook + x-list: false put: operationId: hook_update description: Update a hook. @@ -2510,6 +2534,7 @@ paths: - host x-subscribe-labels: - main.Host + x-list: true post: operationId: host_add description: Create a new host. @@ -2541,6 +2566,7 @@ paths: - host x-subscribe-labels: - main.Host + x-list: false put: operationId: host_update description: Update a host. @@ -2730,6 +2756,7 @@ paths: - host x-subscribe-labels: - main.Variable + x-list: true post: operationId: host_variables_add description: Create a new variable of instance. @@ -2767,6 +2794,7 @@ paths: - host x-subscribe-labels: - main.Variable + x-list: false put: operationId: host_variables_update description: Update variable value. @@ -2919,6 +2947,7 @@ paths: - inventory x-subscribe-labels: - main.Inventory + x-list: true post: operationId: inventory_add description: Create a new inventory. @@ -2968,6 +2997,7 @@ paths: - inventory x-subscribe-labels: - main.Inventory + x-list: false put: operationId: inventory_update description: Update a inventory. @@ -3122,6 +3152,7 @@ paths: x-subscribe-labels: - main.Group x-deep-nested-view: groups + x-list: true parameters: - name: id in: path @@ -3143,6 +3174,7 @@ paths: x-subscribe-labels: - main.Group x-deep-nested-view: groups + x-list: false parameters: - name: all_groups_id in: path @@ -3259,6 +3291,7 @@ paths: - inventory x-subscribe-labels: - main.Host + x-list: true parameters: - name: id in: path @@ -3279,6 +3312,7 @@ paths: - inventory x-subscribe-labels: - main.Host + x-list: false parameters: - name: all_hosts_id in: path @@ -3419,6 +3453,7 @@ paths: x-subscribe-labels: - main.Group x-deep-nested-view: groups + x-list: true post: operationId: inventory_group_add description: Create a new group. @@ -3457,6 +3492,7 @@ paths: x-subscribe-labels: - main.Group x-deep-nested-view: groups + x-list: false put: operationId: inventory_group_update description: Update a group. @@ -3643,6 +3679,7 @@ paths: - inventory x-subscribe-labels: - main.Group + x-list: true post: operationId: inventory_group_groups_add description: Create a new group. @@ -3685,6 +3722,7 @@ paths: - inventory x-subscribe-labels: - main.Group + x-list: false put: operationId: inventory_group_groups_update description: Update a group. @@ -3848,6 +3886,7 @@ paths: - inventory x-subscribe-labels: - main.Host + x-list: true post: operationId: inventory_group_hosts_add description: Create a new host. @@ -3890,6 +3929,7 @@ paths: - inventory x-subscribe-labels: - main.Host + x-list: false put: operationId: inventory_group_hosts_update description: Update a host. @@ -4109,6 +4149,7 @@ paths: - inventory x-subscribe-labels: - main.Variable + x-list: true post: operationId: inventory_group_hosts_variables_add description: Create a new variable of instance. @@ -4156,6 +4197,7 @@ paths: - inventory x-subscribe-labels: - main.Variable + x-list: false put: operationId: inventory_group_hosts_variables_update description: Update variable value. @@ -4343,6 +4385,7 @@ paths: - inventory x-subscribe-labels: - main.Variable + x-list: true post: operationId: inventory_group_variables_add description: Create a new variable of instance. @@ -4385,6 +4428,7 @@ paths: - inventory x-subscribe-labels: - main.Variable + x-list: false put: operationId: inventory_group_variables_update description: Update variable value. @@ -4549,6 +4593,7 @@ paths: - inventory x-subscribe-labels: - main.Host + x-list: true post: operationId: inventory_hosts_add description: Create a new host. @@ -4586,6 +4631,7 @@ paths: - inventory x-subscribe-labels: - main.Host + x-list: false put: operationId: inventory_hosts_update description: Update a host. @@ -4790,6 +4836,7 @@ paths: - inventory x-subscribe-labels: - main.Variable + x-list: true post: operationId: inventory_hosts_variables_add description: Create a new variable of instance. @@ -4832,6 +4879,7 @@ paths: - inventory x-subscribe-labels: - main.Variable + x-list: false put: operationId: inventory_hosts_variables_update description: Update variable value. @@ -5009,6 +5057,7 @@ paths: - inventory x-subscribe-labels: - main.Variable + x-list: true post: operationId: inventory_variables_add description: Create a new variable of instance. @@ -5046,6 +5095,7 @@ paths: - inventory x-subscribe-labels: - main.Variable + x-list: false put: operationId: inventory_variables_update description: Update variable value. @@ -5220,6 +5270,7 @@ paths: - project x-subscribe-labels: - main.Project + x-list: true post: operationId: project_add description: Create a new project. @@ -5251,6 +5302,7 @@ paths: - project x-subscribe-labels: - main.Project + x-list: false put: operationId: project_update description: Update a project. @@ -5478,6 +5530,7 @@ paths: - project x-subscribe-labels: - main.Template + x-list: true post: operationId: project_execution_templates_add description: Template(id, hidden, notes, owner, name, kind, template_data, options_data, @@ -5517,6 +5570,7 @@ paths: - project x-subscribe-labels: - main.Template + x-list: false put: operationId: project_execution_templates_update description: Template(id, hidden, notes, owner, name, kind, template_data, options_data, @@ -5696,6 +5750,7 @@ paths: - project x-subscribe-labels: - main.TemplateOption + x-list: true post: operationId: project_execution_templates_option_add description: TemplateOption(template, id, name, data) @@ -5739,6 +5794,7 @@ paths: - project x-subscribe-labels: - main.TemplateOption + x-list: false put: operationId: project_execution_templates_option_update description: TemplateOption(template, id, name, data) @@ -5935,6 +5991,7 @@ paths: - project x-subscribe-labels: - main.History + x-list: true parameters: - name: id in: path @@ -5957,6 +6014,7 @@ paths: - project x-subscribe-labels: - main.History + x-list: false delete: operationId: project_history_remove description: History(id, hidden, project, inventory, mode, revision, kind, start_time, @@ -6034,7 +6092,7 @@ paths: type: integer /project/{id}/history/{history_id}/facts/: get: - operationId: project_history_facts_get + operationId: project_history_facts description: Get compilated history facts (only for execution 'module' with module 'setup'). parameters: [] @@ -6047,6 +6105,7 @@ paths: - project x-subscribe-labels: - main.History + x-list: false parameters: - name: history_id in: path @@ -6157,6 +6216,7 @@ paths: - project x-subscribe-labels: - main.Inventory + x-list: true post: operationId: project_inventory_add description: Create a new inventory. @@ -6240,6 +6300,7 @@ paths: - project x-subscribe-labels: - main.Inventory + x-list: false put: operationId: project_inventory_update description: Update a inventory. @@ -6400,6 +6461,7 @@ paths: x-subscribe-labels: - main.Group x-deep-nested-view: groups + x-list: true parameters: - name: id in: path @@ -6427,6 +6489,7 @@ paths: x-subscribe-labels: - main.Group x-deep-nested-view: groups + x-list: false parameters: - name: all_groups_id in: path @@ -6549,6 +6612,7 @@ paths: - project x-subscribe-labels: - main.Host + x-list: true parameters: - name: id in: path @@ -6575,6 +6639,7 @@ paths: - project x-subscribe-labels: - main.Host + x-list: false parameters: - name: all_hosts_id in: path @@ -6727,6 +6792,7 @@ paths: x-subscribe-labels: - main.Group x-deep-nested-view: groups + x-list: true post: operationId: project_inventory_group_add description: Create a new group. @@ -6771,6 +6837,7 @@ paths: x-subscribe-labels: - main.Group x-deep-nested-view: groups + x-list: false put: operationId: project_inventory_group_update description: Update a group. @@ -6967,6 +7034,7 @@ paths: - project x-subscribe-labels: - main.Group + x-list: true post: operationId: project_inventory_group_groups_add description: Create a new group. @@ -7014,6 +7082,7 @@ paths: - project x-subscribe-labels: - main.Group + x-list: false put: operationId: project_inventory_group_groups_update description: Update a group. @@ -7182,6 +7251,7 @@ paths: - project x-subscribe-labels: - main.Host + x-list: true post: operationId: project_inventory_group_hosts_add description: Create a new host. @@ -7229,6 +7299,7 @@ paths: - project x-subscribe-labels: - main.Host + x-list: false put: operationId: project_inventory_group_hosts_update description: Update a host. @@ -7463,6 +7534,7 @@ paths: - project x-subscribe-labels: - main.Variable + x-list: true post: operationId: project_inventory_group_hosts_variables_add description: Create a new variable of instance. @@ -7515,6 +7587,7 @@ paths: - project x-subscribe-labels: - main.Variable + x-list: false put: operationId: project_inventory_group_hosts_variables_update description: Update variable value. @@ -7712,6 +7785,7 @@ paths: - project x-subscribe-labels: - main.Variable + x-list: true post: operationId: project_inventory_group_variables_add description: Create a new variable of instance. @@ -7759,6 +7833,7 @@ paths: - project x-subscribe-labels: - main.Variable + x-list: false put: operationId: project_inventory_group_variables_update description: Update variable value. @@ -7928,6 +8003,7 @@ paths: - project x-subscribe-labels: - main.Host + x-list: true post: operationId: project_inventory_hosts_add description: Create a new host. @@ -7971,6 +8047,7 @@ paths: - project x-subscribe-labels: - main.Host + x-list: false put: operationId: project_inventory_hosts_update description: Update a host. @@ -8193,6 +8270,7 @@ paths: - project x-subscribe-labels: - main.Variable + x-list: true post: operationId: project_inventory_hosts_variables_add description: Create a new variable of instance. @@ -8241,6 +8319,7 @@ paths: - project x-subscribe-labels: - main.Variable + x-list: false put: operationId: project_inventory_hosts_variables_update description: Update variable value. @@ -8430,6 +8509,7 @@ paths: - project x-subscribe-labels: - main.Variable + x-list: true post: operationId: project_inventory_variables_add description: Create a new variable of instance. @@ -8473,6 +8553,7 @@ paths: - project x-subscribe-labels: - main.Variable + x-list: false put: operationId: project_inventory_variables_update description: Update variable value. @@ -8609,6 +8690,7 @@ paths: - project x-subscribe-labels: - main.Module + x-list: true parameters: - name: id in: path @@ -8629,6 +8711,7 @@ paths: - project x-subscribe-labels: - main.Module + x-list: false parameters: - name: id in: path @@ -8769,6 +8852,7 @@ paths: - project x-subscribe-labels: - main.PeriodicTask + x-list: true post: operationId: project_periodic_task_add description: Create a new periodic task. @@ -8806,6 +8890,7 @@ paths: - project x-subscribe-labels: - main.PeriodicTask + x-list: false put: operationId: project_periodic_task_update description: Update a periodic task. @@ -8986,6 +9071,7 @@ paths: - project x-subscribe-labels: - main.Variable + x-list: true post: operationId: project_periodic_task_variables_add description: Create a new variable of periodic task. @@ -9029,6 +9115,7 @@ paths: - project x-subscribe-labels: - main.Variable + x-list: false put: operationId: project_periodic_task_variables_update description: Update variable value. @@ -9199,6 +9286,7 @@ paths: - project x-subscribe-labels: - main.Task + x-list: true parameters: - name: id in: path @@ -9219,6 +9307,7 @@ paths: - project x-subscribe-labels: - main.Task + x-list: false parameters: - name: id in: path @@ -9375,6 +9464,7 @@ paths: - project x-subscribe-labels: - main.Variable + x-list: true post: operationId: project_variables_add description: Create a new variable of instance. @@ -9412,6 +9502,7 @@ paths: - project x-subscribe-labels: - main.Variable + x-list: false put: operationId: project_variables_update description: Update variable value. @@ -9559,6 +9650,7 @@ paths: - team x-subscribe-labels: - main.UserGroup + x-list: true post: operationId: team_add description: Create a new team. @@ -9590,6 +9682,7 @@ paths: - team x-subscribe-labels: - main.UserGroup + x-list: false put: operationId: team_update description: Update a team. @@ -9801,6 +9894,7 @@ paths: - team x-subscribe-labels: - auth.User + x-list: true post: operationId: team_user_add description: Create a new user. @@ -9838,6 +9932,7 @@ paths: - team x-subscribe-labels: - auth.User + x-list: false put: operationId: team_user_update description: Update a user. @@ -9904,6 +9999,7 @@ paths: - team x-subscribe-labels: - auth.User + x-list: false put: operationId: team_user__settings_update description: Update a user. @@ -10001,6 +10097,7 @@ paths: - team x-subscribe-labels: - auth.User + x-list: false put: operationId: team_user_twofa_update description: Update a user. @@ -10146,6 +10243,7 @@ paths: - user x-subscribe-labels: - auth.User + x-list: true post: operationId: user_add description: Create a new user. @@ -10177,6 +10275,7 @@ paths: - user x-subscribe-labels: - auth.User + x-list: false put: operationId: user_update description: Update a user. @@ -10238,6 +10337,7 @@ paths: - user x-subscribe-labels: - auth.User + x-list: false put: operationId: user__settings_update description: '' @@ -10320,6 +10420,7 @@ paths: - user x-subscribe-labels: - auth.User + x-list: false put: operationId: user_twofa_update description: '' diff --git a/doc/contribute.rst b/doc/contribute.rst index e17ac0e9..51eaf364 100644 --- a/doc/contribute.rst +++ b/doc/contribute.rst @@ -86,6 +86,18 @@ Here is how to proceed: pylint and flake and run main python tests. Make sure that your code meets those checks. + .. warning:: + Some tests linked to git may fail because local ``file://`` clones are considered unsafe by default. + For more information please see + `this topic `_. + If you are encountered this problem, one of the solutions might be: + + .. sourcecode:: bash:: + + git config --global protocol.file.allow always + + Keep in mind that this command allows file clone **globally at git level for all your projects**. + #. Reflect your changes in documentation (if needed). Build documentation, read what you have changed and make sure that all is right. To build documentation use: diff --git a/doc/gui.rst b/doc/gui.rst index 66b6efb2..c288ca6d 100644 --- a/doc/gui.rst +++ b/doc/gui.rst @@ -167,6 +167,18 @@ Once your project status changes to "OK", you can start working with Polemarch. .. warning:: If you update something in your GIT repository, don't forget to run sync in Polemarch for pulling your changes. +.. warning:: + If you have trouble when cloning from *local* git repository, this may be caused by + ``protocol.file.allow`` setting is is set to ``user`` in your git config. + For more information please see + `this topic `_. + One of the solutions might be: + + .. sourcecode:: bash:: + + git config --global protocol.file.allow always + + Keep in mind that this command allows file clone **globally at git level for all your projects**. Project variables ----------------- diff --git a/frontend_src/.eslintrc.js b/frontend_src/.eslintrc.js index 2bbbc1f3..e9f7e543 100644 --- a/frontend_src/.eslintrc.js +++ b/frontend_src/.eslintrc.js @@ -13,7 +13,7 @@ module.exports = { }, rules: { 'no-debugger': 'warn', - 'prettier/prettier': 'warn', + 'prettier/prettier': 'error', 'vue/component-tags-order': 'off', 'vue/html-indent': ['error', 4], 'vue/html-self-closing': ['error', { html: { void: 'any' } }], diff --git a/frontend_src/Home.vue b/frontend_src/Home.vue index 5537ee06..23845dec 100644 --- a/frontend_src/Home.vue +++ b/frontend_src/Home.vue @@ -1,23 +1,23 @@ @@ -32,51 +32,15 @@ TasksChart, SmallBoxWidget: spa.components.widgets.SmallBoxWidget, }, - mixins: [spa.views.mixins.BasestViewMixin], - data() { - return { - statsData: null, - smallBoxes: [ - { key: 'templates', label: 'Templates', icon: 'fa fa-cog' }, - { key: 'projects', label: 'Projects', href: '#/project', icon: 'fa fa-cog' }, - { key: 'inventories', label: 'Inventories', href: '#/inventory', icon: 'fas fa-cog' }, - { key: 'groups', label: 'Groups', href: '#/group', icon: 'fa fa-cog' }, - { key: 'hosts', label: 'Hosts', href: '#/host', icon: 'fa fa-cog' }, - { key: 'users', label: 'Users', href: '#/user', icon: 'fa fa-cog' }, - ], - period: 14, - }; - }, + mixins: [spa.components.BaseViewMixin], computed: { - additionalSections() { - return []; - }, - title() { - return this.$t('Dashboard'); - }, - isLoading() { - return !this.statsData; - }, smallBoxesValues() { return Object.fromEntries( - this.smallBoxes.map(({ key }) => [key, this.statsData?.[key] || 0]), + this.store.smallBoxes.map(({ key }) => [key, this.store.statsData?.[key] || 0]), ); }, jobs() { - return this.statsData?.jobs; - }, - }, - methods: { - updateData(period = 14) { - return this.$app.api - .makeRequest({ useBulk: true, method: 'get', path: 'stats', query: { last: period } }) - .then((response) => { - if (response.status !== 200) { - console.warn(response); - return; - } - this.statsData = response.data; - }); + return this.store.statsData?.jobs; }, }, }; diff --git a/frontend_src/TasksChart.vue b/frontend_src/TasksChart.vue index d24dcf0c..d14c5b53 100644 --- a/frontend_src/TasksChart.vue +++ b/frontend_src/TasksChart.vue @@ -157,6 +157,9 @@ if (newPeriod?.queryAmount !== period?.queryAmount) { this.$emit('request-data', newPeriod.queryAmount); } + if (newPeriod?.label !== period?.label) { + this.updateChart(); + } }, }, created() { diff --git a/frontend_src/history/OldLinesMixin.js b/frontend_src/history/OldLinesMixin.js index 69d67912..ca228ba0 100644 --- a/frontend_src/history/OldLinesMixin.js +++ b/frontend_src/history/OldLinesMixin.js @@ -122,6 +122,7 @@ export default { beforeDestroy() { if (this.subscription) { this.subscription.unsubscribe(); + this.subscription.removeAllListeners(); } }, @@ -132,7 +133,8 @@ export default { methods: { startUpdate() { if (this.$app.centrifugoClient) { - this.subscription = this.$app.centrifugoClient.subscribe('history_lines', (msg) => { + this.subscription = this.$app.centrifugoClient.subscribe( + `${this.$app.autoUpdateController.subscriptionsPrefix}.history_lines`, (msg) => { if (msg.data.pk === this.pk && !this.loading) { this.updateData(); } @@ -142,9 +144,6 @@ export default { } }, - autoAutoUpdateActionName() { - return 'updateData'; - }, /** * Method - on scroll event handler. */ diff --git a/frontend_src/history/OutputLines.vue b/frontend_src/history/OutputLines.vue index 7d1a63c4..b9836a25 100644 --- a/frontend_src/history/OutputLines.vue +++ b/frontend_src/history/OutputLines.vue @@ -1,6 +1,6 @@