Skip to content

Commit

Permalink
editor: add a external link to the mef authority
Browse files Browse the repository at this point in the history
* Closes rero/rero-ils#1598.
* Closes rero/rero-ils#1425.
* Changes the schemaform url to schemas.
* Uses ngx-formly 5.10.12.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
  • Loading branch information
jma committed Jan 28, 2021
1 parent 1abe208 commit a1441af
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 17 deletions.
15 changes: 8 additions & 7 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
"@angular/platform-browser-dynamic": "^11.0.9",
"@angular/router": "^11.0.9",
"@ngneat/hotkeys": "^1.1.2",
"@ngx-formly/bootstrap": "^5.10.11",
"@ngx-formly/core": "^5.10.11",
"@ngx-formly/bootstrap": "^5.10.12",
"@ngx-formly/core": "^5.10.12",
"@ngx-translate/core": "^13.0.0",
"@rero/ng-core": "^1.1.2",
"bootstrap": "^4.5.3",
Expand Down
12 changes: 8 additions & 4 deletions projects/admin/src/app/class/typeahead/mef-typeahead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ export class MefTypeahead implements ITypeahead {
) {
return {
source: source.toUpperCase(),
name: data.hits.hits[0].metadata[source].authorized_access_point
name: data.hits.hits[0].metadata[source].authorized_access_point,
url: data.hits.hits[0].metadata[source].identifier
};
}
}),
map((v: { name: string, source: string }) => `
<strong>${v.name}</strong>
map((v: { name: string, source: string, url: string }) => `
<a href="${v.url}" target="_blank">${v.name} <i class="fa fa-external-link"></i></a>
<small class="badge badge-secondary ml-1">${v.source}</small>
`)
);
Expand Down Expand Up @@ -136,8 +137,11 @@ export class MefTypeahead implements ITypeahead {
* @return Metadata the label, $ref and group.
*/
private _getNameRef(metadata: any, sourceName: string): SuggestionMetadata {
const label = metadata[sourceName].authorized_access_point;
const url = metadata[sourceName].identifier;
return {
label: metadata[sourceName].authorized_access_point,
label: `${label}`,
externalLink: url,
value: `https://mef.rero.ch/api/${sourceName}/${metadata[sourceName].pid}`,
group: this._translateService.instant(
'link to authority {{ sourceName }}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@
 You should have received a copy of the GNU Affero General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

<ng-core-editor (loadingChange)="loadingChanged($event)" [model]="model"></ng-core-editor>
2 changes: 1 addition & 1 deletion projects/admin/src/app/service/app-config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class AppConfigService extends CoreConfigService {
this.production = environment.production;
this.apiBaseUrl = environment.apiBaseUrl;
this.$refPrefix = environment.$refPrefix;
this.schemaFormEndpoint = '/schemaform';
this.schemaFormEndpoint = '/schemas';
this.languages = environment.languages;
this.defaultLanguage = environment.defaultLanguage;
this.adminRoles = environment.adminRoles;
Expand Down
4 changes: 2 additions & 2 deletions proxy.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"^/patrons": "https://localhost:5000/patrons"
}
},
"/schemaform": {
"/schemas": {
"target": "https://localhost:5000",
"secure": false,
"logLevel": "debug",
"changeOrigin": true,
"pathRewrite": {
"^/schemaform": "https://localhost:5000/schemaform"
"^/schemas": "https://localhost:5000/schemas"
}
},
"/api/*": {
Expand Down

0 comments on commit a1441af

Please sign in to comment.