@imposium-hub/components 1.27.1 → 1.28.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imposium-hub/components",
3
- "version": "1.27.1",
3
+ "version": "1.28.0",
4
4
  "description": "React & Typescript component / asset library for Imposium front-ends",
5
5
  "main": "dist/components.js",
6
6
  "scripts": {
@@ -42,7 +42,7 @@ export const getAssets = (api : IImposiumAPI, storyId : string) : any => {
42
42
  dispatch(toggleLoading(true));
43
43
  }
44
44
 
45
- api.getAssets(assetFilters, storyId)
45
+ api.getAssets(assetFilters, storyId, true)
46
46
  .then((assetList : any) => {
47
47
  dispatch({type: assetActions.GET, assetList});
48
48
  dispatch(toggleLoading(false));
@@ -1,4 +1,5 @@
1
1
  import IImposiumAPI from '../../services/API';
2
+ import {doAssetTableHydration} from './asset-list';
2
3
 
3
4
  const assetUploadsActions : any = {
4
5
  TOGGLE_AUTO_TAG: 'assetUploads/TOGGLE_AUTO_TAG',
@@ -54,10 +55,13 @@ export const uploadAssets = (api : IImposiumAPI, files : File[], storyId : strin
54
55
  return {
55
56
  footageId: f[0].id,
56
57
  jobId: f[0].job_id,
57
- onProcessed: () => dispatch({
58
- type: assetUploadsActions.REMOVE_UPLOAD,
59
- filename: uploadBlobs[i].filename
60
- })
58
+ onProcessed: () => {
59
+ dispatch({
60
+ type: assetUploadsActions.REMOVE_UPLOAD,
61
+ filename: uploadBlobs[i].filename
62
+ });
63
+ doAssetTableHydration(api, storyId);
64
+ }
61
65
  };
62
66
  });
63
67
 
@@ -69,6 +73,7 @@ export const uploadAssets = (api : IImposiumAPI, files : File[], storyId : strin
69
73
  type: assetUploadsActions.REMOVE_UPLOAD,
70
74
  filename: uploadBlobs[i].filename
71
75
  });
76
+ doAssetTableHydration(api, storyId);
72
77
  }
73
78
 
74
79
  return jobIdExists;
@@ -94,7 +99,8 @@ const pollAssetJobs = (api, ongoingJobs : any[], timeout : number) : void => {
94
99
  let processedJob : any;
95
100
 
96
101
  ongoingJobResults.forEach((ongoingJobResult : any) => {
97
- if (!ongoingJobResult.processing) {
102
+
103
+ if (ongoingJobResult.status === 'processing' || ongoingJobResult.status === 'completed') {
98
104
  processedJob = ongoingJobs
99
105
  .find((ongoingJob : any) => (ongoingJob.jobId === ongoingJobResult.id));
100
106
 
@@ -104,6 +110,7 @@ const pollAssetJobs = (api, ongoingJobs : any[], timeout : number) : void => {
104
110
  .filter((ongoingJob : any) => (ongoingJob.jobId !== ongoingJobResult.id));
105
111
  }
106
112
  }
113
+ // TODO: handle errored out
107
114
  });
108
115
 
109
116
  if (ongoingJobs.length > 0) {
package/services/API.ts CHANGED
@@ -252,10 +252,9 @@ export default class API {
252
252
  });
253
253
  }
254
254
 
255
- public getAssets = (filters : any, storyId : string) : Promise<any | Error> => {
255
+ public getAssets = (filters : any, storyId : string, unprocessed = false) : Promise<any | Error> => {
256
256
 
257
- // TODO: add story_id filtering
258
- let parameterizedRoute : string = `/assets?items_per_page=50&optional_story_id=${storyId}`;
257
+ let parameterizedRoute : string = `/assets?items_per_page=50&optional_story_id=${storyId}&unprocessed=${unprocessed}`;
259
258
  let tagsSplit : string[];
260
259
 
261
260
  for (const key in filters) {