Skip to content

Commit 021f7c4

Browse files
authored
Merge pull request #883 from Real-Dev-Squad/develop
Dev to Main Sync
2 parents e7d695d + fa3eb23 commit 021f7c4

File tree

8 files changed

+98
-17
lines changed

8 files changed

+98
-17
lines changed

.github/workflows/tests.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@ on:
44
branches: [main, develop]
55
push:
66
branches: [main, develop]
7+
78
jobs:
8-
Lint-Check:
9+
test:
910
runs-on: ubuntu-latest
1011
steps:
11-
- uses: actions/checkout@v2
12-
- run: yarn
13-
- run: yarn test
12+
- uses: actions/checkout@v2
13+
14+
- name: Install system dependencies
15+
run: |
16+
echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
17+
- name: Install project dependencies
18+
run: yarn install
19+
20+
- name: Run tests
21+
run: yarn test

__tests__/applications/applications.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,23 @@ describe('Applications page', () => {
103103
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
104104
},
105105
});
106+
} else if (
107+
request.url() ===
108+
`${API_BASE_URL}/applications?size=6&status=pending&dev=true`
109+
) {
110+
request.respond({
111+
status: 200,
112+
contentType: 'application/json',
113+
body: JSON.stringify({
114+
applications: acceptedApplications,
115+
totalCount: acceptedApplications.length,
116+
}),
117+
headers: {
118+
'Access-Control-Allow-Origin': '*',
119+
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
120+
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
121+
},
122+
});
106123
} else {
107124
request.continue();
108125
}
@@ -129,6 +146,12 @@ describe('Applications page', () => {
129146
expect(applicationCards.length).toBe(6);
130147
});
131148

149+
it('should render the index of pending applications under dev flag === true', async function () {
150+
await page.goto(`${SITE_URL}/applications?dev=true&status=pending`);
151+
const indexOfApplication = await page.$$('[data-testid="user-index"]');
152+
expect(indexOfApplication).toBeTruthy();
153+
});
154+
132155
it('should render the initial UI elements under dev flag === true', async function () {
133156
await page.goto(`${SITE_URL}/applications?dev=true`);
134157
const title = await page.$('.header h1');

__tests__/extension-requests/extension-requests.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,10 +633,9 @@ describe('Tests the Extension Requests Screen', () => {
633633
break;
634634
}
635635
}
636-
await page.waitForTimeout(1650);
636+
await page.waitForTimeout(2000);
637637

638638
const extensionCardsAfter = await page.$$('.extension-card');
639-
640639
const cardCount = extensionCardsAfter.length;
641640
expect(cardCount === 3 || cardCount === 7).toBe(true);
642641
});

applications/script.js

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import {
88
} from './utils.js';
99
let nextLink;
1010
let isDataLoading = false;
11+
let totalApplicationCount = 0;
12+
let currentApplicationIndex = 0;
1113
const loader = document.querySelector('.loader');
1214
const filterModal = document.querySelector('.filter-modal');
1315
const backDrop = document.querySelector('.backdrop');
@@ -38,6 +40,7 @@ const applicationDetailsActionsContainer = document.querySelector(
3840
);
3941
const urlParams = new URLSearchParams(window.location.search);
4042
const isDev = urlParams.get('dev') === 'true';
43+
let isApplicationPending = urlParams.get('status') === 'pending';
4144
const filterButton = isDev
4245
? document.getElementById('filter-button-new')
4346
: document.getElementById('filter-button');
@@ -100,6 +103,7 @@ function changeFilter() {
100103
} else {
101104
totalCountElement.classList.add('hidden');
102105
status = 'all';
106+
totalApplicationCount = 0;
103107
}
104108
applicationContainer.innerHTML = '';
105109
}
@@ -297,7 +301,7 @@ function removeQueryParamInUrl(queryParamKey) {
297301
window.history.replaceState(window.history.state, '', updatedUrl);
298302
}
299303

