Skip to content

Commit

Permalink
Adding new task status DONE to task status options
Browse files Browse the repository at this point in the history
  • Loading branch information
chandrareddy7 committed Oct 26, 2023
1 parent b116a97 commit 1d94049
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 59 deletions.
24 changes: 20 additions & 4 deletions app/components/task/holder.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { TASK_KEYS, TASK_STATUS_LIST } from 'website-my/constants/tasks';
import { tracked } from '@glimmer/tracking';
import { TASK_PERCENTAGE } from '../../constants/tasks';
import {
TASK_KEYS,
TASK_STATUS_LIST,
TASK_KEYS_NEW,
TASK_STATUS_LIST_NEW,
TASK_PERCENTAGE,
} from '../../constants/tasks';
import { inject as service } from '@ember/service';

export default class TasksHolderComponent extends Component {
@tracked percentCompleted = this.args.task.percentCompleted;
@tracked status = this.args.task.status;
@tracked extensionFormOpened = false;
@tracked isLoading = false;
@service featureFlag;
queryParams = ['dev'];

TASK_KEYS = TASK_KEYS;
availabletaskStatusList = TASK_STATUS_LIST;
get isDevMode() {
return this.featureFlag.isDevMode;
}

get TASK_KEYS() {
return this.isDevMode ? TASK_KEYS_NEW : TASK_KEYS;
}

get availabletaskStatusList() {
return this.isDevMode ? TASK_STATUS_LIST_NEW : TASK_STATUS_LIST;
}

get taskStyleClass() {
const statusNotOverDueList = [
Expand Down
86 changes: 81 additions & 5 deletions app/constants/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@ const TASK_KEYS = {
DONE: 'DONE',
};

const TASK_KEYS_NEW = {
ALL: 'ALL',
ASSIGNED: 'ASSIGNED',
IN_PROGRESS: 'IN_PROGRESS',
BLOCKED: 'BLOCKED',
SMOKE_TESTING: 'SMOKE_TESTING',
DONE: 'DONE',
NEEDS_REVIEW: 'NEEDS_REVIEW',
IN_REVIEW: 'IN_REVIEW',
APPROVED: 'APPROVED',
MERGED: 'MERGED',
SANITY_CHECK: 'SANITY_CHECK',
REGRESSION_CHECK: 'REGRESSION_CHECK',
RELEASED: 'RELEASED',
VERIFIED: 'VERIFIED',
};

const {
ALL,
AVAILABLE,
Expand All @@ -25,7 +42,6 @@ const {
BLOCKED,
SMOKE_TESTING,
COMPLETED,
DONE,
NEEDS_REVIEW,
IN_REVIEW,
APPROVED,
Expand All @@ -36,6 +52,8 @@ const {
VERIFIED,
} = TASK_KEYS;

const { DONE } = TASK_KEYS_NEW;

const TASK_STATUS_LIST = [
{
displayLabel: 'All',
Expand Down Expand Up @@ -99,6 +117,61 @@ const TASK_STATUS_LIST = [
},
];

const TASK_STATUS_LIST_NEW = [
{
displayLabel: 'All',
key: ALL,
},
{
displayLabel: 'Assigned',
key: ASSIGNED,
},
{
displayLabel: 'In Progress',
key: IN_PROGRESS,
},
{
displayLabel: 'Blocked',
key: BLOCKED,
},
{
displayLabel: 'Smoke Testing',
key: SMOKE_TESTING,
},
{
displayLabel: 'Done',
key: DONE,
},
{
displayLabel: 'Needs Review',
key: NEEDS_REVIEW,
},
{
displayLabel: 'In Review',
key: IN_REVIEW,
},
{
displayLabel: 'Approved',
key: APPROVED,
},
{
displayLabel: 'Sanity Check',
key: SANITY_CHECK,
},
{
displayLabel: 'Regression Check',
key: REGRESSION_CHECK,
},
{
displayLabel: 'Released',
key: RELEASED,
},
{
displayLabel: 'Verified',
key: VERIFIED,
},
];

const TABS_TASK_STATUS_LIST = [
{
displayLabel: 'All',
Expand Down Expand Up @@ -148,7 +221,10 @@ export const TASK_PERCENTAGE = {
completedPercentage: '100',
};

export { TASK_KEYS, TASK_STATUS_LIST, TABS_TASK_STATUS_LIST };

export const oldTaskStatus = { AVAILABLE: 'AVAILABLE', COMPLETED: 'COMPLETED' };
export const newTaskStatus = { DONE: 'DONE' };
export {
TASK_KEYS,
TASK_STATUS_LIST,
TABS_TASK_STATUS_LIST,
TASK_KEYS_NEW,
TASK_STATUS_LIST_NEW,
};
5 changes: 5 additions & 0 deletions tests/integration/components/tasks-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { find, render, waitUntil, fillIn } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { tasks } from 'website-my/tests/fixtures/tasks';
import { TASK_KEYS } from 'website-my/constants/tasks';
import Service from '@ember/service';

module('Integration | Component | tasks', function (hooks) {
setupRenderingTest(hooks);
Expand Down Expand Up @@ -43,6 +44,10 @@ module('Integration | Component | tasks', function (hooks) {

test('Spinner should be visible only on the current updating card', async function (assert) {
tasks[0].status = 'IN_PROGRESS';
class MockFeatureFlagService extends Service {
isDevMode = true;
}
this.owner.register('service:featureFlag', MockFeatureFlagService);
this.setProperties({
onTaskChange: () => {},
onTaskUpdate: () => {},
Expand Down
Loading

0 comments on commit 1d94049

Please sign in to comment.