Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-11-23 15:04:03 +0300
committerPhil Hughes <me@iamphill.com>2017-11-23 15:04:03 +0300
commit45631562565760add7a7c52a6137e891f3a0c8f4 (patch)
tree44915f7c46d05fb8c6197662a3341ea8fb610f06 /app/assets/javascripts/pipelines
parent1d8ab59ebfa0d57e4015665c470c8339cd258a2c (diff)
Improve environments performance
Diffstat (limited to 'app/assets/javascripts/pipelines')
-rw-r--r--app/assets/javascripts/pipelines/components/navigation_tabs.vue51
-rw-r--r--app/assets/javascripts/pipelines/components/pipelines.vue31
2 files changed, 5 insertions, 77 deletions
diff --git a/app/assets/javascripts/pipelines/components/navigation_tabs.vue b/app/assets/javascripts/pipelines/components/navigation_tabs.vue
deleted file mode 100644
index 07befd23500..00000000000
--- a/app/assets/javascripts/pipelines/components/navigation_tabs.vue
+++ /dev/null
@@ -1,51 +0,0 @@
-<script>
- export default {
- name: 'PipelineNavigationTabs',
- props: {
- tabs: {
- type: Array,
- required: true,
- },
- },
- mounted() {
- $(document).trigger('init.scrolling-tabs');
- },
- methods: {
- shouldRenderBadge(count) {
- // 0 is valid in a badge, but evaluates to false, we need to check for undefined
- return count !== undefined;
- },
-
- onTabClick(tab) {
- this.$emit('onChangeTab', tab.scope);
- },
- },
-};
-</script>
-<template>
- <ul class="nav-links scrolling-tabs">
- <li
- v-for="(tab, i) in tabs"
- :key="i"
- :class="{
- active: tab.isActive,
- }"
- >
- <a
- role="button"
- @click="onTabClick(tab)"
- :class="`js-pipelines-tab-${tab.scope}`"
- >
- {{ tab.name }}
-
- <span
- v-if="shouldRenderBadge(tab.count)"
- class="badge"
- >
- {{tab.count}}
- </span>
-
- </a>
- </li>
- </ul>
-</template>
diff --git a/app/assets/javascripts/pipelines/components/pipelines.vue b/app/assets/javascripts/pipelines/components/pipelines.vue
index 233be8a49c8..fe1f3b4246a 100644
--- a/app/assets/javascripts/pipelines/components/pipelines.vue
+++ b/app/assets/javascripts/pipelines/components/pipelines.vue
@@ -3,15 +3,14 @@
import PipelinesService from '../services/pipelines_service';
import pipelinesMixin from '../mixins/pipelines';
import tablePagination from '../../vue_shared/components/table_pagination.vue';
- import navigationTabs from './navigation_tabs.vue';
+ import navigationTabs from '../../vue_shared/components/navigation_tabs.vue';
import navigationControls from './nav_controls.vue';
import {
convertPermissionToBoolean,
getParameterByName,
- historyPushState,
- buildUrlWithCurrentLocation,
parseQueryStringIntoObject,
} from '../../lib/utils/common_utils';
+ import CIPaginationMixin from '../../vue_shared/mixins/ci_pagination_api_mixin';
export default {
props: {
@@ -36,6 +35,7 @@
},
mixins: [
pipelinesMixin,
+ CIPaginationMixin,
],
data() {
const pipelinesData = document.querySelector('#pipelines-list-vue').dataset;
@@ -170,22 +170,8 @@
* - Update the internal state
*/
updateContent(parameters) {
- // stop polling
- this.poll.stop();
+ this.updateInternalState(parameters);
- const queryString = Object.keys(parameters).map((parameter) => {
- const value = parameters[parameter];
- // update internal state for UI
- this[parameter] = value;
- return `${parameter}=${encodeURIComponent(value)}`;
- }).join('&');
-
- // update polling parameters
- this.requestData = parameters;
-
- historyPushState(buildUrlWithCurrentLocation(`?${queryString}`));
-
- this.isLoading = true;
// fetch new data
return this.service.getPipelines(this.requestData)
.then((response) => {
@@ -203,14 +189,6 @@
this.poll.restart();
});
},
-
- onChangeTab(scope) {
- this.updateContent({ scope, page: '1' });
- },
- onChangePage(page) {
- /* URLS parameters are strings, we need to parse to match types */
- this.updateContent({ scope: this.scope, page: Number(page).toString() });
- },
},
};
</script>
@@ -235,6 +213,7 @@
<navigation-tabs
:tabs="tabs"
@onChangeTab="onChangeTab"
+ scope="pipelines"
/>
<navigation-controls