Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add team selection in create project button #975

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
2 changes: 2 additions & 0 deletions src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"component_spdx_license_desc": "Gibt die SPDX-Lizenz-ID der Komponente an",
"component_supplier_name_desc": "Die Organisation, die die Komponente geliefert hat",
"component_swid_tagid_desc": "Die vom Softwareanbieter bereitgestellte ISO/IEC 19770-2:2015 (SWID)-Tag-ID",
"component_team_desc": "Wählen Sie das diesem Projekt zugewiesene Team aus",
"component_updated": "Komponente aktualisiert",
"component_version_desc": "Die vom Lieferanten bereitgestellte Version der Komponente",
"component_vulnerabilities": "Schwachstellen in Komponenten",
Expand Down Expand Up @@ -804,6 +805,7 @@
"tag_name": "Verlinke den Namen",
"tag_unassigned_successfully": "Tag-Zuweisung erfolgreich aufgehoben",
"tags": "Stichworte",
"team": "Team",
"template": "Vorlage",
"text_search": "Textsuche",
"title": "Titel",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"component_spdx_license_desc": "Specifies the SPDX license ID of the component",
"component_supplier_name_desc": "The organization that supplied the component",
"component_swid_tagid_desc": "The ISO/IEC 19770-2:2015 (SWID) tag ID provided by the software vendor",
"component_team_desc": "Select the team assigned to this project",
"component_updated": "Component updated",
"component_version_desc": "The version of the component as provided by the supplier",
"component_vulnerabilities": "Component Vulnerabilities",
Expand Down Expand Up @@ -804,6 +805,7 @@
"tag_name": "Tag Name",
"tag_unassigned_successfully": "Untagged successfully",
"tags": "Tags",
"team": "Team",
"template": "Template",
"text_search": "Text Search",
"title": "Title",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"component_spdx_license_desc": "Especifica el ID de licencia SPDX del componente.",
"component_supplier_name_desc": "La organización que suministró el componente.",
"component_swid_tagid_desc": "El ID de etiqueta ISO/IEC 19770-2:2015 (SWID) proporcionado por el proveedor de software",
"component_team_desc": "Seleccione el equipo asignado a este proyecto",
"component_updated": "Componente actualizado",
"component_version_desc": "La versión del componente proporcionada por el proveedor.",
"component_vulnerabilities": "Vulnerabilidades de los componentes",
Expand Down Expand Up @@ -804,6 +805,7 @@
"tag_name": "Nombre de etiqueta",
"tag_unassigned_successfully": "Sin etiquetar con éxito",
"tags": "Etiquetas",
"team": "Equipo",
"template": "Plantilla",
"text_search": "Búsqueda de texto",
"title": "Título",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"component_spdx_license_desc": "Spécifie l'ID de licence SPDX du composant",
"component_supplier_name_desc": "L'organisation qui a fourni le composant",
"component_swid_tagid_desc": "L'ID de balise ISO/IEC 19770-2:2015 (SWID) fourni par l'éditeur du logiciel",
"component_team_desc": "Sélectionnez l'équipe affectée à ce projet",
"component_updated": "Composant mis à jour",
"component_version_desc": "La version du composant telle que fournie par le fournisseur",
"component_vulnerabilities": "Vulnérabilités des composants",
Expand Down Expand Up @@ -804,6 +805,7 @@
"tag_name": "Nom de la tag",
"tag_unassigned_successfully": "Détaché avec succès",
"tags": "Tags",
"team": "Équipe",
"template": "Modèle",
"text_search": "Recherche de texte",
"title": "Titre",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"component_spdx_license_desc": "घटक की SPDX लाइसेंस आईडी निर्दिष्ट करता है",
"component_supplier_name_desc": "वह संगठन जिसने घटक की आपूर्ति की",
"component_swid_tagid_desc": "सॉफ़्टवेयर विक्रेता द्वारा प्रदान की गई ISO/IEC 19770-2:2015 (SWID) टैग आईडी",
"component_team_desc": "इस प्रोजेक्ट के लिए सौंपी गई टीम का चयन करें",
"component_updated": "घटक अद्यतन",
"component_version_desc": "आपूर्तिकर्ता द्वारा प्रदान किया गया घटक का संस्करण",
"component_vulnerabilities": "घटक कमज़ोरियाँ",
Expand Down Expand Up @@ -804,6 +805,7 @@
"tag_name": "टैग नाम",
"tag_unassigned_successfully": "सफलतापूर्वक अनटैग किया गया",
"tags": "टैग",
"team": "टीम",
"template": "खाका",
"text_search": "पाठ्य खोज",
"title": "शीर्षक",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"component_spdx_license_desc": "Specifica l'ID della licenza SPDX del componente",
"component_supplier_name_desc": "L'organizzazione che ha fornito il componente",
"component_swid_tagid_desc": "L'ID tag ISO/IEC 19770-2:2015 (SWID) fornito dal fornitore del software",
"component_team_desc": "Seleziona il team assegnato a questo progetto",
"component_updated": "Componente aggiornato",
"component_version_desc": "La versione del componente fornita dal fornitore",
"component_vulnerabilities": "Vulnerabilità dei componenti",
Expand Down Expand Up @@ -804,6 +805,7 @@
"tag_name": "Nome dell'etichetta",
"tag_unassigned_successfully": "Deselezionato con successo",
"tags": "Tag",
"team": "Squadra",
"template": "Modello",
"text_search": "Ricerca di testo",
"title": "Titolo",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"component_spdx_license_desc": "コンポーネントのSPDXライセンスIDを指定します",
"component_supplier_name_desc": "コンポーネントを供給した組織",
"component_swid_tagid_desc": "ソフトウェアベンダーが提供するISO/IEC 19770-2:2015(SWID)タグID",
"component_team_desc": "このプロジェクトに割り当てられたチームを選択してください",
"component_updated": "コンポーネントが更新されました",
"component_version_desc": "サプライヤーが提供するコンポーネントのバージョン",
"component_vulnerabilities": "コンポーネントの脆弱性",
Expand Down Expand Up @@ -804,6 +805,7 @@
"tag_name": "タグ名",
"tag_unassigned_successfully": "タグが正常に解除されました",
"tags": "タグ",
"team": "チーム",
"template": "テンプレート",
"text_search": "テキスト検索",
"title": "タイトル",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"component_spdx_license_desc": "Określa identyfikator licencji SPDX komponentu",
"component_supplier_name_desc": "Organizacja, która dostarczyła komponent",
"component_swid_tagid_desc": "Identyfikator znacznika ISO/IEC 19770-2:2015 (SWID) dostarczony przez dostawcę oprogramowania",
"component_team_desc": "Wybierz zespół przypisany do tego projektu",
"component_updated": "Komponent zaktualizowany",
"component_version_desc": "Wersja komponentu dostarczona przez dostawcę",
"component_vulnerabilities": "Luki w komponentach",
Expand Down Expand Up @@ -804,6 +805,7 @@
"tag_name": "Nazwa znacznika",
"tag_unassigned_successfully": "Pomyślnie nieoznaczono",
"tags": "Tagi",
"team": "Zespół",
"template": "Szablon",
"text_search": "Wyszukiwanie tekstu",
"title": "Tytuł",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"component_spdx_license_desc": "Especifica o ID de licença SPDX do componente",
"component_supplier_name_desc": "A organização que forneceu o componente",
"component_swid_tagid_desc": "O ID da etiqueta ISO/IEC 19770-2:2015 (SWID) fornecido pelo fornecedor do software",
"component_team_desc": "Selecione a equipe atribuída a este projeto",
"component_updated": "Componente atualizado",
"component_version_desc": "A versão do componente conforme fornecida pelo fornecedor",
"component_vulnerabilities": "Vulnerabilidades de componentes",
Expand Down Expand Up @@ -804,6 +805,7 @@
"tag_name": "Nome da etiqueta",
"tag_unassigned_successfully": "Não marcado com sucesso",
"tags": "Tag",
"team": "Equipe",
"template": "Modelo",
"text_search": "Pesquisa de texto",
"title": "Título",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"component_spdx_license_desc": "Especifica o ID de licença SPDX do componente",
"component_supplier_name_desc": "A organização que forneceu o componente",
"component_swid_tagid_desc": "O ID da etiqueta ISO/IEC 19770-2:2015 (SWID) fornecido pelo fornecedor do software",
"component_team_desc": "Selecione a equipe atribuída a este projeto",
"component_updated": "Componente atualizado",
"component_version_desc": "A versão do componente conforme fornecida pelo fornecedor",
"component_vulnerabilities": "Vulnerabilidades de componentes",
Expand Down Expand Up @@ -804,6 +805,7 @@
"tag_name": "Nome da etiqueta",
"tag_unassigned_successfully": "Não marcado com sucesso",
"tags": "Tag",
"team": "Equipe",
"template": "Modelo",
"text_search": "Pesquisa de texto",
"title": "Título",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"component_spdx_license_desc": "Указывает идентификатор лицензии SPDX компонента.",
"component_supplier_name_desc": "Организация, поставившая компонент",
"component_swid_tagid_desc": "Идентификатор тега ISO/IEC 19770-2:2015 (SWID), предоставленный поставщиком программного обеспечения.",
"component_team_desc": "Выберите команду, назначенную на этот проект",
"component_updated": "Компонент обновлен",
"component_version_desc": "Версия компонента, предоставленная поставщиком.",
"component_vulnerabilities": "Уязвимости компонентов",
Expand Down Expand Up @@ -804,6 +805,7 @@
"tag_name": "Название тэга",
"tag_unassigned_successfully": "Отметка успешно снята",
"tags": "Теги",
"team": "Команда",
"template": "Шаблон",
"text_search": "Текстовый поиск",
"title": "Заголовок",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/uk-UA.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"component_spdx_license_desc": "Визначає ідентифікатор ліцензії SPDX компонента",
"component_supplier_name_desc": "Організація, яка поставила компонент",
"component_swid_tagid_desc": "Ідентифікатор тегу ISO/IEC 19770-2:2015 (SWID), наданий постачальником програмного забезпечення",
"component_team_desc": "Виберіть команду, призначену для цього проекту",
"component_updated": "Компонент оновлений",
"component_version_desc": "Версія компонента, надана постачальником",
"component_vulnerabilities": "Уразливості компонентів",
Expand Down Expand Up @@ -804,6 +805,7 @@
"tag_name": "Назва тегу",
"tag_unassigned_successfully": "Теги успішно видалено",
"tags": "Теги",
"team": "Команда",
"template": "Шаблон",
"text_search": "Текстовий пошук",
"title": "Назва",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"component_spdx_license_desc": "指定组件的 SPDX 许可证 ID",
"component_supplier_name_desc": "供应组件的组织",
"component_swid_tagid_desc": "软件供应商提供的 ISO/IEC 19770-2:2015 (SWID) 标签 ID",
"component_team_desc": "选择分配给该项目的团队",
"component_updated": "组件已更新",
"component_version_desc": "供应商提供的组件版本",
"component_vulnerabilities": "组件漏洞",
Expand Down Expand Up @@ -804,6 +805,7 @@
"tag_name": "标签名",
"tag_unassigned_successfully": "成功取消标记",
"tags": "标签",
"team": "团队",
"template": "模板",
"text_search": "文本搜索",
"title": "标题",
Expand Down
51 changes: 50 additions & 1 deletion src/views/portfolio/projects/ProjectCreateProjectModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@
:label="$t('message.classifier')"
:tooltip="$t('message.component_classifier_desc')"
/>
<b-input-group-form-select
id="v-team-input"
:required="requiresTeam"
v-model="project.team"
:options="availableTeams"
:label="$t('message.team')"
:tooltip="$t('message.component_team_desc')"
:disabled="isDisabled"
/>
<div style="margin-bottom: 1rem">
<label>Parent</label>
<multiselect
Expand Down Expand Up @@ -214,6 +223,8 @@ export default {
},
data() {
return {
requiresTeam: true,
isDisabled: false,
readOnlyProjectName: '',
readOnlyProjectVersion: '',
availableClassifiers: [
Expand All @@ -238,11 +249,13 @@ export default {
{ value: 'FIRMWARE', text: this.$i18n.t('message.component_firmware') },
{ value: 'FILE', text: this.$i18n.t('message.component_file') },
],
availableTeams: [],
selectableLicenses: [],
selectedLicense: '',
selectedParent: null,
availableParents: [],
project: {},
project: { team: [] },
teams: [],
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
tagsAutoCompleteItems: [],
Expand All @@ -255,6 +268,11 @@ export default {
isLoading: false,
};
},
created() {
this.getACLEnabled().then(() => {
this.getAvailableTeams();
});
},
beforeUpdate() {
if (this.tags.length === 0 && this.project && this.project.tags) {
// Prevents line from being executed when entering new tags
Expand All @@ -281,6 +299,29 @@ export default {
tag: 'searchTags',
},
methods: {
async getACLEnabled() {
let url = `${this.$api.BASE_URL}/${this.$api.URL_CONFIG_PROPERTY}/public/access-management/acl.enabled`;
let response = await this.axios.get(url);
this.requiresTeam = response.data.propertyValue.toString();
},
async getAvailableTeams() {
let url = `${this.$api.BASE_URL}/${this.$api.URL_TEAM}/visible`;
let response = await this.axios.get(url);
console.log(response.data);
let convertedTeams = response.data.map((team) => {
console.log(team.uuid);
return { text: team.name, value: team.uuid };
});
this.availableTeams = convertedTeams;
this.teams = response.data;
if (this.requiresTeam && this.availableTeams.length == 1) {
this.project.team = teams[0][0].value;
this.isDisabled = true;
}
this.availableTeams.sort(function (a, b) {
return a.text.localeCompare(b.text);
});
},
syncReadOnlyNameField: function (value) {
this.readOnlyProjectName = value;
},
Expand All @@ -290,6 +331,13 @@ export default {
createProject: function () {
let url = `${this.$api.BASE_URL}/${this.$api.URL_PROJECT}`;
let tagsNode = [];
let choosenTeams = this.teams.filter((team) => {
return this.project.team.includes(team.uuid);
});
let choosenTeamswithoutAPIKeys = choosenTeams.map((team) => {
team.apiKeys = [];
return team;
});
let parent = null;
if (this.selectedParent) {
parent = { uuid: this.selectedParent.uuid };
Expand All @@ -304,6 +352,7 @@ export default {
//license: this.selectedLicense,
parent: parent,
classifier: this.project.classifier,
accessTeams: choosenTeamswithoutAPIKeys,
purl: this.project.purl,
cpe: this.project.cpe,
swidTagId: this.project.swidTagId,
Expand Down
Loading