Skip to content

Commit

Permalink
make Analyst Action for Add only, with link to viewing plans after su…
Browse files Browse the repository at this point in the history
…ccessful add.
  • Loading branch information
ekraffmiller committed Aug 15, 2023
1 parent c3cf4e8 commit 193815c
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 15 deletions.
29 changes: 27 additions & 2 deletions client/src/components/MyAnalysisPlans/CreateAnalysisPlanDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@

</v-card-text>

<v-card-actions>
<v-card-actions v-if="!isPlanCreated || selectedDataset == null">
<v-btn :disabled="isSubmitDisabled" data-test="createPlanSubmitButton" color="primary" @click="createPlan">Create</v-btn>
<v-btn color="secondary" @click="closeDialog">Cancel</v-btn>
</v-card-actions>
<v-card-actions v-if="isPlanCreated && selectedDataset !== null" class="success-message">
Plan created successfully!
<router-link to="/my-data">Go to My Data</router-link>
<router-link to="/my-plans">Go to My Analysis Plans</router-link>
</v-card-actions>
</v-card>
</v-dialog>
</template>
Expand All @@ -65,6 +70,7 @@ export default {
},
data() {
return {
isPlanCreated: false,
newPlan: {
datasetId: null,
planName: null,
Expand Down Expand Up @@ -138,7 +144,17 @@ export default {
this.$store.dispatch('dataset/createAnalysisPlan',
this.newPlan)
this.closeDialog();
// If we opened this from the Analysis Plans table, then close the dialog
// when the plan is created
if (this.selectedDataset == null) {
this.closeDialog();
} else {
// Else keep the dialog open so the Success message appears
// and user can choose to go to
// the analysis plans page or back to My Data
this.isPlanCreated = true
}
//
},
availableDatasets() {
Expand All @@ -154,6 +170,7 @@ export default {
},
closeDialog() {
this.resetPlan()
this.isPlanCreated = false
this.$emit("close")
},
Expand All @@ -165,6 +182,14 @@ export default {
.max-budget {
margin-left: 16px;
}
.success-message {
justify-content: center;
margin-top: 10px;
}
.success-message a {
color: green;
text-decoration: underline;
}
</style>


Expand Down
33 changes: 26 additions & 7 deletions client/src/components/MyAnalysisPlans/MyPlansTable.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
<template>
<div>

<v-data-table v-if="plans"
data-test="my-plans-table"
:headers="headers"
:items="plans"
:custom-filter="filterOnlyCapsText"
:items-per-page="computedItemsPerPage"
:search="searchTerm || search"
:search="search"
:hide-default-footer="true"
class="my-data-table"
:page.sync="page"
@page-count="pageCount = $event"
:disable-sort="$vuetify.breakpoint.xsOnly"
>
<template v-slot:top v-if="inlineSearchEnabled">
<v-text-field
v-model="search"
label="Search"
class="mx-4"
></v-text-field>
<v-container>
<v-row align="start"
no-gutters>
<v-col cols="6" class="align-left">
<b>Filter By:</b>
<v-select
v-model="selectedFilter"
:items="filterOptions"
label="Select Filter"
></v-select>
<v-btn text small @click="clearFilter">Clear Filter</v-btn>
</v-col>
</v-row>
</v-container>
</template>
<template v-slot:[`header.options`]="{ header }">
<span class="font-weight-bold text-start d-inline">
Expand Down Expand Up @@ -222,7 +233,7 @@ export default {
},
inlineSearchEnabled: {
type: Boolean,
default: false
default: true
},
searchTerm: {
type: String
Expand Down Expand Up @@ -255,6 +266,8 @@ export default {
{text: "Options", value: "actions", align: "end"}
],
selectedFilter: '', // Initialize selected filter
filterOptions: ['My Plans', 'Plans Created From My Datasets'], // Define filter options
statusInformation,
actionsInformation,
stepInformation,
Expand All @@ -267,6 +280,9 @@ export default {
handleButtonClick(action, item) {
this[action](item)
},
filterOnlyCapsText (value, query, item) {
return value != null && query != null && typeof value === 'string' && value.toString().toLocaleUpperCase().indexOf(query) !== -1
},
deleteItem(item) {
this.selectedItem = Object.assign({}, item);
this.dialogDelete = true;
Expand All @@ -284,6 +300,9 @@ export default {
delete(item) {
this.deleteItem(item)
},
clearFilter() {
this.selectedFilter = ''; // Clear the selected filter
},
formatDate(dateString) {
const dateObj = new Date(dateString);
// The dateString returned from the v-date-picker is in UTC, so we have to display that
Expand Down
4 changes: 0 additions & 4 deletions client/src/components/MyData/MyDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,8 @@ export default {
this[action](item)
},
viewPlans(item) {
if (item.analysisPlans.length === 0){
this.selectedItem = Object.assign({}, item);
this.dialogCreateAnalysis = true
} else {
this.goToAnalysisPlanPage(item.objectId)
}
},
deleteItem(item) {
this.selectedItem = Object.assign({}, item);
Expand Down
2 changes: 1 addition & 1 deletion client/src/data/actionsInformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default {
viewDetails: "View Details",
continueWorkflow: "Continue",
cancelExecution: "Cancel Execution",
viewPlans: "Add/View Analysis Plans",
viewPlans: "Add Analysis Plan",
delete: "Delete",
actions: {
VIEW_DETAILS: "viewDetails",
Expand Down
2 changes: 1 addition & 1 deletion client/src/views/MyAnalysisPlans.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
data-test="createPlanButton"
:disabled="!budgetAvailableForCreate()"
color="Secondary"
label="Create Analysis Plan"
label="Add Analysis Plan"
:class="{
'width80 mx-auto d-block mb-2': $vuetify.breakpoint.xsOnly,
'mr-2 mb-2': $vuetify.breakpoint.smAndUp
Expand Down

0 comments on commit 193815c

Please sign in to comment.