Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@
"property_deleted": "Property deleted",
"create_project": "Create Project",
"show_inactive_projects": "Show inactive projects",
"hierarchical_view": "Hierarchical view",
"create_project_property": "Create Project Property",
"group_name": "Group Name",
"property_name": "Property Name",
Expand Down Expand Up @@ -243,7 +242,6 @@
"snapshot_notification": "Snapshot Notification",
"select_project": "Select Project",
"select_tag": "Select Tag",
"parent": "Parent",
"select": "Select",
"identity": "Identity",
"extended": "Extended",
Expand Down Expand Up @@ -384,8 +382,7 @@
"component_device": "Device",
"component_firmware": "Firmware",
"component_file": "File",
"dates": "Dates",
"inactive_active_children": "The project cannot be set to inactive if it has active children"
"dates": "Dates"
},
"admin": {
"configuration": "Configuration",
Expand Down
4 changes: 3 additions & 1 deletion src/views/portfolio/projects/Project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
<project-policy-violations :key="this.uuid" :uuid="this.uuid" v-on:total="totalViolations = $event" />
</b-tab>
</b-tabs>
<project-details-modal :project="cloneDeep(project)" :uuid="this.uuid" v-on:projectUpdated="syncProjectFields"/>
<project-details-modal :project="cloneDeep(project)" v-on:projectUpdated="syncProjectFields"/>
<project-properties-modal :uuid="this.uuid" />
<project-create-property-modal :uuid="this.uuid" />
<project-add-version-modal :uuid="this.uuid" />
Expand Down Expand Up @@ -244,6 +244,8 @@
},
beforeMount() {
this.uuid = this.$route.params.uuid;
},
mounted() {
this.initialize();
},
watch:{
Expand Down
34 changes: 0 additions & 34 deletions src/views/portfolio/projects/ProjectCreateProjectModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
<b-input-group-form-select id="v-classifier-input" required="true"
v-model="project.classifier" :options="sortAvailableClassifiers"
:label="$t('message.classifier')" :tooltip="$t('message.component_classifier_desc')" />
<b-input-group-form-select id="project-parent-input" required="false"
v-model="selectedParent" :options="availableParents"
:label="$t('message.parent')" />
<b-form-group
id="project-description-form-group"
:label="this.$t('message.description')"
Expand Down Expand Up @@ -114,10 +111,6 @@
],
selectableLicenses: [],
selectedLicense: '',
selectedParent: null,
availableParents: [
{ value: null, text: ''}
],
project: {},
tag: '', // The contents of a tag as its being typed into the vue-tag-input
tags: [], // An array of tags bound to the vue-tag-input
Expand All @@ -137,7 +130,6 @@
},
beforeMount() {
this.retrieveLicenses();
this.retrieveParents();
},
computed: {
sortAvailableClassifiers: function() {
Expand All @@ -157,18 +149,13 @@
createProject: function() {
let url = `${this.$api.BASE_URL}/${this.$api.URL_PROJECT}`;
let tagsNode = [];
let parent = {uuid: this.selectedParent};
if (this.selectedParent == null){
parent = null;
}
this.tags.forEach((tag) => tagsNode.push({name: tag.text}));
this.axios.put(url, {
name: this.project.name,
version: this.project.version,
group: this.project.group,
description: this.project.description,
//license: this.selectedLicense,
parent: parent,
classifier: this.project.classifier,
purl: this.project.purl,
cpe: this.project.cpe,
Expand Down Expand Up @@ -199,31 +186,10 @@
this.$toastr.w(this.$t('condition.unsuccessful_action'));
});
},
retrieveParents: function() {
let url = `${this.$api.BASE_URL}/${this.$api.URL_PROJECT}`;
this.axios.get(url).then((response) => {
for (let i = 0; i < response.data.length; i++) {
let project = response.data[i];
if (project.version) {
this.availableParents.push({value: project.uuid, text: project.name + ' : ' + project.version});
} else {
this.availableParents.push({value: project.uuid, text: project.name});
}
if (this.project.parent && this.project.parent.uuid === project.uuid ) {
this.selectedParent = project.uuid;
}
}
}).catch((error) => {
this.$toastr.w(this.$t('condition.unsuccessful_action'));
});
},
resetValues: function () {
this.project = {};
this.tag = "";
this.tags = [];
this.selectedParent = null;
this.availableParents = [{ value: null, text: ''}]
this.retrieveParents();
}
}
}
Expand Down
51 changes: 2 additions & 49 deletions src/views/portfolio/projects/ProjectDetailsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
v-model="project.classifier" :options="availableClassifiers"
:label="$t('message.classifier')" :tooltip="$t('message.component_classifier_desc')"
:readonly="this.isNotPermitted(PERMISSIONS.PORTFOLIO_MANAGEMENT)" />
<b-input-group-form-select id="project-parent-input" required="false"
v-model="selectedParent" :options="availableParents"
:label="$t('message.parent')" :readonly="this.isNotPermitted(PERMISSIONS.PORTFOLIO_MANAGEMENT)" />
<b-form-group
id="project-description-form-group"
:label="this.$t('message.description')"
Expand All @@ -36,9 +33,7 @@
style="max-width:none; background-color:transparent;"
:readonly="this.isNotPermitted(PERMISSIONS.PORTFOLIO_MANAGEMENT)" />
</b-form-group>
<c-switch id="input-5" class="mx-1" color="primary" v-model="project.active" label
:disabled="this.isNotPermitted(PERMISSIONS.PORTFOLIO_MANAGEMENT) || (project.active && this.hasActiveChild(project))" v-bind="labelIcon"
v-b-tooltip.hover :title="$t('message.inactive_active_children')"/> {{$t('message.active')}}
<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')}}
<p></p>
<b-input-group-form-input id="project-uuid" input-group-size="mb-3" type="text" v-model="project.uuid"
lazy="false" required="false" feedback="false" autofocus="false" disabled="true"
Expand Down Expand Up @@ -104,8 +99,7 @@
cSwitch
},
props: {
project: Object,
uuid: String
project: Object
},
data() {
return {
Expand All @@ -121,10 +115,6 @@
{ value: 'FIRMWARE', text: this.$i18n.t('message.component_firmware') },
{ value: 'FILE', text: this.$i18n.t('message.component_file') }
],
selectedParent: null,
availableParents: [
{ value: null, text: ''}
],
tag: '', // The contents of a tag as its being typed into the vue-tag-input
tags: [], // An array of tags bound to the vue-tag-input
addOnKeys: [9, 13, 32, ':', ';', ','], // Separators used when typing tags into the vue-tag-input
Expand All @@ -138,9 +128,6 @@
this.readOnlyProjectName = this.project.name;
this.readOnlyProjectVersion = this.project.version;
},
mounted() {
this.retrieveParents();
},
methods: {
initializeTags: function() {
this.tags = (this.project.tags || []).map(tag => ({ text: tag.name }));
Expand All @@ -164,7 +151,6 @@
version: this.project.version,
description: this.project.description,
classifier: this.project.classifier,
parent: {uuid: this.selectedParent},
cpe: this.project.cpe,
purl: this.project.purl,
swidTagId: this.project.swidTagId,
Expand All @@ -188,39 +174,6 @@
}).catch((error) => {
this.$toastr.w(this.$t('condition.unsuccessful_action'));
});
},
retrieveParents: function() {
let url = `${this.$api.BASE_URL}/${this.$api.URL_PROJECT}/withoutDescendantsOf/${this.$props.uuid}`;
this.axios.get(url).then((response) => {
for (let i = 0; i < response.data.length; i++) {
let project = response.data[i];
if (project.uuid !== this.project.uuid){
if (project.version){
this.availableParents.push({value: project.uuid, text: project.name + ' : ' + project.version});
} else {
this.availableParents.push({value: project.uuid, text: project.name});
}
}
if (this.project.parent && this.project.parent.uuid === project.uuid ) {
this.selectedParent = project.uuid;
}
}
}).catch((error) => {
this.$toastr.w(this.$t('condition.unsuccessful_action'));
});
},
hasActiveChild: function (project) {
let bool = false;
if (project.children){
for (const child of project.children){
if (child.active || bool){
return true;
} else {
bool = this.hasActiveChild(child);
}
}
}
return bool;
}
}
}
Expand Down
Loading