Skip to content

Commit c5c5ab3

Browse files
authored
Merge pull request #290 from nscuro/revert-272
2 parents 0bf649a + 622f275 commit c5c5ab3

5 files changed

Lines changed: 12 additions & 195 deletions

File tree

src/i18n/locales/en.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
"property_deleted": "Property deleted",
110110
"create_project": "Create Project",
111111
"show_inactive_projects": "Show inactive projects",
112-
"hierarchical_view": "Hierarchical view",
113112
"create_project_property": "Create Project Property",
114113
"group_name": "Group Name",
115114
"property_name": "Property Name",
@@ -243,7 +242,6 @@
243242
"snapshot_notification": "Snapshot Notification",
244243
"select_project": "Select Project",
245244
"select_tag": "Select Tag",
246-
"parent": "Parent",
247245
"select": "Select",
248246
"identity": "Identity",
249247
"extended": "Extended",
@@ -384,8 +382,7 @@
384382
"component_device": "Device",
385383
"component_firmware": "Firmware",
386384
"component_file": "File",
387-
"dates": "Dates",
388-
"inactive_active_children": "The project cannot be set to inactive if it has active children"
385+
"dates": "Dates"
389386
},
390387
"admin": {
391388
"configuration": "Configuration",

src/views/portfolio/projects/Project.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
<project-policy-violations :key="this.uuid" :uuid="this.uuid" v-on:total="totalViolations = $event" />
126126
</b-tab>
127127
</b-tabs>
128-
<project-details-modal :project="cloneDeep(project)" :uuid="this.uuid" v-on:projectUpdated="syncProjectFields"/>
128+
<project-details-modal :project="cloneDeep(project)" v-on:projectUpdated="syncProjectFields"/>
129129
<project-properties-modal :uuid="this.uuid" />
130130
<project-create-property-modal :uuid="this.uuid" />
131131
<project-add-version-modal :uuid="this.uuid" />
@@ -244,6 +244,8 @@
244244
},
245245
beforeMount() {
246246
this.uuid = this.$route.params.uuid;
247+
},
248+
mounted() {
247249
this.initialize();
248250
},
249251
watch:{

src/views/portfolio/projects/ProjectCreateProjectModal.vue

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
<b-input-group-form-select id="v-classifier-input" required="true"
1515
v-model="project.classifier" :options="sortAvailableClassifiers"
1616
:label="$t('message.classifier')" :tooltip="$t('message.component_classifier_desc')" />
17-
<b-input-group-form-select id="project-parent-input" required="false"
18-
v-model="selectedParent" :options="availableParents"
19-
:label="$t('message.parent')" />
2017
<b-form-group
2118
id="project-description-form-group"
2219
:label="this.$t('message.description')"
@@ -114,10 +111,6 @@
114111
],
115112
selectableLicenses: [],
116113
selectedLicense: '',
117-
selectedParent: null,
118-
availableParents: [
119-
{ value: null, text: ''}
120-
],
121114
project: {},
122115
tag: '', // The contents of a tag as its being typed into the vue-tag-input
123116
tags: [], // An array of tags bound to the vue-tag-input
@@ -137,7 +130,6 @@
137130
},
138131
beforeMount() {
139132
this.retrieveLicenses();
140-
this.retrieveParents();
141133
},
142134
computed: {
143135
sortAvailableClassifiers: function() {
@@ -157,18 +149,13 @@
157149
createProject: function() {
158150
let url = `${this.$api.BASE_URL}/${this.$api.URL_PROJECT}`;
159151
let tagsNode = [];
160-
let parent = {uuid: this.selectedParent};
161-
if (this.selectedParent == null){
162-
parent = null;
163-
}
164152
this.tags.forEach((tag) => tagsNode.push({name: tag.text}));
165153
this.axios.put(url, {
166154
name: this.project.name,
167155
version: this.project.version,
168156
group: this.project.group,
169157
description: this.project.description,
170158
//license: this.selectedLicense,
171-
parent: parent,
172159
classifier: this.project.classifier,
173160
purl: this.project.purl,
174161
cpe: this.project.cpe,
@@ -199,31 +186,10 @@
199186
this.$toastr.w(this.$t('condition.unsuccessful_action'));
200187
});
201188
},
202-
retrieveParents: function() {
203-
let url = `${this.$api.BASE_URL}/${this.$api.URL_PROJECT}`;
204-
this.axios.get(url).then((response) => {
205-
for (let i = 0; i < response.data.length; i++) {
206-
let project = response.data[i];
207-
if (project.version) {
208-
this.availableParents.push({value: project.uuid, text: project.name + ' : ' + project.version});
209-
} else {
210-
this.availableParents.push({value: project.uuid, text: project.name});
211-
}
212-
if (this.project.parent && this.project.parent.uuid === project.uuid ) {
213-
this.selectedParent = project.uuid;
214-
}
215-
}
216-
}).catch((error) => {
217-
this.$toastr.w(this.$t('condition.unsuccessful_action'));
218-
});
219-
},
220189
resetValues: function () {
221190
this.project = {};
222191
this.tag = "";
223192
this.tags = [];
224-
this.selectedParent = null;
225-
this.availableParents = [{ value: null, text: ''}]
226-
this.retrieveParents();
227193
}
228194
}
229195
}

