Skip to content

Commit

Permalink
Release 5.11.0
Browse files Browse the repository at this point in the history
### BREAKING CHANGES:
* Dropped support for MariaDB 10.4.
* Dropped support for PostgreSQL 12.
* Other Django 5.1 breaking changes.

### Changelog:
* Feature(backend): Migrate to Django 5.1.
* Feature(backend): Allow to set field title using ``x-name`` parameter in Schema. Used for filters.
* Feature(backend): Allow to set field name for detail view which will indicate available operations.
* Feature(backend): Allow to hide fields on frontend using property ``_hidden_on_frontend`` on serializer class.
* Feature(backend): Allow to pass label to ``ListSerializer`` and ``ListField``.
* Feature(frontend): Allow to filter list view columns.
* Feature(frontend): Update page data after empty action.
* Fix(backend): Change ``get_view_class`` arguments types.
* Fix(frontend): Make list tables responsive.
* Fix(frontend): Change sidebar open swipe gesture threshold to prevent accident sidebar opening.
* Fix(docs): Typo in ``BModel`` doc string.
* Chore(frontend): Update npm dependencies.

See merge request vst/vst-utils!669
  • Loading branch information
onegreyonewhite committed Sep 26, 2024
2 parents a218f20 + bd588f1 commit 10b695a
Show file tree
Hide file tree
Showing 53 changed files with 1,383 additions and 1,095 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ functional_test:
parallel:
matrix:
- TOX_ENVS:
- py310-django50-install
- py310-django51-install
- TOX_ENVS:
- py312-django50-coverage
- py312-django51-coverage

js_tests:
<<: *branch_js_tests
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=cyclic-import,unused-private-member,super-with-arguments,duplicate-code,logging-fstring-interpolation,no-else-continue,unused-argument,signature-differs,no-else-return,consider-using-ternary,inconsistent-return-statements,len-as-condition,keyword-arg-before-vararg,expression-not-assigned,broad-except,logging-format-interpolation,model-no-explicit-unicode,too-many-ancestors,redefined-builtin,missing-docstring,line-too-long,suppressed-message,useless-suppression,model-has-unicode,bare-except,too-few-public-methods,fixme,dangerous-default-value,attribute-defined-outside-init,pointless-string-statement,too-many-instance-attributes,arguments-differ,binary-op-exception,bad-classmethod-argument,locally-disabled,file-ignored,multiple-statements,superfluous-parens,isinstance-second-argument-not-valid-type
disable=possibly-used-before-assignment,too-many-positional-arguments,import-error,declare-non-slot,cyclic-import,unused-private-member,super-with-arguments,duplicate-code,logging-fstring-interpolation,no-else-continue,unused-argument,signature-differs,no-else-return,consider-using-ternary,inconsistent-return-statements,len-as-condition,keyword-arg-before-vararg,expression-not-assigned,broad-except,logging-format-interpolation,model-no-explicit-unicode,too-many-ancestors,redefined-builtin,missing-docstring,line-too-long,suppressed-message,useless-suppression,model-has-unicode,bare-except,too-few-public-methods,fixme,dangerous-default-value,attribute-defined-outside-init,pointless-string-statement,too-many-instance-attributes,arguments-differ,binary-op-exception,bad-classmethod-argument,locally-disabled,file-ignored,multiple-statements,superfluous-parens,isinstance-second-argument-not-valid-type


[REPORTS]
Expand Down
50 changes: 39 additions & 11 deletions doc/locale/ru/LC_MESSAGES/backend.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: VST Utils 5.0.4\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-12 01:25+0000\n"
"POT-Creation-Date: 2024-09-25 05:35+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -63,8 +63,8 @@ msgstr ""
#: of vstutils.api.actions.Action:5 vstutils.api.actions.EmptyAction:9
#: vstutils.api.actions.SimpleAction:20 vstutils.api.actions.SimpleFileAction:7
#: vstutils.api.base.ModelViewSet:31 vstutils.api.fields.DeepFkField:37
#: vstutils.api.fields.FkField:37 vstutils.models.BModel:162
#: vstutils.models.BModel:187 vstutils.models.custom_model.FileModel:20
#: vstutils.api.fields.FkField:37 vstutils.models.BModel:165
#: vstutils.models.BModel:190 vstutils.models.custom_model.FileModel:20
#: vstutils.models.custom_model.ListModel:16
#: vstutils.models.custom_model.ListModel:35
msgid "Examples:"
Expand Down Expand Up @@ -330,8 +330,36 @@ msgstr ""
"атрибутов view, имеет меньший приоритет перед сгенерированными "
"атрибутами."

