Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rename configuration page[WTEL-3818] #540

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@vuelidate/validators": "^2.0.0",
"@vueuse/core": "^10.3.0",
"@webitel/flow-ui-sdk": "^0.1.14",
"@webitel/ui-sdk": "^23.12.21",
"@webitel/ui-sdk": "^23.12.23",
"axios": "^0.27.1",
"clipboard-copy": "^4.0.1",
"cron-validator": "^1.3.1",
Expand Down
4 changes: 4 additions & 0 deletions src/app/locale/en/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,10 @@ export default {
},

},
configuration: {
configuration: 'Configuration | Configurations',
parameter: 'Parameter',
},
},

pagination: {
Expand Down
4 changes: 4 additions & 0 deletions src/app/locale/ru/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,10 @@ export default {
},
},
},
configuration: {
configuration: 'Конфигурация | Конфигурации',
parameter: 'Параметр',
},
},
pagination: {
rowsPerPage: 'Количество строк на странице',
Expand Down
4 changes: 4 additions & 0 deletions src/app/locale/ua/ua.js
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,10 @@ export default {
},
},
},
configuration: {
configuration: 'Конфігурація | Конфігурації',
parameter: 'Параметр',
},
},
pagination: {
rowsPerPage: 'Кількість записів',
Expand Down
6 changes: 3 additions & 3 deletions src/app/router/_internals/NavigationPages.lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ const nav = Object.freeze([
route: 'changelogs',
},
{
value: AdminSections.SETTINGS,
locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.SETTINGS}`,
route: 'settings',
value: AdminSections.CONFIGURATION,
locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.CONFIGURATION}`,
route: 'configuration',
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion src/app/router/_internals/RouteNames.enum.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default Object.freeze({

// SYSTEM
CHANGELOGS: 'changelogs',
SETTINGS: 'admin-settings',
CONFIGURATION: 'configuration',

SETTINGS_PAGE: 'settings',
PAGE_403: 'access-denied',
Expand Down
8 changes: 4 additions & 4 deletions src/app/router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const OpenedImportCsv = () => import('../../modules/integrations/modules/import-
const OpenedTrigger = () => import('../../modules/integrations/modules/triggers/components/opened-trigger.vue');
const Changelogs = () => import('../../modules/system/modules/changelogs/components/the-changelogs.vue');
const OpenedChangelog = () => import('../../modules/system/modules/changelogs/components/opened-changelog.vue');
const TheSettings = () => import('../../modules/system/modules/settings/components/the-settings.vue');
const Configuration = () => import('../../modules/system/modules/configuration/components/the-configuration.vue');

const checkAppAccess = (to, from, next) => {
const hasReadAccess = store.getters['userinfo/CHECK_APP_ACCESS'](store.getters['userinfo/THIS_APP']);
Expand Down Expand Up @@ -689,9 +689,9 @@ const router = createRouter({
beforeEnter: checkRouteAccess,
},
{
path: '/system/settings',
name: RouteNames.SETTINGS,
component: TheSettings,
path: '/system/configuration',
name: RouteNames.CONFIGURATION,
component: Configuration,
beforeEnter: checkRouteAccess,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const deleteItem = async ({ id }) => {
}
};

const SettingsAPI = {
const ConfigurationAPI = {
getList,
get,
add,
Expand All @@ -125,4 +125,4 @@ const SettingsAPI = {
getLookup,
};

export default SettingsAPI;
export default ConfigurationAPI;
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,28 @@
>
<template #title>
{{ id ? $t('reusable.edit') : $t('reusable.new') }}
{{ $tc('settings.settings', 1).toLowerCase() }}
{{ $t('objects.system.configuration.parameter').toLowerCase() }}
</template>
<template #main>
<form>
<wt-select
:value="itemInstance.name"
:v="v$.itemInstance.name"
:label="$t('reusable.name')"
:search-method="loadSettingsNameList"
:label="$t('objects.system.configuration.parameter')"
:search-method="loadParameterList"
:clearable="false"
:track-by="null"
:disabled="id"
required
@input="setSettingName"
@input="setParameterName"
/>
<div
v-if="itemInstance.name"
>
<!-- https://github.com/vuejs/core/issues/2279#issuecomment-701266701-->
<component
:is="componentConfig.component"
:label="componentConfig.label"
v-bind="componentConfig.bind"
v-on="componentConfig.on"
/>
Expand All @@ -53,16 +54,16 @@
<script>
import deepmerge from 'deepmerge';
import { useVuelidate } from '@vuelidate/core';
import { required } from '@vuelidate/validators';
import { required, minValue } from '@vuelidate/validators';
import { EngineSystemSettingName } from 'webitel-sdk';
import openedObjectMixin from '../../../../../app/mixins/objectPagesMixins/openedObjectMixin/openedObjectMixin';
import openedTabComponentMixin
from '../../../../../app/mixins/objectPagesMixins/openedObjectTabMixin/openedTabComponentMixin';
import SettingsAPI from '../api/settings';
import SettingsValueTypes from '../utils/settingsValueTypes';
import ConfigurationAPI from '../api/configuration';
import ConfigurationValueTypes from '../utils/configurationValueTypes';

export default {
name: 'SettingsPopup',
name: 'ConfigurationPopup',
mixins: [openedObjectMixin, openedTabComponentMixin],
props: {
id: {
Expand All @@ -78,31 +79,35 @@ export default {
validations: {
itemInstance: {
name: { required },
value: { required },
value: {
required,
minValue: minValue(0),
},
},
},
computed: {
valueType() {
return SettingsValueTypes[this.itemInstance.name];
return ConfigurationValueTypes[this.itemInstance.name];
},
componentConfig() {
const defaultConfig = {
bind: {
value: this.itemInstance.value,
v: this.v$.itemInstance.value,
required: true,
label: this.$tc('vocabulary.values', 1),
},
};

const defaultBooleanConfig = deepmerge(defaultConfig, {
component: 'wt-switcher',
label: this.$t('reusable.state'),
on: {
change: (event) => this.setItemProp({ prop: 'value', value: event }),
},
});
const defaultNumberConfig = deepmerge(defaultConfig, {
component: 'wt-input',
label: this.$tc('vocabulary.values', 1),
bind: {
type: 'number',
},
Expand Down Expand Up @@ -146,16 +151,16 @@ export default {
close() {
this.$emit('close');
},
async loadSettingsNameList(params) {
const response = await SettingsAPI.getLookup({ ...params, size: 5000 });
async loadParameterList(params) {
const response = await ConfigurationAPI.getLookup({ ...params, size: 5000 });

response.items = Object.values(EngineSystemSettingName)
.filter((name) => (
response.items.every((item) => item.name !== name)
));
return response;
},
setSettingName(event) {
setParameterName(event) {
this.setItemProp({ prop: 'name', value: event });
if (this.valueType === 'boolean') this.setItemProp({ prop: 'value', value: false });
if (this.valueType === 'number') this.setItemProp({ prop: 'value', value: 0 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
<template #header>
<wt-page-header
:hide-primary="!hasCreateAccess"
:primary-action="() => isSettingPopup = true"
:primary-action="() => isConfigurationPopup = true"
hide-secondary
>
<wt-headline-nav :path="path" />
</wt-page-header>
</template>

<template v-slot:main>
<setting-popup
v-if="isSettingPopup"
<configuration-popup
v-if="isConfigurationPopup"
:id="id"
:namespace="namespace"
@close="isSettingPopup = false"
></setting-popup>
@close="isConfigurationPopup = false"
></configuration-popup>

<delete-confirmation-popup
v-show="deleteConfirmation.isDeleteConfirmationPopup"
Expand All @@ -29,7 +29,7 @@
<h3 class="content-title">
{{
$t('objects.all', {
entity: $tc('settings.settings', 2).toLowerCase(),
entity: $tc('objects.system.configuration.configuration', 2).toLowerCase(),
})
}}
</h3>
Expand Down Expand Up @@ -81,7 +81,7 @@
<wt-icon-action
v-if="hasEditAccess"
action="edit"
@click="editSetting(item)"
@click="editParameter(item)"
/>
<wt-icon-action
v-if="hasDeleteAccess"
Expand Down Expand Up @@ -112,21 +112,21 @@ import { mapActions, mapState } from 'vuex';
import getNamespacedState from '@webitel/ui-sdk/src/store/helpers/getNamespacedState';
import { useDummy } from '../../../../../app/composables/useDummy';
import tableComponentMixin from '../../../../../app/mixins/objectPagesMixins/objectTableMixin/tableComponentMixin';
import SettingPopup from './setting-popup.vue';
import ConfigurationPopup from './configuration-popup.vue';

const namespace = 'system/settings';
const namespace = 'system/configuration';

export default {
name: 'TheSettings',
components: { SettingPopup },
name: 'TheConfiguration',
components: { ConfigurationPopup },
mixins: [tableComponentMixin],
setup() {
const { dummy } = useDummy({ namespace });
return { dummy };
},
data: () => ({
namespace,
isSettingPopup: false,
isConfigurationPopup: false,
}),
computed: {
...mapState({
Expand All @@ -137,7 +137,7 @@ export default {
path() {
return [
{ name: this.$t('objects.system.system') },
{ name: this.$tc('settings.settings', 2), route: namespace },
{ name: this.$tc('objects.system.configuration.configuration', 1), route: namespace },
];
},
},
Expand All @@ -147,9 +147,9 @@ export default {
return dispatch(`${namespace}/SET_ITEM_ID`, payload);
},
}),
editSetting(item) {
editParameter(item) {
this.setItemId(item.id);
this.isSettingPopup = true;
this.isConfigurationPopup = true;
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { SortSymbols } from '@webitel/ui-sdk/src/scripts/sortQueryAdapters';
export default [
{
value: 'name',
locale: 'objects.name',
locale: 'objects.system.configuration.parameter',
field: 'name',
sort: SortSymbols.NONE,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ObjectStoreModule
from '../../../../../app/store/BaseStoreModules/StoreModules/ObjectStoreModule';
import SettingsAPI from '../api/settings';
import ConfigurationAPI from '../api/configuration';
import headers from './_internals/headers';

const actions = {
Expand All @@ -19,9 +19,9 @@ const actions = {
},
};

const settings = new ObjectStoreModule({ headers })
.attachAPIModule(SettingsAPI)
const configuration = new ObjectStoreModule({ headers })
.attachAPIModule(ConfigurationAPI)
.generateAPIActions()
.getModule({ actions });

export default settings;
export default configuration;
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { EngineSystemSettingName } from 'webitel-sdk';

const SettingsValueTypes = Object.freeze({
const ConfigurationValueTypes = Object.freeze({
[EngineSystemSettingName.EnableOmnichannel]: 'boolean',
[EngineSystemSettingName.MemberChunkSize]: 'number',
},
);

export default SettingsValueTypes;
export default ConfigurationValueTypes;
4 changes: 2 additions & 2 deletions src/modules/system/store/system.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import changelogs from '../modules/changelogs/store/changelogs';
import settings from '../modules/settings/store/settings';
import configuration from '../modules/configuration/store/configuration';

export default {
namespaced: true,
modules: {
changelogs,
settings,
configuration,
},
};