bfg-common 1.5.682 → 1.5.683

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.
@@ -0,0 +1,101 @@
1
+ <template>
2
+ <div class="advanced-options-wrap clr-form-control">
3
+ <b class="advanced-options-label">
4
+ {{ localization.common.advancedOptions }}
5
+ </b>
6
+ <div class="advanced-options compact">
7
+ <div class="radio">
8
+ <input
9
+ v-model="model"
10
+ id="advanced-option-liner"
11
+ data-id="advanced-option-liner"
12
+ type="radio"
13
+ value="linear"
14
+ />
15
+ <label for="advanced-option-liner"> Linear </label>
16
+ </div>
17
+ <div :class="['radio', { disabled: props.devNamesCount < 2 }]">
18
+ <input
19
+ v-model="model"
20
+ id="advanced-option-raid0"
21
+ :disabled="props.devNamesCount < 2"
22
+ data-id="advanced-option-raid0"
23
+ type="radio"
24
+ value="raid0"
25
+ />
26
+ <label for="advanced-option-raid0"> Raid0 </label>
27
+ </div>
28
+ <div :class="['radio', { disabled: props.devNamesCount < 2 }]">
29
+ <input
30
+ v-model="model"
31
+ id="advanced-option-raid1"
32
+ :disabled="props.devNamesCount < 2"
33
+ data-id="advanced-option-raid1"
34
+ type="radio"
35
+ value="raid1"
36
+ />
37
+ <label for="advanced-option-raid1"> Raid1 </label>
38
+ </div>
39
+ <div :class="['radio', { disabled: props.devNamesCount < 3 }]">
40
+ <input
41
+ v-model="model"
42
+ id="advanced-option-raid5"
43
+ :disabled="props.devNamesCount < 3"
44
+ data-id="advanced-option-raid5"
45
+ type="radio"
46
+ value="raid5"
47
+ />
48
+ <label for="advanced-option-raid5"> Raid5 </label>
49
+ </div>
50
+ <div :class="['radio', { disabled: props.devNamesCount < 4 }]">
51
+ <input
52
+ v-model="model"
53
+ id="advanced-option-raid6"
54
+ :disabled="props.devNamesCount < 4"
55
+ data-id="advanced-option-raid6"
56
+ type="radio"
57
+ value="raid6"
58
+ />
59
+ <label for="advanced-option-raid6"> Raid6 </label>
60
+ </div>
61
+ <div :class="['radio', { disabled: props.devNamesCount < 4 }]">
62
+ <input
63
+ v-model="model"
64
+ id="advanced-option-raid10"
65
+ :disabled="props.devNamesCount < 4"
66
+ data-id="advanced-option-raid10"
67
+ type="radio"
68
+ value="raid10"
69
+ />
70
+ <label for="advanced-option-raid10"> Raid10 </label>
71
+ </div>
72
+ </div>
73
+ </div>
74
+ </template>
75
+
76
+ <script setup lang="ts">
77
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
78
+ import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
79
+
80
+ const model = defineModel<UI_I_CreateDatastoreForm['level']>({ required: true })
81
+
82
+ const props = defineProps<{
83
+ devNamesCount: number
84
+ }>()
85
+
86
+ const localization = computed<UI_I_Localization>(() => useLocal())
87
+ </script>
88
+
89
+ <style scoped lang="scss">
90
+ .advanced-options-wrap {
91
+ display: flex;
92
+ gap: 10px;
93
+ .radio {
94
+ margin-bottom: 5px;
95
+ }
96
+ input[type='radio']:focus:checked + label::before,
97
+ input[type='radio']:focus + label::before {
98
+ box-shadow: inset 0 0 0 0.25rem #0094d2;
99
+ }
100
+ }
101
+ </style>
@@ -18,8 +18,7 @@
18
18
  hide-page-size
19
19
  @sorting="onSorting"
20
20
  @main-filter="emits('main-filter', $event)"
21
- >
22
- </atoms-table-data-grid>
21
+ />
23
22
  </div>
24
23
  </template>
25
24
 
@@ -92,7 +91,7 @@ watch(
92
91
  .data-table {
93
92
  height: inherit;
94
93
  :deep(.datagrid-outer-wrapper) {
95
- height: 400px;
94
+ max-height: 400px;
96
95
  }
97
96
  }
98
97
  }
