Skip to content

Commit 0efaa02

Browse files
Removed console log
1 parent 652248e commit 0efaa02

File tree

3 files changed

+63
-4
lines changed

3 files changed

+63
-4
lines changed

src/views/administration/repositories/Repositories.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@
180180
});
181181
},
182182
updateRepository: function() {
183-
console.log("update");
184183
let url = `${this.$api.BASE_URL}/${this.$api.URL_REPOSITORY}`;
185184
this.axios.post(url, {
186185
identifier: this.identifier,

src/views/policy/PolicyList.vue

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import bootstrapTableMixin from "../../mixins/bootstrapTableMixin";
2828
import BInputGroupFormSelect from "../../forms/BInputGroupFormSelect";
2929
import PolicyCondition from "./PolicyCondition";
30+
import BToggleableDisplayButton from "@/views/components/BToggleableDisplayButton";
31+
import SelectProjectModal from "@/views/portfolio/projects/SelectProjectModal";
3032
3133
export default {
3234
mixins: [permissionsMixin, bootstrapTableMixin],
@@ -124,17 +126,34 @@
124126
</div>
125127
</b-form-group>
126128
<div style="text-align:right">
129+
<b-toggleable-display-button variant="outline-primary" :label="$t('admin.limit_to')"
130+
v-permission="PERMISSIONS.VIEW_PORTFOLIO" v-on:toggle="limitToVisible = !limitToVisible" />
127131
<b-button variant="outline-danger" @click="deletePolicy">{{ $t('message.delete_policy') }}</b-button>
128132
</div>
129133
</b-col>
130134
</b-row>
131-
</div>
135+
<b-row>
136+
<b-col md="6">
137+
<b-form-group v-if="limitToVisible === true" id="projectLimitsList" :label="this.$t('admin.limit_to_projects')">
138+
<div class="list-group">
139+
<span v-for="project in projects">
140+
<actionable-list-group-item :value="formatProjectLabel(project.name, project.version)" delete-icon="true" v-on:actionClicked="deleteLimiter(project.uuid)"/>
141+
</span>
142+
<actionable-list-group-item add-icon="true" v-on:actionClicked="$root.$emit('bv::show::modal', 'selectProjectModal')"/>
143+
</div>
144+
</b-form-group>
145+
</b-col>
146+
</b-row>
147+
<select-project-modal v-on:selection="updateProjectSelection"/>
148+
</div>
132149
`,
133150
mixins: [permissionsMixin],
134151
components: {
135152
ActionableListGroupItem,
136153
BInputGroupFormInput,
137154
BInputGroupFormSelect,
155+
BToggleableDisplayButton,
156+
SelectProjectModal,
138157
PolicyCondition
139158
},
140159
data() {
@@ -152,10 +171,19 @@
152171
{ value: 'INFO', text: this.$t('violation.info') },
153172
{ value: 'WARN', text: this.$t('violation.warn') },
154173
{ value: 'FAIL', text: this.$t('violation.fail') }
155-
]
174+
],
175+
projects: row.projects,
176+
limitToVisible: false
156177
}
157178
},
158179
methods: {
180+
formatProjectLabel: function(projectName, projectVersion) {
181+
if (projectName && projectVersion) {
182+
return projectName + " " + projectVersion;
183+
} else {
184+
return projectName;
185+
}
186+
},
159187
addCondition: function() {
160188
if (! this.conditions) {
161189
this.conditions = [];
@@ -204,6 +232,38 @@
204232
this.operator = policy.operator;
205233
this.violationState = policy.violationState;
206234
this.conditions = policy.policyConditions;
235+
},
236+
deleteLimiter: function(projectUuid) {
237+
let url = `${this.$api.BASE_URL}/${this.$api.URL_POLICY}/${this.policy.uuid}/project/${projectUuid}`;
238+
this.axios.delete(url).then((response) => {
239+
let p = [];
240+
for (let i=0; i<this.projects.length; i++) {
241+
if (this.projects[i].uuid !== projectUuid) {
242+
p.push(this.projects[i]);
243+
}
244+
}
245+
this.projects = p;
246+
this.$toastr.s(this.$t('message.updated'));
247+
}).catch((error) => {
248+
this.$toastr.w(this.$t('condition.unsuccessful_action'));
249+
});
250+
},
251+
updateProjectSelection: function(selections) {
252+
this.$root.$emit('bv::hide::modal', 'selectProjectModal');
253+
for (let i=0; i<selections.length; i++) {
254+
let selection = selections[i];
255+
let url = `${this.$api.BASE_URL}/${this.$api.URL_POLICY}/${this.policy.uuid}/project/${selection.uuid}`;
256+
this.axios.post(url).then((response) => {
257+
this.projects.push(selection);
258+
this.$toastr.s(this.$t('message.updated'));
259+
}).catch((error) => {
260+
if (error.response.status === 304) {
261+
//this.$toastr.w(this.$t('condition.unsuccessful_action'));
262+
} else {
263+
this.$toastr.w(this.$t('condition.unsuccessful_action'));
264+
}
265+
});
266+
}
207267
}
208268
},
209269
watch: {

src/views/portfolio/projects/ComponentDetailsModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
this.retrieveLicenses();
135135
},
136136
beforeUpdate() {
137-
console.log(this.component);
137+
//console.log(this.component);
138138
},
139139
methods: {
140140
updateComponent: function() {

0 commit comments

Comments
 (0)