diff --git a/.gitignore b/.gitignore index 750cb7d..0544e78 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,9 @@ build/Release node_modules app/node_modules +# NPM package lock +package-lock.json + # OSX .DS_Store diff --git a/README.md b/README.md index f2a09a9..39533ac 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,16 @@ To run a project you can use either [Yarn](https://yarnpkg.com/lang/en/) or NPM: ``` $ cd your_project $ yarn +$ git submodule update --init +$ powershell.exe .\_agt_clean.ps1 $ npm run dev ``` or ``` $ cd your_project $ npm install +$ git submodule update --init +$ powershell.exe .\_agt_clean.ps1 $ npm run dev ``` diff --git a/_aqt_merge.js b/_aqt_merge.js index ae4e225..ffda324 100644 --- a/_aqt_merge.js +++ b/_aqt_merge.js @@ -7,7 +7,9 @@ const dirMetadata = 'app/data/aqt'; glob('azure-quickstart-templates/**/metadata.json', (error, files) => { if (fs.existsSync(dirMetadata) === false) { - fs.mkdirSync(dirMetadata); + const dirMetaSplit = dirMetadata.split('/'); + fs.mkdirSync(`${dirMetaSplit[0]}/${dirMetaSplit[1]}`); + fs.mkdirSync(`${dirMetaSplit[0]}/${dirMetaSplit[1]}/${dirMetaSplit[2]}`); } let simpleCounter = 0; diff --git a/app/components/QuickTemplate.css b/app/components/QuickTemplate.css new file mode 100644 index 0000000..5f0cd60 --- /dev/null +++ b/app/components/QuickTemplate.css @@ -0,0 +1,19 @@ +.quicktemplate { + position: relative; + } + + .row { + padding-top: 2px !important; + padding-bottom: 2px !important; + } + + .buttonRight { + position: absolute; + right: 30px; + } + + .buttonLeft { + position: absolute; + left: 30px; + } + \ No newline at end of file diff --git a/app/components/QuickTemplate.js b/app/components/QuickTemplate.js new file mode 100644 index 0000000..6789261 --- /dev/null +++ b/app/components/QuickTemplate.js @@ -0,0 +1,65 @@ +// @flow +import React, { Component } from 'react'; +import { Button, Form, Header, Icon, Grid, Modal, Divider } from 'semantic-ui-react'; + +import styles from './QuickTemplate.css'; + +const fs = require('fs'); + +const dirMetadata = 'app/data/aqt'; +export default class QuickTemplate extends Component { + props: { + dispatchButtonClick: (action: string) => void, + openTemplate: (deployPath: string) => void, + isQuickTemplateOpen: boolean, + changePage: (action: string) => void, + currentPage: number + } + + openTemplate(deployPath: string) { + this.props.openTemplate(deployPath); + this.props.dispatchButtonClick('CLOSE_QUICKTEMPLATE'); + } + + generateGrid() { + const templates = JSON.parse(fs.readFileSync(`./${dirMetadata}/output_${this.props.currentPage}.json`, 'utf8')); + + const grid = []; + for (let i = 0; i < 10; i += 2) { + grid.push( + + + + + + + ); + } + + return grid; + } + + render() { + return ( + this.props.dispatchButtonClick('CLOSE_QUICKTEMPLATE')} closeIcon="close"> + +
+ + Sample templates + + Select quick template to load. + +
+ +
+ + {this.generateGrid()} + +
+ + +
+
+
); + } +}