Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Commit 3e5172a

Browse files
committed
Revert the whole pipeline status icons update feature
1 parent d32503f commit 3e5172a

File tree

5 files changed

+11
-79
lines changed

5 files changed

+11
-79
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ A browser extension that enhance all Merge Requests lists on any instance of Git
2121
- Base Jira URL is configured in extension preferences
2222
- The ticket ID or an icon can be displayed as the link label (configured in extension preferences)
2323
- WIP toggle button (can be enabled/disabled in the extension preferences)
24-
- Automatic pipeline status update every 10 seconds (can be enabled/disabled in the extension preferences)
2524
- Compatible with all GitLab editions (GitLab CE, GitLab EE, GitLab.com) (look at the prerequisites, though)
2625

2726
## Prerequisites
@@ -51,6 +50,10 @@ Due to a technical GitLab limitation, the extension has no reliable way to deter
5150

5251
It would be great, however the extension has no reliable way to do that due to a technical GitLab limitation.
5352

53+
- Pipeline status icons aren't being automatically updated on Merge Requests lists (it is on other pages), can you add this feature?
54+
55+
That was the initial idea for the 1.6 release, however it's not possible due to a technical GitLab limitation.
56+
5457
## Changelog
5558

5659
See [here](https://github.com/EpocDotFr/gitlab-merge-requests-lists-enhancer/releases).

html/options.html

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,6 @@
6262
<div class="pbs pll">
6363
<small class="txt-muted">This feature is automatically disabled if logged-out</small>
6464
</div>
65-
<div class="pts row">
66-
<div class="w40p txt-center browser-style">
67-
<input type="checkbox" id="automatically_update_pipeline_status_icons">
68-
</div>
69-
<div>
70-
<label for="automatically_update_pipeline_status_icons">Automatically update pipeline status icons every 10 seconds</label>
71-
</div>
72-
</div>
73-
<div class="pbs pll">
74-
<small class="txt-muted">This feature is automatically disabled if the GitLab "pipeline" feature is disabled</small>
75-
</div>
7665
<div class="txt-center pts pbs"><button type="submit" class="browser-style">Save preferences</button></div>
7766
</form>
7867

js/content.js

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@
132132
this.baseUrl = location.protocol + '//' + location.host;
133133
this.baseApiUrl = this.baseUrl + '/api/v4/';
134134
this.userAuthenticated = this.isUserAuthenticated();
135-
this.pipelineFeatureEnabled = this.isPipelineFeatureEnabled();
136135
this.apiClient = new GitLabApiClient(this.baseApiUrl, this.getCsrfToken());
137136

138137
this.currentMergeRequestIds = this.getCurrentMergeRequestIds();
@@ -185,13 +184,6 @@
185184
return document.querySelector('.navbar-nav .header-user') ? true : false;
186185
}
187186

188-
/**
189-
* Determines if the project do uses the Gitlab "pipeline" feature.
190-
*/
191-
isPipelineFeatureEnabled() {
192-
return document.querySelector('.issuable-pipeline-status') ? true : false;
193-
}
194-
195187
/**
196188
* Gets all Merge Requests IDs that are currently displayed.
197189
*/
@@ -210,7 +202,10 @@
210202
fetchMergeRequestsDetailsThenUpdateUI(mergeRequestIds) {
211203
let self = this;
212204

213-
this.fetchMergeRequestsDetails(mergeRequestIds).then(function(responseData) {
205+
this.apiClient.getProjectMergeRequests(
206+
this.currentProjectId,
207+
mergeRequestIds
208+
).then(function(responseData) {
214209
if (self.preferences.display_source_and_target_branches) {
215210
self.removeExistingTargetBranchNodes();
216211
}
@@ -228,24 +223,9 @@
228223
if (self.userAuthenticated && self.preferences.enable_button_to_toggle_wip_status) {
229224
self.attachClickEventToToggleWipStatusButtons();
230225
}
231-
232-
if (self.pipelineFeatureEnabled && self.preferences.automatically_update_pipeline_status_icons) {
233-
self.schedulePipelineStatusIconsUpdate();
234-
}
235226
});
236227
}
237228

238-
/**
239-
* Performs an HTTP GET request to the GitLab API to retrieve details about Merge Requests that are
240-
* currently displayed.
241-
*/
242-
fetchMergeRequestsDetails(mergeRequestIds) {
243-
return this.apiClient.getProjectMergeRequests(
244-
this.currentProjectId,
245-
mergeRequestIds
246-
);
247-
}
248-
249229
/**
250230
* Removes all branches that may have been already displayed by GitLab.
251231
*/
@@ -594,34 +574,6 @@
594574
return placeholders[placeholder];
595575
}).trim();
596576
}
597-
598-
/*
599-
* Schedule a pipeline status icons update to be performed in 10 seconds.
600-
*/
601-
schedulePipelineStatusIconsUpdate() {
602-
let self = this;
603-
604-
setTimeout(function() {
605-
self.updatePipelineStatusIcons();
606-
}, 10000);
607-
}
608-
609-
/**
610-
* Actually update pipeline status icons by invoking the GitLab API.
611-
*/
612-
updatePipelineStatusIcons() {
613-
let self = this;
614-
615-
this.fetchMergeRequestsDetails(this.currentMergeRequestIds).then(function(mergeRequests) {
616-
mergeRequests.forEach(function(mergeRequest) {
617-
let mergeRequestNode = self.getMergeRequestNode(mergeRequest.id);
618-
619-
// TODO
620-
});
621-
622-
self.schedulePipelineStatusIconsUpdate();
623-
});
624-
}
625577
}
626578

