From a365dcc5ba34ead16b262e68aa2b6a061985df2d Mon Sep 17 00:00:00 2001
From: Rohan Raj Gupta <78433013+rohan09-raj@users.noreply.github.com>
Date: Sat, 10 Dec 2022 13:10:53 +0530
Subject: [PATCH 1/4] handles the case when user status not found in collection
(#337) (#338)
* handles the case when user status not found in collection
* Resolves Rohan Raj comments on #337
Co-authored-by: Randhir Kumar Singh <97341921+heyrandhir@users.noreply.github.com>
---
app/components/user-status.hbs | 9 +++---
app/components/user-status.js | 56 +++++++++++++++++++++++-----------
app/constants/user-status.js | 7 ++++-
app/routes/index.js | 12 ++++++--
4 files changed, 57 insertions(+), 27 deletions(-)
diff --git a/app/components/user-status.hbs b/app/components/user-status.hbs
index 47a59d77..06f3b280 100644
--- a/app/components/user-status.hbs
+++ b/app/components/user-status.hbs
@@ -9,12 +9,11 @@
{{#each this.currentUserStatus as |currentStatus|}}
{{#if (eq @status currentStatus.status)}}
-
diff --git a/app/components/user-status.js b/app/components/user-status.js
index 5529adf1..56d91b74 100644
--- a/app/components/user-status.js
+++ b/app/components/user-status.js
@@ -1,36 +1,56 @@
import Component from '@glimmer/component';
import { USER_STATES } from '../constants/user-status';
export default class UserStatusComponent extends Component {
+ ALL_FEASIBLE_STATUS = {
+ [USER_STATES.ACTIVE]: {
+ status: USER_STATES.ACTIVE,
+ message: 'Change your status to Active',
+ class: 'buttons__active',
+ },
+ [USER_STATES.IDLE]: {
+ status: USER_STATES.IDLE,
+ message: 'Change your status to Idle',
+ class: 'buttons__idle',
+ },
+ [USER_STATES.OOO]: {
+ status: USER_STATES.OOO,
+ message: 'Change your status to OOO',
+ class: 'buttons__ooo',
+ },
+ };
currentUserStatus = [
{
status: USER_STATES.ACTIVE,
message: 'You are Active',
- firstAvailableStatus: USER_STATES.IDLE,
- firstStatusMessage: 'Change your status to Idle',
- firstStatusClass: 'buttons__idle',
- secondAvailableStatus: USER_STATES.OOO,
- secondStatusMessage: 'Change your status to OOO',
- secondStatusClass: 'buttons__ooo',
+ otherAvailableStatus: [
+ this.ALL_FEASIBLE_STATUS.IDLE,
+ this.ALL_FEASIBLE_STATUS.OOO,
+ ],
},
{
status: USER_STATES.IDLE,
message: 'You are Idle',
- firstAvailableStatus: USER_STATES.ACTIVE,
- firstStatusMessage: 'Change your status status to Active',
- firstStatusClass: 'buttons__active',
- secondAvailableStatus: USER_STATES.OOO,
- secondStatusMessage: 'Change your status status to OOO',
- secondStatusClass: 'buttons__ooo',
+ otherAvailableStatus: [
+ this.ALL_FEASIBLE_STATUS.ACTIVE,
+ this.ALL_FEASIBLE_STATUS.OOO,
+ ],
},
{
status: USER_STATES.OOO,
message: 'You are OOO',
- firstAvailableStatus: USER_STATES.IDLE,
- firstStatusMessage: 'Change your status status to Idle',
- firstStatusClass: 'buttons__idle',
- secondAvailableStatus: USER_STATES.ACTIVE,
- secondStatusMessage: 'Change your status status to Active',
- secondStatusClass: 'buttons__active',
+ otherAvailableStatus: [
+ this.ALL_FEASIBLE_STATUS.ACTIVE,
+ this.ALL_FEASIBLE_STATUS.IDLE,
+ ],
+ },
+ {
+ status: USER_STATES.DNE,
+ message: `Your Status doesn't exist`,
+ otherAvailableStatus: [
+ this.ALL_FEASIBLE_STATUS.ACTIVE,
+ this.ALL_FEASIBLE_STATUS.IDLE,
+ this.ALL_FEASIBLE_STATUS.OOO,
+ ],
},
];
}
diff --git a/app/constants/user-status.js b/app/constants/user-status.js
index 5eb62dab..f6807bb9 100644
--- a/app/constants/user-status.js
+++ b/app/constants/user-status.js
@@ -4,6 +4,11 @@ export const WARNING_MESSAGE_FOR_OOO =
'The Reason Field is mandatory. Please mention the reason for going OOO.';
export const WARNING_MESSAGE_FOR_IDLE =
'The Missing Skills Field is mandatory. Please mention the skills you are lagging in.';
-export const USER_STATES = { IDLE: 'IDLE', ACTIVE: 'ACTIVE', OOO: 'OOO' };
+export const USER_STATES = {
+ IDLE: 'IDLE',
+ ACTIVE: 'ACTIVE',
+ OOO: 'OOO',
+ DNE: 'DNE',
+};
export const WARNING_FROM_DATE_EXCEEDS_UNTIL_DATE =
'Until date cant lie before the From date. Please recheck the dates again.';
diff --git a/app/routes/index.js b/app/routes/index.js
index 5c8276f4..a66c62d7 100644
--- a/app/routes/index.js
+++ b/app/routes/index.js
@@ -8,14 +8,13 @@ const API_BASE_URL = ENV.BASE_API_URL;
export default class IndexRoute extends Route {
@service toast;
model = async () => {
- const defaultStatus = USER_STATES.ACTIVE;
try {
const response = await fetch(`${API_BASE_URL}/users/status/self`, {
credentials: 'include',
});
const userData = await response.json();
- if (response.status === 200 && !userData.incompleteUserDetails) {
- return userData?.data?.currentStatus?.state ?? defaultStatus;
+ if (response.status === 200) {
+ return userData?.data?.currentStatus?.state ?? USER_STATES.DNE;
} else if (response.status === 401) {
this.toast.error(
'You are not logged in. Please login to continue.',
@@ -30,6 +29,13 @@ export default class IndexRoute extends Route {
}
window.open(authUrl, '_self');
}, 2000);
+ } else if (response.status === 404) {
+ this.toast.error(
+ `Your Status data doesn't exist yet. Please choose your status from the options below.`,
+ '',
+ toastNotificationTimeoutOptions
+ );
+ return USER_STATES.DNE;
}
} catch (error) {
console.error(error.message);
From ccfc0a8aad949eeeeb5baf47fec3ea9c669f9240 Mon Sep 17 00:00:00 2001
From: Prakash Choudhary <34452139+prakashchoudhary07@users.noreply.github.com>
Date: Sat, 11 Mar 2023 10:30:51 +0530
Subject: [PATCH 2/4] Fix: add toast service, in signup route (#371) (#372)
---
app/routes/signup.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/routes/signup.js b/app/routes/signup.js
index cd594e2f..9a47a457 100644
--- a/app/routes/signup.js
+++ b/app/routes/signup.js
@@ -9,6 +9,7 @@ import { AUTH_URL, GOTO_URL } from '../constants/url';
export default class SignupRoute extends Route {
@service analytics;
@service router;
+ @service toast;
beforeModel(transition) {
if (transition?.to?.queryParams?.dev === 'true') {
this.analytics.trackEvent(SIGNUP.PAGE_LOADED);
@@ -39,7 +40,7 @@ export default class SignupRoute extends Route {
);
setTimeout(() => window.open(GOTO_URL, '_self'), 2000);
}
- } catch {
+ } catch (err) {
this.toast.error(
ERROR_MESSAGES.unknown,
'',
From 8f52558ef741236e58adc7781cadf8577aed6cc0 Mon Sep 17 00:00:00 2001
From: Aryex82 <98796547+Aryex82@users.noreply.github.com>
Date: Wed, 26 Jul 2023 21:40:14 +0530
Subject: [PATCH 3/4] Dev to main sync (#459)
* fix : task status fails to update to VERIFIED
* fix : task status fails to update to VERIFIED
---
app/components/task/holder.hbs | 1 -
app/components/task/holder.js | 1 +
.../components/tasks/holder-test.js | 33 +++++++++++++++++++
3 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/app/components/task/holder.hbs b/app/components/task/holder.hbs
index 2b96de6f..3ce2b3d7 100644
--- a/app/components/task/holder.hbs
+++ b/app/components/task/holder.hbs
@@ -27,7 +27,6 @@
data-test-task-status-select
id='task-update'
{{on 'change' this.onStatusChange}}
- {{on 'change' (fn this.onUpdate @task.id)}}
>
{{#each this.availabletaskStatusList as |taskStatus|}}
{{#if (not-eq taskStatus.key this.TASK_KEYS.ALL)}}
diff --git a/app/components/task/holder.js b/app/components/task/holder.js
index 1153550a..95e0b72e 100644
--- a/app/components/task/holder.js
+++ b/app/components/task/holder.js
@@ -95,6 +95,7 @@ export default class TasksHolderComponent extends Component {
const { value } = e.target;
this.status = value;
this.args.onTaskChange('status', value);
+ this.onUpdate(this.args.task.id);
}
@action
diff --git a/tests/integration/components/tasks/holder-test.js b/tests/integration/components/tasks/holder-test.js
index b86538e9..77ad27c0 100644
--- a/tests/integration/components/tasks/holder-test.js
+++ b/tests/integration/components/tasks/holder-test.js
@@ -209,4 +209,37 @@ module('Integration | Component | Tasks Holder', function (hooks) {
.dom('[data-test-task-status-select]')
.hasValue(TASK_KEYS.IN_PROGRESS);
});
+
+ test('Verify status change to VERIFIED', async function (assert) {
+ const testTask = tasksData[3];
+
+ testTask.status = TASK_KEYS.IN_PROGRESS;
+
+ let onTaskUpdateCalled = 0;
+
+ this.set('task', testTask);
+ this.set('onTaskUpdate', () => {
+ onTaskUpdateCalled++;
+ });
+ this.set('mock', () => {});
+ this.set('isLoading', false);
+ this.set('disabled', false);
+ this.set('defaultType', DEFAULT_TASK_TYPE);
+
+ await render(hbs``);
+
+ assert
+ .dom('[data-test-task-status-select]')
+ .hasValue(TASK_KEYS.IN_PROGRESS);
+
+ await select('[data-test-task-status-select]', TASK_KEYS.VERIFIED);
+
+ assert.equal(onTaskUpdateCalled, 1, 'onTaskUpdate should be called once');
+ });
});
From 046c2d13c5b99857f62b8703a234bc6261c5216c Mon Sep 17 00:00:00 2001
From: Prakash Choudhary <34452139+prakashchoudhary07@users.noreply.github.com>
Date: Wed, 25 Oct 2023 06:25:41 +0000
Subject: [PATCH 4/4] Dev to Main sync (#504)
---
app/components/task/holder.hbs | 21 +-
app/components/task/holder.js | 1 +
app/components/task/latest-extension-info.hbs | 35 ++
app/components/task/latest-extension-info.js | 11 +
.../task/multiple-extension-form.hbs | 143 +++++++
.../task/multiple-extension-form.js | 181 ++++++++
app/constants/user-status.js | 2 +
app/styles/tasks.css | 142 ++++++-
tests/fixtures/extension-requests.js | 1 +
.../tasks/multiple-extension-form-test.js | 387 ++++++++++++++++++
10 files changed, 913 insertions(+), 11 deletions(-)
create mode 100644 app/components/task/latest-extension-info.hbs
create mode 100644 app/components/task/latest-extension-info.js
create mode 100644 app/components/task/multiple-extension-form.hbs
create mode 100644 app/components/task/multiple-extension-form.js
create mode 100644 tests/integration/components/tasks/multiple-extension-form-test.js
diff --git a/app/components/task/holder.hbs b/app/components/task/holder.hbs
index 3fd9d2f5..b6b38809 100644
--- a/app/components/task/holder.hbs
+++ b/app/components/task/holder.hbs
@@ -14,12 +14,21 @@