bfg-common 1.5.725 → 1.5.727

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,154 +1,152 @@
1
- <template>
2
- <component
3
- :is="currentComponent"
4
- v-model:security="security"
5
- v-model:new-view-local="newViewLocal"
6
- v-model:time-format="timeFormat"
7
- v-model:console-value="consoleValue"
8
- v-model:vm-in-hosts-clusters="vmInHostsClusters"
9
- v-model:is-dark-theme="isDarkTheme"
10
- :is-show-main-menu="props.isShowMainMenu"
11
- :company-name="props.companyName"
12
- :beta-text="props.betaText"
13
- :global-refresh-loading="props.globalRefreshLoading"
14
- :hostname="props.hostname"
15
- :project-name="props.projectName"
16
- :is-preference="props.isPreference"
17
- :selected-language-type="props.selectedLanguageType"
18
- :selected-lang="props.selectedLang"
19
- :new-view="props.newView"
20
- :project="props.project"
21
- :security-loader="props.securityLoader"
22
- :recovery="props.recovery"
23
- @toggle-main-menu="emits('toggle-main-menu')"
24
- @show-preference="emits('show-preference')"
25
- @reset-preference="emits('reset-preference')"
26
- @hide-preference="emits('hide-preference')"
27
- @global-refresh="emits('global-refresh')"
28
- @change-theme-mode="emits('change-theme-mode')"
29
- @update-language="emits('update-language', $event)"
30
- @update-is-browser="emits('update-is-browser', $event)"
31
- @security-confirm="emits('security-confirm', $event)"
32
- @submit-preferences="emits('submit-preferences')"
33
- />
34
-
35
- <common-layout-the-header-modals-reconnect />
36
- <common-layout-the-header-modals-redirect-login />
37
- </template>
38
-
39
- <script setup lang="ts">
40
- import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
41
- import type { UI_T_Project } from '~/lib/models/types'
42
- import type { UI_T_TimeValue } from '~/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/lib/models/types'
43
- import type { UI_I_Recovery } from '~/components/common/layout/theHeader/userMenu/modals/preferences/security/lib/models/interfaces'
44
- import { checkIsTokenExpired } from '~/lib/utils/token'
45
-
46
- const security = defineModel<boolean>('security')
47
- const newViewLocal = defineModel<boolean>('newViewLocal')
48
- const timeFormat = defineModel<UI_T_TimeValue>('timeFormat')
49
- const consoleValue = defineModel<string>('consoleValue')
50
- const vmInHostsClusters = defineModel<boolean>('vmInHostsClusters')
51
- const isDarkTheme = defineModel<boolean>('isDarkTheme')
52
-
53
- const props = withDefaults(
54
- defineProps<{
55
- isShowMainMenu: boolean
56
- companyName: string
57
- betaText: string
58
- globalRefreshLoading: boolean
59
- project: UI_T_Project
60
- projectName: string
61
- hostname: string
62
- isPreference: boolean
63
- selectedLanguageType: string
64
- selectedLang: UI_I_Dropdown
65
- newView: boolean
66
- isPauseReconnect: boolean
67
- expireTimeFromState: number
68
- isShowReconnectModal: boolean
69
- isShowRedirectLoginModal: boolean
70
- securityLoader?: boolean // для Сферы
71
- recovery?: UI_I_Recovery | null // для Сферы
72
- }>(),
73
- {
74
- securityLoader: false,
75
- recovery: null,
76
- }
77
- )
78
-
79
- const emits = defineEmits<{
80
- (event: 'toggle-main-menu'): void
81
- (event: 'global-refresh'): void
82
- (event: 'show-preference'): void
83
- (event: 'reset-preference'): void
84
- (event: 'hide-preference'): void
85
- (event: 'change-theme-mode'): void
86
- (event: 'update-language', value: UI_I_Dropdown): void
87
- (event: 'update-is-browser', value: string): void
88
- (event: 'security-confirm', value: boolean): void
89
- (event: 'submit-preferences'): void
90
- (event: 'show-redirect-login-modal', value: boolean): void
91
- (event: 'show-reconnect-modal', value: boolean): void
92
- }>()
93
-
94
- const currentComponent = computed(() =>
95
- props.newView
96
- ? defineAsyncComponent(() => import('./New.vue'))
97
- : defineAsyncComponent(() => import('./Old.vue'))
98
- )
99
-
100
- const inactivityTimer = ref<NodeJS.Timeout | undefined>(undefined)
101
- const inactivityTimeout = ref<number>(10 * 60 * 1000)
102
-
103
- const startInactivityTimer = (): void => {
104
- inactivityTimer.value = setTimeout(() => {
105
- // Проверяем если isPauseReconnect истина то не показываем модальное окно переподключения,
106
- // к примеру если загружаем файл и он загружается дольше чем срабатывает таймаут
107
-
108
- if (props.isPauseReconnect) {
109
- startInactivityTimer()
110
- return
111
- }
112
-
113
- const expireTime =
114
- props.expireTimeFromState || useCookie('token-expired-time').value
115
-
116
- const isExpiredToken = checkIsTokenExpired(expireTime)
117
-
118
- if (isExpiredToken) {
119
- emits('show-redirect-login-modal', true)
120
-
121
- if (props.isShowReconnectModal) {
122
- emits('show-reconnect-modal', false)
123
- }
124
- }
125
-
126
- if (!isExpiredToken && !props.isShowRedirectLoginModal) {
127
- emits('show-reconnect-modal', true)
128
- startInactivityTimer()
129
- }
130
-
131
- console.log('Пользователь бездействует!')
132
- }, inactivityTimeout.value)
133
- }
134
-
135
- const resetInactivityTimer = (): void => {
136
- // Сброс таймера бездействия при каждом действии пользователя
137
- inactivityTimer.value !== null && clearTimeout(inactivityTimer.value)
138
- startInactivityTimer()
139
- }
140
-
141
- onMounted(() => {
142
- document.addEventListener('mousemove', resetInactivityTimer)
143
-
144
- startInactivityTimer()
145
- })
146
-
147
- onBeforeUnmount(() => {
148
- document.removeEventListener('mousemove', resetInactivityTimer)
149
-
150
- inactivityTimer.value !== null && clearTimeout(inactivityTimer.value)
151
- })
152
- </script>
153
-
154
- <style scoped lang="scss"></style>
1
+ <template>
2
+ <component
3
+ :is="currentComponent"
4
+ v-model:security="security"
5
+ v-model:new-view-local="newViewLocal"
6
+ v-model:time-format="timeFormat"
7
+ v-model:console-value="consoleValue"
8
+ v-model:vm-in-hosts-clusters="vmInHostsClusters"
9
+ v-model:is-dark-theme="isDarkTheme"
10
+ :is-show-main-menu="props.isShowMainMenu"
11
+ :company-name="props.companyName"
12
+ :beta-text="props.betaText"
13
+ :global-refresh-loading="props.globalRefreshLoading"
14
+ :hostname="props.hostname"
15
+ :project-name="props.projectName"
16
+ :is-preference="props.isPreference"
17
+ :selected-language-type="props.selectedLanguageType"
18
+ :selected-lang="props.selectedLang"
19
+ :new-view="props.newView"
20
+ :project="props.project"
21
+ :security-loader="props.securityLoader"
22
+ :recovery="props.recovery"
23
+ @toggle-main-menu="emits('toggle-main-menu')"
24
+ @show-preference="emits('show-preference')"
25
+ @reset-preference="emits('reset-preference')"
26
+ @hide-preference="emits('hide-preference')"
27
+ @global-refresh="emits('global-refresh')"
28
+ @update-language="emits('update-language', $event)"
29
+ @update-is-browser="emits('update-is-browser', $event)"
30
+ @security-confirm="emits('security-confirm', $event)"
31
+ @submit-preferences="emits('submit-preferences')"
32
+ />
33
+
34
+ <common-layout-the-header-modals-reconnect />
35
+ <common-layout-the-header-modals-redirect-login />
36
+ </template>
37
+
38
+ <script setup lang="ts">
39
+ import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
40
+ import type { UI_T_Project } from '~/lib/models/types'
41
+ import type { UI_T_TimeValue } from '~/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/lib/models/types'
42
+ import type { UI_I_Recovery } from '~/components/common/layout/theHeader/userMenu/modals/preferences/security/lib/models/interfaces'
43
+ import { checkIsTokenExpired } from '~/lib/utils/token'
44
+
45
+ const security = defineModel<boolean>('security')
46
+ const newViewLocal = defineModel<boolean>('newViewLocal')
47
+ const timeFormat = defineModel<UI_T_TimeValue>('timeFormat')
48
+ const consoleValue = defineModel<string>('consoleValue')
49
+ const vmInHostsClusters = defineModel<boolean>('vmInHostsClusters')
50
+ const isDarkTheme = defineModel<boolean>('isDarkTheme')
51
+
52
+ const props = withDefaults(
53
+ defineProps<{
54
+ isShowMainMenu: boolean
55
+ companyName: string
56
+ betaText: string
57
+ globalRefreshLoading: boolean
58
+ project: UI_T_Project
59
+ projectName: string
60
+ hostname: string
61
+ isPreference: boolean
62
+ selectedLanguageType: string
63
+ selectedLang: UI_I_Dropdown
64
+ newView: boolean
65
+ isPauseReconnect: boolean
66
+ expireTimeFromState: number
67
+ isShowReconnectModal: boolean
68
+ isShowRedirectLoginModal: boolean
69
+ securityLoader?: boolean // для Сферы
70
+ recovery?: UI_I_Recovery | null // для Сферы
71
+ }>(),
72
+ {
73
+ securityLoader: false,
74
+ recovery: null,
75
+ }
76
+ )
77
+
78
+ const emits = defineEmits<{
79
+ (event: 'toggle-main-menu'): void
80
+ (event: 'global-refresh'): void
81
+ (event: 'show-preference'): void
82
+ (event: 'reset-preference'): void
83
+ (event: 'hide-preference'): void
84
+ (event: 'update-language', value: UI_I_Dropdown): void
85
+ (event: 'update-is-browser', value: string): void
86
+ (event: 'security-confirm', value: boolean): void
87
+ (event: 'submit-preferences'): void
88
+ (event: 'show-redirect-login-modal', value: boolean): void
89
+ (event: 'show-reconnect-modal', value: boolean): void
90
+ }>()
91
+
92
+ const currentComponent = computed(() =>
93
+ props.newView
94
+ ? defineAsyncComponent(() => import('./New.vue'))
95
+ : defineAsyncComponent(() => import('./Old.vue'))
96
+ )
97
+
98
+ const inactivityTimer = ref<NodeJS.Timeout | undefined>(undefined)
99
+ const inactivityTimeout = ref<number>(10 * 60 * 1000)
100
+
101
+ const startInactivityTimer = (): void => {
102
+ inactivityTimer.value = setTimeout(() => {
103
+ // Проверяем если isPauseReconnect истина то не показываем модальное окно переподключения,
104
+ // к примеру если загружаем файл и он загружается дольше чем срабатывает таймаут
105
+
106
+ if (props.isPauseReconnect) {
107
+ startInactivityTimer()
108
+ return
109
+ }
110
+
111
+ const expireTime =
112
+ props.expireTimeFromState || useCookie('token-expired-time').value
113
+
114
+ const isExpiredToken = checkIsTokenExpired(expireTime)
115
+
116
+ if (isExpiredToken) {
117
+ emits('show-redirect-login-modal', true)
118
+
119
+ if (props.isShowReconnectModal) {
120
+ emits('show-reconnect-modal', false)
121
+ }
122
+ }
123
+
124
+ if (!isExpiredToken && !props.isShowRedirectLoginModal) {
125
+ emits('show-reconnect-modal', true)
126
+ startInactivityTimer()
127
+ }
128
+
129
+ console.log('Пользователь бездействует!')
130
+ }, inactivityTimeout.value)
131
+ }
132
+
133
+ const resetInactivityTimer = (): void => {
134
+ // Сброс таймера бездействия при каждом действии пользователя
135
+ inactivityTimer.value !== null && clearTimeout(inactivityTimer.value)
136
+ startInactivityTimer()
137
+ }
138
+
139
+ onMounted(() => {
140
+ document.addEventListener('mousemove', resetInactivityTimer)
141
+
142
+ startInactivityTimer()
143
+ })
144
+
145
+ onBeforeUnmount(() => {
146
+ document.removeEventListener('mousemove', resetInactivityTimer)
147
+
148
+ inactivityTimer.value !== null && clearTimeout(inactivityTimer.value)
149
+ })
150
+ </script>
151
+
152
+ <style scoped lang="scss"></style>
@@ -1,97 +1,97 @@
1
- <template>
2
- <ui-modal
3
- :title="props.title"
4
- :subtitle="props.subtitle"
5
- :texts="{}"
6
- test-id="about-modal"
7
- width="720px"
8
- show
9
- @hide="onHideModal"
10
- >
11
- <template #content>
12
- <ui-modal-block-standard>
13
- <div class="about-modal__text">
14
- <p>{{ aboutHeadingText }}</p>
15
-
16
- <p>{{ localization.layout.aboutSubtitle }}</p>
17
- </div>
18
-
19
- <div class="about-modal__description">
20
- {{ props.aboutDescOne
21
- }}<a
22
- id="about-description-link"
23
- :href="url"
24
- data-id="about-description-link"
25
- target="_blank"
26
- class="about-modal__description-link"
27
- >
28
- {{ props.url }} </a
29
- >{{ props.aboutDescSecond }}
30
- </div>
31
- </ui-modal-block-standard>
32
- </template>
33
- <template #footer><div class="modal-footer-block"></div></template>
34
- </ui-modal>
35
- </template>
36
-
37
- <script lang="ts" setup>
38
- import type { UI_I_Localization } from '~/lib/models/interfaces'
39
-
40
- const props = defineProps<{
41
- title: string
42
- subtitle: string
43
- aboutHeadingText: string
44
- aboutDescOne: string
45
- aboutDescSecond: string
46
- url: string
47
- projectName: string // для warning console
48
- }>()
49
- const emits = defineEmits<{
50
- (event: 'hide'): void
51
- }>()
52
-
53
- const localization = computed<UI_I_Localization>(() => useLocal())
54
-
55
- const onHideModal = (): void => {
56
- emits('hide')
57
- }
58
- </script>
59
-
60
- <style lang="scss" scoped>
61
- .modal-container-standard {
62
- padding-top: 12px;
63
- padding-bottom: 12px;
64
-
65
- .about-modal {
66
- &__text {
67
- color: var(--about-text-color);
68
- font-size: 13px;
69
- font-weight: 400;
70
- line-height: 15.73px;
71
-
72
- p:last-child {
73
- margin: 16px 0;
74
- }
75
- }
76
- &__description {
77
- color: var(--about-text-color);
78
- font-size: 13px;
79
- font-weight: 400;
80
- line-height: 15.73px;
81
-
82
- &-link {
83
- color: var(--about-text-link-color);
84
- &:hover {
85
- color: var(--about-text-link-hover-color);
86
- }
87
- }
88
- }
89
- }
90
- }
91
- .modal-footer-block {
92
- height: 32px;
93
- }
94
- :deep(.title-wrapper__subtitle) {
95
- max-width: 400px;
96
- }
97
- </style>
1
+ <template>
2
+ <ui-modal
3
+ :title="props.title"
4
+ :subtitle="props.subtitle"
5
+ :texts="{}"
6
+ test-id="about-modal"
7
+ width="720px"
8
+ show
9
+ @hide="onHideModal"
10
+ >
11
+ <template #content>
12
+ <ui-modal-block-standard>
13
+ <div class="about-modal__text">
14
+ <p>{{ aboutHeadingText }}</p>
15
+
16
+ <p>{{ localization.layout.aboutSubtitle }}</p>
17
+ </div>
18
+
19
+ <div class="about-modal__description">
20
+ {{ props.aboutDescOne
21
+ }}<a
22
+ id="about-description-link"
23
+ :href="url"
24
+ data-id="about-description-link"
25
+ target="_blank"
26
+ class="about-modal__description-link"
27
+ >
28
+ {{ props.url }} </a
29
+ >{{ props.aboutDescSecond }}
30
+ </div>
31
+ </ui-modal-block-standard>
32
+ </template>
33
+ <template #footer><div class="modal-footer-block"></div></template>
34
+ </ui-modal>
35
+ </template>
36
+
37
+ <script lang="ts" setup>
38
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
39
+
40
+ const props = defineProps<{
41
+ title: string
42
+ subtitle: string
43
+ aboutHeadingText: string
44
+ aboutDescOne: string
45
+ aboutDescSecond: string
46
+ url: string
47
+ projectName: string // для warning console
48
+ }>()
49
+ const emits = defineEmits<{
50
+ (event: 'hide'): void
51
+ }>()
52
+
53
+ const localization = computed<UI_I_Localization>(() => useLocal())
54
+
55
+ const onHideModal = (): void => {
56
+ emits('hide')
57
+ }
58
+ </script>
59
+
60
+ <style lang="scss" scoped>
61
+ .modal-container-standard {
62
+ padding-top: 12px;
63
+ padding-bottom: 12px;
64
+
65
+ .about-modal {
66
+ &__text {
67
+ color: var(--about-text-color);
68
+ font-size: 13px;
69
+ font-weight: 400;
70
+ line-height: 15.73px;
71
+
72
+ p:last-child {
73
+ margin: 16px 0;
74
+ }
75
+ }
76
+ &__description {
77
+ color: var(--about-text-color);
78
+ font-size: 13px;
79
+ font-weight: 400;
80
+ line-height: 15.73px;
81
+
82
+ &-link {
83
+ color: var(--about-text-link-color);
84
+ &:hover {
85
+ color: var(--about-text-link-hover-color);
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ .modal-footer-block {
92
+ height: 32px;
93
+ }
94
+ :deep(.title-wrapper__subtitle) {
95
+ max-width: 400px;
96
+ }
97
+ </style>