Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding DONE to task status options #499

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
56bda08
Adding UNASSIGNED and DONE to task status options
chandrareddy7 Oct 8, 2023
70971c6
Updating test name
chandrareddy7 Oct 8, 2023
cad584e
Removing UNASSIGNED status from task status options
chandrareddy7 Oct 8, 2023
53d935f
Updating tests in holder-test file
chandrareddy7 Oct 8, 2023
afd9f37
Updating tests in holder-test file
chandrareddy7 Oct 8, 2023
d25e635
Adding test to check if AVAILABLE is not displayed when dev is true
chandrareddy7 Oct 8, 2023
51d7cad
cancel OOO button enabled (#500)
PeeyushPrashant Oct 13, 2023
9d2c982
Feat/allow multiple extension requests (#496)
MayurLund Oct 14, 2023
0d93af1
Extension request should show reviewer's log if the request has been …
joyguptaa Oct 18, 2023
a6c862f
Adding UNASSIGNED and DONE to task status options
chandrareddy7 Oct 8, 2023
e31c3ea
Updating test name
chandrareddy7 Oct 8, 2023
f620715
Removing UNASSIGNED status from task status options
chandrareddy7 Oct 8, 2023
e82b4a2
Updating tests in holder-test file
chandrareddy7 Oct 8, 2023
67d6573
Updating tests in holder-test file
chandrareddy7 Oct 8, 2023
b116a97
Adding test to check if AVAILABLE is not displayed when dev is true
chandrareddy7 Oct 8, 2023
1d94049
Adding new task status DONE to task status options
chandrareddy7 Oct 26, 2023
f24d0e0
Merge branch 'Add-UNASSIGNED-and-DONE-in-task-status-options' of http…
chandrareddy7 Oct 26, 2023
202bfcc
Update holder-test.js
chandrareddy7 Oct 26, 2023
d84b4cc
Modifying task constants
chandrareddy7 Oct 27, 2023
2a94838
Merge branch 'Add-UNASSIGNED-and-DONE-in-task-status-options' of http…
chandrareddy7 Oct 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 34 additions & 12 deletions app/components/task/holder.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,21 @@
<div class='task-card__status-update-container'>

{{#if this.extensionFormOpened}}
<Task::ExtensionForm
@task={{@task}}
@closeForm={{this.closeExtensionForm}}
@title='Form for extension Request'
@closeModel={{this.closeExtensionModel}}
/>
{{#if @dev}}
<Task::MultipleExtensionForm
@task={{@task}}
@closeForm={{this.closeExtensionForm}}
@title='Extension Details'
@closeModel={{this.closeExtensionModel}}
/>
{{else}}
<Task::ExtensionForm
@task={{@task}}
@closeForm={{this.closeExtensionForm}}
@title='Form for extension Request'
@closeModel={{this.closeExtensionModel}}
/>
{{/if}}
{{/if}}

{{#if (not-eq this.status this.TASK_KEYS.VERIFIED)}}
Expand All @@ -32,12 +41,25 @@
>
{{#each this.availabletaskStatusList as |taskStatus|}}
{{#if (not-eq taskStatus.key this.TASK_KEYS.ALL)}}
<option
value={{taskStatus.key}}
selected={{eq taskStatus.key this.status}}
>
{{taskStatus.displayLabel}}
</option>
{{#if @dev}}
{{#if (not (or (eq taskStatus.key this.TASK_KEYS.AVAILABLE) (eq taskStatus.key this.TASK_KEYS.COMPLETED)))}}
<option
value={{taskStatus.key}}
selected={{eq taskStatus.key this.status}}
>
{{taskStatus.displayLabel}}
</option>
{{/if}}
Comment on lines +44 to +52
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding conditions inside a loop to populate the task status, can we just have two separate availableTaskStatusList?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You meant to maintain two seperate lists in the constants file itself?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Something like that where we don't have to write extra logic to maintain the old flow.

{{else}}
{{#if (not (or (eq taskStatus.key this.TASK_KEYS.DONE)))}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add new logic under the old flow, won't it defeat the purpose of adding a feature flag?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have added new task status to constants file. So have to do this.
Can we do it in any other way?

<option
value={{taskStatus.key}}
selected={{eq taskStatus.key this.status}}
>
{{taskStatus.displayLabel}}
</option>
{{/if}}
{{/if}}
{{/if}}
{{/each}}
</select>
Expand Down
25 changes: 21 additions & 4 deletions app/components/task/holder.js
Original file line number Diff line number Diff line change
@@ -1,17 +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
35 changes: 35 additions & 0 deletions app/components/task/latest-extension-info.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<div class='latest-extension-info__content' data-test-extension-info-content>
<table class="latest-table">
<tbody class="latest-table">
<tr>
<th>Request : </th>
<td>{{#if (eq this.extension.requestNumber undefined)}}
#1
{{else}}
#{{this.extension.requestNumber}}
{{/if}}
</td>
</tr>
<tr>
<th >Reason : </th>
<td>{{this.extension.reason}}</td>
</tr>
<tr>
<th>Title : </th>
<td>{{this.extension.title}}</td>
</tr>
<tr>
<th>Old Ends On : </th>
<td>{{this.oldEndsOn}}</td>
</tr>
<tr>
<th>New Ends On : </th>
<td>{{this.newEndsOn}}</td>
</tr>
<tr>
<th>Status : </th>
<td>{{this.extension.status}}</td>
</tr>
</tbody>
</table>
</div>
11 changes: 11 additions & 0 deletions app/components/task/latest-extension-info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Component from '@glimmer/component';

export default class LatestExtensionInfoComponent extends Component {
extension = this.args.extension;
newEndsOn = this.localTime(this.extension.newEndsOn);
oldEndsOn = this.localTime(this.extension.oldEndsOn);

localTime(time) {
return new Date(time * 1000).toLocaleString();
}
}
143 changes: 143 additions & 0 deletions app/components/task/multiple-extension-form.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<div class='extension-form__container-parent'>
<div
role='button'
id='create'
class='extension-form__container-back'
data-test-extension-form-container-back
{{on 'click' @closeModel}}
></div>
<div class='extension-form__container-main'>
<h2 data-test-title>
{{#if this.createExtensionRequest}}
Extension Request Form
{{else}}
Extension Details
{{/if}}
</h2>
{{#if this.createExtensionRequest}}
<div class='extension-form__content' data-test-extension-from-content>
<form {{on 'submit' this.submitExtensionRequest}}>
<label for='reason'>Reason</label>
<textarea
required
type='text-box'
id='reason'
name='reason'
data-test-extension-form-reason-input
></textarea>
<p>Old ETA - {{this.oldETA}}</p>
<label for='newEndsOn'>New ETA</label>
<input
required
type='datetime-local'
id='newEndsOn'
name='newEndsOn'
{{on 'change' this.changeExtensionRequestETA}}
data-test-extension-form-newEndsOn-input
/>
<label for='title'>Title</label>
<textarea
required
type='text-box'
id='title'
name='title'
data-test-extension-form-title-input
></textarea>
<div class='error-container' id='error'>
<span
class='error-placeholder'
data-test-extension-from-error
></span>
</div>
<div class='buttons' id='form'>
<button
class='multiple-extension-form__container-close'
data-test-extension-form-container-close
type='button'
{{on 'click' @closeForm}}
>
Cancel
</button>

<button
class='multiple-extension-form__create-button primary-button-style'
disabled={{this.isSubmitButtonDisabled}}
type='submit'
>Submit</button>
</div>
</form>
</div>
{{else}}
<div class='extension-form__content' data-test-extension-from-content>
{{#if this.extensionData.value}}
<div class='extension-form__content-wrapper'>
{{#each this.extensionData.value as |extension|}}
<Task::LatestExtensionInfo @extension={{extension}} />
{{#if extension.reviewedBy}}
<p data-reviewed-log>Your request was
{{#if
(eq extension.status 'APPROVED')
}}approved{{else}}denied{{/if}}
by
{{extension.reviewedBy}}
{{convertDate (array extension.timestamp) end_date=0}}.
</p>
{{/if}}
{{/each}}
</div>

<div class='buttons' id='detail'>
<button
class='multiple-extension-form__container-close'
data-test-extension-form-container-close
type='button'
{{on 'click' @closeForm}}
>
Close
</button>

{{#if
(or
(eq this.previousExtensionStatus 'APPROVED')
(eq this.previousExtensionStatus 'DENIED')
)
}}
<button
class='multiple-extension-form__open-button primary-button-style'
data-test-create-another-extension
type='button'
{{on 'click' this.createNewExtensionRequest}}
>
Request Extension
</button>
{{/if}}
</div>
{{else if this.extensionData.isLoading}}
<div class='task-card__loader-container'>
<Spinner />
</div>
{{else if this.extensionData.error}}
<h4>{{this.extensionData.error}}</h4>
<div class='buttons' id='create'>
<button
class='multiple-extension-form__container-close'
data-test-extension-form-container-close
type='button'
{{on 'click' @closeForm}}
>
Close
</button>
<button
class='multiple-extension-form__open-button primary-button-style'
data-test-create-extension-button
type='button'
{{on 'click' this.createNewExtensionRequest}}
>
Request Extension
</button>
</div>
{{/if}}
</div>
{{/if}}
</div>
</div>
Loading
Loading