Skip to content

Commit

Permalink
Merge pull request #17 from samply/feature/results
Browse files Browse the repository at this point in the history
Feature/results
  • Loading branch information
djuarezgf authored Jan 20, 2025
2 parents 5335dfc + 1e49fb6 commit fab3b1c
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 53 deletions.
75 changes: 49 additions & 26 deletions src/components/BridgeheadOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@
<!-- Header in the first column -->
<td class="header-cell">{{ header }}</td>
<td v-if="header === 'Sites'" class="header-summary-cell" style="border-top: 1px solid #dddddd">{{ bridgeheads.length }}</td>
<td v-if="header === 'Votum'" class="header-summary-cell status-cell">{{ getVotumStatus()[0] }} <div class="exist-small green"></div> / {{ getVotumStatus()[1]}}<div class="exist-small red"></div></td>
<td v-if="header === 'User Access'" class="header-summary-cell status-cell">{{ getBridgeheadStatus()[0] }} <div class="exist-small green"></div> / {{ getBridgeheadStatus()[1]}}<div class="exist-small red"></div></td>
<td v-if="header === 'DataSHIELD Status'" class="header-summary-cell status-cell">{{ getDatashieldStatus()[0] }} <div class="exist-small green"></div> / {{ getDatashieldStatus()[1]}}<div class="exist-small red"></div></td>
<td v-if="header === 'Teiler'" class="header-summary-cell status-cell">{{ getQueryStatus()[0] }} <div class="exist-small green"></div> / {{ getQueryStatus()[1]}}<div class="exist-small red"></div></td>
<td v-if="header === 'Creator Results Acceptance' " class="header-summary-cell status-cell">{{ getCreatorStatus()[0] }}<div class="exist-small green"></div> / {{ getCreatorStatus()[1]}}<div class="exist-small red"></div></td>
<td v-else-if="header === 'Votum'" class="header-summary-cell status-cell">{{ getVotumStatus()[0] }} <div class="exist-small green"></div> / {{ getVotumStatus()[1] }}<div class="exist-small red"></div></td>
<td v-else-if="header === 'Teiler'" class="header-summary-cell status-cell">{{ getQueryStatus()[0] }} <div class="exist-small green"></div> / {{ getQueryStatus()[1] }}<div class="exist-small red"></div></td>
<td v-if="header === 'DataSHIELD Status' " class="header-summary-cell status-cell">
{{ getDatashieldStatus()[0] }} <div class="exist-small green"></div> / {{ getDatashieldStatus()[1] }}<div class="exist-small red"></div>
</td>
<td v-else-if="header === 'User Access'" class="header-summary-cell status-cell">{{ getBridgeheadStatus()[0] }} <div class="exist-small green"></div> / {{ getBridgeheadStatus()[1] }}<div class="exist-small red"></div></td>
<td v-else-if="header === 'Creator Results Acceptance'" class="header-summary-cell status-cell">{{ getCreatorStatus()[0] }} <div class="exist-small green"></div> / {{ getCreatorStatus()[1] }}<div class="exist-small red"></div></td>
<!-- Data for each bridgehead in subsequent columns -->
<td
v-for="(bridgehead, bridgeheadIndex) in bridgeheads.slice(scrollIndex,(scrollIndex + numberBridgeheadShown))"
v-for="(bridgehead, bridgeheadIndex) in bridgeheads.slice(scrollIndex, scrollIndex + numberBridgeheadShown)"
:key="bridgeheadIndex"
class="data-cell"
:class="{ 'selected': selectedBridgehead === bridgeheadIndex }"
>
<!-- First row: bridgehead.bridgehead -->
<div v-if="index === 0" style="font-weight: bold; text-align: center"
@click="selectBridgehead(bridgeheadIndex)"
>{{ bridgehead.humanReadable }}</div>
<!-- Second row: existVotum -->
<div v-else-if="index === 1">
<div v-if="header === 'Sites'" style="font-weight: bold; text-align: center" @click="selectBridgehead(bridgeheadIndex)">
{{ bridgehead.humanReadable }}
</div>
<div v-else-if="header === 'Votum'">
<div v-if="existsVotums.length > 0 && existsVotums[bridgeheadIndex]" class="states-circle-container">
<div class="state_circle green"></div>
<DownloadButton
Expand All @@ -35,19 +35,32 @@
icon-class="bi bi-download"
button-class="download-button"
:module="Module.PROJECT_DOCUMENTS_MODULE"
:action="Action.DOWNLOAD_VOTUM_ACTION"/>
:action="Action.DOWNLOAD_VOTUM_ACTION"
/>
</div>
<div v-else class="states-circle-container"><div class="state_circle red"></div></div>
<div v-else class="states-circle-container"><div class="state_circle red"></div></div>
</div>
<div v-else-if="header === 'Teiler'" class="states-circle-container">
<div class="state_circle" :class="bridgehead?.queryState?.toLowerCase()" v-b-tooltip.hover :title="bridgehead?.queryState ?? undefined"/>
</div>
<div v-else-if="header === 'User Access'" class="states-circle-container">
<div class="state_circle" :class="bridgehead?.state?.toLowerCase()" v-b-tooltip.hover :title="bridgehead?.state ?? undefined"/>
</div>
<div v-else-if="header === 'Creator Results Acceptance'" class="states-circle-container">
<div class="state_circle" :class="getCreatorStatusForBridgehead(bridgehead)?.toLowerCase()" v-b-tooltip.hover :title="getCreatorStatusForBridgehead(bridgehead) ?? undefined"/>
</div>
<!-- Third row: bridgehead.state -->
<div v-else-if="index === 2" class="states-circle-container"><div class="state_circle" :class="bridgehead?.state.toLowerCase()" v-b-tooltip.hover :title="bridgehead?.state"/></div>
<div v-else-if="index === 3" class="states-circle-container"><div class="state_circle" :class="bridgehead?.queryState.toLowerCase()" v-b-tooltip.hover :title="bridgehead?.queryState"/></div>
<div v-else-if="index === 4" class="states-circle-container"><div class="state_circle" :class="getCreatorStatusForBridgehead(bridgehead).toLowerCase()" v-b-tooltip.hover :title="getCreatorStatusForBridgehead(bridgehead)"/></div>
<div v-else> <!-- We assume that the DataSHIELD Status is the last header -->
<div v-if="dataShieldStatusArray[bridgeheadIndex]" class="states-circle-container"><div class="state_circle" :class="dataShieldStatusArray[bridgeheadIndex]?.project_status?.toLowerCase()" v-b-tooltip.hover :title="dataShieldStatusArray[bridgeheadIndex]?.project_status"></div></div>
<div v-else-if="header === 'DataSHIELD Status'">
<div v-if="dataShieldStatusArray[bridgeheadIndex]" class="states-circle-container">
<div class="state_circle" :class="dataShieldStatusArray[bridgeheadIndex]?.project_status?.toLowerCase()"
v-b-tooltip.hover
:title="dataShieldStatusArray[bridgeheadIndex]?.project_status">
</div>
</div>
<div v-else></div>
</div>