#: of vstutils.models.BModel:125
msgid ""
"``_hidden_on_frontend_list_fields`` - list with fields names which will "
"be hidden in list view on frontend."
msgstr ""
"``_hidden_on_frontend_list_fields`` - список имен полей, которые будут "
"скрыты в списковом представлении на фронтенде."

#: of vstutils.models.BModel:126
msgid ""
"``_hidden_on_frontend_detail_fields`` - list with fields names which will"
" be hidden in detail view on frontend."
msgstr ""
"``_hidden_on_frontend_detail_fields`` - список имен полей, которые будут "
"скрыты в детальном представлении на фронтенде."

#: of vstutils.models.BModel:127
msgid ""
"``_detail_operations_availability_field_name`` - name of field which "
"indicates availability of operations, field value can be dict where key "
"is operation name and value is boolean flag or simply list of available "
"operations."
msgstr ""
"``_detail_operations_availability_field_name`` - имя поля, которое "
"указывает доступность операции, значение может быть словарем, где ключ "
"это имя операции, а значение - логическое значение или просто список "
"доступных операций."

#: of vstutils.models.BModel:130
msgid ""
"In common, you can also add custom attributes to override or extend the "
"default list of processing classes. Supported view attributes are "
"``filter_backends``, ``permission_classes``, ``authentication_classes``, "
Expand All @@ -344,15 +372,15 @@ msgstr ""
"``throttle_classes``, ``renderer_classes`` и ``parser_classes``. Список "
"мета-атрибутов для настройки выглядит так:"

#: of vstutils.models.BModel:132
#: of vstutils.models.BModel:135
msgid "``_pre_{attribute}`` - List of classes included before defaults."
msgstr "``_pre_{attribute}`` - Список классов, включаемых до классов по умолчанию."

#: of vstutils.models.BModel:133
#: of vstutils.models.BModel:136
msgid "``_{attribute}`` - List of classes included after defaults."
msgstr "``_{attribute}`` - Список классов, включаемых после классов по умолчанию."

#: of vstutils.models.BModel:134
#: of vstutils.models.BModel:137
msgid ""
"``_override_{attribute}`` - boolean flag indicates that attribute "
"override default viewset (otherwise appends). Default is ``False``."
Expand All @@ -361,7 +389,7 @@ msgstr ""
"переопределяет стандартный viewset (в противном случае расширяет). По "
"умолчанию: ``False``."

#: of vstutils.models.BModel:138
#: of vstutils.models.BModel:141
msgid ""
"You may need to create an `action <https://www.django-rest-framework.org"
"/api-guide/viewsets/#marking-extra-actions-for-routing>`_ on generated "
Expand All @@ -377,7 +405,7 @@ msgstr ""
"``detail``, чтобы применить его к списку или детальной записи. В этом "
"случае декорированный метод будет принимать экземпляр view в ``self``."

#: of vstutils.models.BModel:145
#: of vstutils.models.BModel:148
msgid ""
"In some cases, inheriting models may require to inherit Meta class from "
"the base model. If the Meta is explicitly declared in the base class, "
Expand All @@ -389,7 +417,7 @@ msgstr ""
"базовом классе, то вы можете получить его с помощью атрибута "
"`OriginalMeta` и использовать его для наследования."

#: of vstutils.models.BModel:150
#: of vstutils.models.BModel:153
msgid ""
"Docstring of model will be reused for view descriptions. It is possible "
"to write both a general description for all actions and description for "
Expand All @@ -399,7 +427,7 @@ msgstr ""
" возможность сделать общее описание для всех экшенов и описание для "
"каждого отдельно, используя следующий синтаксис:"

#: of vstutils.models.BModel:164
#: of vstutils.models.BModel:167
msgid ""
"The ``get_view_class()`` method is a utility method in the Django ORM "
"model designed to facilitate the configuration and instantiation of "
Expand All @@ -411,7 +439,7 @@ msgstr ""
"представлений Django Rest Framework (DRF). Это позволяет разработчикам "
"определить и настроить различные аспекты класса представления DRF."

#: of vstutils.models.BModel:189
#: of vstutils.models.BModel:192
msgid ""
"Developers can use this method to customize various aspects of the "
"associated view, such as serializer classes, field configurations, filter"
Expand Down
61 changes: 44 additions & 17 deletions doc/locale/ru/LC_MESSAGES/quickstart.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: VST Utils 5.0.4\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-10 23:37+0000\n"
"POT-Creation-Date: 2024-09-25 05:35+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.14.0\n"
"Generated-By: Babel 2.16.0\n"

