Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/annaojdowska/kiohub
Browse files Browse the repository at this point in the history
  • Loading branch information
annaojdowska committed Dec 1, 2018
2 parents 3eed6e8 + e975fea commit 0962f38
Show file tree
Hide file tree
Showing 23 changed files with 123 additions and 214 deletions.
2 changes: 1 addition & 1 deletion kiohub-client/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="container">
<app-menu-bar [style.display]="display" *ngIf="isLogged == true"></app-menu-bar>
<app-menu-bar [style.display]="display" *ngIf="isLogged == true" hideSearch={{isOnUnloggedSearch}}></app-menu-bar>
<app-menu-bar-not-logged [style.display]="display" *ngIf="isLogged == false"></app-menu-bar-not-logged>
<app-content-container></app-content-container>
<app-footer [style.display]="display"></app-footer>
Expand Down
9 changes: 9 additions & 0 deletions kiohub-client/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ export class AppComponent implements OnInit {
currentUser: User;
private valueUtils = new ValueUtils();
public display = 'block';
public isOnUnloggedSearch: boolean;

public constructor(@Inject(UserService) private userService: UserService,
@Inject(Router) private router: Router) {
this.detectInternetExplorer();
this.isOnUnloggedSearch = this.isOnUnloggedSearchPage();
}

ngOnInit(): void {
Expand Down Expand Up @@ -54,4 +56,11 @@ export class AppComponent implements OnInit {
&& !this.valueUtils.isNullOrEmpty(window.location.pathname)
&& window.location.pathname === '/ie-detected';
}

private isOnUnloggedSearchPage(): boolean {
console.log(window.location.pathname);
console.log(window.location.pathname === '/**');
console.log(window.location.pathname === '/home');
return (window.location.pathname === '/**' || window.location.pathname === '/home');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -651,15 +651,26 @@ export class EditProjectGeneralTabComponent implements OnInit {
.subscribe(data => {
infoString = 'Pomyślnie cofnięto publikację projektu na stronie.';
this.viewUtils.scrollToTop();
this.onCompleted(infoString, ErrorType.SUCCESS);
this.onCompletedFIXME(infoString, ErrorType.SUCCESS);
console.log(data);
}, error => {
infoString = 'Nie udało się cofnąć publikacji projektu na stronie.';
this.viewUtils.scrollToTop();
this.onCompleted(infoString, ErrorType.ERROR);
this.onCompletedFIXME(infoString, ErrorType.ERROR);
console.log(error);
});
}

onCompletedFIXME(text: string, errorType: ErrorType) { // TODO usunac
this.uploadInfoSpinner.setDisplay(false);
this.valueUtils.saveToSession(this.valueUtils.updatedProjectBoolean, true);
this.valueUtils.saveToSession(this.valueUtils.updatedProjectText, text);
this.valueUtils.saveToSession(this.valueUtils.updatedProjectStatus, errorType);
this.projectAttachmentsUpdatingInProgress = false;

// window.location.reload();
}

isUserSupervisor(): boolean {
return this.isLoggedUserSupervisor;
}
Expand Down
2 changes: 1 addition & 1 deletion kiohub-client/src/app/menu-bar/menu-bar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div class="margin_extreme_right" *ngIf="isUserDefined()">
<label class="menu_label">{{currentUser.firstName}} {{currentUser.lastName}}</label>
</div>
<app-search-input id=search-input resizable='true'></app-search-input>
<app-search-input id=search-input resizable='true' [style.display]="displaySearch"></app-search-input>
</div>
</div>
</div>
11 changes: 10 additions & 1 deletion kiohub-client/src/app/menu-bar/menu-bar.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Inject, OnInit } from '@angular/core';
import { Component, Inject, OnInit, Input } from '@angular/core';
import { User } from '../model/user.interface';
import { address } from '../services/project.service';
import { UserService } from '../services/user.service';
Expand All @@ -13,11 +13,20 @@ export class MenuBarComponent implements OnInit {
pathToLogo: string;
currentUser: User;
valueUtils = new ValueUtils();
@Input() hideSearch;
displaySearch;

private addressToLogOut = address + '/login/logout';
constructor(@Inject(UserService) private userService: UserService) {
this.pathToLogo = '../../assets/logo/logo4.png';
}

hideSearchIfNecessary(): any {
this.displaySearch = this.valueUtils.setDisplay(this.hideSearch !== 'true');
}

ngOnInit() {
this.hideSearchIfNecessary();
this.userService.getCurrentUser().subscribe(x => this.currentUser = x);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<app-error-info #previewModeInfo errorText="Ten projekt nie został jeszcze opublikowany. Znajdujesz się w trybie podglądu dostępnym tylko dla współautorów projektu"
<app-error-info #previewModeInfo errorText="Ten projekt nie został jeszcze opublikowany. Znajdujesz się w trybie podglądu dostępnym tylko dla współautorów projektu."
errorType="WARNING"></app-error-info>

<div class="right-top" *ngIf="loggedIsCollaborator" matTooltip="Edytuj">
<div class="right-top" *ngIf="loggedIsCollaborator">
<a href="/edit-project/{{project?.id}}" class="submit-button mat-stroked-button edit">
Edytuj
</a>
Expand Down Expand Up @@ -114,7 +114,7 @@ <h4>Powiązane projekty</h4>
<div id="list">
<li class="relatedProjectHover" *ngFor="let relatedProject of relatedProjects">
<img id="bullet-character" src="../../assets/bullet-character.png" />
<a [routerLink]="['/details/', relatedProject?.id]">{{relatedProject?.title}}</a>
<a href="/details/{{relatedProject?.id}}">{{relatedProject?.title}}</a>
</li>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions kiohub-client/src/app/project-view/project-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export class ProjectViewComponent implements OnInit, FileDownloaderView {
this.getItem(this.id).then(project => {
if (!project.published) {
this.previewModeInfo.setDisplay(true);
} else {
this.previewModeInfo.setDisplay(false);
}
this.project = project;
this.initData(this.project.id);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="left-top-wrapper " *ngIf='pinned'>
<img src="assets/pin.png" class="left-top" matTooltip="Przypięty">
<img src="assets/pin.png" class="left-top" matTooltip="Ten projekt jest przypięty">
</div>
<div class="left-top-wrapper " *ngIf='allowCollaboratedIcon && collaborated'>
<img src="assets/authors.png" class="left-top" matTooltip="Bierzesz udział w tym projekcie ">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
.project_image {
max-width: 8vw;
max-height: 15vh;
float: left;
margin-right: 1vw;
}

#info {
Expand Down Expand Up @@ -54,4 +51,13 @@ h3 {
#publication-state {
font-style: italic;
color: var(--color-gray);
}

.img-wrapper {
width: 8vw;
display: block;
max-height: 15vw;
float: left;
margin-right: 1vw;
text-align: center;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
class="options" [projectId]="project.id"></app-search-result-single-project-options>
<div id="inner_content" (click)="navigateToDetails()">
<div *ngIf="!showDefault; else noImageFound">
<img class="project_image" *ngIf="mainPhoto" [src]="mainPhoto">
<div class="img-wrapper">
<img class="project_image" *ngIf="mainPhoto" [src]="mainPhoto">
</div>
</div>
<div id="project_image_container">
<ng-template #noImageFound>
<img class="project_image" [src]="brokenImage" alt="Uszkodzony plik">
<div class="img-wrapper">
<img class="project_image" [src]="brokenImage" alt="Uszkodzony plik">
</div>
</ng-template>
</div>
<div id="info">
Expand Down
2 changes: 1 addition & 1 deletion kiohub-client/src/app/services/attachment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class AttachmentService {

getPhotoAttachment(id: number) {
const params = new HttpParams().set('id', id.toString());
return this.http.get(address + '/attachment/downloadPhoto', { responseType: 'blob', params: params });
return this.http.get(address + '/attachment/download', { responseType: 'blob', params: params });
}

getAttachment(id: number) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ h5 {
padding-top: 7px;
}

button {
.download-button {
float: left;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h3>
<div id="elements_to_download_list">
<li id="files_to_download" *ngFor="let attachment of attachments">
<div id="element_to_download">
<button mat-raised-button (click)="downloadFile(attachment)">Pobierz</button>
<a mat-raised-button class="download-button" href="/attachment/download?id={{attachment?.id}}">Pobierz</a>
<h5>{{attachment?.fileName}}</h5>
</div>
</li>
Expand Down
9 changes: 5 additions & 4 deletions kiohub-client/src/app/utils/file-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ export class FileUtils {
readonly EXT_ZIP_2 = 'multipart/x-zip';
readonly EXT_ZIP_3 = 'application/x-zip-compressed';
readonly EXT_TGZ = 'application/tgz';
readonly EXT_GZ = 'application/x-gzip';
readonly EXT_GIF = 'image/gif';
readonly EXT_JPG = 'image/jpeg';
readonly EXT_JPEG = 'image/jpeg';
readonly EXT_PNG = 'image/png';
readonly EXT_ODT = 'application/vnd.oasis.opendocument.text';

readonly thesisExtensions = [this.EXT_PDF, this.EXT_DOC, this.EXT_DOCX, this.EXT_TXT, this.EXT_TEX, this.EXT_DVI, this.EXT_ODT];
readonly sourceCodeExtensions = [this.EXT_ZIP, this.EXT_ZIP_2, this.EXT_ZIP_3, this.EXT_TGZ];
readonly sourceCodeExtensions = [this.EXT_ZIP, this.EXT_ZIP_2, this.EXT_ZIP_3, this.EXT_TGZ, this.EXT_GZ];
readonly imageExtensions = [this.EXT_GIF, this.EXT_JPG, this.EXT_JPEG, this.EXT_PNG];
readonly manualExtensions = this.thesisExtensions;
readonly manualStartupExtensions = this.thesisExtensions;
readonly otherFileExtensions = [this.EXT_PDF, this.EXT_DOC, this.EXT_DOCX, this.EXT_TXT, this.EXT_TEX, this.EXT_DVI, this.EXT_ZIP, this.EXT_ZIP_2, this.EXT_ZIP_3, this.EXT_ODT,
this.EXT_TGZ, this.EXT_GIF, this.EXT_JPG, this.EXT_JPEG, this.EXT_PNG];
this.EXT_TGZ, this.EXT_GZ, this.EXT_GIF, this.EXT_JPG, this.EXT_JPEG, this.EXT_PNG];

valueUtils = new ValueUtils();

Expand All @@ -36,7 +37,7 @@ export class FileUtils {
}

getSourceCodeExtensions() {
return '.zip, .tgz';
return '.zip, .gz, .tgz';
}

getImageExtensions() {
Expand All @@ -52,7 +53,7 @@ export class FileUtils {
}

getOtherFileExtensions() {
return '.pdf, .doc, .docx, .txt, .tex, .dvi, .zip, .odt, .tgz, .gif, .jpg, .jpeg, .png';
return '.pdf, .doc, .docx, .txt, .tex, .dvi, .zip, .odt, .gz, .tgz, .gif, .jpg, .jpeg, .png';
}

// ******** CHECK IF ATTACHMENT IS ACCEPTABLE ********
Expand Down
4 changes: 2 additions & 2 deletions kiohub-client/src/app/utils/validation-patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Validation {
readonly MAX_SIZE_EMAIL = 30;

readonly MAX_FILENAME_LENGTH = 255;
readonly MAX_FILE_SIZE = 100000000; // in bytes
readonly MAX_FILE_SIZE = 1000000000; // in bytes

readonly WRONG_EXTENSION = 'Niepoprawny typ pliku lub plik jest zbyt duży (maksymalny rozmiar to ' + this.getMaxFileSizeInMegaBytes() + '). '
+ 'Podaj plik z jednym z poniższych rozszerzeń: ';
Expand Down Expand Up @@ -95,7 +95,7 @@ export class Validation {
}

getMaxFileSizeInMegaBytes() {
return 100 + ' MB';
return 1000 + ' MB';
}

// ******** REGEX PATTERNS ********
Expand Down
Loading

0 comments on commit 0962f38

Please sign in to comment.