Skip to content

Commit

Permalink
Merge pull request #374 from systragroup/dev
Browse files Browse the repository at this point in the history
V4.7
  • Loading branch information
sboivinsystra authored Jun 28, 2023
2 parents 9e70e53 + dfa1def commit ebd49b2
Show file tree
Hide file tree
Showing 29 changed files with 1,262 additions and 618 deletions.
14 changes: 0 additions & 14 deletions dist/404.html

This file was deleted.

2 changes: 1 addition & 1 deletion dist/build.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/build.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions dist/config.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/config.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion dist/vendor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vendor.js.map

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions gen_report_html

This file was deleted.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Network Editor",
"author": "Simon Fortin <[email protected]>; Simon Boivin <[email protected]>",
"license": "MIT",
"version": "4.6.0",
"version": "4.7.0",
"private": true,
"scripts": {
"clean": "rm -rf dist && rm -f src/config.js",
Expand Down Expand Up @@ -82,8 +82,7 @@
"webpack-bundle-analyzer": "^4.9.0",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.15.0",
"write-file-webpack-plugin": "^4.5.1",
"xunit-viewer": "^7.2.0"
"write-file-webpack-plugin": "^4.5.1"
},
"resolutions": {
"ansi-regex": "^5.0.1",
Expand Down
24 changes: 23 additions & 1 deletion src/AWSClient.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { store } from '@src/store/index.js'
import AWS from 'aws-sdk'
import JSZip from 'jszip'
import saveAs from 'file-saver'

const USERPOOL_ID = process.env.VUE_APP_COGNITO_USERPOOL_ID
const IDENTITY_POOL_ID = process.env.VUE_APP_COGNITO_IDENTITY_POOL_ID
const REGION = process.env.VUE_APP_COGNITO_REGION
Expand All @@ -19,6 +22,24 @@ async function readJson (bucket, key) {
const fileContent = JSON.parse(response.Body.toString('utf-8').trim()) // can also do 'base64' here if desired
return fileContent
}
async function downloadFolder (bucket, prefix) {
// zip everything in a folder. keep filename. Folder structure will not work.
const zip = new JSZip()
const params = { Bucket: bucket, Prefix: prefix }
const response = await s3Client.listObjectsV2(params).promise()
if (response.Contents.length === 0) throw new Error('no params.json in base scenario')
for (const file of response.Contents) {
const fileName = file.Key.split('/').slice(-1)[0]
const params = { Bucket: bucket, Key: file.Key, ResponseCacheControl: 'no-cache' }
const response = await s3Client.getObject(params).promise()
zip.file(fileName, response.Body)
}

zip.generateAsync({ type: 'blob' }).then(function (content) {
saveAs(content, 'example.zip')
})
}

async function getBucketList () {
// from the cognito group name. get the list of available buckets on quetzal-config.
const bucketList = await this.readJson('quetzal-config', 'cognito_group_access.json')
Expand Down Expand Up @@ -128,7 +149,7 @@ async function getScenario (bucket) {
try {
const resp = await s3Client.headObject({ Bucket: bucket, Key: maxDateObj.Key }).promise()
userEmail = resp.Metadata.user_email
} catch (err) { console.error(err) }
} catch (err) { store.commit('changeAlert', err) }
scenList.push({ model: bucket, scenario: scen, lastModified: maxDate, userEmail: userEmail })
}
return scenList
Expand Down Expand Up @@ -157,5 +178,6 @@ export default {
createFolder,
putObject,
getImagesURL,
downloadFolder,

}
4 changes: 3 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
import Toolbar from '@comp/layout/Toolbar.vue'
import NavigationDrawer from '@comp/layout/NavigationDrawer.vue'
import Alert from '@comp/utils/Alert.vue'
import auth from './auth'
import s3 from './AWSClient'
import { axiosClient } from './axiosClient'
Expand All @@ -11,6 +11,7 @@ export default {
components: {
Toolbar,
NavigationDrawer,
Alert,
},
data () {
return {
Expand Down Expand Up @@ -94,6 +95,7 @@ export default {
</v-btn>
</template>
</v-snackbar>
<Alert />
</v-app>
</template>
<style lang="scss" scoped>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export default {
})
},
onMapLoaded (event) {
if (this.map) this.map.remove(); this.mapIsLoaded = false
if (this.map) this.mapIsLoaded = false
const bounds = new Mapbox.LngLatBounds()
// only use first and last point. seems to bug when there is anchor...
if (this.$store.getters.links.features.length > 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/MapResults.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default {
})
},
onMapLoaded (event) {
if (this.map) this.map.remove()
if (this.map) this.mapIsLoaded = false
const bounds = new mapboxgl.LngLatBounds()
// only use first and last point. seems to bug when there is anchor...
if (this.layerType === 'zones') {
Expand All @@ -83,7 +83,7 @@ export default {
bounds.extend([link.geometry.coordinates[0][0][0],
link.geometry.coordinates[0][0][link.geometry.coordinates.length - 1]])
}
} catch (err) { console.log(err) }
} catch (err) { this.$store.commit('changeAlert', err) }
})
} else {
this.links.features.forEach(link => {
Expand Down
Loading

0 comments on commit ebd49b2

Please sign in to comment.