#: ../../quickstart.rst:2
msgid "Quick Start"
Expand Down Expand Up @@ -441,7 +441,7 @@ msgstr ""
"сериализаторы для list() и retrieve(), фильтры, эндпоинты API и вложенные"
" view"

#: of vstutils.models.BModel:162 vstutils.models.BModel:187
#: of vstutils.models.BModel:165 vstutils.models.BModel:190
msgid "Examples:"
msgstr "Примеры:"

Expand Down Expand Up @@ -704,8 +704,36 @@ msgstr ""
"атрибутами view, но имеет меньший приоритет перед сгенерированными "
"атрибутами."

#: of vstutils.models.BModel:125
msgid ""
"``_hidden_on_frontend_list_fields`` - list with fields names which will "
"be hidden in list view on frontend."
msgstr ""
"``_hidden_on_frontend_list_fields`` - список имен полей, которые будут "
"скрыты в списковом представлении на фронтенде."

#: of vstutils.models.BModel:126
msgid ""
"``_hidden_on_frontend_detail_fields`` - list with fields names which will"
" be hidden in detail view on frontend."
msgstr ""
"``_hidden_on_frontend_detail_fields`` - список имен полей, которые будут "
"скрыты в детальном представлении на фронтенде."

#: of vstutils.models.BModel:127
msgid ""
"``_detail_operations_availability_field_name`` - name of field which "
"indicates availability of operations, field value can be dict where key "
"is operation name and value is boolean flag or simply list of available "
"operations."
msgstr ""
"``_detail_operations_availability_field_name`` - имя поля, которое "
"указывает доступность операции, значение может быть словарем, где ключ "
"это имя операции, а значение - логическое значение или просто список "
"доступных операций."

#: of vstutils.models.BModel:130
msgid ""
"In common, you can also add custom attributes to override or extend the "
"default list of processing classes. Supported view attributes are "
"``filter_backends``, ``permission_classes``, ``authentication_classes``, "
Expand All @@ -719,17 +747,17 @@ msgstr ""
" ``renderer_classes`` и ``parser_classes``. Список мета-атрибутов для "
"настроек view выглядит следующим образом:"

#: of vstutils.models.BModel:132
#: of vstutils.models.BModel:135
msgid "``_pre_{attribute}`` - List of classes included before defaults."
msgstr ""
"``_pre_{attribute}`` - список классов, включаемых перед значениями по "
"умолчанию."

#: of vstutils.models.BModel:133
#: of vstutils.models.BModel:136
msgid "``_{attribute}`` - List of classes included after defaults."
msgstr "``_{attribute}`` - список классов, включаемых после значений по умолчанию."

#: of vstutils.models.BModel:134
#: of vstutils.models.BModel:137
msgid ""
"``_override_{attribute}`` - boolean flag indicates that attribute "
"override default viewset (otherwise appends). Default is ``False``."
Expand All @@ -738,7 +766,7 @@ msgstr ""
"переопределяет ли атрибут view по умолчанию (в противном случае "
"добавляется). По умолчанию False."

#: of vstutils.models.BModel:138
#: of vstutils.models.BModel:141
msgid ""
"You may need to create an `action <https://www.django-rest-framework.org"
"/api-guide/viewsets/#marking-extra-actions-for-routing>`_ on generated "
Expand All @@ -755,7 +783,7 @@ msgstr ""
"В этом случае декорированный метод будет принимать объект view в качестве"
" атрибута ``self``."

#: of vstutils.models.BModel:145
#: of vstutils.models.BModel:148
msgid ""
"In some cases, inheriting models may require to inherit Meta class from "
"the base model. If the Meta is explicitly declared in the base class, "
Expand All @@ -767,7 +795,7 @@ msgstr ""
"базовом классе, вы можете получить ее через атрибут `OriginalMeta` и "
"использовать для наследования."

#: of vstutils.models.BModel:150
#: of vstutils.models.BModel:153
msgid ""
"Docstring of model will be reused for view descriptions. It is possible "
"to write both a general description for all actions and description for "
Expand All @@ -777,20 +805,19 @@ msgstr ""
"как общее описание для всех действий, так и описание для каждого "
"действия, используя следующий синтаксис:"

#: of vstutils.models.BModel:164
#: of vstutils.models.BModel:167
msgid ""
"The ``get_view_class()`` method is a utility method in the Django ORM "
"model designed to facilitate the configuration and instantiation of "
"Django Rest Framework (DRF) Generic ViewSets. It allows developers to "
"define and customize various aspects of the associated DRF view class."
msgstr ""
"Метод ``get_view_class()`` — это служебный метод в ORM Django моделях, "
"предназначенный для облегчения настройки и создания "
"экземпляров представлений Django Rest Framework (DRF). Это позволяет "
"разработчикам определить и настроить различные аспекты класса "
"представления DRF."
"предназначенный для облегчения настройки и создания экземпляров "
"представлений Django Rest Framework (DRF). Это позволяет разработчикам "
"определить и настроить различные аспекты класса представления DRF."