src/views/portfolio/projects/ProjectDetailsModal.vue

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
v-model="project.classifier" :options="availableClassifiers"
1818
:label="$t('message.classifier')" :tooltip="$t('message.component_classifier_desc')"
1919
: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)" />
2320
<b-form-group
2421
id="project-description-form-group"
2522
:label="this.$t('message.description')"
@@ -36,9 +33,7 @@
3633
style="max-width:none; background-color:transparent;"
3734
:readonly="this.isNotPermitted(PERMISSIONS.PORTFOLIO_MANAGEMENT)" />
3835
</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')}}
4237
<p></p>
4338
<b-input-group-form-input id="project-uuid" input-group-size="mb-3" type="text" v-model="project.uuid"
4439
lazy="false" required="false" feedback="false" autofocus="false" disabled="true"
@@ -104,8 +99,7 @@
10499
cSwitch
105100
},
106101
props: {
107-
project: Object,
108-
uuid: String
102+
project: Object
109103
},
110104
data() {
111105
return {
@@ -121,10 +115,6 @@
121115
{ value: 'FIRMWARE', text: this.$i18n.t('message.component_firmware') },
122116
{ value: 'FILE', text: this.$i18n.t('message.component_file') }
123117
],
124-
selectedParent: null,
125-
availableParents: [
126-
{ value: null, text: ''}
127-
],
128118
tag: '', // The contents of a tag as its being typed into the vue-tag-input
129119
tags: [], // An array of tags bound to the vue-tag-input
130120
addOnKeys: [9, 13, 32, ':', ';', ','], // Separators used when typing tags into the vue-tag-input
@@ -138,9 +128,6 @@
138128
this.readOnlyProjectName = this.project.name;
139129
this.readOnlyProjectVersion = this.project.version;
140130
},
141-
mounted() {
142-
this.retrieveParents();
143-
},
144131
methods: {
145132
initializeTags: function() {
146133
this.tags = (this.project.tags || []).map(tag => ({ text: tag.name }));
@@ -164,7 +151,6 @@
164151
version: this.project.version,
165152
description: this.project.description,
166153
classifier: this.project.classifier,
167-
parent: {uuid: this.selectedParent},
168154
cpe: this.project.cpe,
169155
purl: this.project.purl,
170156
swidTagId: this.project.swidTagId,
@@ -188,39 +174,6 @@
188174
}).catch((error) => {
189175
this.$toastr.w(this.$t('condition.unsuccessful_action'));
190176
});
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;
224177
}
225178
}
226179
}

0 commit comments

Comments
 (0)