Skip to content

Commit f32a216

Browse files
authored
Merge pull request #232 from Breeding-Insight/feature/BI-1459
Feature/bi 1459
2 parents 15bbb68 + 0a3af5b commit f32a216

File tree

13 files changed

+407
-48
lines changed

13 files changed

+407
-48
lines changed

src/breeding-insight/dao/JobDAO.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* See the NOTICE file distributed with this work for additional information
3+
* regarding copyright ownership.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import * as api from '@/util/api';
19+
import { BiResponse, Response } from '@/breeding-insight/model/BiResponse';
20+
21+
export class JobDAO {
22+
23+
static async getProgramJobs(programId: string) {
24+
const {data} = await api.call({
25+
url: `${process.env.VUE_APP_BI_API_V1_PATH}/programs/${programId}/jobs`,
26+
method: 'get'
27+
}) as Response;
28+
29+
return new BiResponse(data);
30+
}
31+
}

src/breeding-insight/model/import/ImportResponse.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,33 @@
1717

1818
import {ImportProgress} from "@/breeding-insight/model/import/ImportProgress";
1919
import {ImportPreview} from "@/breeding-insight/model/import/ImportPreview";
20+
import { User } from '@/breeding-insight/model/User';
21+
import { JobDetail } from '@/breeding-insight/model/job/JobDetail';
2022

