Skip to content

Commit

Permalink
#36 - fixed adding multiple resources of the same type from the toolbox
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Mrzygłód committed Oct 26, 2017
1 parent ad6fcf3 commit a5caa4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/parsers/templateParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
12 changes: 9 additions & 3 deletions app/reducers/fileDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a5caa4e

Please sign in to comment.