Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(resource): upload video (DEV-204) #577

Merged
merged 29 commits into from Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
99f1619
feat(resource): upload video
kilchenmann Nov 5, 2021
394e09e
feat(resource): upload video
kilchenmann Nov 5, 2021
6d662ab
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Nov 5, 2021
f6c0847
feat(resource): upload video
kilchenmann Nov 9, 2021
07f2f24
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Nov 12, 2021
fd20165
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Nov 12, 2021
e1d1680
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Nov 12, 2021
69a494c
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Nov 30, 2021
73a1e35
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Dec 3, 2021
ee88e41
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Dec 3, 2021
dc1a791
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Dec 8, 2021
8def5be
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Dec 8, 2021
c7460f7
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Dec 8, 2021
1ad4218
fix(upload): bug fix after merge conflict
kilchenmann Dec 8, 2021
c6d3d57
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Jan 6, 2022
21c21e7
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Jan 18, 2022
6f60496
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Feb 1, 2022
9053f2c
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Mar 15, 2022
d339a1c
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Mar 21, 2022
a796f74
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Mar 21, 2022
c236a6d
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Mar 23, 2022
7bacb1a
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Apr 1, 2022
9c6b9eb
chore(deps): update package-lock after running npm i
kilchenmann Apr 1, 2022
e721ed4
chore(deps): bump js-lib to latest
kilchenmann Apr 1, 2022
8e2a067
style(resource-instance): optimize submit button
kilchenmann Apr 1, 2022
565464b
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Apr 4, 2022
def48cf
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Apr 6, 2022
9bb22b9
refactor(upload): remove commented code
kilchenmann Apr 6, 2022
899ad1e
Merge branch 'main' into wip/dev-204-upload-video
kilchenmann Apr 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -34,7 +34,7 @@
"@angular/platform-browser-dynamic": "^13.2.6",
"@angular/router": "^13.2.6",
"@ckeditor/ckeditor5-angular": "^2.0.2",
"@dasch-swiss/dsp-js": "^7.0.1",
"@dasch-swiss/dsp-js": "^7.0.2",
"@datadog/browser-rum": "^3.11.0",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "6.0.0",
Expand Down
Expand Up @@ -6,11 +6,13 @@ import {
CreateAudioFileValue,
CreateDocumentFileValue,
CreateFileValue,
CreateMovingImageFileValue,
CreateStillImageFileValue,
UpdateArchiveFileValue,
UpdateAudioFileValue,
UpdateDocumentFileValue,
UpdateFileValue,
UpdateMovingImageFileValue,
UpdateStillImageFileValue
} from '@dasch-swiss/dsp-js';
import { NotificationService } from 'src/app/main/services/notification.service';
Expand Down Expand Up @@ -46,6 +48,7 @@ export class UploadComponent implements OnInit {
supportedImageTypes = ['image/jpeg', 'image/jp2', 'image/tiff', 'image/tiff-fx', 'image/png'];
supportedDocumentTypes = ['application/pdf'];
supportedAudioTypes = ['audio/mpeg'];
supportedVideoTypes = ['video/mp4'];
supportedArchiveTypes = ['application/zip', 'application/x-tar', 'application/gzip'];

constructor(
Expand Down Expand Up @@ -101,8 +104,8 @@ export class UploadComponent implements OnInit {
case 'document':
// the preview thumbnail is deactivated for the moment;
// --> TODO: it will be activated as soon as we implement a pdf viewer
// this.thumbnailUrl = res.uploadedFiles[0].temporaryUrl;
this.thumbnailUrl = undefined;
this.thumbnailUrl = res.uploadedFiles[0].temporaryUrl;
// this.thumbnailUrl = undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can probably be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 9bb22b9

break;

default:
Expand Down Expand Up @@ -224,6 +227,10 @@ export class UploadComponent implements OnInit {
fileValue = new CreateAudioFileValue();
break;

case 'movingImage':
fileValue = new CreateMovingImageFileValue();
break;

case 'archive':
fileValue = new CreateArchiveFileValue();
break;
Expand Down Expand Up @@ -268,6 +275,10 @@ export class UploadComponent implements OnInit {
fileValue = new UpdateAudioFileValue();
break;

case 'movingImage':
fileValue = new UpdateMovingImageFileValue();
break;

case 'archive':
fileValue = new UpdateArchiveFileValue();
break;
Expand Down Expand Up @@ -311,6 +322,10 @@ export class UploadComponent implements OnInit {
this.allowedFileTypes = this.supportedAudioTypes;
break;

case 'movingImage':
this.allowedFileTypes = this.supportedVideoTypes;
break;

case 'archive':
this.allowedFileTypes = this.supportedArchiveTypes;
break;
Expand Down
Expand Up @@ -88,8 +88,10 @@
</button>
<span class="fill-remaining-space"></span>
<span>
<button mat-raised-button type="submit" color="primary" class="form-submit" [disabled]="!propertiesParentForm.valid">
{{ 'appLabels.form.action.submit' | translate}}
<button mat-raised-button type="submit" [color]="error ? 'warn' : 'primary'" class="form-submit" [disabled]="!propertiesParentForm.valid">
<app-progress-indicator *ngIf="loading && !error" [color]="'white'" [status]="0" class="submit-progress"></app-progress-indicator>
<mat-icon *ngIf="!loading && error">close</mat-icon>
{{ !loading && error ? ('appLabels.form.action.retry' | translate) : ('appLabels.form.action.submit' | translate) }}
</button>
</span>
</div>
Expand Down
Expand Up @@ -79,6 +79,9 @@ export class ResourceInstanceFormComponent implements OnInit, OnDestroy {

valueOperationEventSubscription: Subscription;

loading = false;
// in case of any error
error = false;
errorMessage: any;

propertiesObj = {};
Expand Down Expand Up @@ -155,6 +158,8 @@ export class ResourceInstanceFormComponent implements OnInit, OnDestroy {

submitData() {

this.loading = true;

if (this.propertiesParentForm.valid) {

const createResource = new CreateResource();
Expand Down Expand Up @@ -193,6 +198,9 @@ export class ResourceInstanceFormComponent implements OnInit, OnDestroy {
case 'audio':
this.propertiesObj[Constants.HasAudioFileValue] = [this.fileValue];
break;
case 'movingImage':
this.propertiesObj[Constants.HasMovingImageFileValue] = [this.fileValue];
break;
case 'archive':
this.propertiesObj[Constants.HasArchiveFileValue] = [this.fileValue];
}
Expand All @@ -212,6 +220,8 @@ export class ResourceInstanceFormComponent implements OnInit, OnDestroy {
this.closeDialog.emit();
},
(error: ApiResponseError) => {
this.error = true;
this.loading = false;
this._errorHandler.showMessage(error);
}
);
Expand Down Expand Up @@ -366,7 +376,9 @@ export class ResourceInstanceFormComponent implements OnInit, OnDestroy {
prop.id !== Constants.HasStillImageFileValue &&
prop.id !== Constants.HasDocumentFileValue &&
prop.id !== Constants.HasAudioFileValue &&
prop.id !== Constants.HasArchiveFileValue // --> TODO for UPLOAD: expand with other representation file values
prop.id !== Constants.HasMovingImageFileValue &&
prop.id !== Constants.HasArchiveFileValue
// --> TODO for UPLOAD: expand with other representation file values
);

if (onto.properties[Constants.HasStillImageFileValue]) {
Expand All @@ -375,6 +387,8 @@ export class ResourceInstanceFormComponent implements OnInit, OnDestroy {
this.hasFileValue = 'document';
} else if (onto.properties[Constants.HasAudioFileValue]) {
this.hasFileValue = 'audio';
} else if (onto.properties[Constants.HasMovingImageFileValue]) {
this.hasFileValue = 'movingImage';
} else if (onto.properties[Constants.HasArchiveFileValue]) {
this.hasFileValue = 'archive';
} else {
Expand Down
Expand Up @@ -35,7 +35,6 @@ export class TextValueAsStringComponent extends BaseValueDirective implements On
editor: Editor;
editorConfig;


constructor(@Inject(FormBuilder) private _fb: FormBuilder) {
super();
}
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/en.json
Expand Up @@ -48,6 +48,8 @@
"cancel": "Cancel",
"close": "Close",
"submit": "Save",
"submitting": "Submitting",
"retry": "Retry",
"add": "Add",
"update": "Update",
"next": "Next",
Expand Down
4 changes: 4 additions & 0 deletions src/assets/style/_layout.scss
Expand Up @@ -176,6 +176,10 @@
text-align: right;
}

.inline {
display: inline-flex;
}

// --------------------------------------

// ?-?-?-?-?-?-?-?-?-?-?-?-?-?-?-?-?-?-
Expand Down