Correction: Les images configurables ne s'affichent pas

This commit is contained in:
FyloZ 2021-06-06 00:08:27 -04:00
parent 54aca43371
commit 0911fd766f
10 changed files with 44 additions and 7 deletions

29
docker-compose.yml Normal file
View File

@ -0,0 +1,29 @@
version: "3.1"
services:
database:
image: mysql
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: "pass"
MYSQL_DATABASE: "cre"
ports:
- 3306:3306
backend:
image: fyloz.dev:5443/color-recipes-explorer/backend:master
environment:
spring_profiles_active: "mysql,debug"
cre_database_url: "mysql://database:3306/cre"
cre_database_username: "root"
cre_database_password: "pass"
CRE_ENABLE_DB_UPDATE: 1
server_port: 9090
ports:
- 9090:9090
volumes:
- cre_data:/usr/bin/cre/data
- cre_config:/usr/bin/cre/config
volumes:
cre_data:
cre_config:

View File

@ -15,7 +15,7 @@ import {Config} from '../shared/model/config.model'
import {ErrorHandlingComponent, SubscribingComponent} from '../shared/components/subscribing.component'
import {ErrorService} from '../shared/service/error.service'
import {ActivatedRoute, Router} from '@angular/router'
import {formatDateTime, readFile} from '../shared/utils/utils'
import {formatDateTime, getFileUrl, readFile} from '../shared/utils/utils'
import {FormControl, Validators} from '@angular/forms'
import {ConfirmBoxComponent} from '../shared/components/confirm-box/confirm-box.component'
@ -115,6 +115,10 @@ export class CreConfig extends SubscribingComponent {
}
}
get configuredImageUrl(): string {
return getFileUrl(this.configuration.content)
}
get lastUpdated(): string {
return formatDateTime(this.configuration.lastUpdated)
}

View File

@ -17,7 +17,7 @@
<div class="image-wrapper d-flex flex-column justify-content-end">
<div>
<img
[src]="updatedImage ? updatedImage : configuration.content"
[src]="updatedImage ? updatedImage : configuredImageUrl"
[attr.width]="previewWidth ? previewWidth : null"
class="mat-elevation-z3"/>
</div>

View File

@ -66,7 +66,7 @@ export class HeaderComponent extends SubscribingComponent {
}
get logoUrl(): string {
return environment.apiUrl + "/file?path=images%2Flogo"
return environment.apiUrl + "/file?path=images%2Flogo&mediaType=image/png"
}
set activeLink(link: string) {

View File

@ -47,7 +47,7 @@ export class CreInputComponent {
@Component({
selector: 'cre-autocomplete-input',
templateUrl: 'autocomplete-input.html',
templateUrl: 'autocomplete.html',
encapsulation: ViewEncapsulation.None
})
export class CreAutocompleteInputComponent {
@ -65,7 +65,7 @@ export class CreAutocompleteInputComponent {
@Component({
selector: 'cre-chip-input',
templateUrl: 'chip-input.html',
templateUrl: 'chips.html',
encapsulation: ViewEncapsulation.None
})
export class CreChipInputComponent implements OnInit {
@ -129,7 +129,7 @@ export class CreComboBoxComponent {
@Component({
selector: 'cre-chip-combo-box',
templateUrl: 'chip-combo-box.html',
templateUrl: 'chips-combo-box.html',
encapsulation: ViewEncapsulation.None
})
export class CreChipComboBoxComponent extends CreChipInputComponent implements OnDestroy {
@ -191,7 +191,7 @@ export class CreCheckboxInputComponent {
@Component({
selector: 'cre-file-input',
templateUrl: 'file-input.html'
templateUrl: 'file.html'
})
export class CreFileInputComponent implements OnInit {
@Input() label: string

View File

@ -56,3 +56,7 @@ export function readFile(file: File, consumer: (any) => void) {
}
reader.readAsDataURL(file)
}
export function getFileUrl(path: string) {
return `${environment.apiUrl}/file?path=${encodeURIComponent(path)}`
}