Skip to content

Commit

Permalink
Add Loading Animation
Browse files Browse the repository at this point in the history
  • Loading branch information
kaishuu0123 authored and kouki-o committed Dec 5, 2019
1 parent 23e250e commit b1faf21
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/javascript/commons/custom-axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default (Vue, { store }) => {
});

http.interceptors.response.use((response) => {
store.commit('SET_IS_LOADING', true);
store.commit('SET_IS_LOADING', false);
return response;
}, (error) => {
const errorMsg = `${error.response.status} ${error.response.statusText}`
Expand Down
46 changes: 36 additions & 10 deletions app/javascript/components/backlogs/StoryModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@
modal-class="rb-modal"
size="lg"
ref="modal"
:visible='visible'
@shown="onShow"
@hidden="onHide"
hide-header
hide-footer
no-fade>
<div class="container-fluid" ref="container">
<div id="rb-story-modal" class="container-fluid" ref="container">
<loading
:active.sync="isLoading"
:can-cancel="false"
:is-full-page="false"
color="#4e73df"
background-color="#f8f9fc"
loader="dots"></loading>

<div v-if="message.body" class="row">
<div :class="`w-100 p-2 alert alert-${this.message.type}`">
{{ this.message.body }}
Expand Down Expand Up @@ -175,6 +182,10 @@ import CustomMoment from '../../commons/custom-moment'
import urlparse from 'url-parse'
import VueClipboard2 from 'vue-clipboard2'
import ColorUtils from '../../mixins/colorUtils'
// Import component
import Loading from 'vue-loading-overlay';
// Import stylesheet
import 'vue-loading-overlay/dist/vue-loading.css';
Vue.use(VueClipboard2)
Expand All @@ -188,20 +199,20 @@ export default {
InputPoint,
CommentFormAndList,
HistoryList,
VueClipboard2
VueClipboard2,
Loading
},
mixins: [
ColorUtils
],
name: 'StoryModal',
props: {
projectId: String,
visible: Boolean
isLoading: Boolean,
},
data() {
return {
isEdit: false,
isLoading: false,
story: {
id: null,
title: '',
Expand Down Expand Up @@ -289,14 +300,10 @@ export default {
}
if (this.$route.params.storyId) {
this.isLoading = true
this.getStory({
projectId: this.projectId,
storyId: this.$route.params.storyId
})
.then(story => {
this.isLoading = false
})
} else {
this.isEdit = true
}
Expand Down Expand Up @@ -391,11 +398,30 @@ export default {
</script>

<style lang="scss">
#rb-story-modal {
/* for vue-loading-overlay */
position: relative;
}
.rb-modal {
font-size: 0.8rem;
.modal-dialog {
max-width: 75%
max-width: 75%k
}
}
/**
* Bootstrap Modal
*/
.modal {
z-index: 1101 !important;
}
/**
* Vue Loading
*/
.vld-overlay.is-full-page {
z-index: 1103 !important;
}
</style>
38 changes: 35 additions & 3 deletions app/javascript/components/kanban/TaskModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@
hide-header
hide-footer
no-fade>
<div class="container-fluid" ref="container">
<div id="rb-task-modal" class="container-fluid" ref="container">
<loading
:active.sync="isLoading"
:can-cancel="false"
:is-full-page="false"
color="#4e73df"
background-color="#f8f9fc"
loader="dots"></loading>

<div class="row">
<div class="col-9">
<div class="d-flex mb-2">
Expand Down Expand Up @@ -166,6 +174,10 @@ import HistoryList from '../commons/HistoryList'
import CustomMoment from '../../commons/custom-moment'
import urlparse from 'url-parse'
import VueClipboard2 from 'vue-clipboard2'
// Import component
import Loading from 'vue-loading-overlay';
// Import stylesheet
import 'vue-loading-overlay/dist/vue-loading.css';
Vue.use(VueClipboard2)
Expand All @@ -177,7 +189,8 @@ export default {
SelectAssignee,
SelectStatus,
CommentFormAndList,
HistoryList
HistoryList,
Loading
},
name: 'TaskModal',
props: {
Expand Down Expand Up @@ -359,14 +372,33 @@ export default {
</script>

<style lang="scss">
#rb-task-modal {
/* for vue-loading-overlay */
position: relative;
}
.rb-modal {
font-size: 0.8rem;
.modal-dialog {
max-width: 75%
max-width: 75%k
}
}
/**
* Bootstrap Modal
*/
.modal {
z-index: 1101 !important;
}
/**
* Vue Loading
*/
.vld-overlay.is-full-page {
z-index: 1103 !important;
}
.rb-select {
border-bottom: 1px solid #888
}
Expand Down
20 changes: 18 additions & 2 deletions app/javascript/pages/BacklogsPage.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<template>
<div id="rb-backlogs" class="container-fluid mt-3">
<loading
:active.sync="isLoading"
:can-cancel="false"
:is-full-page="false"
color="#4e73df"
background-color="#f8f9fc"
loader="dots"></loading>
<div class="row px-2">
<div class="d-flex w-100 align-items-center justify-content-between mb-2">
<h1 class="h4 mb-0 text-gray-700">{{ $t('title.masterBacklogs')}}</h1>
Expand Down Expand Up @@ -47,7 +54,7 @@
</div>
</div>

<StoryModal id="storyModal" :projectId="projectId" />
<StoryModal id="storyModal" :projectId="projectId" :isLoading="isLoading" />
</div>
</template>

Expand All @@ -60,6 +67,10 @@ import BacklogsCard from '../components/backlogs/BacklogsCard'
import SprintCard from '../components/backlogs/SprintCard'
import StoryListItem from '../components/backlogs/StoryListItem'
import '../commons/custom-bootstrap-vue'
// Import component
import Loading from 'vue-loading-overlay';
// Import stylesheet
import 'vue-loading-overlay/dist/vue-loading.css';
export default {
data () {
Expand All @@ -83,7 +94,8 @@ export default {
StoryModal,
BacklogsCard,
SprintCard,
StoryListItem
StoryListItem,
Loading
},
mounted() {
this.projectId = this.$route.meta.projectId
Expand All @@ -104,6 +116,7 @@ export default {
},
computed: {
...mapState({
isLoading: 'isLoading',
sprints: 'sprints',
storiesInBacklogs: 'storiesInBacklogs'
}),
Expand All @@ -124,6 +137,9 @@ export default {
#rb-backlogs {
font-size: 0.8em;
/* for vue-loading-overlay */
position: relative;
}
.rb-alert-primary {
Expand Down
16 changes: 15 additions & 1 deletion app/javascript/pages/ClosedSprintsPage.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<template>
<div class="container-fluid">
<loading
:active.sync="isLoading"
:can-cancel="false"
:is-full-page="false"
color="#4e73df"
background-color="#f8f9fc"
loader="dots"></loading>

<div class="row">
<div class="col-6" v-for="sprint in sprints" :key="sprint.id">
<SprintCard class="mb-3" :sprint="sprint" :projectId="projectId" />
Expand All @@ -22,6 +30,10 @@ import BacklogsCard from '../components/backlogs/BacklogsCard'
import SprintCard from '../components/backlogs/SprintCard'
import StoryListItem from '../components/backlogs/StoryListItem'
import '../commons/custom-bootstrap-vue'
// Import component
import Loading from 'vue-loading-overlay';
// Import stylesheet
import 'vue-loading-overlay/dist/vue-loading.css';
export default {
data () {
Expand All @@ -34,7 +46,8 @@ export default {
StoryModal,
BacklogsCard,
SprintCard,
StoryListItem
StoryListItem,
Loading
},
mounted() {
this.projectId = this.$route.meta.projectId
Expand All @@ -55,6 +68,7 @@ export default {
},
computed: {
...mapState({
isLoading: 'isLoading',
sprints: 'sprints',
storiesInBacklogs: 'storiesInBacklogs'
}),
Expand Down
27 changes: 23 additions & 4 deletions app/javascript/pages/KanbanPage.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<template>
<div class="container-fluid mt-2">
<div id="kanban" class="container-fluid mt-2">
<loading
:active.sync="isLoading"
:can-cancel="false"
:is-full-page="false"
color="#4e73df"
background-color="#f8f9fc"
loader="dots"></loading>

<div class="row mb-2 bg-light sticky-top">
<nav class="navbar px-1 py-0 navbar-light">
<a class="navbar-brand text-gray-700" href="#">{{ sprintTitle }}</a>
Expand Down Expand Up @@ -83,8 +91,8 @@
</table>
</div>

<TaskModal :projectId="projectId" />
<StoryModal :projectId="projectId" />
<TaskModal :projectId="projectId" :isLoading="isLoading" />
<StoryModal :projectId="projectId" :isLoading="isLoading" />
</div>
</template>

Expand All @@ -98,14 +106,19 @@ import MarkdownText from '../components/MarkdownText'
import VueDraggable from 'vuedraggable'
import '../commons/custom-bootstrap-vue'
import ColorUtils from '../mixins/colorUtils'
// Import component
import Loading from 'vue-loading-overlay';
// Import stylesheet
// import 'vue-loading-overlay/dist/vue-loading.css';
export default {
components: {
StoryModal,
TaskModal,
TaskCard,
MarkdownText,
VueDraggable
VueDraggable,
Loading
},
mixins: [
ColorUtils
Expand Down Expand Up @@ -163,6 +176,7 @@ export default {
return this.projectTicketStatuses.length
},
...mapState([
'isLoading',
'stories',
'projectTicketStatuses'
])
Expand Down Expand Up @@ -255,6 +269,11 @@ export default {
</script>

<style lang="scss">
#kanban {
/* for vue-loading-overlay */
position: relative;
}
.no-move {
transition: transform 0s;
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"vue-color": "^2.7.0",
"vue-i18n": "^8.14.1",
"vue-loader": "^15.7.1",
"vue-loading-overlay": "^3.2.0",
"vue-numeral-filter": "^1.1.1",
"vue-observe-visibility": "^0.4.4",
"vue-router": "^3.1.3",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7358,6 +7358,11 @@ vue-loader@^15.7.1:
vue-hot-reload-api "^2.3.0"
vue-style-loader "^4.1.0"

vue-loading-overlay@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/vue-loading-overlay/-/vue-loading-overlay-3.2.0.tgz#7896f195e26a8d915219139a096367c9ad2c3c61"
integrity sha512-QBHa+vwcQ3k3oKp4pucP7RHWHSQvgVWFlDFqSaXLu+kCuEv1PZCoerAo1T04enF5y9yMFCqh7L9ChrWHy7HYvA==

vue-numeral-filter@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/vue-numeral-filter/-/vue-numeral-filter-1.1.1.tgz#dc717c7d86cb10d2fc370ef992bcac80fb9fc666"
Expand Down

0 comments on commit b1faf21

Please sign in to comment.