diff --git a/cypress/e2e/origin-save.cy.js b/cypress/e2e/origin-save.cy.js
--- a/cypress/e2e/origin-save.cy.js
+++ b/cypress/e2e/origin-save.cy.js
@@ -54,7 +54,8 @@
errorMessage = '',
saveRequestDate = new Date(),
visitDate = new Date(),
- visitStatus = null
+ visitStatus = null,
+ fromWebhook = false
} = {}) {
let response;
if (responseStatus !== 200 && errorMessage) {
@@ -68,7 +69,8 @@
saveRequestDate: saveRequestDate,
saveTaskStatus: saveTaskStatus,
visitDate: visitDate,
- visitStatus: visitStatus
+ visitStatus: visitStatus,
+ fromWebhook: fromWebhook
});
}
cy.intercept('POST', requestUrl, {body: response, statusCode: responseStatus})
@@ -84,7 +86,8 @@
saveRequestDate = new Date(),
saveTaskStatus,
visitDate = new Date(),
- visitStatus
+ visitStatus,
+ fromWebhook = false
} = {}) {
return {
'visit_type': visitType,
@@ -94,7 +97,8 @@
'save_request_date': saveRequestDate ? saveRequestDate.toISOString() : null,
'save_task_status': saveTaskStatus,
'visit_date': visitDate ? visitDate.toISOString() : null,
- 'visit_status': visitStatus
+ 'visit_status': visitStatus,
+ 'from_webhook': fromWebhook
};
};
@@ -317,6 +321,34 @@
});
});
+ it('should display webhook icon when request was created from forge webhook receiver', function() {
+ const originUrl = 'https://git.example.org/example.git';
+ const saveRequestData = genOriginSaveResponse({
+ saveRequestStatus: 'accepted',
+ originUrl: originUrl,
+ saveTaskStatus: 'succeeded',
+ visitDate: null,
+ visitStatus: 'full',
+ fromWebhook: true
+ });
+ const saveRequestsListData = {
+ 'recordsTotal': 1,
+ 'draw': 2,
+ 'recordsFiltered': 1,
+ 'data': [saveRequestData]
+ };
+
+ cy.intercept('/save/requests/list/**', {body: saveRequestsListData})
+ .as('saveRequestsList');
+
+ loadSaveRequestsListPage();
+
+ cy.get('tbody tr').then(rows => {
+ const firstRowCells = rows[0].cells;
+ expect($(firstRowCells[5]).html()).to.contain.string('mdi-webhook');
+ });
+ });
+
it('should not add timestamp to the browse origin URL is no visit date has been found', function() {
const originUrl = 'https://git.example.org/example.git';
const saveRequestData = genOriginSaveResponse({
diff --git a/swh/web/save_code_now/assets/origin-save-admin.js b/swh/web/save_code_now/assets/origin-save-admin.js
--- a/swh/web/save_code_now/assets/origin-save-admin.js
+++ b/swh/web/save_code_now/assets/origin-save-admin.js
@@ -119,14 +119,18 @@
columnsData.push({
name: 'info',
render: (data, type, row) => {
+ let info = '';
if (row.save_task_status === 'succeeded' || row.save_task_status === 'failed' ||
row.note != null) {
- return ``;
- } else {
- return '';
}
+ if (row.from_webhook) {
+ info += ``;
+ }
+ return info;
}
});
diff --git a/swh/web/save_code_now/assets/origin-save.js b/swh/web/save_code_now/assets/origin-save.js
--- a/swh/web/save_code_now/assets/origin-save.js
+++ b/swh/web/save_code_now/assets/origin-save.js
@@ -204,14 +204,19 @@
{
name: 'info',
render: (data, type, row) => {
+ let info = '';
if (row.save_task_status === 'succeeded' || row.save_task_status === 'failed' ||
row.note != null) {
- return ``;
- } else {
- return '';
}
+ if (row.from_webhook) {
+ info += ``;
+ }
+ return info;
+
}
},
{