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

Bc 5170 no preview for larger files #4457

Merged
merged 43 commits into from
Oct 27, 2023

Conversation

SevenWaysDP
Copy link
Contributor

@SevenWaysDP SevenWaysDP commented Oct 5, 2023

Description

Links to Tickets or other pull requests

Changes

Datasecurity

Deployment

New Repos, NPM pakages or vendor scripts

Approval for review

  • DEV: If api was changed - generate-client:server was executed in vue frontend and changes were tested and put in a PR with the same branch name.
  • QA: In addition to review, the code has been manually tested (if manual testing is possible)
  • All points were discussed with the ticket creator, support-team or product owner. The code upholds all quality guidelines from the PR-template.

Notice: Please remove the WIP label if the PR is ready to review, otherwise nobody will review it.

@SevenWaysDP SevenWaysDP added the WIP This feature branch is in progress, do not merge into master. label Oct 5, 2023
@SevenWaysDP SevenWaysDP requested review from bischofmax and CeEv October 9, 2023 13:44
Copy link
Contributor Author

@SevenWaysDP SevenWaysDP left a comment

Choose a reason for hiding this comment

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

api-configmap
api-secret

private readonly logger: LegacyLogger,
protected readonly configService: ConfigService<any, true>
) {
super(amqpConnection, FilesPreviewExchange, configService.get('INCOMING_REQUEST_TIMEOUT'));
Copy link
Contributor

Choose a reason for hiding this comment

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

Ist configService.get('INCOMING_REQUEST_TIMEOUT') inzwischen Typ sicher? Kannst du das vorher auf eine const schreiben?

@@ -0,0 +1,7 @@
import { Configuration } from '@hpi-schul-cloud/commons/lib';

export const FilesPreviewExchange = Configuration.get('FILES_STORAGE__EXCHANGE') as string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Können wir die direkte Verwendung von Configuration hier vermeiden?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Leider wollte Phillip, das wir exchanges konfigurierbar machen. Deswegen ist das so.

Copy link
Contributor

Choose a reason for hiding this comment

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

Todo: Follow up Ticket für Umstellung auf nest config.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

{
name: FilesPreviewExchange,
type: 'direct',
},
],
uri: Configuration.get('RABBITMQ_URI') as string,
Copy link
Contributor

Choose a reason for hiding this comment

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

Hier haben wir auch eine versteckte Zuweisung der Envirement.

Copy link
Contributor

Choose a reason for hiding this comment

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

Todo: Follow up Ticket für Umstellung auf nest config.

ansible/roles/schulcloud-server-core/tasks/main.yml Outdated Show resolved Hide resolved
ansible/roles/schulcloud-server-core/tasks/main.yml Outdated Show resolved Hide resolved
ansible/roles/schulcloud-server-core/tasks/main.yml Outdated Show resolved Hide resolved
ansible/roles/schulcloud-server-core/tasks/main.yml Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
Comment on lines 10 to 12
idleReplicaCount: 1
minReplicaCount: 1
maxReplicaCount: 5
Copy link
Member

Choose a reason for hiding this comment

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

Make this tree configurable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it so correct ?

Suggested change
idleReplicaCount: 1
minReplicaCount: 1
maxReplicaCount: 5
idleReplicaCount: {{ AMQP_FILE_PREVIEW_IDLE_REPLICA_COUNT|default("1", true) }}
minReplicaCount: {{ AMQP_FILE_PREVIEW_MIN_REPLICA_COUNT|default("1", true) }}
maxReplicaCount: {{ AMQP_FILE_PREVIEW_MAX_REPLICA_COUNT|default("5", true) }}

@SevenWaysDP SevenWaysDP removed the WIP This feature branch is in progress, do not merge into master. label Oct 26, 2023
@SevenWaysDP SevenWaysDP requested review from CeEv and mamutmk5 October 26, 2023 09:09
@@ -38,3 +39,21 @@ export function createFileRecord(

return entity;
}

export function getFormat(mimeType: string): string {
const format = mimeType.split('/')[1];
Copy link
Contributor

Choose a reason for hiding this comment

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

validation fehlt ...was ist wenn [0] bzw. [1] undefined ist Das muss behandelt werden.

return fileRecord.name;
}

const fileNameWithoutExtension = fileRecord.name.split('.')[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

Das gleiche validation von [0] !== undefined bzw. die Behandlung dessen.
Ich würde das gerne auch nach fileRecord verlagern. FileRecord.getFileNameWithoutExtension()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Das kann nicht geben

@SevenWaysDP SevenWaysDP requested a review from CeEv October 26, 2023 10:45
@@ -293,4 +293,10 @@ export class FileRecord extends BaseEntityWithTimestamps {

return PreviewStatus.PREVIEW_NOT_POSSIBLE_SCAN_STATUS_ERROR;
}

public get fileNameWithoutExtension(): string {
const fileNameWithoutExtension = this.name.split('.')[0];
Copy link
Contributor

@CeEv CeEv Oct 26, 2023

Choose a reason for hiding this comment

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

Das kann auch ein undefined zurück liefern, wenn nach dem Split in [0] nichts vorhanden ist.
Wenn es schon nicht behandelt wird, dann müsste zumindest der return Wert string | undefined sein.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nein? Wir haben immer ein string im name auch wenn das leer ist wird zu ""

Copy link
Contributor Author

Choose a reason for hiding this comment

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

im spec ist auch ein test dazu

Copy link
Contributor

@CeEv CeEv Oct 26, 2023

Choose a reason for hiding this comment

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

Stimmt das liefert immer "" zurück.
Nur ".bild.123.jpg" als Test hinfügen und sollte dann ".bild.123" zurück liefern.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@SevenWaysDP SevenWaysDP merged commit 84c44c1 into main Oct 27, 2023
46 checks passed
@SevenWaysDP SevenWaysDP deleted the BC-5170-no-preview-for-larger-files branch October 27, 2023 06:56
bergatco pushed a commit that referenced this pull request Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants