Browse Source

Remove deprecated substrings. (#830)

pull/831/head
Sebastian Stehle 4 years ago
committed by GitHub
parent
commit
8f382ada86
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      frontend/src/app/features/rules/shared/actions/formattable-input.component.ts
  2. 2
      frontend/src/app/framework/angular/forms/control-errors.component.ts
  3. 4
      frontend/src/app/framework/angular/forms/error-validator.ts
  4. 2
      frontend/src/app/framework/angular/pipes/colors.pipes.ts
  5. 2
      frontend/src/app/framework/angular/pipes/money.pipe.ts
  6. 2
      frontend/src/app/framework/configurations.ts
  7. 2
      frontend/src/app/framework/services/localizer.service.ts
  8. 2
      frontend/src/app/framework/utils/error.spec.ts
  9. 2
      frontend/src/app/framework/utils/math-helper.ts

4
frontend/src/app/features/rules/shared/actions/formattable-input.component.ts

@ -78,11 +78,11 @@ export class FormattableInputComponent implements ControlValueAccessor, AfterVie
const lower = obj.toLowerCase(); const lower = obj.toLowerCase();
if (lower.startsWith('liquid(')) { if (lower.startsWith('liquid(')) {
this.value = obj.substr(7, obj.length - 8); this.value = obj.substring(7, obj.length - 1);
mode = 'Liquid'; mode = 'Liquid';
} else if (lower.startsWith('script(')) { } else if (lower.startsWith('script(')) {
this.value = obj.substr(7, obj.length - 8); this.value = obj.substring(7, obj.length - 1);
mode = 'Script'; mode = 'Script';
} }

2
frontend/src/app/framework/angular/forms/control-errors.component.ts

@ -56,7 +56,7 @@ export class ControlErrorsComponent extends StatefulComponent<State> implements
let translation = this.localizer.get(`common.${this.for}`)!; let translation = this.localizer.get(`common.${this.for}`)!;
if (!translation) { if (!translation) {
translation = this.for.substr(0, 1).toUpperCase() + this.for.substr(1); translation = this.for.substring(0, 1).toUpperCase() + this.for.substring(1);
} }
this.controlDisplayName = translation; this.controlDisplayName = translation;

4
frontend/src/app/framework/angular/forms/error-validator.ts

@ -39,7 +39,7 @@ export class ErrorValidator {
for (const details of this.error.details) { for (const details of this.error.details) {
for (const property of details.properties) { for (const property of details.properties) {
if (property.startsWith(path)) { if (property.startsWith(path)) {
const subProperty = property.substr(path.length); const subProperty = property.substring(path.length);
const first = subProperty[0]; const first = subProperty[0];
@ -50,7 +50,7 @@ export class ErrorValidator {
errors.push(`${subProperty}: ${details.message}`); errors.push(`${subProperty}: ${details.message}`);
break; break;
} else if (first === '.') { } else if (first === '.') {
errors.push(`${subProperty.substr(1)}: ${details.message}`); errors.push(`${subProperty.substring(1)}: ${details.message}`);
break; break;
} }
} }

2
frontend/src/app/framework/angular/pipes/colors.pipes.ts

@ -58,7 +58,7 @@ const ColorDefinitions: ReadonlyArray<ColorDefinition> = [
function parseColor(value: string) { function parseColor(value: string) {
if (value.charAt(0) === '#') { if (value.charAt(0) === '#') {
value = value.substr(1, 6); value = value.substring(1, 7);
} }
value = value.replace(/ /g, '').toLowerCase(); value = value.replace(/ /g, '').toLowerCase();

2
frontend/src/app/framework/angular/pipes/money.pipe.ts

@ -22,7 +22,7 @@ export class MoneyPipe implements PipeTransform {
public transform(value: number): any { public transform(value: number): any {
const money = value.toFixed(2).toString(); const money = value.toFixed(2).toString();
let result = `${money.substr(0, money.length - 3) + this.separator.value}<span class="decimal">${money.substr(money.length - 2, 2)}</span>`; let result = `${money.substring(0, money.length - 3) + this.separator.value}<span class="decimal">${money.substring(money.length - 2)}</span>`;
if (this.currency.showAfter) { if (this.currency.showAfter) {
result = `${result} ${this.currency.symbol}`; result = `${result} ${this.currency.symbol}`;

2
frontend/src/app/framework/configurations.ts

@ -47,7 +47,7 @@ export class ApiUrlConfig {
public buildUrl(path: string) { public buildUrl(path: string) {
if (path.indexOf('/') === 0) { if (path.indexOf('/') === 0) {
path = path.substr(1); path = path.substring(1);
} }
return this.value + path; return this.value + path;

2
frontend/src/app/framework/services/localizer.service.ts

@ -56,7 +56,7 @@ export class LocalizerService {
private replaceVariables(text: string, args: {}): string { private replaceVariables(text: string, args: {}): string {
text = text.replace(/{[^}]*}/g, (matched: string) => { text = text.replace(/{[^}]*}/g, (matched: string) => {
const inner = matched.substr(1, matched.length - 2); const inner = matched.substring(1, matched.length - 1);
let replaceValue: string; let replaceValue: string;

2
frontend/src/app/framework/utils/error.spec.ts

@ -17,7 +17,7 @@ describe('ErrorDto', () => {
localizer = Mock.ofType<LocalizerService>(); localizer = Mock.ofType<LocalizerService>();
localizer.setup(x => x.getOrKey(It.isAnyString())) localizer.setup(x => x.getOrKey(It.isAnyString()))
.returns((key: string) => key.substr(5)); .returns((key: string) => key.substring(5));
}); });
it('should create simple message with error code', () => { it('should create simple message with error code', () => {

2
frontend/src/app/framework/utils/math-helper.ts

@ -146,7 +146,7 @@ export module MathHelper {
} }
if (value.charAt(0) === '#') { if (value.charAt(0) === '#') {
value = value.substr(1, 6); value = value.substr(1, 7);
} }
value = value.replace(/ /g, '').toLowerCase(); value = value.replace(/ /g, '').toLowerCase();

Loading…
Cancel
Save