21-
export class ImportResponse {
23+
export class ImportResponse extends JobDetail{
2224
importId?: string;
2325
progress?: ImportProgress;
2426
preview?: ImportPreview;
27+
uploadFileName?: string;
28+
importMappingName?:string;
29+
importType?:string;
30+
createdByUser?: User;
31+
updatedByUser?: User;
32+
createdAt?: Date;
33+
updatedAt?: Date;
2534

26-
constructor({importId, progress, preview}: ImportResponse) {
35+
constructor({importId, progress, preview, uploadFileName, importMappingName, importType, createdByUser, updatedByUser, createdAt, updatedAt, jobType}: ImportResponse) {
36+
super();
2737
this.importId = importId;
2838
this.progress = progress;
2939
this.preview = preview;
40+
this.uploadFileName = uploadFileName;
41+
this.importMappingName = importMappingName;
42+
this.importType = importType;
43+
this.createdByUser = createdByUser;
44+
this.updatedByUser = updatedByUser;
45+
this.createdAt = createdAt;
46+
this.updatedAt = updatedAt;
47+
this.jobType = jobType;
3048
}
3149
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* See the NOTICE file distributed with this work for additional information
3+
* regarding copyright ownership.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import { User } from '@/breeding-insight/model/User';
19+
import { JobDetail } from '@/breeding-insight/model/job/JobDetail';
20+
21+
export class Job {
22+
statuscode?: number;
23+
statusMessage?: string;
24+
jobType?: string;
25+
createdAt?: Date;
26+
updatedAt?: Date;
27+
createdByUser?: User;
28+
jobDetail?: JobDetail;
29+
30+
constructor ({statuscode, statusMessage, jobType, createdAt, updatedAt, createdByUser, jobDetail}: Job) {
31+
this.statuscode = statuscode;
32+
this.statusMessage = statusMessage;
33+
this.jobType = jobType;
34+
this.createdAt = createdAt;
35+
this.updatedAt = updatedAt;
36+
this.createdByUser = createdByUser;
37+
this.jobDetail = jobDetail;
38+
}
39+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* See the NOTICE file distributed with this work for additional information
3+
* regarding copyright ownership.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
export class JobDetail {
19+
jobType?: string;
20+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* See the NOTICE file distributed with this work for additional information
3+
* regarding copyright ownership.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import { BiResponse } from '@/breeding-insight/model/BiResponse';
19+
import { Job } from '@/breeding-insight/model/job/Job';
20+
import { JobDAO } from '@/breeding-insight/dao/JobDAO';
21+
22+
export class JobService {
23+
static getJobsUnknown: string = 'An unknown error occurred while retrieving job statuses';
24+
25+
static async getProgramJobs(programId: string): Promise<Job[]> {
26+
if (!programId) {
27+
throw 'Program ID not provided';
28+
}
29+
30+
try {
31+
const response: BiResponse = await JobDAO.getProgramJobs(programId);
32+
const data: any = response.result.data;
33+
if(data) {
34+
return data.map((response: Job) => new Job(response));
35+
} else {
36+
return [];
37+
}
38+
} catch (e) {
39+
if (e.response && e.response.statusText) {
40+
e.errorMessage = e.response.statusText;
41+
} else {
42+
e.errorMessage = this.getJobsUnknown;
43+
}
44+
throw e;
45+
}
46+
47+
}
48+
}

src/components/layouts/UserSideBarLayout.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,19 @@
128128
BrAPI
129129
</router-link>
130130
</li>
131+
<li>
132+
<router-link
133+
v-bind:to="{name: 'job-management', params: {programId: activeProgram.id}}"
134+
:id="jobManagementMenuId"
135+
>
136+
Jobs
137+
</router-link>
138+
</li>
131139
<li>
132140
<router-link
133141
v-bind:to="{name: 'trials-studies', params: {programId: activeProgram.id}}"
134142
>
135-
Trials and Studies - Beta
143+
Trials and Studies <span class="ml-2 tag is-warning">Beta</span>
136144
</router-link>
137145
</li>
138146
</ul>
@@ -202,6 +210,7 @@
202210
private importFileMenuId: string = "usersidebarlayout-import-file-menu";
203211
private ontologyMenuId: string = "usersidebarlayout-ontology-menu";
204212
private programManagementMenuId: string = "usersidebarlayout-program-management-menu";
213+
private jobManagementMenuId: string = "usersidebarlayout-job-management-menu";
205214
private brAPIMenuId: string = "usersidebarlayout-brapi-menu";
206215
private germplasmMenuId: string = "usersidebarlayout-germplasm-menu";
207216

src/components/tables/expandableTable/ExpandableTable.vue

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,24 @@
4343
>
4444

4545
<slot></slot>
46-
<b-table-column v-if="editable || archivable" v-slot="props" cell-class="has-text-right is-narrow" :th-attrs="(column) => ({scope:'col'})">
46+
<b-table-column v-if="editable || details || archivable" v-slot="props" cell-class="has-text-right is-narrow" :th-attrs="(column) => ({scope:'col'})">
4747
<a
48-
v-if="editable"
48+
v-if="editable || details"
4949
data-testid="edit"
5050
v-on:click="props.toggleDetails(props.row)"
5151
v-on:keypress.enter.space="props.toggleDetails(props.row)"
5252
tabindex="0"
5353
>
54-
Edit
54+
<span v-if="editable">Edit</span>
55+
<span v-if="details">Details</span>
56+
57+
<span v-if="(editable || details) && !isVisibleDetailRow(props.row)" class="icon is-small margin-right-2 has-vertical-align-middle">
58+
<ChevronRightIcon size="1x" aria-hidden="true"></ChevronRightIcon>
59+
</span>
60+
<span v-if="(editable || details) && isVisibleDetailRow(props.row)" class="icon is-small margin-right-2 has-vertical-align-middle">
61+
<ChevronDownIcon size="1x" aria-hidden="true"></ChevronDownIcon>
62+
</span>
5563
</a>
56-
<span v-if="editable && !isVisibleDetailRow(props.row)" class="icon is-small margin-right-2 has-vertical-align-middle">
57-
<ChevronRightIcon size="1x" aria-hidden="true"></ChevronRightIcon>
58-
</span>
59-
<span v-if="editable && isVisibleDetailRow(props.row)" class="icon is-small margin-right-2 has-vertical-align-middle">
60-
<ChevronDownIcon size="1x" aria-hidden="true"></ChevronDownIcon>
61-
</span>
6264
<a
6365
v-if="archivable"
6466
v-on:click="$emit('remove', props.row.data)"
@@ -75,6 +77,7 @@
7577

7678
<template v-slot:detail="props">
7779
<EditDataRowForm class="mb-0"
80+
v-if="editable"
7881
v-bind:data-form-state="dataFormState"
7982
v-on:submit="validateAndSubmit(props.row)"
8083
v-on:cancel="cancelEditClicked(props.row)"
@@ -85,6 +88,12 @@
8588
name="edit"
8689
/>
8790
</EditDataRowForm>
91+
92+
<slot
93+
v-if="details"
94+
v-bind:row="props.row.data"
95+
name="detail"
96+
/>
8897
</template>
8998

9099
<template v-slot:pagination>
@@ -128,6 +137,8 @@ export default class ExpandableTable extends Mixins(ValidationMixin) {
128137
rowClasses: any;
129138
@Prop()
130139
loading!: boolean;
140+
@Prop()
141+
details!: boolean;
131142
132143
private tableRows: Array<TableRow<any>> = new Array<TableRow<any>>();
133144
private openDetail: Array<TableRow<any>> = new Array<TableRow<any>>();

src/components/trait/ConfirmImportMessageBox.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717

1818
<template>
1919
<div class="corfirm-import">
20+
<article class="message is-warning" v-if="confirmImportState.saveStarted">
21+
<div class="message-body">
22+
Your import is being processed. You can view on its progress by going to the <router-link v-bind:to="{name: 'job-management', params:{programId: activeProgram.id}}">Jobs</router-link> page.
23+
</div>
24+
</article>
2025
<article class="message is-success">
2126
<div class="message-body">
2227
<nav class="columns">
@@ -59,11 +64,18 @@
5964
import {AlertTriangleIcon} from 'vue-feather-icons'
6065
import {StringFormatters} from '@/breeding-insight/utils/StringFormatters'
6166
import {DataFormEventBusHandler} from "@/components/forms/DataFormEventBusHandler";
67+
import {mapGetters} from "vuex";
68+
import { Program } from '@/breeding-insight/model/Program';
6269
6370
@Component({
6471
components: {
6572
AlertTriangleIcon
66-
}
73+
},
74+
computed: {
75+
...mapGetters([
76+
'activeProgram',
77+
])
78+
},
6779
})
6880
export default class ConfirmImportMessageBox extends Vue {
6981
@@ -76,6 +88,8 @@
7688
@Prop()
7789
confirmImportState!: DataFormEventBusHandler;
7890
91+
private activeProgram?: Program;
92+
7993
confirm() {
8094
this.$emit('confirm');
8195
this.confirmImportState.bus.$emit(DataFormEventBusHandler.SAVE_STARTED_EVENT);

src/router/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ import Germplasm from "@/views/germplasm/Germplasm.vue";
6464
import GermplasmLists from "@/views/germplasm/GermplasmLists.vue";
6565
import GermplasmDetails from "@/views/germplasm/GermplasmDetails.vue";
6666
import ProgramConfiguration from "@/views/program/ProgramConfiguration.vue";
67+
import JobManagement from '@/views/program/JobManagement.vue';
6768

6869
Vue.use(VueRouter);
6970

@@ -378,6 +379,16 @@ const routes = [
378379
component: BrAPIInfo,
379380
beforeEnter: processProgramNavigation
380381
},
382+
{
383+
path: '/programs/:programId/jobs',
384+
name: 'job-management',
385+
meta: {
386+
title: 'Jobs',
387+
layout: layouts.userSideBar
388+
},
389+
component: JobManagement,
390+
beforeEnter: processProgramNavigation
391+
},
381392
{
382393
path: '/programs/:programId/brapi/authorize',
383394
name: 'brapi-authorize',

src/views/Home.vue

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,6 @@
2121
<div class="columns">
2222
<div class="column is-three-fifths">
2323
<p class="title">Welcome, {{ activeUser.name }}!</p>
24-
<div class="columns is-mobile">
25-
<div class="column">
26-
<p class="title is-6">Last activity:</p>
27-
<div class="columns is-mobile">
28-
<div class="column is-narrow">
29-
<p>Data entry for trial Y4-03-10</p>
30-
</div>
31-
<div class="column is-narrow">
32-
<b-button class="button is-primary">RESUME</b-button>
33-
</div>
34-
</div>
35-
</div>
36-
<div class="column">
37-
<p class="title is-6">Most common tasks:</p>
38-
<p>Inventory</p>
39-
<p>Trial Y4--02-10</p>
40-
<p>Trial Y4-01-01</p>
41-
<p>Experiments</p>
42-
</div>
43-
</div>
44-
45-
<div class="columns is-mobile">
46-
<div class="column">
47-
<p class="title is-6">Program Activity Log</p>
48-
<p>Username | Type of activity here, data changed, etc. | 2019-12-12 4:08pm</p>
49-
<p>Username | Type of activity here, data changed, etc. | 2019-12-12 4:08pm</p>
50-
<p>Username | Type of activity here, data changed, etc. | 2019-12-12 4:08pm</p>
51-
<p>Username | Type of activity here, data changed, etc. | 2019-12-12 4:08pm</p>
52-
<p>Username | Type of activity here, data changed, etc. | 2019-12-12 4:08pm</p>
53-
</div>
54-
</div>
5524
</div>
5625
<div class="column">
5726
<div class="card">
@@ -68,9 +37,9 @@
6837
</div>
6938
</div>
7039
</div>
71-
<footer class="card-footer">
72-
<a href="#" class="card-footer-item">Edit</a>
73-
</footer>
40+
<!-- <footer class="card-footer">-->
41+
<!-- <a href="#" class="card-footer-item">Edit</a>-->
42+
<!-- </footer>-->
7443
</div>
7544
</div>
7645
</div>

0 commit comments

Comments
 (0)