-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/IQSS/dataverse-frontend …
…into feature/249-boilerplate-file-page
- Loading branch information
Showing
98 changed files
with
1,392 additions
and
427 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"title": "Root", | ||
"noDatasetsMessage": { | ||
"authenticated": "This dataverse currently has no datasets. You can add to it by using the Add Data button on this page.", | ||
"anonymous": "This dataverse currently has no datasets. Please <1>log in</1> to see if you are able to add to it." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"results": "{{start}} to {{end}} of {{total}} {{item}}s", | ||
"pageSize": "{{item}}s per page" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { PaginationInfo } from '../../../shared/domain/models/PaginationInfo' | ||
|
||
export class DatasetPaginationInfo extends PaginationInfo<DatasetPaginationInfo> { | ||
constructor(page = 1, pageSize = 10, totalItems = 0, itemName = 'Dataset') { | ||
super(page, pageSize, totalItems, itemName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { DatasetLabel, DatasetVersion } from './Dataset' | ||
|
||
export class DatasetPreview { | ||
constructor( | ||
public persistentId: string, | ||
public title: string, | ||
public version: DatasetVersion, | ||
public citation: string, | ||
public labels: DatasetLabel[], | ||
public isDeaccessioned: boolean, | ||
public releaseOrCreateDate: Date, | ||
public description: string, | ||
public thumbnail?: string | ||
) {} | ||
|
||
get abbreviatedDescription(): string { | ||
if (this.description.length > 280) { | ||
return `${this.description.substring(0, 280)}...` | ||
} | ||
return this.description | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type TotalDatasetsCount = number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import { Dataset } from '../models/Dataset' | ||
import { TotalDatasetsCount } from '../models/TotalDatasetsCount' | ||
import { DatasetPaginationInfo } from '../models/DatasetPaginationInfo' | ||
import { DatasetPreview } from '../models/DatasetPreview' | ||
|
||
export interface DatasetRepository { | ||
getByPersistentId: (persistentId: string, version?: string) => Promise<Dataset | undefined> | ||
getByPrivateUrlToken: (privateUrlToken: string) => Promise<Dataset | undefined> | ||
getAll: (paginationInfo: DatasetPaginationInfo) => Promise<DatasetPreview[]> | ||
getTotalDatasetsCount: () => Promise<TotalDatasetsCount> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { DatasetRepository } from '../repositories/DatasetRepository' | ||
import { DatasetPaginationInfo } from '../models/DatasetPaginationInfo' | ||
import { DatasetPreview } from '../models/DatasetPreview' | ||
|
||
export async function getDatasets( | ||
datasetRepository: DatasetRepository, | ||
paginationInfo: DatasetPaginationInfo | ||
): Promise<DatasetPreview[]> { | ||
return datasetRepository.getAll(paginationInfo).catch((error: Error) => { | ||
throw new Error(error.message) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { DatasetRepository } from '../repositories/DatasetRepository' | ||
import { TotalDatasetsCount } from '../models/TotalDatasetsCount' | ||
|
||
export async function getTotalDatasetsCount( | ||
datasetRepository: DatasetRepository | ||
): Promise<TotalDatasetsCount> { | ||
return datasetRepository.getTotalDatasetsCount().catch((error: Error) => { | ||
throw new Error(error.message) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,7 @@ | ||
export class FilePaginationInfo { | ||
constructor( | ||
public readonly page: number = 1, | ||
public readonly pageSize: number = 10, | ||
public readonly totalFiles: number = 0 | ||
) {} | ||
import { PaginationInfo } from '../../../shared/domain/models/PaginationInfo' | ||
|
||
withTotal(total: number): FilePaginationInfo { | ||
return new FilePaginationInfo(this.page, this.pageSize, total) | ||
} | ||
goToPage(page: number): FilePaginationInfo { | ||
return new FilePaginationInfo(page, this.pageSize, this.totalFiles) | ||
} | ||
|
||
goToPreviousPage(): FilePaginationInfo { | ||
if (!this.previousPage) throw new Error('No previous page') | ||
return this.goToPage(this.previousPage) | ||
} | ||
|
||
goToNextPage(): FilePaginationInfo { | ||
if (!this.nextPage) throw new Error('No next page') | ||
return this.goToPage(this.nextPage) | ||
} | ||
|
||
withPageSize(pageSize: number): FilePaginationInfo { | ||
const getNewPage = (oldPageSize: number, newPageSize: number) => { | ||
const newPage = Math.ceil(((this.page - 1) * oldPageSize + 1) / newPageSize) | ||
return newPage > 0 ? newPage : 1 | ||
} | ||
return new FilePaginationInfo(getNewPage(this.pageSize, pageSize), pageSize, this.totalFiles) | ||
} | ||
|
||
get totalPages(): number { | ||
return Math.ceil(this.totalFiles / this.pageSize) | ||
} | ||
|
||
get hasPreviousPage(): boolean { | ||
return this.page > 1 | ||
} | ||
|
||
get hasNextPage(): boolean { | ||
return this.page < this.totalPages | ||
} | ||
|
||
get previousPage(): number | undefined { | ||
return this.hasPreviousPage ? this.page - 1 : undefined | ||
} | ||
|
||
get nextPage(): number | undefined { | ||
return this.hasNextPage ? this.page + 1 : undefined | ||
export class FilePaginationInfo extends PaginationInfo<FilePaginationInfo> { | ||
constructor(page = 1, pageSize = 10, totalItems = 0, itemName = 'File') { | ||
super(page, pageSize, totalItems, itemName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
src/sections/dataset/dataset-citation/CitationThumbnail.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.