diff --git a/README.md b/README.md index a241f72910..466e736de2 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,7 @@ dspace-angular ├── config * Folder for configuration files │ ├── environment.default.js * Default configuration files │ └── environment.test.js * Test configuration files +├── docs * Folder for documentation ├── e2e * Folder for e2e test files │ ├── app.e2e-spec.ts * │ ├── app.po.ts * @@ -380,6 +381,11 @@ This project makes use of [`yarn`](https://yarnpkg.com/en/) to ensure that the e As you can see above, using `yarn` commandline tools means that you should never need to modify the `package.json` manually. *We recommend always using `yarn` to keep dependencies updated / in sync.* +Further Documentation +--------------------- + +See [`./docs`](docs) for further documentation. + Frequently asked questions -------------------------- diff --git a/config/environment.default.js b/config/environment.default.js index 25684402f2..4f3aee5f0e 100644 --- a/config/environment.default.js +++ b/config/environment.default.js @@ -18,7 +18,8 @@ module.exports = { // Caching settings cache: { // NOTE: how long should objects be cached for by default - msToLive: 15 * 60 * 1000, // 15 minute + msToLive: 15 * 60 * 1000, // 15 minutes + // msToLive: 1000, // 15 minutes control: 'max-age=60' // revalidate browser }, // Notifications @@ -38,6 +39,8 @@ module.exports = { async: true, time: false }, + // Google Analytics tracking id + gaTrackingId: '', // Log directory logDirectory: '.', // NOTE: will log all redux actions and transfers in console diff --git a/docs/Configuration.md b/docs/Configuration.md new file mode 100644 index 0000000000..712b1523a0 --- /dev/null +++ b/docs/Configuration.md @@ -0,0 +1,10 @@ +# Configuration + +## Supporting analytics services other than Google Analytics +This project makes use of [Angulartics](https://angulartics.github.io/angulartics2/) to track usage events and send them to Google Analytics. + +Angulartics can be configured to work with a number of other services besides Google Analytics as well, e.g. [Piwik](https://github.com/angulartics/angulartics2/tree/master/src/lib/providers/piwik), [Google Tag Manager](https://github.com/angulartics/angulartics2/tree/master/src/lib/providers/gtm), or [Azure Application Insights](https://azure.microsoft.com/en-us/services/application-insights/) to name a few. + +In order to start using one of these services, select it from the [Angulartics Providers page](https://angulartics.github.io/angulartics2/#providers), and follow the instructions on how to configure it. + +The Google Analytics script was added in [`main.browser.ts`](https://github.com/DSpace/dspace-angular/blob/ff04760f4af91ac3e7add5e7424a46cb2439e874/src/main.browser.ts#L33) instead of the `
` tag in `index.html` to ensure events get sent when the page is shown in a client's browser, and not when it's rendered on the universal server. Likely you'll want to do the same when adding a new service. \ No newline at end of file diff --git a/karma.conf.js b/karma.conf.js index 073ce7040b..456c2ecd99 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -51,7 +51,7 @@ module.exports = function (config) { */ files: [{ pattern: './spec-bundle.js', - watched: false + watched: false, }], /* diff --git a/nodemon.json b/nodemon.json index 00313fe368..107ae1a754 100644 --- a/nodemon.json +++ b/nodemon.json @@ -4,5 +4,6 @@ "config", "src/index.html" ], - "ext": "js ts json html" + "ext": "js ts json html", + "delay": "50" } diff --git a/package.json b/package.json index 35bd2602b6..2878daf1c8 100644 --- a/package.json +++ b/package.json @@ -87,6 +87,7 @@ "@ngx-translate/core": "9.1.1", "@ngx-translate/http-loader": "2.0.1", "angular-idle-preload": "2.0.4", + "angulartics2": "^5.2.0", "body-parser": "1.18.2", "bootstrap": "^4.0.0", "cerialize": "0.1.18", @@ -116,6 +117,7 @@ "@angular/compiler-cli": "^5.2.5", "@ngrx/store-devtools": "^5.1.0", "@ngtools/webpack": "^1.10.0", + "@types/acorn": "^4.0.3", "@types/cookie-parser": "1.4.1", "@types/deep-freeze": "0.1.1", "@types/express": "^4.11.1", diff --git a/resources/i18n/en.json b/resources/i18n/en.json index 7b3d31c3e0..53ae9015f6 100644 --- a/resources/i18n/en.json +++ b/resources/i18n/en.json @@ -56,6 +56,10 @@ "detail": "{{ range }} of {{ total }}" } }, + "sorting": { + "ASC": "Ascending", + "DESC": "Descending" + }, "title": "DSpace", "404": { "help": "We can't find the page you're looking for. The page may have been moved or deleted. You can use the button below to get back to the home page. ", @@ -80,7 +84,8 @@ "search_dspace": "Search DSpace" }, "results": { - "head": "Search Results" + "head": "Search Results", + "no-results": "There were no results for this search" }, "sidebar": { "close": "Back to results", @@ -117,9 +122,13 @@ "placeholder": "Subject", "head": "Subject" }, - "date": { + "dateIssued": { "placeholder": "Date", "head": "Date" + }, + "has_content_in_original_bundle": { + "placeholder": "Has files", + "head": "Has files" } } } diff --git a/src/app/+collection-page/collection-page.component.ts b/src/app/+collection-page/collection-page.component.ts index de7e9a72d4..4a935b73b9 100644 --- a/src/app/+collection-page/collection-page.component.ts +++ b/src/app/+collection-page/collection-page.component.ts @@ -3,7 +3,7 @@ import { ActivatedRoute } from '@angular/router'; import { Observable } from 'rxjs/Observable'; import { Subscription } from 'rxjs/Subscription'; -import { SortOptions } from '../core/cache/models/sort-options.model'; +import { SortDirection, SortOptions } from '../core/cache/models/sort-options.model'; import { CollectionDataService } from '../core/data/collection-data.service'; import { ItemDataService } from '../core/data/item-data.service'; import { PaginatedList } from '../core/data/paginated-list'; @@ -48,7 +48,7 @@ export class CollectionPageComponent implements OnInit, OnDestroy { this.paginationConfig.id = 'collection-page-pagination'; this.paginationConfig.pageSize = 5; this.paginationConfig.currentPage = 1; - this.sortConfig = new SortOptions(); + this.sortConfig = new SortOptions('dc.title', SortDirection.ASC); } ngOnInit(): void { diff --git a/src/app/+home-page/top-level-community-list/top-level-community-list.component.ts b/src/app/+home-page/top-level-community-list/top-level-community-list.component.ts index 1b71220382..8fca66ea79 100644 --- a/src/app/+home-page/top-level-community-list/top-level-community-list.component.ts +++ b/src/app/+home-page/top-level-community-list/top-level-community-list.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; import { Observable } from 'rxjs/Observable'; -import { SortOptions } from '../../core/cache/models/sort-options.model'; +import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; import { CommunityDataService } from '../../core/data/community-data.service'; import { PaginatedList } from '../../core/data/paginated-list'; @@ -27,7 +27,7 @@ export class TopLevelCommunityListComponent { this.config.id = 'top-level-pagination'; this.config.pageSize = 5; this.config.currentPage = 1; - this.sortConfig = new SortOptions(); + this.sortConfig = new SortOptions('dc.title', SortDirection.ASC); this.updatePage({ page: this.config.currentPage, diff --git a/src/app/+search-page/normalized-search-result.model.ts b/src/app/+search-page/normalized-search-result.model.ts new file mode 100644 index 0000000000..2e9a4a8b8e --- /dev/null +++ b/src/app/+search-page/normalized-search-result.model.ts @@ -0,0 +1,13 @@ +import { autoserialize } from 'cerialize'; +import { Metadatum } from '../core/shared/metadatum.model'; +import { ListableObject } from '../shared/object-collection/shared/listable-object.model'; + +export class NormalizedSearchResult implements ListableObject { + + @autoserialize + dspaceObject: string; + + @autoserialize + hitHighlights: Metadatum[]; + +} diff --git a/src/app/+search-page/paginated-search-options.model.ts b/src/app/+search-page/paginated-search-options.model.ts new file mode 100644 index 0000000000..0c403af827 --- /dev/null +++ b/src/app/+search-page/paginated-search-options.model.ts @@ -0,0 +1,20 @@ +import { SortOptions } from '../core/cache/models/sort-options.model'; +import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model'; +import { isNotEmpty } from '../shared/empty.util'; +import { URLCombiner } from '../core/url-combiner/url-combiner'; +import { SearchOptions } from './search-options.model'; + +export class PaginatedSearchOptions extends SearchOptions { + pagination?: PaginationComponentOptions; + sort?: SortOptions; + toRestUrl(url: string, args: string[] = []): string { + if (isNotEmpty(this.sort)) { + args.push(`sort=${this.sort.field},${this.sort.direction}`); + } + if (isNotEmpty(this.pagination)) { + args.push(`page=${this.pagination.currentPage - 1}`); + args.push(`size=${this.pagination.pageSize}`); + } + return super.toRestUrl(url, args); + } +} diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter/search-facet-filter.component.html b/src/app/+search-page/search-filters/search-filter/search-facet-filter/search-facet-filter.component.html index 114837ce65..074c5700d7 100644 --- a/src/app/+search-page/search-filters/search-filter/search-facet-filter/search-facet-filter.component.html +++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter/search-facet-filter.component.html @@ -2,26 +2,29 @@