Lines 41-64
export default {
Link Here
|
41 |
setup() { |
41 |
setup() { |
42 |
const vendorStore = inject("vendorStore") |
42 |
const vendorStore = inject("vendorStore") |
43 |
|
43 |
|
44 |
const AVStore = inject("AVStore") |
|
|
45 |
|
46 |
const mainStore = inject("mainStore") |
44 |
const mainStore = inject("mainStore") |
47 |
|
45 |
|
48 |
const { loading, loaded, setError } = mainStore |
46 |
const { loading, loaded, setError, loadAuthorisedValues } = mainStore |
49 |
|
47 |
|
50 |
const ERMStore = inject("ERMStore") |
48 |
const ERMStore = inject("ERMStore") |
51 |
|
49 |
|
52 |
const { config } = storeToRefs(ERMStore) |
50 |
const { config, authorisedValues } = storeToRefs(ERMStore) |
53 |
|
51 |
|
54 |
return { |
52 |
return { |
55 |
vendorStore, |
53 |
vendorStore, |
56 |
AVStore, |
|
|
57 |
ERMStore, |
54 |
ERMStore, |
58 |
config, |
55 |
config, |
59 |
setError, |
56 |
setError, |
60 |
loading, |
57 |
loading, |
61 |
loaded, |
58 |
loaded, |
|
|
59 |
loadAuthorisedValues, |
60 |
authorisedValues, |
62 |
} |
61 |
} |
63 |
}, |
62 |
}, |
64 |
data() { |
63 |
data() { |
Lines 80-130
export default {
Link Here
|
80 |
}, |
79 |
}, |
81 |
error => {} |
80 |
error => {} |
82 |
) |
81 |
) |
83 |
|
82 |
this.loadAuthorisedValues(this.authorisedValues).then(() => { |
84 |
const av_client = APIClient.authorised_values |
83 |
this.loaded() |
85 |
const authorised_values = { |
84 |
this.initialized = true |
86 |
av_agreement_statuses: "ERM_AGREEMENT_STATUS", |
|
|
87 |
av_agreement_closure_reasons: "ERM_AGREEMENT_CLOSURE_REASON", |
88 |
av_agreement_renewal_priorities: |
89 |
"ERM_AGREEMENT_RENEWAL_PRIORITY", |
90 |
av_user_roles: "ERM_USER_ROLES", |
91 |
av_license_types: "ERM_LICENSE_TYPE", |
92 |
av_license_statuses: "ERM_LICENSE_STATUS", |
93 |
av_agreement_license_statuses: "ERM_AGREEMENT_LICENSE_STATUS", |
94 |
av_agreement_license_location: "ERM_AGREEMENT_LICENSE_LOCATION", |
95 |
av_package_types: "ERM_PACKAGE_TYPE", |
96 |
av_package_content_types: "ERM_PACKAGE_CONTENT_TYPE", |
97 |
av_title_publication_types: "ERM_TITLE_PUBLICATION_TYPE", |
98 |
av_report_types: "ERM_REPORT_TYPES", |
99 |
av_platform_reports_metrics: "ERM_PLATFORM_REPORTS_METRICS", |
100 |
av_database_reports_metrics: "ERM_DATABASE_REPORTS_METRICS", |
101 |
av_title_reports_metrics: "ERM_TITLE_REPORTS_METRICS", |
102 |
av_item_reports_metrics: "ERM_ITEM_REPORTS_METRICS", |
103 |
} |
104 |
|
105 |
let av_cat_array = Object.keys(authorised_values).map(function ( |
106 |
av_cat |
107 |
) { |
108 |
return '"' + authorised_values[av_cat] + '"' |
109 |
}) |
85 |
}) |
110 |
|
|
|
111 |
promises.push( |
112 |
av_client.values |
113 |
.getCategoriesWithValues(av_cat_array) |
114 |
.then(av_categories => { |
115 |
Object.entries(authorised_values).forEach( |
116 |
([av_var, av_cat]) => { |
117 |
const av_match = av_categories.find( |
118 |
element => element.category_name == av_cat |
119 |
) |
120 |
this.AVStore[av_var] = |
121 |
av_match.authorised_values |
122 |
} |
123 |
) |
124 |
}) |
125 |
) |
126 |
|
127 |
return Promise.all(promises) |
128 |
} |
86 |
} |
129 |
|
87 |
|
130 |
const client = APIClient.erm |
88 |
const client = APIClient.erm |