627579
let cs = new ContentScript();

js/options.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
this.jiraTicketLinkLabelTypeRadioButtons = Array.from(document.querySelectorAll('input[name="jira_ticket_link_label_type"]'));
3838

3939
this.enableButtonToToggleWipStatusCheckbox = document.querySelector('input#enable_button_to_toggle_wip_status');
40-
41-
this.automaticallyUpdatePipelineStatusIconsCheckbox = document.querySelector('input#automatically_update_pipeline_status_icons');
4240
}
4341

4442
/**
@@ -69,9 +67,6 @@
6967

7068
self.enableButtonToToggleWipStatusCheckbox.checked = preferences.enable_button_to_toggle_wip_status;
7169
self.enableButtonToToggleWipStatusCheckbox.dispatchEvent(new CustomEvent('change'));
72-
73-
self.automaticallyUpdatePipelineStatusIconsCheckbox.checked = preferences.automatically_update_pipeline_status_icons;
74-
self.automaticallyUpdatePipelineStatusIconsCheckbox.dispatchEvent(new CustomEvent('change'));
7570
});
7671
}
7772

@@ -122,10 +117,6 @@
122117
this.enableButtonToToggleWipStatusCheckbox.addEventListener('change', function() {
123118
self.forceUserToEnableAtLeastOneFeatureIfNecessarily();
124119
});
125-
126-
this.automaticallyUpdatePipelineStatusIconsCheckbox.addEventListener('change', function() {
127-
self.forceUserToEnableAtLeastOneFeatureIfNecessarily();
128-
});
129120
}
130121

131122
/**
@@ -147,8 +138,7 @@
147138
enable_jira_ticket_link: this.enableJiraTicketLinkCheckbox.checked,
148139
base_jira_url: this.baseJiraUrlInput.value,
149140
jira_ticket_link_label_type: jira_ticket_link_label_type,
150-
enable_button_to_toggle_wip_status: this.enableButtonToToggleWipStatusCheckbox.checked,
151-
automatically_update_pipeline_status_icons: this.automaticallyUpdatePipelineStatusIconsCheckbox.checked
141+
enable_button_to_toggle_wip_status: this.enableButtonToToggleWipStatusCheckbox.checked
152142
},
153143
function() {
154144
self.setSuccessfulVisualFeedbackOnSubmitButton();
@@ -183,8 +173,7 @@
183173
return !this.displaySourceAndTargetBranchesCheckbox.checked
184174
&& !this.enableButtonToCopyMrInfoCheckbox.checked
185175
&& !this.enableJiraTicketLinkCheckbox.checked
186-
&& !this.enableButtonToToggleWipStatusCheckbox.checked
187-
&& !this.automaticallyUpdatePipelineStatusIconsCheckbox.checked;
176+
&& !this.enableButtonToToggleWipStatusCheckbox.checked;
188177
}
189178

190179
/**

js/preferences.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
enable_jira_ticket_link: false,
1414
base_jira_url: '',
1515
jira_ticket_link_label_type: 'ticket_id',
16-
enable_button_to_toggle_wip_status: true,
17-
automatically_update_pipeline_status_icons: false
16+
enable_button_to_toggle_wip_status: true
1817
};
1918
}
2019

0 commit comments

Comments
 (0)