Skip to content

Commit

Permalink
Revert "remove feature flag (#522)"
Browse files Browse the repository at this point in the history
This reverts commit 86b2c5b.
  • Loading branch information
shubhamsinghbundela authored Nov 23, 2023
1 parent e1916f8 commit 8600544
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
10 changes: 8 additions & 2 deletions app/components/task/holder.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,20 @@ export default class TasksHolderComponent extends Component {

get taskStatusList() {
const statusToDisplay = this.availabletaskStatusList.filter(
(taskStatus) => taskStatus.key !== 'ALL'
(taskStatus) => {
if (this.args.dev === true) {
return taskStatus.key !== 'ALL' && taskStatus.key !== 'COMPLETED';
} else {
return taskStatus.key !== 'ALL' && taskStatus.key !== 'DONE';
}
}
);
return statusToDisplay;
}

get taskStyleClass() {
const statusNotOverDueList = [
TASK_KEYS.DONE,
this.args.dev === true ? TASK_KEYS.DONE : TASK_KEYS.COMPLETED,
TASK_KEYS.VERIFIED,
TASK_KEYS.AVAILABLE,
];
Expand Down
6 changes: 6 additions & 0 deletions app/constants/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const TASK_KEYS = {
IN_PROGRESS: 'IN_PROGRESS',
BLOCKED: 'BLOCKED',
SMOKE_TESTING: 'SMOKE_TESTING',
COMPLETED: 'COMPLETED',
DONE: 'DONE',
NEEDS_REVIEW: 'NEEDS_REVIEW',
IN_REVIEW: 'IN_REVIEW',
Expand All @@ -23,6 +24,7 @@ const {
IN_PROGRESS,
BLOCKED,
SMOKE_TESTING,
COMPLETED,
DONE,
NEEDS_REVIEW,
IN_REVIEW,
Expand Down Expand Up @@ -59,6 +61,10 @@ const TASK_STATUS_LIST = [
displayLabel: 'Smoke Testing',
key: SMOKE_TESTING,
},
{
displayLabel: 'Completed',
key: COMPLETED,
},
{
displayLabel: 'Done',
key: DONE,
Expand Down
9 changes: 8 additions & 1 deletion app/controllers/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const API_BASE_URL = ENV.BASE_API_URL;
export default class TasksController extends Controller {
queryParams = ['dev'];
@service toast;
@service featureFlag;
TASK_KEYS = TASK_KEYS;
taskStatusList = TASK_STATUS_LIST;
tabsTaskStatusList = TABS_TASK_STATUS_LIST;
Expand All @@ -42,6 +43,10 @@ export default class TasksController extends Controller {
@tracked showFetchButton = this.isShowFetchButton() && !this.alreadyFetched;
alreadyFetched = localStorage.getItem('already-fetched');

get isDevMode() {
return this.featureFlag.isDevMode;
}

@action toggleDropDown() {
this.showDropDown = !this.showDropDown;
}
Expand Down Expand Up @@ -93,7 +98,9 @@ export default class TasksController extends Controller {
const taskCompletionPercentage = object.percentCompleted;
if (taskCompletionPercentage) {
if (taskCompletionPercentage === TASK_PERCENTAGE.completedPercentage) {
requestBody.status = 'DONE';
this.isDevMode === true
? (requestBody.status = 'DONE')
: (requestBody.status = 'COMPLETED');
}
requestBody.percentCompleted = parseInt(taskCompletionPercentage);
}
Expand Down
37 changes: 37 additions & 0 deletions tests/integration/components/tasks/holder-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,41 @@ module('Integration | Component | Tasks Holder', function (hooks) {
@disabled={{this.disabled}}
/>`);

assert
.dom('[data-test-task-status-select]')
.hasValue(TASK_KEYS.IN_PROGRESS);

await select('[data-test-task-status-select]', TASK_KEYS.COMPLETED);

assert
.dom('[data-test-task-status-select]')
.hasValue(TASK_KEYS.IN_PROGRESS);
});

test('Verify values of task status upon api failures under feature flag', async function (assert) {
const testTask = tasksData[3];
testTask.status = TASK_KEYS.IN_PROGRESS;

this.set('task', testTask);
this.set('mock', () => {});
this.set('onTaskUpdate', (taskId, error) => {
error();
});
this.set('isLoading', false);
this.set('disabled', false);
this.set('defaultType', DEFAULT_TASK_TYPE);
this.set('dev', true);

await render(hbs`<Task::Holder
@task={{this.task}}
@onTaskChange={{this.mock}}
@onStausChange={{this.mock}}
@onTaskUpdate={{this.onTaskUpdate}}
@userSelectedTask={{this.defaultType}}
@disabled={{this.disabled}}
@dev={{this.dev}}
/>`);

assert
.dom('[data-test-task-status-select]')
.hasValue(TASK_KEYS.IN_PROGRESS);
Expand Down Expand Up @@ -249,6 +284,7 @@ module('Integration | Component | Tasks Holder', function (hooks) {
this.set('isLoading', false);
this.set('disabled', false);
this.set('defaultType', DEFAULT_TASK_TYPE);
this.set('dev', true);

await render(hbs`<Task::Holder
@task={{this.task}}
Expand All @@ -258,6 +294,7 @@ module('Integration | Component | Tasks Holder', function (hooks) {
@isLoading={{this.isLoading}}
@userSelectedTask={{this.defaultType}}
@disabled={{this.disabled}}
@dev={{this.dev}}
/>`);

assert.dom('[data-test-task-status-select]').exists();
Expand Down

0 comments on commit 8600544

Please sign in to comment.