Skip to content

Commit

Permalink
#26: added visual feedback for button click
Browse files Browse the repository at this point in the history
  • Loading branch information
croser committed Oct 21, 2019
1 parent 8d4a1e6 commit 5ea83d8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
35 changes: 35 additions & 0 deletions aar-frontend/src/components/FetchButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<template>
<v-btn @click.prevent="performDownload()" :class="className">
<div v-if="loading" style="display:inline;margin-right:16px;width:24px;height:24px;">
<v-progress-circular indeterminate="true" size="18" width="2"></v-progress-circular>
</div>
<v-icon v-else left>{{icon}}</v-icon>
<slot/>
</v-btn>
</template>

<script>
import {fetchService} from '../service/FetchService';
import Urls from '../constants/Urls';
export default {
name: 'FetchButton',
props: ['url', 'className', 'icon'],
data: function () {
return {
loading: false,
};
},
methods: {
performDownload () {
const me = this;
me.loading = true;
fetchService.performGet(Urls.HTTP_BASE + this.url).then(response => {
me.loading = false;
});
}
},
created: function () {
}
};
</script>
8 changes: 4 additions & 4 deletions aar-frontend/src/pages/MainPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@
</v-list>
</v-card>
</v-menu>
<v-btn @click.prevent="analyseRecords()" class="diagramButton">
<v-icon left>rotate_right</v-icon>
<fetch-button url="/analyseRecords" className="diagramButton" icon="rotate_right">
Post-Process
</v-btn>
</fetch-button>
<v-menu offset-y content-class="dropdown-menu" transition="slide-y-transition">
<v-btn slot="activator">
<v-icon left>save_alt</v-icon>
Expand Down Expand Up @@ -97,9 +96,11 @@
import EventName from '../constants/EventName';
import {fetchService} from '../service/FetchService';
import Urls from '../constants/Urls';
import FetchButton from '../components/FetchButton';
export default {
name: 'MainPage',
components: {FetchButton},
data: () => ({
exportDataItems: [
{exportType: 'CSV', title: 'CSV'},
Expand Down Expand Up @@ -130,7 +131,6 @@
},
downloadReport (reportType) {
const path = (reportType === 'FIRST_IMPRESSION') ? 'createFIEPDFReport' : 'createPDFStatisticReport';
console.log("###", reportType, path);
fetchService.performSimpleDownload(path);
}
},
Expand Down

0 comments on commit 5ea83d8

Please sign in to comment.