Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7066601
D7413.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Subscribers
None
D7413.diff
View Options
diff --git a/assets/src/bundles/add_forge/add-request-history-item.ejs b/assets/src/bundles/add_forge/add-request-history-item.ejs
--- a/assets/src/bundles/add_forge/add-request-history-item.ejs
+++ b/assets/src/bundles/add_forge/add-request-history-item.ejs
@@ -12,7 +12,7 @@
aria-expanded="true" aria-controls="collapse$<%= index %>">
From <%= event.actor %> (<%= event.actor_role %>) on <%= event.date.slice(0, 16) %>
<%if (event.new_status !== null) { %>
- <span style="padding-left: 10px;">New status:</span> <%= event.new_status %>
+ <span style="padding-left: 10px;">New status:</span> <%= swh.add_forge.formatRequestStatusName(event.new_status) %>
<% } %>
</button>
</h2>
@@ -22,10 +22,10 @@
<p><%= event.text %></p>
<%if (event.new_status !== null) { %>
<p>
- <span>Status changed to:</span> <strong><%= event.new_status %></strong>
+ <span>Status changed to:</span> <strong><%= swh.add_forge.formatRequestStatusName(event.new_status) %></strong>
</p>
<% } %>
</div>
</div>
</div>
</div>
\ No newline at end of file
diff --git a/assets/src/bundles/add_forge/create-request.js b/assets/src/bundles/add_forge/create-request.js
--- a/assets/src/bundles/add_forge/create-request.js
+++ b/assets/src/bundles/add_forge/create-request.js
@@ -105,7 +105,10 @@
},
{
data: 'status',
- name: 'status'
+ name: 'status',
+ render: function(data, type, row, meta) {
+ return swh.add_forge.formatRequestStatusName(data);
+ }
}
]
});
diff --git a/assets/src/bundles/add_forge/index.js b/assets/src/bundles/add_forge/index.js
--- a/assets/src/bundles/add_forge/index.js
+++ b/assets/src/bundles/add_forge/index.js
@@ -11,3 +11,20 @@
export * from './create-request';
export * from './moderation-dashboard';
export * from './request-dashboard';
+
+export function formatRequestStatusName(status) {
+ // Mapping to format the request status to a human readable text
+ const statusLabel = {
+ 'PENDING': 'Pending',
+ 'WAITING_FOR_FEEDBACK': 'Waiting for feedback',
+ 'FEEDBACK_TO_HANDLE': 'Feedback to handle',
+ 'ACCEPTED': 'Accepted',
+ 'SCHEDULED': 'Scheduled',
+ 'FIRST_LISTING_DONE': 'First listing done',
+ 'FIRST_ORIGIN_LOADED': 'First origin loaded',
+ 'REJECTED': 'Rejected',
+ 'SUSPENDED': 'Suspended',
+ 'DENIED': 'Denied'
+ };
+ return status in statusLabel ? statusLabel[status] : status;
+}
diff --git a/assets/src/bundles/add_forge/moderation-dashboard.js b/assets/src/bundles/add_forge/moderation-dashboard.js
--- a/assets/src/bundles/add_forge/moderation-dashboard.js
+++ b/assets/src/bundles/add_forge/moderation-dashboard.js
@@ -51,7 +51,9 @@
{
data: 'status',
name: 'status',
- render: $.fn.dataTable.render.text()
+ render: function(data, type, row, meta) {
+ return swh.add_forge.formatRequestStatusName(data);
+ }
}
]
});
diff --git a/assets/src/bundles/add_forge/request-dashboard.js b/assets/src/bundles/add_forge/request-dashboard.js
--- a/assets/src/bundles/add_forge/request-dashboard.js
+++ b/assets/src/bundles/add_forge/request-dashboard.js
@@ -46,7 +46,7 @@
const data = await response.json();
forgeRequest = data.request;
- $('#requestStatus').text(forgeRequest.status);
+ $('#requestStatus').text(swh.add_forge.formatRequestStatusName(forgeRequest.status));
$('#requestType').text(forgeRequest.forge_type);
$('#requestURL').text(forgeRequest.forge_url);
$('#requestContactName').text(forgeRequest.forge_contact_name);
@@ -98,25 +98,12 @@
'DENIED': []
};
- const statusLabel = {
- 'PENDING': 'pending',
- 'WAITING_FOR_FEEDBACK': 'waiting for feedback',
- 'FEEDBACK_TO_HANDLE': 'feedback to handle',
- 'ACCEPTED': 'accepted',
- 'SCHEDULED': 'scheduled',
- 'FIRST_LISTING_DONE': 'first listing done',
- 'FIRST_ORIGIN_LOADED': 'first origin loaded',
- 'REJECTED': 'rejected',
- 'SUSPENDED': 'suspended',
- 'DENIED': 'denied'
- };
-
// Determine the possible next status out of the current one
const nextStatuses = nextStatusesFor[currentStatus];
function addStatusOption(status, index) {
// Push the next possible status options
- const label = statusLabel[status];
+ const label = swh.add_forge.formatRequestStatusName(status);
$('#decisionOptions').append(
`<option value="${status}">${label}</option>`
);
diff --git a/cypress/integration/add-forge-now-request-create.spec.js b/cypress/integration/add-forge-now-request-create.spec.js
--- a/cypress/integration/add-forge-now-request-create.spec.js
+++ b/cypress/integration/add-forge-now-request-create.spec.js
@@ -122,7 +122,7 @@
cy.get('#add-forge-request-browse')
.should('be.visible')
- .should('contain', 'PENDING');
+ .should('contain', 'Pending');
});
it('should show error message on conflict', function() {
diff --git a/cypress/integration/add-forge-now-request-dashboard.spec.js b/cypress/integration/add-forge-now-request-dashboard.spec.js
--- a/cypress/integration/add-forge-now-request-dashboard.spec.js
+++ b/cypress/integration/add-forge-now-request-dashboard.spec.js
@@ -20,7 +20,7 @@
it('should load add forge request details', function() {
cy.wait('@forgeAddRequest');
cy.get('#requestStatus')
- .should('contain', 'PENDING');
+ .should('contain', 'Pending');
cy.get('#requestType')
.should('contain', 'bitbucket');
@@ -60,7 +60,7 @@
cy.get('#requestHistory')
.children()
- .should('contain', 'New status: PENDING');
+ .should('contain', 'New status: Pending');
});
it('should load possible next status', function() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 5 2024, 3:44 PM (11 w, 14 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221313
Attached To
D7413: Show forge request status in a human readable form
Event Timeline
Log In to Comment