</td>

</tr>
</tbody>
</table>
Expand Down Expand Up @@ -94,7 +107,7 @@ export default class BridgeheadOverview extends Vue {
Action = Action;
DATASHIELD_STATUS_HEADER = 'DataSHIELD Status';
headers = ['Sites', 'Votum', 'User Access', 'Teiler', 'Creator Results Acceptance'];
headers = ['Sites', 'Votum', 'Teiler', 'User Access', 'Creator Results Acceptance'];
existsVotums: boolean[] = [];
dataShieldStatusArray: DataShieldProjectStatus[] = [];
selectedBridgehead: number | null = null;
Expand All @@ -116,7 +129,13 @@ export default class BridgeheadOverview extends Vue {
this.existsVotums = await this.fetchExistsVotums();
if (this.project && this.project.type === 'DATASHIELD') {
if (!this.headers.includes(this.DATASHIELD_STATUS_HEADER)) {
this.headers.push(this.DATASHIELD_STATUS_HEADER); // We assume that the DataSHIELD Status is the last header
const userAccessIndex = this.headers.indexOf('User Access');
if (userAccessIndex !== -1) {
this.headers.splice(userAccessIndex, 0, this.DATASHIELD_STATUS_HEADER);
} else {
// If 'User Access' is not found, append the header as a fallback
this.headers.push(this.DATASHIELD_STATUS_HEADER);
}
}
this.dataShieldStatusArray = await this.fetchDataShieldStates();
}
Expand Down Expand Up @@ -194,16 +213,20 @@ export default class BridgeheadOverview extends Vue {
if (this.project?.creatorState === 'REJECTED'){
return [0, 1];
}
const isFinished = this.bridgeheads.filter((bridgehead) => bridgehead?.creatorState === 'ACCEPTED');
const notFinished = this.bridgeheads.filter((bridgehead) => bridgehead?.queryState !== 'ACCEPTED');
const isFinished = this.bridgeheads.filter((bridgehead) => this.isBridgeheadAcceptedByCreator(bridgehead));
const notFinished = this.bridgeheads.filter((bridgehead) => !this.isBridgeheadAcceptedByCreator(bridgehead));
return [isFinished.length, notFinished.length]
}
getCreatorStatusForBridgehead(bridgehead: Bridgehead): string {
isBridgeheadAcceptedByCreator(bridgehead: Bridgehead): boolean{
return bridgehead?.state === 'ACCEPTED' && bridgehead?.creatorState === 'ACCEPTED';
}
getCreatorStatusForBridgehead(bridgehead: Bridgehead): string | null | undefined {
if (this.project?.creatorState === 'ACCEPTED' || this.project?.creatorState === 'REJECTED'){
return this.project?.creatorState;
}
return bridgehead?.creatorState;
return (bridgehead?.state === 'ACCEPTED') ? bridgehead?.creatorState : 'CREATED';
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/components/ProjectView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
<tbody>
<tr>
<td>{{ project ? project.code : '' }}</td>
<td v-if="visibleBridgeheads?.length == 1 && activeBridgehead"><div class="state_circle" :class="activeBridgehead?.state.toLowerCase()" v-b-tooltip.hover :title="activeBridgehead?.state"></div></td>
<td v-if="visibleBridgeheads?.length == 1 && activeBridgehead"><div class="state_circle" :class="activeBridgehead?.queryState.toLowerCase()" v-b-tooltip.hover :title="activeBridgehead?.queryState"></div></td>
<td v-if="visibleBridgeheads?.length == 1 && activeBridgehead"><div class="state_circle" :class="activeBridgehead?.state?.toLowerCase()" v-b-tooltip.hover :title="activeBridgehead?.state ?? undefined"></div></td>
<td v-if="visibleBridgeheads?.length == 1 && activeBridgehead"><div class="state_circle" :class="activeBridgehead?.queryState?.toLowerCase()" v-b-tooltip.hover :title="activeBridgehead?.queryState ?? undefined"></div></td>
<td v-if="visibleBridgeheads?.length == 1 && activeBridgehead && currentUser"><div class="state_circle" :class="currentUser?.projectState.toLowerCase()" v-b-tooltip.hover :title="currentUser.projectState"></div></td>
<td v-if="visibleBridgeheads?.length == 1 && dataShieldStatus"><div class="state_circle" :class="dataShieldStatus?.project_status.toLowerCase()" v-b-tooltip.hover :title="dataShieldStatus?.project_status"></div></td>
<td v-if="visibleBridgeheads?.length == 1 && (project?.type == 'RESEARCH_ENVIRONMENT')">
Expand Down Expand Up @@ -126,7 +126,6 @@
/>
</div>
</div>
<br><br>
<div class="data-container mt-12">
<div v-if="project">
<div class="box-header">Request</div>
Expand Down Expand Up @@ -1143,6 +1142,7 @@ export default defineComponent({
border-radius: 10px;
box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12);
height: 100%;
margin-bottom: 1.5%;
}
.project-actions {
background-color: white;
Expand All @@ -1154,13 +1154,13 @@ export default defineComponent({
background-color: white;
border-radius: 10px;
box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12);
margin-top: 1.5%;
margin-bottom: 1.5%;
}
.documents {
background-color: white;
border-radius: 10px;
box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12);
margin-top: 1.5%;
margin-bottom: 1.5%;
}
.main-container {
display: flex;
Expand All @@ -1175,7 +1175,7 @@ export default defineComponent({
min-height: 800px;
margin-top: 1.5%;
margin-left: 1.5%;
margin-bottom: 4%;
margin-bottom: 5%;
background-color: white;
border-radius: 10px;
box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12);
Expand Down Expand Up @@ -1310,7 +1310,7 @@ export default defineComponent({
border-radius: 10px;
box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12);
margin-top: 1.5%;
margin-bottom: 4%;
margin-bottom: 5%;
margin-right: 0.5%;
}
.open-right-panel {
Expand Down
49 changes: 35 additions & 14 deletions src/components/ResultsBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Options, Vue} from "vue-class-component";
import {Prop, Watch} from "vue-property-decorator";
import {
Action,
ActionButton,
ActionButton, Bridgehead,
Module,
Project,
ProjectManagerBackendService,
Expand Down Expand Up @@ -104,6 +104,8 @@ export default class ResultsBox extends Vue {
}
resetCanSend() {
this.canSendProjectResults = false;
this.canSendProjectBridgheadResults = false;
this.projectManagerBackendService.isModuleActionActive(Module.PROJECT_RESULTS_MODULE, Action.ADD_PROJECT_RESULTS_URL_ACTION).then(condition => {
this.canSendProjectResults = condition;
});
Expand All @@ -113,10 +115,14 @@ export default class ResultsBox extends Vue {
}
resetCanAccept() {
this.projectManagerBackendService.isModuleActionActive(Module.PROJECT_RESULTS_MODULE, Action.ACCEPT_PROJECT_RESULTS_URL_ACTION).then(condition => {
this.canAcceptProjectResults = condition;
this.updateActionButtons();
});
this.canAcceptProjectResults = false;
this.canAcceptProjectBridgheadResults = false;
if (this.currentUsers.length > 0) { // It makes only sense if there are final users
this.projectManagerBackendService.isModuleActionActive(Module.PROJECT_RESULTS_MODULE, Action.ACCEPT_PROJECT_RESULTS_URL_ACTION).then(condition => {
this.canAcceptProjectResults = condition;
this.updateActionButtons();
});
}
this.projectManagerBackendService.isModuleActionActive(Module.PROJECT_RESULTS_MODULE, Action.ACCEPT_PROJECT_BRIDGEHEAD_RESULTS_URL_ACTION).then(condition => {
this.canAcceptProjectBridgheadResults = condition;
this.updateActionButtons();
Expand Down Expand Up @@ -214,6 +220,24 @@ export default class ResultsBox extends Vue {
return true;
}
fetchButtonContext(results: Results){
if (this.canAcceptProjectResults){
return this.context;
}
if (this.canAcceptProjectBridgheadResults){
const bridgehead: Bridgehead = {"bridgehead" : results.bridgehead, "projectCode" : this.context.projectCode, "creatorState" : null, "state": null, "queryState": null, "humanReadable": null, "modifiedAt": null};
return new ProjectManagerContext(this.context.projectCode, bridgehead);
}
}
fetchUserAccess(results: Results){
return results.bridgeheadAdminState ? results.bridgeheadAdminState : results.finalUserState;
}
fetchCreatorState(results: Results){
return (this.fetchUserAccess(results) === 'ACCEPTED') ? results.creatorState : 'CREATED';
}
}
</script>

Expand Down Expand Up @@ -318,14 +342,11 @@ export default class ResultsBox extends Vue {
<table v-if="resultsToShow.length">
<thead>
<tr>
<th v-if="!projectResults">Bridgehead</th>
<th v-if="!projectResults">Site</th>
<th v-if="!projectResults">Bridgehead Admin</th>
<th v-if="projectResults">Final User</th>
<th>URL</th>
<th>
<div v-if="projectResults !== undefined">Final User Acceptance</div>
<div v-else>Bridgehead Admin Acceptance</div>
</th>
<th>User Access</th>
<th>Creator Acceptance</th>
<th v-if="actionButtons.length > 0">Actions</th>
</tr>
Expand All @@ -346,20 +367,20 @@ export default class ResultsBox extends Vue {
<td>
<div class="states-circle-container">
<div class="state_circle"
:class="(result.bridgeheadAdminState ? result.bridgeheadAdminState : result.finalUserState)?.toLowerCase()"
:title="result.bridgeheadAdminState ? result.bridgeheadAdminState : result.finalUserState"/>
:class="fetchUserAccess(result)?.toLowerCase()"
:title="fetchUserAccess(result)"/>
</div>
</td>
<td>
<div class="states-circle-container">
<div class="state_circle" :class="result?.creatorState.toLowerCase()" :title="result.creatorState"/>
<div class="state_circle" :class="fetchCreatorState(result)?.toLowerCase()" :title="fetchCreatorState(result)"/>
</div>
</td>
<td v-if="actionButtons.length > 0">
<div style="display: flex">
<ProjectManagerButton v-for="(button, index) in actionButtons" :key="index"
:module="button.module" :action="button.action"
:context="context" :call-refreh-context="this.callRefrehContext"
:context="fetchButtonContext(result)" :call-refreh-context="this.callRefrehContext"
:text="button.text"
:button-class="button.cssClass" :with-message="button.withMessage"
:visibility="isButtonVisible(button, result)"
Expand Down
12 changes: 6 additions & 6 deletions src/services/projectManagerBackendService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,13 @@ export interface MessageSubject {


export interface Bridgehead {
projectCode: string;
projectCode: string | null | undefined;
bridgehead: string;
humanReadable: string | null;
state: string;
modifiedAt: string;
queryState: string;
creatorState: string;
humanReadable: string | null | undefined;
state: string | null | undefined;
modifiedAt: string | null | undefined;
queryState: string | null | undefined;
creatorState: string | null | undefined;
}

export interface ProjectDocument {
Expand Down

0 comments on commit fab3b1c

Please sign in to comment.