Commit 57731bbc authored by Regis's avatar Regis

better name for zeroData - use insteaf importing Vue

parent 05c409d2
...@@ -2,25 +2,25 @@ export default (apiData, tasks) => { ...@@ -2,25 +2,25 @@ export default (apiData, tasks) => {
const $tasks = $('#task_status'); const $tasks = $('#task_status');
const $tasksShort = $('#task_status_short'); const $tasksShort = $('#task_status_short');
const $issueableHeader = $('.issuable-header'); const $issueableHeader = $('.issuable-header');
const zeroData = { api: null, tasks: null }; const tasksStates = { api: null, tasks: null };
if ($tasks.length === 0) { if ($tasks.length === 0) {
if (!(apiData.task_status.indexOf('0 of 0') >= 0)) { if (!(apiData.task_status.indexOf('0 of 0') === 0)) {
$issueableHeader.append(`<span id="task_status">${apiData.task_status}</span>`); $issueableHeader.append(`<span id="task_status">${apiData.task_status}</span>`);
} else { } else {
$issueableHeader.append('<span id="task_status"></span>'); $issueableHeader.append('<span id="task_status"></span>');
} }
} else { } else {
zeroData.api = apiData.task_status.indexOf('0 of 0') >= 0; tasksStates.api = apiData.task_status.indexOf('0 of 0') === 0;
zeroData.tasks = tasks.indexOf('0 of 0') >= 0; tasksStates.tasks = tasks.indexOf('0 of 0') === 0;
} }
if ($tasks && !zeroData.api) { if ($tasks && !tasksStates.api) {
$tasks.text(apiData.task_status); $tasks.text(apiData.task_status);
$tasksShort.text(apiData.task_status); $tasksShort.text(apiData.task_status);
} else if (zeroData.tasks) { } else if (tasksStates.tasks) {
$issueableHeader.append(`<span id="task_status">${apiData.task_status}</span>`); $issueableHeader.append(`<span id="task_status">${apiData.task_status}</span>`);
} else if (zeroData.api) { } else if (tasksStates.api) {
$tasks.remove(); $tasks.remove();
$tasksShort.remove(); $tasksShort.remove();
} }
......
<script> <script>
import Vue from 'vue';
import Visibility from 'visibilityjs'; import Visibility from 'visibilityjs';
import Poll from './../lib/utils/poll'; import Poll from './../lib/utils/poll';
import Service from './services/index'; import Service from './services/index';
...@@ -91,7 +90,7 @@ export default { ...@@ -91,7 +90,7 @@ export default {
this.description = description; this.description = description;
this.setTabTitle(); this.setTabTitle();
Vue.nextTick(() => { this.$nextTick(() => {
elementsToVisualize.forEach((element) => { elementsToVisualize.forEach((element) => {
if (element) { if (element) {
element.classList.remove('issue-realtime-pre-pulse'); element.classList.remove('issue-realtime-pre-pulse');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment