Skip to content
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vidispine/admin-tool",
"version": "24.3.0",
"version": "24.3.1",
"private": true,
"dependencies": {
"@devbookhq/splitter": "^1.3.2",
Expand Down
48 changes: 19 additions & 29 deletions src/components/exportlocation/ExportLocationSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,32 @@ import React from 'react';
import { Field } from 'redux-form';
import debounce from 'lodash.debounce';

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

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

export const loadExportLocationOptions = (inputValue) => new Promise((resolve, reject) => {
_listExportLocation()
.then((response) => {
if (!response.ok) {
throw new Error(response.statusText);
}
return response.json();
})
.then((jsonDocument) => {
const { exportLocation = [] } = jsonDocument;
let filterExportLocation = exportLocation;
if (inputValue && inputValue !== '*') filterExportLocation = exportLocation.filter((f) => f.name.toLowerCase().includes(inputValue.toLowerCase()));
const options = filterExportLocation.map((f) => ({ label: f.name, value: f.name }));
resolve(options);
})
.catch((error) => {
reject(error);
});
});

const parse = (value) => {
if (value) {
return value.value;
export const loadExportLocationOptions = async (inputValue) => {
const { data: exportLocationListType } = await debounceListExportLocation();
const { exportLocation = [] } = exportLocationListType;
let filterExportLocation = exportLocation;
if (inputValue && inputValue !== '*') {
filterExportLocation = exportLocation
.filter((f) => f.name.toLowerCase().includes(inputValue.toLowerCase()));
}
return undefined;
const options = filterExportLocation.map((f) => ({
label: f.name,
value: f.name,
}));
return options;
};

const parse = (value) => value?.value;

export default function ExportLocationSelect(props) {
return (
<Field
Expand Down
42 changes: 14 additions & 28 deletions src/components/fieldgroup/FieldGroupSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,27 @@ import React from 'react';
import { Field } from 'redux-form';
import debounce from 'lodash.debounce';

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

// eslint-disable-next-line no-underscore-dangle
const _listFieldGroup = debounce(api.listFieldGroup, 500, { leading: true, trailing: false });

export const loadFieldGroupOptions = (inputValue) => new Promise((resolve, reject) => {
_listFieldGroup()
.then((response) => {
if (!response.ok) {
throw new Error(response.statusText);
}
return response.json();
})
.then((jsonDocument) => {
const { group = [] } = jsonDocument;
let filterFields = group;
if (inputValue && inputValue !== '*') {
filterFields = group.filter((f) => f.name.toLowerCase().includes(inputValue.toLowerCase()));
}
const options = filterFields.map((f) => ({ label: f.name, value: f.name }));
resolve(options);
})
.catch((error) => {
reject(error);
});
const debouncedListFieldGroup = debounce(FieldGroupApi.listFieldGroup, 500, {
leading: true,
trailing: false,
});

const parse = (value) => {
if (value) {
return value.value;
export const loadFieldGroupOptions = async (inputValue) => {
const { data: fieldgroupListType } = await debouncedListFieldGroup();
const { group = [] } = fieldgroupListType;
let filterFields = group;
if (inputValue && inputValue !== '*') {
filterFields = group.filter((f) => f.name.toLowerCase().includes(inputValue.toLowerCase()));
}
return undefined;
const options = filterFields.map((f) => ({ label: f.name, value: f.name }));
return options;
};

const parse = (value) => value?.value;

export default function FieldGroupSelect(props) {
return (
<Field
Expand Down
43 changes: 16 additions & 27 deletions src/components/group/GroupSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,28 @@ import React from 'react';
import { Field } from 'redux-form';
import debounce from 'lodash.debounce';

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

// eslint-disable-next-line no-underscore-dangle
const _listGroup = debounce(api.listGroup, 500, { leading: true, trailing: false });

export const loadGroupOptions = (inputValue) => new Promise((resolve, reject) => {
_listGroup()
.then((response) => {
if (!response.ok) {
throw new Error(response.statusText);
}
return response.json();
})
.then((jsonDocument) => {
const { group = [] } = jsonDocument;
let filterOps = group;
if (inputValue && inputValue !== '*') filterOps = group.filter((f) => f.groupName.toLowerCase().includes(inputValue.toLowerCase()));
const options = filterOps.map((f) => ({ label: f.groupName, value: f.groupName }));
resolve(options);
})
.catch((error) => {
reject(error);
});
const debouncedListGroup = debounce(GroupApi.listGroup, 500, {
leading: true,
trailing: false,
});

const parse = (value) => {
if (value) {
return value.value;
}
return undefined;
export const loadGroupOptions = async (inputValue) => {
const { data: groupListType } = await debouncedListGroup();
const { group = [] } = groupListType;
let filterOps = group;
if (inputValue && inputValue !== '*') { filterOps = group.filter((f) => f.groupName.toLowerCase().includes(inputValue.toLowerCase())); }
const options = filterOps.map((f) => ({
label: f.groupName,
value: f.groupName,
}));
return options;
};

const parse = (value) => value?.value;

export default function GroupSelect(props) {
return (
<Field
Expand Down
51 changes: 0 additions & 51 deletions src/components/job/JobTypeSelect.jsx

This file was deleted.

40 changes: 15 additions & 25 deletions src/components/jobtype/JobTypeSelect.jsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,28 @@
import React from 'react';
import { Field } from 'redux-form';
import debounce from 'lodash.debounce';

import { taskdefinition as api } from '@vidispine/vdt-api';
import { taskdefinition as TaskDefinitionApi } from '@vidispine/vdt-api';
import Select from '../ui/Select';

export const loadJobTypeOptions = (inputValue) => new Promise((resolve, reject) => {
api.listJobType()
.then((response) => {
if (!response.ok) {
throw new Error(response.statusText);
}
return response.json();
})
.then((jsonDocument) => {
const { uri = [] } = jsonDocument;
let filterFields = uri;
if (inputValue && inputValue !== '*') {
filterFields = uri.filter((f) => f.toLowerCase().includes(inputValue.toLowerCase()));
}
const options = filterFields.map((f) => ({ label: f, value: f }));
resolve(options);
})
.catch((error) => {
reject(error);
});
const debouncedListJobType = debounce(TaskDefinitionApi.listJobType, 500, {
leading: true,
trailing: false,
});

const parse = (value) => {
if (value) {
return value.value;
export const loadJobTypeOptions = async (inputValue) => {
const { data: uriListType } = await debouncedListJobType();
const { uri = [] } = uriListType;
let filterFields = uri;
if (inputValue && inputValue !== '*') {
filterFields = uri.filter((f) => f.toLowerCase().includes(inputValue.toLowerCase()));
}
return undefined;
const options = filterFields.map((f) => ({ label: f, value: f }));
return options;
};

const parse = (value) => value?.value;

export default function JobTypeSelect(props) {
return (
<Field
Expand Down
58 changes: 21 additions & 37 deletions src/components/metadatafield/MetadataFieldSelect.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Field } from 'redux-form';
import { metadatafield as api } from '@vidispine/vdt-api';
import { metadatafield as MetadataFieldApi } from '@vidispine/vdt-api';
import debounce from 'lodash.debounce';

import Select from '../ui/Select';
Expand Down Expand Up @@ -38,46 +38,30 @@ const TRANSIENT_FIELDS = [
{ name: '__deletion_lock_expiry' },
];

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

export const loadMetadataFieldOptions = (inputValue) => new Promise((resolve, reject) => {
_listMetadataField()
.then((response) => {
if (!response.ok) {
throw new Error(response.statusText);
}
return response.json();
})
.then((jsonDocument) => {
const { field = [] } = jsonDocument;
const fieldList = field.concat(TRANSIENT_FIELDS);
let filterFields = fieldList;
if (inputValue && inputValue !== '*') {
const inputValueLower = inputValue.toLowerCase();
filterFields = fieldList.filter((f) => f.name.toLowerCase().includes(inputValueLower));
}
const options = filterFields.map((f) => ({ label: f.name, value: f.name }));
resolve(options);
})
.catch((error) => {
reject(error);
});
});

// export const loadMetadataFieldOptions = debounce(
// _loadMetadataFieldOptions,
// 500,
// { leading: true, trailing: false },
// );

const parse = (value) => {
if (value) {
return value.value;
export const loadMetadataFieldOptions = async (inputValue) => {
const { data: fieldListType } = await debouncedListMetadataField();
const { field = [] } = fieldListType;
const fieldList = field.concat(TRANSIENT_FIELDS);
let filterFields = fieldList;
if (inputValue && inputValue !== '*') {
const inputValueLower = inputValue.toLowerCase();
filterFields = fieldList.filter((f) => f.name.toLowerCase().includes(inputValueLower));
}
return undefined;
const options = filterFields.map((f) => ({
label: f.name,
value: f.name,
}));
return options;
};

const parse = (value) => value?.value;

export default function MetadataFieldSelect(props) {
return (
<Field
Expand Down
Loading
Loading