@@ -112,7 +112,7 @@ const sharedStormDetailsFunc = (
112
112
  localization: UI_I_Localization,
113
113
  data: UI_I_CreateDatastoreForm
114
114
  ): UI_I_DetailsItem[] => {
115
- const { name, dev_names } = data
115
+ const { name, dev_names, level } = data
116
116
 
117
117
  return [
118
118
  {
@@ -132,6 +132,13 @@ const sharedStormDetailsFunc = (
132
132
  items: [],
133
133
  testId: 'view-selected-lun-disks-in-complete',
134
134
  },
135
+ {
136
+ label: localization.common.advancedOptions,
137
+ value: level,
138
+ items: [],
139
+ testId: 'view-advanced-options-in-complete',
140
+ iconClassName: '',
141
+ },
135
142
  ],
136
143
  actions: [],
137
144
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.682",
4
+ "version": "1.5.683",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -1,165 +1,165 @@
1
- import type {
2
- API_UI_I_Error,
3
- API_UI_I_Response,
4
- UI_I_CommitOptions,
5
- } from '~/lib/models/store/interfaces'
6
- import type {
7
- UI_I_DataTableQuery,
8
- UI_I_TableQuery,
9
- } from '~/lib/models/table/interfaces'
10
- import type { UI_I_Options } from '~/lib/models/composables/useMyFetch/interfaces'
11
- import type {
12
- API_UI_I_RecentTask,
13
- UI_I_RTaskQuery,
14
- UI_I_TasksLoadingPayload,
15
- UI_I_RawRecentTask,
16
- UI_I_RecentTask,
17
- API_UI_I_Task,
18
- } from '~/lib/models/store/tasks/interfaces'
19
- import type { UI_I_TasksState } from '~/store/tasks/lib/models/interfaces'
20
- import type { UI_I_RefreshStack } from '~/store/main/lib/interfaces'
21
- import { tasksConstructor } from '~/store/tasks/mappers/tasks'
22
- import { recentTasks } from '~/store/tasks/mappers/recentTasks'
23
-
24
- export default {
25
- async A_GET_TASKS(
26
- context: {
27
- commit: <T>(arg0: string, arg1: T) => void
28
- state: UI_I_TasksState
29
- dispatch: <T>(arg0: string, arg1: T, arg2: UI_I_CommitOptions) => void
30
- },
31
- payload: UI_I_DataTableQuery
32
- ): Promise<API_UI_I_Error | void> {
33
- const { page, pageSize, sortBy, filter } = payload
34
-
35
- const query: UI_I_TableQuery = {
36
- page_size: pageSize,
37
- page,
38
- }
39
-
40
- if (sortBy) query.sortBy = sortBy
41
- if (filter) query.filter = filter
42
-
43
- const queryJson: string = JSON.stringify({ type: 'tasks', ...query })
44
- const lastQuery: string = context.state.taskQuery || ''
45
-
46
- if (queryJson === lastQuery) {
47
- // Снимаем с паузы сам запрос, для глобального обновления
48
- context.dispatch<string>('main/A_CONTINUE_GLOBAL_REFRESH', queryJson, {
49
- root: true,
50
- })
51
- return
52
- }
53
- context.commit('M_SET_TASKS_LAST_QUERY', queryJson)
54
-
55
- const url = '/ui/tasks'
56
- const options: UI_I_Options = {
57
- query,
58
- method: 'GET',
59
- key: Date.now().toString(),
60
- onRequest() {
61
- context.commit<UI_I_TasksLoadingPayload>('M_SET_LOADING', {
62
- prop: 'tasks',
63
- value: true,
64
- })
65
- },
66
- onResponse({ response }: API_UI_I_Response<API_UI_I_Task<string>>) {
67
- const tasks = tasksConstructor(response._data)
68
-
69
- context.commit('M_SET_TASKS_LIST', tasks)
70
- context.commit<UI_I_TasksLoadingPayload>('M_SET_LOADING', {
71
- prop: 'tasks',
72
- value: false,
73
- })
74
- },
75
- }
76
- const { error } = await useMyFetch<API_UI_I_Task<string>, API_UI_I_Error>(
77
- url,
78
- options
79
- )
80
-
81
- if (error.value?.data?.error_code)
82
- throw new Error(error.value.data.error_message)
83
-
84
- context.dispatch<UI_I_RefreshStack>(
85
- 'main/A_ADD_IN_GLOBAL_REFRESH',
86
- { key: queryJson, url, options },
87
- { root: true }
88
- )
89
- },
90
- async A_GET_RECENT_TASKS(
91
- context: {
92
- commit: <T>(arg0: string, arg1: T) => void
93
- state: UI_I_TasksState
94
- },
95
- payload: string
96
- ): Promise<void> {
97
- const query: UI_I_RTaskQuery = {
98
- last: context.state.recentTaskList?.last || 0,
99
- }
100
- if (payload) query.sortBy = payload
101
-
102
- // Создаем контроллер для возможности отмены
103
- const abortController = new AbortController()
104
- context.commit('M_SET_ABORT_CONTROLLER', abortController)
105
-
106
- const { data, error } = await useMyFetch<
107
- API_UI_I_RecentTask<string>,
108
- API_UI_I_Error
109
- // >('/ui/tasks/watch', {
110
- >('/ui/rtasks', {
111
- query,
112
- method: 'GET',
113
- initialCache: false,
114
- signal: abortController.signal,
115
- })
116
-
117
- if (error.value?.data?.error_code)
118
- throw new Error(error.value.data.error_message)
119
-
120
- context.commit<UI_I_RecentTask<string>>(
121
- 'M_SET_RECENT_TASKS_LIST',
122
- recentTasks(data.value)
123
- )
124
- context.commit<UI_I_RawRecentTask<string>>(
125
- 'M_SET_UPDATED_RECENT_TASKS_LIST',
126
- data.value
127
- )
128
- // context.commit<I_TasksLoadingPayload>('M_SET_LOADING', {
129
- // prop: 'recentTasks',
130
- // value: false,
131
- // })
132
- },
133
- A_CANCEL_RECENT_TASKS(context: { commit: (arg0: string) => void }): void {
134
- context.commit('M_CANCEL_RECENT_TASKS')
135
- },
136
- async A_CANCEL_RECENT_TASK_BY_ID(
137
- context: {
138
- commit: (arg0: string, arg1: string) => void
139
- },
140
- payload: string
141
- ): Promise<void> {
142
- // Скрываем кнопку cancel
143
- context.commit(
144
- 'M_HIDE_CANCEL_RECENT_TASK_BY_ID',
145
- payload
146
- )
147
- const { error } = await useMyFetch<
148
- API_UI_I_RecentTask<string>,
149
- API_UI_I_Error
150
- >(`/ui/tasks/${payload}/cancel`, {
151
- method: 'POST',
152
- initialCache: false,
153
- })
154
-
155
- if (error.value?.data?.error_code)
156
- throw new Error(error.value.data.error_message)
157
- },
158
-
159
- // Вызывается в useMyFetch когда получаем первый ответ от запроса с url tasks
160
- // и default.vue когда срабатывает watch на recentTasks
161
- // Нужно для того чтобы не обрабатывали те таски которые были сделаны перед загрузкой страницы
162
- A_SET_FIRST_TASK(context: { commit: (arg0: string) => void }): void {
163
- context.commit('M_SET_FIRST_TASK')
164
- },
165
- }
1
+ import type {
2
+ API_UI_I_Error,
3
+ API_UI_I_Response,
4
+ UI_I_CommitOptions,
5
+ } from '~/lib/models/store/interfaces'
6
+ import type {
7
+ UI_I_DataTableQuery,
8
+ UI_I_TableQuery,
9
+ } from '~/lib/models/table/interfaces'
10
+ import type { UI_I_Options } from '~/lib/models/composables/useMyFetch/interfaces'
11
+ import type {
12
+ API_UI_I_RecentTask,
13
+ UI_I_RTaskQuery,
14
+ UI_I_TasksLoadingPayload,
15
+ UI_I_RawRecentTask,
16
+ UI_I_RecentTask,
17
+ API_UI_I_Task,
18
+ } from '~/lib/models/store/tasks/interfaces'
19
+ import type { UI_I_TasksState } from '~/store/tasks/lib/models/interfaces'
20
+ import type { UI_I_RefreshStack } from '~/store/main/lib/interfaces'
21
+ import { tasksConstructor } from '~/store/tasks/mappers/tasks'
22
+ import { recentTasks } from '~/store/tasks/mappers/recentTasks'
23
+
24
+ export default {
25
+ async A_GET_TASKS(
26
+ context: {
27
+ commit: <T>(arg0: string, arg1: T) => void
28
+ state: UI_I_TasksState
29
+ dispatch: <T>(arg0: string, arg1: T, arg2: UI_I_CommitOptions) => void
30
+ },
31
+ payload: UI_I_DataTableQuery
32
+ ): Promise<API_UI_I_Error | void> {
33
+ const { page, pageSize, sortBy, filter } = payload
34
+
35
+ const query: UI_I_TableQuery = {
36
+ page_size: pageSize,
37
+ page,
38
+ }
39
+
40
+ if (sortBy) query.sortBy = sortBy
41
+ if (filter) query.filter = filter
42
+
43
+ const queryJson: string = JSON.stringify({ type: 'tasks', ...query })
44
+ const lastQuery: string = context.state.taskQuery || ''
45
+
46
+ if (queryJson === lastQuery) {
47
+ // Снимаем с паузы сам запрос, для глобального обновления
48
+ context.dispatch<string>('main/A_CONTINUE_GLOBAL_REFRESH', queryJson, {
49
+ root: true,
50
+ })
51
+ return
52
+ }
53
+ context.commit('M_SET_TASKS_LAST_QUERY', queryJson)
54
+
55
+ const url = '/ui/tasks'
56
+ const options: UI_I_Options = {
57
+ query,
58
+ method: 'GET',
59
+ key: Date.now().toString(),
60
+ onRequest() {
61
+ context.commit<UI_I_TasksLoadingPayload>('M_SET_LOADING', {
62
+ prop: 'tasks',
63
+ value: true,
64
+ })
65
+ },
66
+ onResponse({ response }: API_UI_I_Response<API_UI_I_Task<string>>) {
67
+ const tasks = tasksConstructor(response._data)
68
+
69
+ context.commit('M_SET_TASKS_LIST', tasks)
70
+ context.commit<UI_I_TasksLoadingPayload>('M_SET_LOADING', {
71
+ prop: 'tasks',
72
+ value: false,
73
+ })
74
+ },
75
+ }
76
+ const { error } = await useMyFetch<API_UI_I_Task<string>, API_UI_I_Error>(
77
+ url,
78
+ options
79
+ )
80
+
81
+ if (error.value?.data?.error_code)
82
+ throw new Error(error.value.data.error_message)
83
+
84
+ context.dispatch<UI_I_RefreshStack>(
85
+ 'main/A_ADD_IN_GLOBAL_REFRESH',
86
+ { key: queryJson, url, options },
87
+ { root: true }
88
+ )
89
+ },
90
+ async A_GET_RECENT_TASKS(
91
+ context: {
92
+ commit: <T>(arg0: string, arg1: T) => void
93
+ state: UI_I_TasksState
94
+ },
95
+ payload: string
96
+ ): Promise<void> {
97
+ const query: UI_I_RTaskQuery = {
98
+ last: context.state.recentTaskList?.last || 0,
99
+ }
100
+ if (payload) query.sortBy = payload
101
+
102
+ // Создаем контроллер для возможности отмены
103
+ const abortController = new AbortController()
104
+ context.commit('M_SET_ABORT_CONTROLLER', abortController)
105
+
106
+ const { data, error } = await useMyFetch<
107
+ API_UI_I_RecentTask<string>,
108
+ API_UI_I_Error
109
+ // >('/ui/tasks/watch', {
110
+ >('/ui/rtasks', {
111
+ query,
112
+ method: 'GET',
113
+ initialCache: false,
114
+ signal: abortController.signal,
115
+ })
116
+
117
+ if (error.value?.data?.error_code)
118
+ throw new Error(error.value.data.error_message)
119
+
120
+ context.commit<UI_I_RecentTask<string>>(
121
+ 'M_SET_RECENT_TASKS_LIST',
122
+ recentTasks(data.value)
123
+ )
124
+ context.commit<UI_I_RawRecentTask<string>>(
125
+ 'M_SET_UPDATED_RECENT_TASKS_LIST',
126
+ data.value
127
+ )
128
+ // context.commit<I_TasksLoadingPayload>('M_SET_LOADING', {
129
+ // prop: 'recentTasks',
130
+ // value: false,
131
+ // })
132
+ },
133
+ A_CANCEL_RECENT_TASKS(context: { commit: (arg0: string) => void }): void {
134
+ context.commit('M_CANCEL_RECENT_TASKS')
135
+ },
136
+ async A_CANCEL_RECENT_TASK_BY_ID(
137
+ context: {
138
+ commit: (arg0: string, arg1: string) => void
139
+ },
140
+ payload: string
141
+ ): Promise<void> {
142
+ // Скрываем кнопку cancel
143
+ context.commit(
144
+ 'M_HIDE_CANCEL_RECENT_TASK_BY_ID',
145
+ payload
146
+ )
147
+ const { error } = await useMyFetch<
148
+ API_UI_I_RecentTask<string>,
149
+ API_UI_I_Error
150
+ >(`/ui/tasks/${payload}/cancel`, {
151
+ method: 'POST',
152
+ initialCache: false,
153
+ })
154
+
155
+ if (error.value?.data?.error_code)
156
+ throw new Error(error.value.data.error_message)
157
+ },
158
+
159
+ // Вызывается в useMyFetch когда получаем первый ответ от запроса с url tasks
160
+ // и default.vue когда срабатывает watch на recentTasks
161
+ // Нужно для того чтобы не обрабатывали те таски которые были сделаны перед загрузкой страницы
162
+ A_SET_FIRST_TASK(context: { commit: (arg0: string) => void }): void {
163
+ context.commit('M_SET_FIRST_TASK')
164
+ },
165
+ }