Skip to content

Commit

Permalink
ADDED: Results already sent button
Browse files Browse the repository at this point in the history
  • Loading branch information
djuarezgf committed Jan 22, 2025
1 parent 19016c0 commit 7b25c07
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.1.0 - 2025-01-21]
## [1.1.0 - 2025-01-22]
### Added
- Dockerfile
- Single Spa
Expand Down Expand Up @@ -90,6 +90,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Fetch email message and subject
- Generate eml and html files for Password Sharing Tool
- Results URL in project
- Results already sent button

### Changed
- Rename accept and reject bridgehead state buttons (authorize/revoke)
Expand Down
47 changes: 34 additions & 13 deletions src/components/ResultsBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export default class ResultsBox extends Vue {
@Prop() readonly currentUsers!: User[];
@Prop() readonly projectRoles!: ProjectRole[];
readonly RESULTS_ALREADY_SENT = 'Results already sent';
resultsUrl = "";
projectResults: Results | undefined = undefined;
projectBridgeheadResults: Results[] | undefined = undefined;
Expand All @@ -46,6 +48,7 @@ export default class ResultsBox extends Vue {
// Reactive property to control the visibility of the long message
isExpanded = false;
// Method to toggle the visibility
toggleReadMore() {
this.isExpanded = !this.isExpanded;
Expand Down Expand Up @@ -204,6 +207,14 @@ export default class ResultsBox extends Vue {
}
}
sendResults(resultsUrl: string){
if (this.canSendProjectResults){
this.sendProjectResults(resultsUrl);
} else if (this.canSendProjectBridgheadResults){
this.sendProjectBridgeheadResults(resultsUrl);
}
}
sendProjectResults(resultsUrl: string) {
if (resultsUrl && this.canSendProjectResults) {
this.projectManagerBackendService.fetchData(Module.PROJECT_RESULTS_MODULE, Action.ADD_PROJECT_RESULTS_URL_ACTION, this.context, new Map([['results-url', resultsUrl]])).then(response => {
Expand All @@ -225,7 +236,7 @@ export default class ResultsBox extends Vue {
}
isButtonVisible(actionButton: ActionButton, results: Results): boolean {
if (!this.isUrl(results?.url)) {
if (!this.isUrl(results?.url) && results?.url != this.RESULTS_ALREADY_SENT) {
return false;
}
if (results.creatorState === 'ACCEPTED' && actionButton.action.includes('ACCEPT')) {
Expand Down Expand Up @@ -259,6 +270,10 @@ export default class ResultsBox extends Vue {
return this.projectRoles.includes(ProjectRole.FINAL);
}
areResultsAlreadyMarkedAsSent(): boolean{
return this.resultsToShow?.length > 0 && this.resultsToShow[0].url == this.RESULTS_ALREADY_SENT;
}
}
</script>

Expand All @@ -275,19 +290,20 @@ export default class ResultsBox extends Vue {
request creator, either through this interface or, if necessary, via other communication methods such as email
or messaging.</p>
</div>
<input
type="text"
v-model="resultsUrl"
placeholder="Enter the results URL"
class="text-field"
/>
<!-- Button to directly call sendProjectResults -->
<button v-if="canSendProjectResults" @click="sendProjectResults(resultsUrl)" class="send-button">Send Results URL
</button>
<button v-if="canSendProjectBridgheadResults" @click="sendProjectBridgeheadResults(resultsUrl)"
class="send-button">
Send Results URL
</button>
<div class="results-url-sender" v-if="canSendProjectResults || canSendProjectBridgheadResults">
<input
type="text"
v-model="resultsUrl"
placeholder="Enter the results URL"
class="text-field"
/>
<button @click="sendResults(resultsUrl)" class="send-button">Send Results URL</button>
<button v-if="!areResultsAlreadyMarkedAsSent()" @click="sendResults(RESULTS_ALREADY_SENT)"
class="send-button">
Mark Results as Sent
</button>
</div>
<div>
<!-- Short Message -->
<p>
Expand Down Expand Up @@ -512,4 +528,9 @@ p {
color: #0056b3;
}
.results-url-sender{
display: flex;
gap: 10px; /* Adds space between buttons */
}
</style>

0 comments on commit 7b25c07

Please sign in to comment.