|
17 | 17 | v-model="project.classifier" :options="availableClassifiers" |
18 | 18 | :label="$t('message.classifier')" :tooltip="$t('message.component_classifier_desc')" |
19 | 19 | :readonly="this.isNotPermitted(PERMISSIONS.PORTFOLIO_MANAGEMENT)" /> |
20 | | - <b-input-group-form-select id="project-parent-input" required="false" |
21 | | - v-model="selectedParent" :options="availableParents" |
22 | | - :label="$t('message.parent')" :readonly="this.isNotPermitted(PERMISSIONS.PORTFOLIO_MANAGEMENT)" /> |
23 | 20 | <b-form-group |
24 | 21 | id="project-description-form-group" |
25 | 22 | :label="this.$t('message.description')" |
|
36 | 33 | style="max-width:none; background-color:transparent;" |
37 | 34 | :readonly="this.isNotPermitted(PERMISSIONS.PORTFOLIO_MANAGEMENT)" /> |
38 | 35 | </b-form-group> |
39 | | - <c-switch id="input-5" class="mx-1" color="primary" v-model="project.active" label |
40 | | - :disabled="this.isNotPermitted(PERMISSIONS.PORTFOLIO_MANAGEMENT) || (project.active && this.hasActiveChild(project))" v-bind="labelIcon" |
41 | | - v-b-tooltip.hover :title="$t('message.inactive_active_children')"/> {{$t('message.active')}} |
| 36 | + <c-switch id="input-5" class="mx-1" color="primary" v-model="project.active" label :disabled="this.isNotPermitted(PERMISSIONS.PORTFOLIO_MANAGEMENT)" v-bind="labelIcon" /> {{$t('message.active')}} |
42 | 37 | <p></p> |
43 | 38 | <b-input-group-form-input id="project-uuid" input-group-size="mb-3" type="text" v-model="project.uuid" |
44 | 39 | lazy="false" required="false" feedback="false" autofocus="false" disabled="true" |
|
104 | 99 | cSwitch |
105 | 100 | }, |
106 | 101 | props: { |
107 | | - project: Object, |
108 | | - uuid: String |
| 102 | + project: Object |
109 | 103 | }, |
110 | 104 | data() { |
111 | 105 | return { |
|
121 | 115 | { value: 'FIRMWARE', text: this.$i18n.t('message.component_firmware') }, |
122 | 116 | { value: 'FILE', text: this.$i18n.t('message.component_file') } |
123 | 117 | ], |
124 | | - selectedParent: null, |
125 | | - availableParents: [ |
126 | | - { value: null, text: ''} |
127 | | - ], |
128 | 118 | tag: '', // The contents of a tag as its being typed into the vue-tag-input |
129 | 119 | tags: [], // An array of tags bound to the vue-tag-input |
130 | 120 | addOnKeys: [9, 13, 32, ':', ';', ','], // Separators used when typing tags into the vue-tag-input |
|
138 | 128 | this.readOnlyProjectName = this.project.name; |
139 | 129 | this.readOnlyProjectVersion = this.project.version; |
140 | 130 | }, |
141 | | - mounted() { |
142 | | - this.retrieveParents(); |
143 | | - }, |
144 | 131 | methods: { |
145 | 132 | initializeTags: function() { |
146 | 133 | this.tags = (this.project.tags || []).map(tag => ({ text: tag.name })); |
|
164 | 151 | version: this.project.version, |
165 | 152 | description: this.project.description, |
166 | 153 | classifier: this.project.classifier, |
167 | | - parent: {uuid: this.selectedParent}, |
168 | 154 | cpe: this.project.cpe, |
169 | 155 | purl: this.project.purl, |
170 | 156 | swidTagId: this.project.swidTagId, |
|
188 | 174 | }).catch((error) => { |
189 | 175 | this.$toastr.w(this.$t('condition.unsuccessful_action')); |
190 | 176 | }); |
191 | | - }, |
192 | | - retrieveParents: function() { |
193 | | - let url = `${this.$api.BASE_URL}/${this.$api.URL_PROJECT}/withoutDescendantsOf/${this.$props.uuid}`; |
194 | | - this.axios.get(url).then((response) => { |
195 | | - for (let i = 0; i < response.data.length; i++) { |
196 | | - let project = response.data[i]; |
197 | | - if (project.uuid !== this.project.uuid){ |
198 | | - if (project.version){ |
199 | | - this.availableParents.push({value: project.uuid, text: project.name + ' : ' + project.version}); |
200 | | - } else { |
201 | | - this.availableParents.push({value: project.uuid, text: project.name}); |
202 | | - } |
203 | | - } |
204 | | - if (this.project.parent && this.project.parent.uuid === project.uuid ) { |
205 | | - this.selectedParent = project.uuid; |
206 | | - } |
207 | | - } |
208 | | - }).catch((error) => { |
209 | | - this.$toastr.w(this.$t('condition.unsuccessful_action')); |
210 | | - }); |
211 | | - }, |
212 | | - hasActiveChild: function (project) { |
213 | | - let bool = false; |
214 | | - if (project.children){ |
215 | | - for (const child of project.children){ |
216 | | - if (child.active || bool){ |
217 | | - return true; |
218 | | - } else { |
219 | | - bool = this.hasActiveChild(child); |
220 | | - } |
221 | | - } |
222 | | - } |
223 | | - return bool; |
224 | 177 | } |
225 | 178 | } |
226 | 179 | } |
|
0 commit comments