本文整理汇总了TypeScript中app/core/ui-services/config.service.ConfigService类的典型用法代码示例。如果您正苦于以下问题:TypeScript service.ConfigService类的具体用法?TypeScript service.ConfigService怎么用?TypeScript service.ConfigService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了service.ConfigService类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
/**
* Constructs this component.
*
* @param {Title} titleService set the browser title
* @param {TranslateService} translate the translation service
* @param {ConfigService} configService The configuration provider
* @param {FormBuilder} formBuilder Form builder
* @param {MotionRepositoryService} repo Motion Repository
* @param {ActivatedRoute} route The activated route
* @param {Router} router The router
* @param {MatSnackBar} matSnackBar Material Design SnackBar
*/
public constructor(
titleService: Title,
protected translate: TranslateService, // protected required for ng-translate-extract
private configService: ConfigService,
private formBuilder: FormBuilder,
private repo: MotionRepositoryService,
private route: ActivatedRoute,
private router: Router,
matSnackBar: MatSnackBar
) {
super(titleService, translate, matSnackBar);
this.createForm();
this.configService.get<number>('motions_line_length').subscribe(lineLength => {
this.lineLength = lineLength;
this.getMotionByUrl();
});
this.configService.get<boolean>('motions_reason_required').subscribe(required => {
this.reasonRequired = required;
});
this.configService.get<boolean>('motions_amendments_multiple_paragraphs').subscribe(allowed => {
this.multipleParagraphsAllowed = allowed;
});
}
示例2: constructor
public constructor(
private operator: OperatorService,
private configService: ConfigService,
private constants: ConstantsService
) {
// load config variables
this.configService
.get<number>('motions_min_supporters')
.subscribe(supporters => (this.configMinSupporters = supporters));
this.configService
.get<boolean>('motions_amendments_enabled')
.subscribe(enabled => (this.amendmentEnabled = enabled));
this.constants
.get<OpenSlidesSettings>('OpenSlidesSettings')
.subscribe(settings => (this.amendmentOfAmendment = settings.MOTIONS_ALLOW_AMENDMENTS_OF_AMENDMENTS));
}
示例3: constructor
public constructor(
titleService: Title,
translate: TranslateService,
matSnackBar: MatSnackBar,
private repo: CountdownRepositoryService,
private configService: ConfigService
) {
super(titleService, translate, matSnackBar);
this.configService.get<number>('agenda_countdown_warning_time').subscribe(time => (this.warningTime = time));
}
示例4: motionToDocDef
/**
* Converts a motion to PdfMake doc definition
*
* @param motion the motion to convert to pdf
* @param lnMode determine the used line mode
* @param crMode determine the used change Recommendation mode
* @param contentToExport determine which content is to export. If left out, everything will be exported
* @param infoToExport determine which metaInfo to export. If left out, everything will be exported.
* @param commentsToExport comments to chose for export. If 'allcomments' is set in infoToExport, this selection will be ignored and all comments exported
* @returns doc def for the motion
*/
public motionToDocDef(
motion: ViewMotion,
lnMode?: LineNumberingMode,
crMode?: ChangeRecoMode,
contentToExport?: string[],
infoToExport?: InfoToExport[],
commentsToExport?: number[]
): object {
let motionPdfContent = [];
// Enforces that statutes should always have Diff Mode and no line numbers
if (motion.isStatuteAmendment()) {
lnMode = LineNumberingMode.None;
crMode = ChangeRecoMode.Diff;
}
// determine the default lnMode if not explicitly given
if (!lnMode) {
lnMode = this.configService.instant('motions_default_line_numbering');
}
// determine the default crMode if not explicitly given
if (!crMode) {
crMode = this.configService.instant('motions_recommendation_text_mode');
}
const title = this.createTitle(motion);
const sequential = !infoToExport || infoToExport.includes('id');
const subtitle = this.createSubtitle(motion, sequential);
motionPdfContent = [title, subtitle];
if ((infoToExport && infoToExport.length > 0) || !infoToExport) {
const metaInfo = this.createMetaInfoTable(motion, crMode, infoToExport);
motionPdfContent.push(metaInfo);
}
if (!contentToExport || contentToExport.includes('text')) {
const preamble = this.createPreamble(motion);
motionPdfContent.push(preamble);
const text = this.createText(motion, lnMode, crMode);
motionPdfContent.push(text);
}
if (!contentToExport || contentToExport.includes('reason')) {
const reason = this.createReason(motion, lnMode);
motionPdfContent.push(reason);
}
if (infoToExport && infoToExport.includes('allcomments')) {
commentsToExport = this.commentRepo.getSortedViewModelList().map(vm => vm.id);
}
if (commentsToExport) {
motionPdfContent.push(this.createComments(motion, commentsToExport));
}
return motionPdfContent;
}
示例5: createWelcomeText
/**
* Generates a welcone text according to the events' configuration
*
* @returns pdfMake definitions
*/
private createWelcomeText(): object {
return [
{
text: this.translate.instant(this.configService.instant<string>('users_pdf_welcometitle')),
style: 'userDataHeading'
},
{
text: this.translate.instant(this.configService.instant<string>('users_pdf_welcometext')),
style: 'userDataTopic'
}
];
}
示例6: ngOnInit
/**
* Init the component.
*
* Sets the welcomeTitle and welcomeText.
*/
public ngOnInit(): void {
super.setTitle('Home');
// set the welcome title
this.configService
.get<string>('general_event_welcome_title')
.subscribe(welcomeTitle => (this.welcomeTitle = welcomeTitle));
// set the welcome text
this.configService
.get<string>('general_event_welcome_text')
.subscribe(welcomeText => (this.welcomeText = welcomeText as string));
}
示例7: createUserAccessContent
/**
* Creates access information (login name, initial password) for the given user,
* additionally encoded in a qr code
*
* @param user
* @returns pdfMake definitions
*/
private createUserAccessContent(user: ViewUser): object {
const columnOpenSlides: object[] = [
{
text: this.translate.instant('OpenSlides access data'),
style: 'userDataHeading'
},
{
text: this.translate.instant('Username') + ':',
style: 'userDataTopic'
},
{
text: user.username,
style: 'userDataValue'
},
{
text: this.translate.instant('Initial password') + ':',
style: 'userDataTopic'
},
{
text: user.default_password,
style: 'userDataValue'
},
{
text: 'URL:',
style: 'userDataTopic'
},
{
text: this.configService.instant<string>('users_pdf_url') || '-',
link: this.configService.instant<string>('users_pdf_url'),
style: 'userDataValue'
},
{
text: '\n'
}
];
// url qr code
if (this.configService.instant<string>('users_pdf_url')) {
columnOpenSlides.push(
{
qr: this.configService.instant<string>('users_pdf_url'),
fit: 120,
margin: [0, 0, 0, 8]
},
{
text: this.translate.instant('Scan this QR code to open URL.'),
style: 'small'
}
);
}
return columnOpenSlides;
}
示例8: createWifiAccessContent
/**
* Creates the wifi access data, including qr code, for the configured event wlan parameters
*
* @returns pdfMake definitions
*/
private createWifiAccessContent(): object {
const wifiColumn: object[] = [
{
text: this.translate.instant('WLAN access data'),
style: 'userDataHeading'
},
{
text: this.translate.instant('WLAN name (SSID)') + ':',
style: 'userDataTopic'
},
{
text: this.configService.instant<string>('users_pdf_wlan_ssid') || '-',
style: 'userDataValue'
},
{
text: this.translate.instant('WLAN password') + ':',
style: 'userDataTopic'
},
{
text: this.configService.instant<string>('users_pdf_wlan_password') || '-',
style: 'userDataValue'
},
{
text: this.translate.instant('WLAN encryption') + ':',
style: 'userDataTopic'
},
{
text: this.configService.instant<string>('users_pdf_wlan_encryption') || '-',
style: 'userDataValue'
},
{
text: '\n'
}
];
if (
this.configService.instant<string>('users_pdf_wlan_ssid') &&
this.configService.instant<string>('users_pdf_wlan_encryption')
) {
const wifiQrCode =
'WIFI:S:' +
this.configService.instant<string>('users_pdf_wlan_ssid') +
';T:' +
this.configService.instant<string>('users_pdf_wlan_encryption') +
';P:' +
this.configService.instant<string>('users_pdf_wlan_password') +
';;';
wifiColumn.push(
{
qr: wifiQrCode,
fit: 120,
margin: [0, 0, 0, 8]
},
{
text: this.translate.instant('Scan this QR code to connect to WLAN.'),
style: 'small'
}
);
}
return wifiColumn;
}
示例9: if
this.operator.getViewUserObservable().subscribe(user => {
if (user) {
this.username = user.short_name;
} else if (!user && configService.instant<boolean>('general_system_enable_anonymous')) {
this.username = translate.instant('Guest');
}
this.isLoggedIn = !!user;
});
示例10: createText
/**
* Creates the motion text - uses HTML to PDF
*
* @param motion the motion to convert to pdf
* @param lnMode determine the used line mode
* @param crMode determine the used change Recommendation mode
* @returns doc def for the "the assembly may decide" preamble
*/
private createText(motion: ViewMotion, lnMode: LineNumberingMode, crMode: ChangeRecoMode): object {
let motionText: string;
// get the line length from the config
const lineLength = this.configService.instant<number>('motions_line_length');
if (motion.isParagraphBasedAmendment()) {
motionText = '';
// this is logically redundant with the formation of amendments in the motion-detail html.
// Should be refactored in a way that a service returns the correct html for both cases
for (const paragraph of this.motionRepo.getAmendedParagraphs(motion, lineLength)) {
if (paragraph.diffLineTo === paragraph.diffLineFrom + 1) {
motionText += `<h3>
${this.translate.instant('Line')} ${paragraph.diffLineFrom}:
</h3>`;
} else {
motionText += `<h3>
${this.translate.instant('Line')} ${paragraph.diffLineFrom} - ${paragraph.diffLineTo - 1}:
</h3>`;
}
motionText += `<div class="paragraphcontext">${paragraph.textPre}</div>`;
motionText += paragraph.text;
motionText += `<div class="paragraphcontext">${paragraph.textPost}</div>`;
}
} else if (motion.isStatuteAmendment()) {
// statute amendments
const statutes = this.statuteRepo.getViewModelList();
motionText = this.motionRepo.formatStatuteAmendment(statutes, motion, lineLength);
} else {
// lead motion or normal amendments
// TODO: Consider tile change recommendation
const changes: ViewUnifiedChange[] = Object.assign(
[],
this.changeRecoRepo.getChangeRecoOfMotion(motion.id)
);
// TODO: Cleanup, everything change reco and amendment based needs a unified structure.
const amendments = this.motionRepo.getAmendmentsInstantly(motion.id);
if (amendments) {
for (const amendment of amendments) {
const changedParagraphs = this.motionRepo.getAmendmentAmendedParagraphs(amendment, lineLength);
for (const change of changedParagraphs) {
changes.push(change as ViewUnifiedChange);
}
}
}
// changes need to be sorted, by "line from".
// otherwise, formatMotion will make unexpected results by messing up the
// order of changes applied to the motion
changes.sort((a, b) => a.getLineFrom() - b.getLineFrom());
motionText = this.motionRepo.formatMotion(motion.id, crMode, changes, lineLength);
// reformat motion text to split long HTML elements to easier convert into PDF
motionText = this.linenumberingService.splitInlineElementsAtLineBreaks(motionText);
}
return this.htmlToPdfService.convertHtml(motionText, lnMode);
}