Skip to content

Commit ce9aeed

Browse files
authored
Merge pull request #28 from vidispine/24.3.1
24.3.1
2 parents 4a82f14 + 0b203fb commit ce9aeed

File tree

22 files changed

+241
-415
lines changed

22 files changed

+241
-415
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vidispine/admin-tool",
3-
"version": "24.3.0",
3+
"version": "24.3.1",
44
"private": true,
55
"dependencies": {
66
"@devbookhq/splitter": "^1.3.2",

src/components/exportlocation/ExportLocationSelect.jsx

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,32 @@ import React from 'react';
22
import { Field } from 'redux-form';
33
import debounce from 'lodash.debounce';
44

5-
import { exportlocation as api } from '@vidispine/vdt-api';
5+
import { exportlocation as ExportLocationApi } from '@vidispine/vdt-api';
66
import Select from '../ui/Select';
77

8-
// eslint-disable-next-line no-underscore-dangle
9-
const _listExportLocation = debounce(
10-
api.listExportLocation,
11-
500, { leading: true, trailing: false },
8+
const debounceListExportLocation = debounce(
9+
ExportLocationApi.listExportLocation,
10+
500,
11+
{ leading: true, trailing: false },
1212
);
1313

14-
export const loadExportLocationOptions = (inputValue) => new Promise((resolve, reject) => {
15-
_listExportLocation()
16-
.then((response) => {
17-
if (!response.ok) {
18-
throw new Error(response.statusText);
19-
}
20-
return response.json();
21-
})
22-
.then((jsonDocument) => {
23-
const { exportLocation = [] } = jsonDocument;
24-
let filterExportLocation = exportLocation;
25-
if (inputValue && inputValue !== '*') filterExportLocation = exportLocation.filter((f) => f.name.toLowerCase().includes(inputValue.toLowerCase()));
26-
const options = filterExportLocation.map((f) => ({ label: f.name, value: f.name }));
27-
resolve(options);
28-
})
29-
.catch((error) => {
30-
reject(error);
31-
});
32-
});
33-
34-
const parse = (value) => {
35-
if (value) {
36-
return value.value;
14+
export const loadExportLocationOptions = async (inputValue) => {
15+
const { data: exportLocationListType } = await debounceListExportLocation();
16+
const { exportLocation = [] } = exportLocationListType;
17+
let filterExportLocation = exportLocation;
18+
if (inputValue && inputValue !== '*') {
19+
filterExportLocation = exportLocation
20+
.filter((f) => f.name.toLowerCase().includes(inputValue.toLowerCase()));
3721
}
38-
return undefined;
22+
const options = filterExportLocation.map((f) => ({
23+
label: f.name,
24+
value: f.name,
25+
}));
26+
return options;
3927
};
4028

29+
const parse = (value) => value?.value;
30+
4131
export default function ExportLocationSelect(props) {
4232
return (
4333
<Field

src/components/fieldgroup/FieldGroupSelect.jsx

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,27 @@ import React from 'react';
22
import { Field } from 'redux-form';
33
import debounce from 'lodash.debounce';
44

5-
import { fieldgroup as api } from '@vidispine/vdt-api';
5+
import { fieldgroup as FieldGroupApi } from '@vidispine/vdt-api';
66
import Select from '../ui/Select';
77

8-
// eslint-disable-next-line no-underscore-dangle
9-
const _listFieldGroup = debounce(api.listFieldGroup, 500, { leading: true, trailing: false });
10-
11-
export const loadFieldGroupOptions = (inputValue) => new Promise((resolve, reject) => {
12-
_listFieldGroup()
13-
.then((response) => {
14-
if (!response.ok) {
15-
throw new Error(response.statusText);
16-
}
17-
return response.json();
18-
})
19-
.then((jsonDocument) => {
20-
const { group = [] } = jsonDocument;
21-
let filterFields = group;
22-
if (inputValue && inputValue !== '*') {
23-
filterFields = group.filter((f) => f.name.toLowerCase().includes(inputValue.toLowerCase()));
24-
}
25-
const options = filterFields.map((f) => ({ label: f.name, value: f.name }));
26-
resolve(options);
27-
})
28-
.catch((error) => {
29-
reject(error);
30-
});
8+
const debouncedListFieldGroup = debounce(FieldGroupApi.listFieldGroup, 500, {
9+
leading: true,
10+
trailing: false,
3111
});
3212

33-
const parse = (value) => {
34-
if (value) {
35-
return value.value;
13+
export const loadFieldGroupOptions = async (inputValue) => {
14+
const { data: fieldgroupListType } = await debouncedListFieldGroup();
15+
const { group = [] } = fieldgroupListType;
16+
let filterFields = group;
17+
if (inputValue && inputValue !== '*') {
18+
filterFields = group.filter((f) => f.name.toLowerCase().includes(inputValue.toLowerCase()));
3619
}
37-
return undefined;
20+
const options = filterFields.map((f) => ({ label: f.name, value: f.name }));
21+
return options;
3822
};
3923

24+
const parse = (value) => value?.value;
25+
4026
export default function FieldGroupSelect(props) {
4127
return (
4228
<Field

src/components/group/GroupSelect.jsx

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,28 @@ import React from 'react';
22
import { Field } from 'redux-form';
33
import debounce from 'lodash.debounce';
44

5-
import { group as api } from '@vidispine/vdt-api';
5+
import { group as GroupApi } from '@vidispine/vdt-api';
66
import { StatefulAsyncSelect } from '../ui/Select';
77

8-
// eslint-disable-next-line no-underscore-dangle
9-
const _listGroup = debounce(api.listGroup, 500, { leading: true, trailing: false });
10-
11-
export const loadGroupOptions = (inputValue) => new Promise((resolve, reject) => {
12-
_listGroup()
13-
.then((response) => {
14-
if (!response.ok) {
15-
throw new Error(response.statusText);
16-
}
17-
return response.json();
18-
})
19-
.then((jsonDocument) => {
20-
const { group = [] } = jsonDocument;
21-
let filterOps = group;
22-
if (inputValue && inputValue !== '*') filterOps = group.filter((f) => f.groupName.toLowerCase().includes(inputValue.toLowerCase()));
23-
const options = filterOps.map((f) => ({ label: f.groupName, value: f.groupName }));
24-
resolve(options);
25-
})
26-
.catch((error) => {
27-
reject(error);
28-
});
8+
const debouncedListGroup = debounce(GroupApi.listGroup, 500, {
9+
leading: true,
10+
trailing: false,
2911
});
3012

31-
const parse = (value) => {
32-
if (value) {
33-
return value.value;
34-
}
35-
return undefined;
13+
export const loadGroupOptions = async (inputValue) => {
14+
const { data: groupListType } = await debouncedListGroup();
15+
const { group = [] } = groupListType;
16+
let filterOps = group;
17+
if (inputValue && inputValue !== '*') { filterOps = group.filter((f) => f.groupName.toLowerCase().includes(inputValue.toLowerCase())); }
18+
const options = filterOps.map((f) => ({
19+
label: f.groupName,
20+
value: f.groupName,
21+
}));
22+
return options;
3623
};
3724

25+
const parse = (value) => value?.value;
26+
3827
export default function GroupSelect(props) {
3928
return (
4029
<Field

src/components/job/JobTypeSelect.jsx

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/components/jobtype/JobTypeSelect.jsx

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,28 @@
11
import React from 'react';
22
import { Field } from 'redux-form';
3+
import debounce from 'lodash.debounce';
34

4-
import { taskdefinition as api } from '@vidispine/vdt-api';
5+
import { taskdefinition as TaskDefinitionApi } from '@vidispine/vdt-api';
56
import Select from '../ui/Select';
67

7-
export const loadJobTypeOptions = (inputValue) => new Promise((resolve, reject) => {
8-
api.listJobType()
9-
.then((response) => {
10-
if (!response.ok) {
11-
throw new Error(response.statusText);
12-
}
13-
return response.json();
14-
})
15-
.then((jsonDocument) => {
16-
const { uri = [] } = jsonDocument;
17-
let filterFields = uri;
18-
if (inputValue && inputValue !== '*') {
19-
filterFields = uri.filter((f) => f.toLowerCase().includes(inputValue.toLowerCase()));
20-
}
21-
const options = filterFields.map((f) => ({ label: f, value: f }));
22-
resolve(options);
23-
})
24-
.catch((error) => {
25-
reject(error);
26-
});
8+
const debouncedListJobType = debounce(TaskDefinitionApi.listJobType, 500, {
9+
leading: true,
10+
trailing: false,
2711
});
2812

29-
const parse = (value) => {
30-
if (value) {
31-
return value.value;
13+
export const loadJobTypeOptions = async (inputValue) => {
14+
const { data: uriListType } = await debouncedListJobType();
15+
const { uri = [] } = uriListType;
16+
let filterFields = uri;
17+
if (inputValue && inputValue !== '*') {
18+
filterFields = uri.filter((f) => f.toLowerCase().includes(inputValue.toLowerCase()));
3219
}
33-
return undefined;
20+
const options = filterFields.map((f) => ({ label: f, value: f }));
21+
return options;
3422
};
3523

24+
const parse = (value) => value?.value;
25+
3626
export default function JobTypeSelect(props) {
3727
return (
3828
<Field

src/components/metadatafield/MetadataFieldSelect.jsx

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { Field } from 'redux-form';
3-
import { metadatafield as api } from '@vidispine/vdt-api';
3+
import { metadatafield as MetadataFieldApi } from '@vidispine/vdt-api';
44
import debounce from 'lodash.debounce';
55

66
import Select from '../ui/Select';
@@ -38,46 +38,30 @@ const TRANSIENT_FIELDS = [
3838
{ name: '__deletion_lock_expiry' },
3939
];
4040

41-
// eslint-disable-next-line no-underscore-dangle
42-
const _listMetadataField = debounce(api.listMetadataField, 500, { leading: true, trailing: false });
41+
const debouncedListMetadataField = debounce(
42+
MetadataFieldApi.listMetadataField,
43+
500,
44+
{ leading: true, trailing: false },
45+
);
4346

44-
export const loadMetadataFieldOptions = (inputValue) => new Promise((resolve, reject) => {
45-
_listMetadataField()
46-
.then((response) => {
47-
if (!response.ok) {
48-
throw new Error(response.statusText);
49-
}
50-
return response.json();
51-
})
52-
.then((jsonDocument) => {
53-
const { field = [] } = jsonDocument;
54-
const fieldList = field.concat(TRANSIENT_FIELDS);
55-
let filterFields = fieldList;
56-
if (inputValue && inputValue !== '*') {
57-
const inputValueLower = inputValue.toLowerCase();
58-
filterFields = fieldList.filter((f) => f.name.toLowerCase().includes(inputValueLower));
59-
}
60-
const options = filterFields.map((f) => ({ label: f.name, value: f.name }));
61-
resolve(options);
62-
})
63-
.catch((error) => {
64-
reject(error);
65-
});
66-
});
67-
68-
// export const loadMetadataFieldOptions = debounce(
69-
// _loadMetadataFieldOptions,
70-
// 500,
71-
// { leading: true, trailing: false },
72-
// );
73-
74-
const parse = (value) => {
75-
if (value) {
76-
return value.value;
47+
export const loadMetadataFieldOptions = async (inputValue) => {
48+
const { data: fieldListType } = await debouncedListMetadataField();
49+
const { field = [] } = fieldListType;
50+
const fieldList = field.concat(TRANSIENT_FIELDS);
51+
let filterFields = fieldList;
52+
if (inputValue && inputValue !== '*') {
53+
const inputValueLower = inputValue.toLowerCase();
54+
filterFields = fieldList.filter((f) => f.name.toLowerCase().includes(inputValueLower));
7755
}
78-
return undefined;
56+
const options = filterFields.map((f) => ({
57+
label: f.name,
58+
value: f.name,
59+
}));
60+
return options;
7961
};
8062

63+
const parse = (value) => value?.value;
64+
8165
export default function MetadataFieldSelect(props) {
8266
return (
8367
<Field

0 commit comments

Comments
 (0)