#: of vstutils.models.BModel:189
#: of vstutils.models.BModel:192
msgid ""
"Developers can use this method to customize various aspects of the "
"associated view, such as serializer classes, field configurations, filter"
Expand All @@ -800,8 +827,8 @@ msgstr ""
"Разработчики могут использовать этот метод для изменения различных "
"аспектов получаемого представления, таких как классы сериализаторов, "
"конфигурацию полей, фильтры,классы разрешений и т.п. Этот метод "
"использует такие же атрибуты, которые были объявлены в мета-атрибутах, но "
"позволяет перегружать отдельные части."
"использует такие же атрибуты, которые были объявлены в мета-атрибутах, но"
" позволяет перегружать отдельные части."

#: ../../quickstart.rst:206
msgid ""
Expand Down
12 changes: 0 additions & 12 deletions frontend_src/gui.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@
line-height: 32px;
}

table {
table-layout: fixed;
}

.popover-title {
color: #000;
}
Expand Down Expand Up @@ -1547,14 +1543,6 @@ input[type='color'] {
padding-bottom: 15px;
}

.table-bordered-custom {
margin: 0;
padding: 0;
border: none;
max-width: none;
margin-bottom: 15px;
}

.card-header-custom {
height: 40px;
line-height: 30px;
Expand Down
3 changes: 2 additions & 1 deletion frontend_src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ export { initApp, type InitAppConfig, type LogoutHandler } from './vstutils/init
export { type AuthAppFactory } from './vstutils/auth-app';
export { getApp } from './vstutils/utils';
export {
hookViewOperation,
onAppAfterInit,
onAppBeforeInit,
onFilterListViewColumns,
onFilterOperations,
onRoutesCreated,
onSchemaLoaded,
onSchemaModelsCreated,
onSchemaViewsCreated,
hookViewOperation,
} from './vstutils/signals';
export { type AppSchema } from './vstutils/schema';
export { defineFieldComponent } from './vstutils/fields/base/defineFieldComponent';
Expand Down
1 change: 1 addition & 0 deletions frontend_src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"useDefineForClassFields": false,
"types": [
"vite/client",
"vitest/globals",
Expand Down
14 changes: 14 additions & 0 deletions frontend_src/unittests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,17 @@ export function expectNthRequest(
export function fetchMockCallAt(idx: number) {
return fetchMock.mock.calls.at(idx);
}

/**
* Helper used to find bulk requests that were left from previous tests.
* Such requests must be awaited and properly mocked in tests that called them.
*/
export function assertNoCollectedBulksInApiConnector() {
const collectedBulks = getApp()
.api.bulk!._getCollectedBulks()
.map(({ request }) => request);

if (collectedBulks.length > 0) {
throw new Error(`Collected bulks left: ${JSON.stringify(collectedBulks, null, 2)}`);
}
}
6 changes: 6 additions & 0 deletions frontend_src/unittests/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import $ from 'jquery';
import createFetchMock from 'vitest-fetch-mock';
import { vi } from 'vitest';
import QRCode from 'qrcode';
// @ts-expect-error No types here :(
import Vue from 'vue/dist/vue.runtime.common.dev.js';

// Hide annoying Vue messages
Vue.config.productionTip = false;
Vue.config.devtools = false;

// @ts-expect-error Mock canvas
// eslint-disable-next-line @typescript-eslint/no-empty-function
Expand Down
2 changes: 1 addition & 1 deletion frontend_src/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default defineConfig(() => ({
coverage: {
enabled: true,
include: ['frontend_src/**'],
provider: 'istanbul',
provider: 'v8',
reporter: ['text', 'text-summary'],
reportsDirectory: join(frontendSrc, '..', 'node_modules', '.coverage'),
},
Expand Down
2 changes: 1 addition & 1 deletion frontend_src/vstutils/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { defineStore } from 'pinia';
import type { CustomVueI18n } from './translation';

import { ActionsManager } from '#vstutils/actions';
import type { ApiConnector } from '#vstutils/api';
import type { ApiConnector } from './api';
import { apiConnector } from '#vstutils/api';
import type { Language } from '#vstutils/api/TranslationsManager';
import { TranslationsManager } from '#vstutils/api/TranslationsManager';
Expand Down
Loading

0 comments on commit 10b695a

Please sign in to comment.