300-
function createApplicationCard({ application, dev }) {
304+
function createApplicationCard({ application, dev, index }) {
301305
const applicationCard = createElement({
302306
type: 'div',
303307
attributes: { class: 'application-card' },
@@ -314,6 +318,29 @@ function createApplicationCard({ application, dev }) {
314318
innerText: application.biodata.firstName,
315319
});
316320

321+
if (dev && isApplicationPending) {
322+
const usernameTextAndIndex = createElement({
323+
type: 'div',
324+
attributes: { class: 'user-text-index' },
325+
});
326+
327+
const userIndex = createElement({
328+
type: 'input',
329+
attributes: {
330+
type: 'number',
331+
value: `${index}`,
332+
readonly: '',
333+
class: 'user-index',
334+
'data-testid': 'user-index',
335+
},
336+
});
337+
usernameTextAndIndex.appendChild(usernameText);
338+
usernameTextAndIndex.appendChild(userIndex);
339+
userInfoContainer.appendChild(usernameTextAndIndex);
340+
} else {
341+
userInfoContainer.appendChild(usernameText);
342+
}
343+
317344
const companyNameText = createElement({
318345
type: 'p',
319346
attributes: { class: 'company-name hide-overflow' },
@@ -326,7 +353,6 @@ function createApplicationCard({ application, dev }) {
326353
innerText: `Skills: ${application.professional.skills}`,
327354
});
328355

329-
userInfoContainer.appendChild(usernameText);
330356
userInfoContainer.appendChild(companyNameText);
331357
userInfoContainer.appendChild(skillsText);
332358

@@ -382,7 +408,10 @@ async function renderApplicationCards(next, status, isInitialRender, dev) {
382408
changeLoaderVisibility({ hide: true });
383409
const applications = data.applications;
384410
const totalSelectedCount = data.totalCount;
385-
411+
if (isInitialRender) {
412+
totalApplicationCount = data.totalCount;
413+
currentApplicationIndex = totalApplicationCount;
414+
}
386415
nextLink = data.next;
387416
if (isDev && status != 'all') {
388417
showAppliedFilter(status);
@@ -394,12 +423,19 @@ async function renderApplicationCards(next, status, isInitialRender, dev) {
394423
}
395424
if (!applications.length)
396425
return noApplicationFoundText.classList.remove('hidden');
397-
applications.forEach((application) => {
426+
427+
if (isInitialRender || !next) {
428+
applicationContainer.innerHTML = '';
429+
currentApplicationIndex = totalSelectedCount;
430+
}
431+
applications.forEach((application, index) => {
398432
const applicationCard = createApplicationCard({
399433
application,
400434
dev,
435+
index: currentApplicationIndex,
401436
});
402437
applicationContainer.appendChild(applicationCard);
438+
currentApplicationIndex--;
403439
});
404440
}
405441

@@ -448,7 +484,8 @@ async function renderApplicationById(id) {
448484
if (applicationId) {
449485
await renderApplicationById(applicationId);
450486
}
451-
487+
totalApplicationCount = 0;
488+
currentApplicationIndex = 0;
452489
if (isDev) {
453490
await renderApplicationCards('', status, true, isDev);
454491
} else {
@@ -467,7 +504,7 @@ const intersectionObserver = new IntersectionObserver(async (entries) => {
467504
if (entries[0].isIntersecting && !isDataLoading) {
468505
const dev = urlParams.get('dev');
469506
if (dev) {
470-
await renderApplicationCards(nextLink, status, true, dev);
507+
await renderApplicationCards(nextLink, status, false, dev);
471508
} else {
472509
await renderApplicationCards(nextLink);
473510
}
@@ -514,7 +551,7 @@ if (isDev) {
514551
const dev = urlParams.get('dev');
515552

516553
if (dev) {
517-
renderApplicationCards(nextLink, status, false, dev);
554+
renderApplicationCards(nextLink, status, true, dev);
518555
} else {
519556
renderApplicationCards(nextLink, status);
520557
}
@@ -539,7 +576,7 @@ function applyFilter(filter, isDev) {
539576
addQueryParamInUrl('status', filter);
540577
changeFilter();
541578
status = filter;
542-
renderApplicationCards(nextLink, status, false, isDev);
579+
renderApplicationCards('', status, false, isDev);
543580
filterDropdown.style.display = 'none';
544581
}
545582
}
@@ -550,7 +587,7 @@ filterRemove.addEventListener('click', () => {
550587
removeQueryParamInUrl('status');
551588
changeFilter();
552589
const dev = urlParams.get('dev');
553-
renderApplicationCards(nextLink, status, false, dev);
590+
renderApplicationCards(nextLink, status, true, dev);
554591
});
555592

556593
backDrop.addEventListener('click', () => {

applications/style.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@
1717
--color-red-variant1: #f43030;
1818
}
1919

20+
.user-text-index {
21+
display: flex;
22+
justify-content: space-between;
23+
}
24+
25+
.user-index {
26+
width: 60px;
27+
border: none;
28+
font-style: normal;
29+
font-size: 20px;
30+
font-weight: 700;
31+
}
32+
2033
body {
2134
font-family: 'Roboto', sans-serif;
2235
margin: 0;

online-members/online-members.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414

1515
.task-container {
16-
overflow: scroll;
16+
overflow: auto;
1717
display: none;
1818
padding-top: 10px;
1919
max-height: 85vh;

online-members/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ async function generateUserTaskData(username) {
142142
return;
143143
}
144144

145-
showLoadingSpinner(`${TASKS_CONTAINER_ID}`);
145+
showLoadingSpinner(`#${TASKS_CONTAINER_ID}`);
146146

147147
isTaskDataBeingFetched = true;
148148

task-requests/details/script.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ const renderGithubIssue = async () => {
312312
simplifiedAutoLink: true,
313313
ghCodeBlocks: true,
314314
openLinksInNewWindow: true,
315+
disableForced4SpacesIndentedSublists: true,
315316
});
316317
let res = await fetch(taskRequest?.externalIssueUrl);
317318
res = await res.json();

0 commit comments

Comments
 (0)