remove confirm modal for asset injection in edit-custom-config (#1219)

This commit is contained in:
Micah Elizabeth Scott 2018-10-07 13:07:14 -07:00 committed by Rigel Kent
parent 302e7b19da
commit 211239ed94

View File

@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core'
import { ConfigService } from '@app/+admin/config/shared/config.service'
import { ConfirmService } from '@app/core'
import { ServerService } from '@app/core/server/server.service'
import { CustomConfigValidatorsService, FormReactive, UserValidatorsService } from '@app/shared'
import { NotificationsService } from 'angular2-notifications'
@ -29,7 +28,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
private notificationsService: NotificationsService,
private configService: ConfigService,
private serverService: ServerService,
private confirmService: ConfirmService,
private i18n: I18n
) {
super()
@ -124,28 +122,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
}
async formValidated () {
const newCustomizationJavascript = this.form.value['customizationJavascript']
const newCustomizationCSS = this.form.value['customizationCSS']
const customizations = []
if (newCustomizationJavascript && newCustomizationJavascript !== this.oldCustomJavascript) customizations.push('JavaScript')
if (newCustomizationCSS && newCustomizationCSS !== this.oldCustomCSS) customizations.push('CSS')
if (customizations.length !== 0) {
const customizationsText = customizations.join('/')
// FIXME: i18n service does not support string concatenation
const message = this.i18n('You set custom {{customizationsText}}. ', { customizationsText }) +
this.i18n('This could lead to security issues or bugs if you do not understand it. ') +
this.i18n('Are you sure you want to update the configuration?')
const label = this.i18n('Please type') + ` "I understand the ${customizationsText} I set" ` + this.i18n('to confirm.')
const expectedInputValue = `I understand the ${customizationsText} I set`
const confirmRes = await this.confirmService.confirmWithInput(message, label, expectedInputValue)
if (confirmRes === false) return
}
const data: CustomConfig = {
instance: {
name: this.form.value['instanceName'],