Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ CorsConfigurationSource corsConfigurationSource() {
configuration.setAllowCredentials(true);

UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/auth/**", configuration);
source.registerCorsConfiguration("/**", configuration);
return source;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class TableController {
@GetMapping("after/{tableId}")
public ResponseEntity<List<TableCreatedDTO>> getTablesAfter(@PathVariable UUID tableId,
@RequestParam int quantity) {

return ResponseEntity.ok().body(tableService.getNextTables(tableId, quantity));
}

Expand All @@ -45,7 +44,6 @@ public ResponseEntity<TableCreatedDTO> createTable(@RequestBody TableCreateDTO t
@PutMapping("/{tableId}")
public ResponseEntity<InformativeResponse> updateTableCard(@PathVariable UUID tableId,
@Valid @RequestBody TablePutDTO tablePutDTO) {

return ResponseEntity.ok().body(new InformativeResponse(tableService.updateTable(tableId, tablePutDTO)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@
public record TableCreateDTO(
@NotNull @Size(min = 1, max = 50) String title,
@Size(max = 500) String description,
@NotNull @PastOrPresent LocalDateTime creationDate,
LocalDateTime lastEditDate
) {
}
@NotNull @PastOrPresent LocalDateTime creationDate
) {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.github.bytestrick.tabula.controller.dto.table;

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.PastOrPresent;

import java.time.LocalDateTime;
import java.util.UUID;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.github.bytestrick.tabula.controller.dto.table;

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.PastOrPresent;
import jakarta.validation.constraints.Size;

import java.time.LocalDateTime;
Expand All @@ -8,6 +10,6 @@
public record TablePutDTO(
@Size(min = 1, max = 50) String title,
@Size(max = 500) String description,
LocalDateTime lastEditTime
@NotNull @PastOrPresent LocalDateTime lastEditDate
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public TableCreatedDTO createNewTable(TableCreateDTO tableCreateDTO) {
.title(tableCreateDTO.title())
.description(tableCreateDTO.description())
.creationDate(tableCreateDTO.creationDate())
.lastEditDate(tableCreateDTO.lastEditDate())
.lastEditDate(tableCreateDTO.creationDate()) // la data di modifica combacia con quella di creazione
.userId(getAuthUser().getId())
.build();

Expand All @@ -109,7 +109,7 @@ public String updateTable(UUID tableId, TablePutDTO tablePutDTO) {
.id(tableId)
.title(tablePutDTO.title())
.description(tablePutDTO.description())
.lastEditDate(tablePutDTO.lastEditTime())
.lastEditDate(tablePutDTO.lastEditDate())
.build();

tableDAO.update(table);
Expand Down
3 changes: 2 additions & 1 deletion database/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ CREATE TABLE data_type
INSERT INTO data_type (name)
VALUES ('Textual'),
('Numeric'),
('Monetary');
('Monetary'),
('Map');

CREATE TABLE tbl_table
(
Expand Down
11 changes: 9 additions & 2 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,22 @@
{
"glob": "**/*",
"input": "public"
},
{
"glob": "*.*",
"input": "node_modules/leaflet/dist/images",
"output": "media"
}
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/bootstrap-icons/font/bootstrap-icons.min.css",
"src/styles.css"
"src/styles.css",
"node_modules/leaflet/dist/leaflet.css"
],
"scripts": [
"node_modules/bootstrap/dist/js/bootstrap.min.js"
"node_modules/bootstrap/dist/js/bootstrap.min.js",
"node_modules/leaflet/dist/leaflet.js"
]
},
"configurations": {
Expand Down
25 changes: 25 additions & 0 deletions frontend/package-lock.json

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

2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@angular/router": "^19.2.7",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.11.3",
"leaflet": "^1.9.4",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.15.0"
Expand All @@ -32,6 +33,7 @@
"@angular/compiler-cli": "^19.2.7",
"@types/bootstrap": "^5.2.10",
"@types/jasmine": "~5.1.0",
"@types/leaflet": "^1.9.17",
"jasmine-core": "~5.2.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<router-outlet></router-outlet>
<tbl-toasts/>
<tbl-confirm-dialog/>
<router-outlet/>
Expand Down
16 changes: 0 additions & 16 deletions frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,11 @@ import {ConfirmDialogComponent} from './confirm-dialog/confirm-dialog.component'
export class AppComponent implements OnInit {

private popUpManager: PopUpManagerService = inject(PopUpManagerService);

_ = inject(ThemeService);

@ViewChild('popUpContainer', { read: ViewContainerRef, static: true }) popUpContainer!: ViewContainerRef;


ngOnInit() {
AppComponent.updateColorScheme();
this.popUpManager.setPopUpContainer(this.popUpContainer);
}


/**
* Sync the app color scheme with the OS color scheme
*/
private static updateColorScheme() {
const darkColorSchemeQuery = matchMedia('(prefers-color-scheme: dark)');
const onChange = (isDark: boolean) => {
document.documentElement.setAttribute('data-bs-theme', isDark ? 'dark' : 'light');
};
darkColorSchemeQuery.addEventListener('change', e => onChange(e.matches));
onChange(darkColorSchemeQuery.matches); // at first load
}
}
2 changes: 0 additions & 2 deletions frontend/src/app/home/home.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import {TableCard} from './table-card/table-card.interface';
providedIn: 'root'
})
export class HomeService {

private readonly BASE_URL: string = '/tables';

private http = inject(HttpClient);


Expand Down
3 changes: 0 additions & 3 deletions frontend/src/app/home/table-card/table-card.component.css

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/src/app/home/table-card/table-card.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="shadow-sm rounded col" (click)="onOpenCard()">
<div class="card overflow-hidden"
<div class="card btn-hover overflow-hidden"
style="height: 320px;">
<div class="card-body overflow-y-scroll my-1" style="cursor: pointer;">
<h5 class="card-title font-weight-bold">{{ title }}</h5>
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/app/home/table-card/table-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ import {TableCard} from './table-card.interface';
import {Subscription} from 'rxjs';
import {DatePipe} from '@angular/common';
import {PrettyDatePipe} from '../pretty-date.pipe';
import {Router, RouterOutlet} from '@angular/router';
import {Router} from '@angular/router';
import {ToastService} from '../../toast/toast.service';
import {ConfirmDialogService} from '../../confirm-dialog/confirm-dialog.service';
import {NavbarComponent} from '../../navbar/navbar.component';

@Component({
selector: 'tbl-table-card',
imports: [DatePipe, PrettyDatePipe],
templateUrl: './table-card.component.html',
styles: `
.card:active {
border-color: var(--bs-btn-active-border-color)
}
`
})
export class TableCardComponent implements OnDestroy {
@Output('editTableCard') editTableCard: EventEmitter<TableCardComponent> = new EventEmitter;
Expand Down Expand Up @@ -142,5 +148,6 @@ export class TableCardComponent implements OnDestroy {
onOpenCard(): void {
this.router.navigate(['/tables', this.id])
.catch(err => console.error(err));
NavbarComponent.setTableTitle(this.title);
}
}
1 change: 0 additions & 1 deletion frontend/src/app/home/table-card/table-card.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ export interface TableCard {
description: string;
creationDate?: Date;
lastEditDate?: Date;
tableId?: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {Type} from '@angular/core';
import {BaseInputComponent} from '../../../table-components/input-components/base-input-component';
import {BaseCellComponent} from '../../../table-components/table/cells/base-cell-component';
import {IDataType} from '../i-data-type';
import {DataTypeRegistryService} from '../../../services/data-type-registry.service';
import {MapInputComponent} from '../../../table-components/input-components/map-input/map-input.component';
import {MapCellComponent} from '../../../table-components/table/cells/map-cell/map-cell.component';


export class MapDataType implements IDataType {
getDataTypeId(): number {
return DataTypeRegistryService.MAP_ID;
}

getInputComponent(): Type<BaseInputComponent> {
return MapInputComponent;
}

getNewDataType(): IDataType {
return new MapDataType();
}

getCellComponent(): Type<BaseCellComponent> {
return MapCellComponent;
}

getIconName(): string {
return 'bi-geo-alt';
}

getDataTypeName(): string {
return 'Map';
}
}
8 changes: 8 additions & 0 deletions frontend/src/app/model/pop-up-content.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import {PopUp} from '../table-components/pop-up-component/pop-up.component';

/**
* Contract that external content components must implement to be used within the PopUp component.
* Defines lifecycle callbacks for showing and hiding events.
*/
export interface PopUpContent {
/**
* Parent popup reference.
*/
popUpRef: PopUp | undefined;

/**
* Lifecycle callback invoked when the pop-up becomes visible.
*/
onShowUp(): void;

/**
* Lifecycle callback invoked when the pop-up is hidden.
* @param action - Identifier of the user action that triggered hiding:
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/app/model/table/cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ export class Cell {
/** The data type logic that drives validation, formatting, and editing UI. */
protected _cellDataType: IDataType;
/** The current string value of the cell; `null` represents a blank cell. */
protected _value: string | null = null;
protected _value: string = '';

/**
* Constructs a new Cell instance.
*
* @param cellDataType The IDataType instance defining how this cell’s data is handled.
* @param value The initial value for the cell; may be any type, but stored as string.
*/
constructor(cellDataType: IDataType, value: any) {
constructor(cellDataType: IDataType, value: string = '') {
this._cellDataType = cellDataType;
this._value = value;
this.value = value;
}

/**
Expand Down Expand Up @@ -64,18 +64,18 @@ export class Cell {
/**
* Gets the current value of the cell.
*
* @returns The cell’s string value, or `null` if blank.
* @returns The cell’s string value, or `''` if blank.
*/
get value(): string | null {
get value(): string {
return this._value;
}

/**
* Updates the cell’s value and notifies its component (if mounted).
*
* @param value The new value to set; `null` clears the cell.
* @param value The new value to set; `''` clears the cell.
*/
set value(value: string | null) {
set value(value: string) {
this._value = value;
// If the cell component is rendered, update its displayed value
this.cellRef?.instance.setValue(value);
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/model/table/row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class Row {
}


public appendNewCell(newDataType: IDataType, value: any = null): void {
public appendNewCell(newDataType: IDataType, value: string = ''): void {
this.row.push(new Cell(newDataType, value));
}

Expand All @@ -23,7 +23,7 @@ export class Row {
}


insertNewCellAt(index: number, newDataType: IDataType, value: any = null): void {
insertNewCellAt(index: number, newDataType: IDataType, value: string = ''): void {
this.row.splice(index, 0, new Cell(newDataType, value));
}

Expand Down
Loading
Loading