@things-factory/warehouse-ui 4.0.25 → 4.0.29

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.
@@ -3,7 +3,7 @@ import '@things-factory/grist-ui'
3
3
  import { i18next, localize } from '@things-factory/i18n-base'
4
4
  import { client } from '@things-factory/shell'
5
5
  import { ScrollbarStyles } from '@things-factory/styles'
6
- import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
6
+ import { isMobileDevice } from '@things-factory/utils'
7
7
  import gql from 'graphql-tag'
8
8
  import { css, html, LitElement } from 'lit-element'
9
9
  import { LOCATION_TYPE } from '../constants'
@@ -251,12 +251,8 @@ export class BufferLocationSelector extends localize(i18next)(LitElement) {
251
251
  async fetchWarehouses({ page, limit, sorters = [] }) {
252
252
  const response = await client.query({
253
253
  query: gql`
254
- query {
255
- warehouses(${gqlBuilder.buildArgs({
256
- filters: this.searchForm.queryFilters,
257
- pagination: { page, limit },
258
- sortings: sorters
259
- })}) {
254
+ query warehouses($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
255
+ warehouses(filters: $filters, pagination: $pagination, sortings: $sortings) {
260
256
  items {
261
257
  id
262
258
  name
@@ -266,7 +262,12 @@ export class BufferLocationSelector extends localize(i18next)(LitElement) {
266
262
  total
267
263
  }
268
264
  }
269
- `
265
+ `,
266
+ variables: {
267
+ filters: this.searchForm.queryFilters,
268
+ pagination: { page, limit },
269
+ sortings: sorters
270
+ }
270
271
  })
271
272
 
272
273
  if (!response.errors) {
@@ -282,23 +283,8 @@ export class BufferLocationSelector extends localize(i18next)(LitElement) {
282
283
 
283
284
  const response = await client.query({
284
285
  query: gql`
285
- query {
286
- locations(${gqlBuilder.buildArgs({
287
- filters: [
288
- {
289
- name: 'warehouse_id',
290
- operator: 'eq',
291
- value: this._warehouseId
292
- },
293
- {
294
- name: 'type',
295
- operator: 'eq',
296
- value: LOCATION_TYPE.BUFFER.value
297
- }
298
- ],
299
- pagination: { page, limit },
300
- sortings: sorters
301
- })}) {
286
+ query locations($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
287
+ locations(filters: $filters, pagination: $pagination, sortings: $sortings) {
302
288
  items {
303
289
  id
304
290
  name
@@ -311,7 +297,23 @@ export class BufferLocationSelector extends localize(i18next)(LitElement) {
311
297
  total
312
298
  }
313
299
  }
314
- `
300
+ `,
301
+ variables: {
302
+ filters: [
303
+ {
304
+ name: 'warehouse_id',
305
+ operator: 'eq',
306
+ value: this._warehouseId
307
+ },
308
+ {
309
+ name: 'type',
310
+ operator: 'eq',
311
+ value: LOCATION_TYPE.BUFFER.value
312
+ }
313
+ ],
314
+ pagination: { page, limit },
315
+ sortings: sorters
316
+ }
315
317
  })
316
318
 
317
319
  if (!response.errors) {
@@ -4,7 +4,7 @@ import { MultiColumnFormStyles } from '@things-factory/form-ui'
4
4
  import '@things-factory/grist-ui'
5
5
  import { i18next, localize } from '@things-factory/i18n-base'
6
6
  import { client, CustomAlert } from '@things-factory/shell'
7
- import { gqlBuilder, sleep, isMobileDevice } from '@things-factory/utils'
7
+ import { sleep, isMobileDevice } from '@things-factory/utils'
8
8
  import { ScrollbarStyles } from '@things-factory/styles'
9
9
  import gql from 'graphql-tag'
10
10
  import { css, html, LitElement } from 'lit-element'
@@ -163,10 +163,9 @@ export class GenerateLocationList extends localize(i18next)(LitElement) {
163
163
  ${(this._formatsFromCode || []).map(
164
164
  format =>
165
165
  html`
166
- <option value="${format && format.name}"
167
- >${format && format.name}
168
- ${format && format.description ? ` ${format && format.description}` : ''}</option
169
- >
166
+ <option value="${format && format.name}"></option>
167
+ ${format && format.name} ${format && format.description ? ` ${format && format.description}` : ''}
168
+ </option>
170
169
  `
171
170
  )}
172
171
  </select>
@@ -746,14 +745,15 @@ export class GenerateLocationList extends localize(i18next)(LitElement) {
746
745
  const patches = chunkPatches[x]
747
746
  const response = await client.query({
748
747
  query: gql`
749
- mutation {
750
- updateMultipleLocation(${gqlBuilder.buildArgs({
751
- patches
752
- })}) {
748
+ mutation updateMultipleLocation($patches: [LocationPatch!]) {
749
+ updateMultipleLocation(patches $patches) {
753
750
  name
754
751
  }
755
752
  }
756
- `
753
+ `,
754
+ variables: {
755
+ patches
756
+ }
757
757
  })
758
758
  }
759
759
 
@@ -12,7 +12,7 @@ import { openImportPopUp } from '@things-factory/import-ui'
12
12
  import { openPopup } from '@things-factory/layout-base'
13
13
  import { client, CustomAlert, PageView, store } from '@things-factory/shell'
14
14
  import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
15
- import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
15
+ import { isMobileDevice } from '@things-factory/utils'
16
16
 
17
17
  import { LOCATION_STATUS, LOCATION_TYPE } from '../constants'
18
18
  import { LOCATION_LABEL_SETTING_KEY } from './constants'
@@ -308,12 +308,8 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
308
308
 
309
309
  const response = await client.query({
310
310
  query: gql`
311
- query {
312
- locations(${gqlBuilder.buildArgs({
313
- filters: [...filters, ...this.searchForm.queryFilters],
314
- pagination: { page, limit },
315
- sortings: sorters
316
- })}) {
311
+ query locations($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
312
+ locations(filters: $filters, pagination: $pagination, sortings: $sortings) {
317
313
  items {
318
314
  id
319
315
  name
@@ -324,7 +320,7 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
324
320
  shelf
325
321
  status
326
322
  updatedAt
327
- updater{
323
+ updater {
328
324
  name
329
325
  description
330
326
  }
@@ -332,7 +328,12 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
332
328
  total
333
329
  }
334
330
  }
335
- `
331
+ `,
332
+ variables: {
333
+ filters: [...filters, ...this.searchForm.queryFilters],
334
+ pagination: { page, limit },
335
+ sortings: sorters
336
+ }
336
337
  })
337
338
 
338
339
  return {
@@ -348,16 +349,15 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
348
349
  return patch
349
350
  })
350
351
 
351
- const response = await client.query({
352
- query: gql`
353
- mutation {
354
- updateMultipleLocation(${gqlBuilder.buildArgs({
355
- patches
356
- })}) {
357
- name
358
- }
352
+ const response = await client.mutate({
353
+ mutation: gql`
354
+ mutation updateMultipleLocation($patches: [LocationPatch!]!) {
355
+ updateMultipleLocation(patches: $patches) {
356
+ name
359
357
  }
360
- `
358
+ }
359
+ `,
360
+ variables: { patches }
361
361
  })
362
362
 
363
363
  if (!response.errors) {
@@ -385,12 +385,13 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
385
385
 
386
386
  if (!anwer.value) return
387
387
 
388
- const response = await client.query({
389
- query: gql`
390
- mutation {
391
- deleteLocations(${gqlBuilder.buildArgs({ ids })})
388
+ const response = await client.mutate({
389
+ mutation: gql`
390
+ mutation deleteLocations($ids: [String!]!) {
391
+ deleteLocations(ids: $ids)
392
392
  }
393
- `
393
+ `,
394
+ variables: { ids }
394
395
  })
395
396
 
396
397
  if (!response.errors) {
@@ -416,12 +417,13 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
416
417
 
417
418
  if (!answer.value) return
418
419
 
419
- const response = await client.query({
420
- query: gql`
421
- mutation {
422
- deleteAllLocations(${gqlBuilder.buildArgs({ warehouseId: this._warehouseId })})
420
+ const response = await client.mutate({
421
+ mutation: gql`
422
+ mutation deleteAllLocations($warehouseId: String!) {
423
+ deleteAllLocations(warehouseId: $warehouseId)
423
424
  }
424
- `
425
+ `,
426
+ variables: { warehouseId: this._warehouseId }
425
427
  })
426
428
 
427
429
  if (!response.errors) {
@@ -4,7 +4,7 @@ import '@things-factory/grist-ui'
4
4
  import { i18next, localize } from '@things-factory/i18n-base'
5
5
  import { openImportPopUp } from '@things-factory/import-ui'
6
6
  import { client, CustomAlert, navigate, PageView } from '@things-factory/shell'
7
- import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
7
+ import { isMobileDevice } from '@things-factory/utils'
8
8
  import { ScrollbarStyles, CommonButtonStyles } from '@things-factory/styles'
9
9
  import gql from 'graphql-tag'
10
10
  import { css, html } from 'lit-element'
@@ -205,19 +205,15 @@ class WarehouseList extends localize(i18next)(PageView) {
205
205
  async fetchHandler({ page, limit, sorters = [{ name: 'name' }] }) {
206
206
  const response = await client.query({
207
207
  query: gql`
208
- query {
209
- warehouses(${gqlBuilder.buildArgs({
210
- filters: this.searchForm.queryFilters,
211
- pagination: { page, limit },
212
- sortings: sorters
213
- })}) {
208
+ query warehouses($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
209
+ warehouses(filters: $filters, pagination: $pagination, sortings: $sortings) {
214
210
  items {
215
211
  id
216
212
  name
217
213
  type
218
214
  description
219
215
  updatedAt
220
- updater{
216
+ updater {
221
217
  name
222
218
  description
223
219
  }
@@ -225,7 +221,12 @@ class WarehouseList extends localize(i18next)(PageView) {
225
221
  total
226
222
  }
227
223
  }
228
- `
224
+ `,
225
+ variables: {
226
+ filters: this.searchForm.queryFilters,
227
+ pagination: { page, limit },
228
+ sortings: sorters
229
+ }
229
230
  })
230
231
 
231
232
  return {
@@ -236,16 +237,15 @@ class WarehouseList extends localize(i18next)(PageView) {
236
237
 
237
238
  async _saveWarehouse(patches) {
238
239
  if (patches && patches.length) {
239
- const response = await client.query({
240
- query: gql`
241
- mutation {
242
- updateMultipleWarehouse(${gqlBuilder.buildArgs({
243
- patches
244
- })}) {
245
- name
246
- }
240
+ const response = await client.mutate({
241
+ mutation: gql`
242
+ mutation updateMultipleWarehouse($patches: [WarehousePatch!]!) {
243
+ updateMultipleWarehouse(patches: $patches) {
244
+ name
247
245
  }
248
- `
246
+ }
247
+ `,
248
+ variables: { patches }
249
249
  })
250
250
 
251
251
  if (!response.errors) {
@@ -273,12 +273,13 @@ class WarehouseList extends localize(i18next)(PageView) {
273
273
 
274
274
  if (!anwer.value) return
275
275
 
276
- const response = await client.query({
277
- query: gql`
278
- mutation {
279
- deleteWarehouses(${gqlBuilder.buildArgs({ ids })})
276
+ const response = await client.mutate({
277
+ mutation: gql`
278
+ mutation deleteWarehouses($ids: [String!]!) {
279
+ deleteWarehouses(ids: $ids)
280
280
  }
281
- `
281
+ `,
282
+ variables: { ids }
282
283
  })
283
284
 
284
285
  if (!response.errors) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/warehouse-ui",
3
- "version": "4.0.25",
3
+ "version": "4.0.29",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,15 +24,15 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@things-factory/barcode-base": "^4.0.25",
28
- "@things-factory/code-base": "^4.0.25",
29
- "@things-factory/form-ui": "^4.0.25",
30
- "@things-factory/grist-ui": "^4.0.25",
31
- "@things-factory/i18n-base": "^4.0.25",
32
- "@things-factory/import-ui": "^4.0.25",
33
- "@things-factory/layout-base": "^4.0.25",
34
- "@things-factory/shell": "^4.0.25",
35
- "@things-factory/warehouse-base": "^4.0.25"
27
+ "@things-factory/barcode-base": "^4.0.28",
28
+ "@things-factory/code-base": "^4.0.28",
29
+ "@things-factory/form-ui": "^4.0.28",
30
+ "@things-factory/grist-ui": "^4.0.28",
31
+ "@things-factory/i18n-base": "^4.0.28",
32
+ "@things-factory/import-ui": "^4.0.28",
33
+ "@things-factory/layout-base": "^4.0.28",
34
+ "@things-factory/shell": "^4.0.28",
35
+ "@things-factory/warehouse-base": "^4.0.29"
36
36
  },
37
- "gitHead": "9c44141d651dab7b4a9c0f0b6fecb8d6937d116f"
37
+ "gitHead": "1dd19ce97afe62e2b05e27c3b7781b9468cbd778"
38
38
  }