mirror of
https://github.com/quay/quay.git
synced 2025-04-18 10:44:06 +03:00
The documentation link on the build trigger tag template screen is currently pointing to the location of the `schema` directly in the code. This is not really useful or user friendly. This will repoint that documentation link to the KCS article written for this purpose.
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { DocumentationService } from './documentation.service';
|
|
import { Injectable, Inject } from 'ng-metadata/core';
|
|
|
|
|
|
@Injectable(DocumentationService.name)
|
|
export class DocumentationServiceImpl implements DocumentationService {
|
|
private documentationRoot: string;
|
|
private documentMap: object;
|
|
|
|
constructor(@Inject('Config') private Config: any) {
|
|
this.documentationRoot = Config['DOCUMENTATION_ROOT'];
|
|
this.documentMap = {
|
|
'builds.custom-trigger': 'html/use_red_hat_quay/setting_up_a_custom_git_trigger',
|
|
'notifications.webhook': function (p) {
|
|
if (!p['event']) {
|
|
return `html/use_red_hat_quay/repository_notifications`;
|
|
}
|
|
return `html/use_red_hat_quay/repository_notifications#${p['event']}`;
|
|
},
|
|
'notifications': 'html/use_red_hat_quay/repository_notifications',
|
|
'builds.tag-templating': 'https://access.redhat.com/solutions/7033393'
|
|
};
|
|
}
|
|
|
|
public getUrl(documentId: string, parameters?: object): string {
|
|
if (!this.documentMap[documentId]) {
|
|
return '';
|
|
}
|
|
|
|
let generator = this.documentMap[documentId];
|
|
if (typeof generator == 'string') {
|
|
generator = (p) => this.documentMap[documentId]
|
|
}
|
|
|
|
let url = generator(parameters || {});
|
|
if (url.indexOf('https://') != 0) {
|
|
url = this.documentationRoot + url;
|
|
}
|
|
return url;
|
|
}
|
|
}
|