diff --git a/app/parsers/templateParser.js b/app/parsers/templateParser.js index 0825175..b62f7e4 100644 --- a/app/parsers/templateParser.js +++ b/app/parsers/templateParser.js @@ -31,7 +31,7 @@ export default class TemplateParser { parseTemplate(): Template { const parsedTemplate = { - schema: this.json.$schema, + schema: this.json.$schema || '', contentVersion: this.json.contentVersion, outputs: this.getOutputs(), parameters: this.getParameters(), diff --git a/app/reducers/fileDialog.js b/app/reducers/fileDialog.js index f9b6f9a..85a212d 100644 --- a/app/reducers/fileDialog.js +++ b/app/reducers/fileDialog.js @@ -102,13 +102,19 @@ export default function fileDialog(state: fileDialogStateType = initialState, ac isError: false }); case ADD_RESOURCE: { + var uuid = Uuid.uuidv4(); state.fileData.resources.push({ - id: `${action.resourceType}${Uuid.uuidv4()}`, - displayName: action.resourceType, - name: action.resourceType, + id: `${action.resourceType}${uuid}`, + displayName: `${action.resourceType}-${uuid}`, + name: `${action.resourceType}-${uuid}`, dependsOn: [], type: action.resourceType }); + + state.fileData.schema === '' ? + state.fileData.schema = 'http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#' : + state.fileData.schema = state.fileData.schema; + return Object.assign({}, state, { selectedFilename: 'EDITED TEMPLATE', fileData: state.fileData,