Skip to content

Commit

Permalink
Merge pull request #537 from mehab/feature/addglobalAuthentication
Browse files Browse the repository at this point in the history
added changes to ui to support authentication for repositories regardless of whether they are for internal packages or not
  • Loading branch information
nscuro authored Nov 14, 2023
2 parents 1ef5405 + fa607ce commit 6bd3a46
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@
"create_repository": "Create Repository",
"repository_type": "Repository Type",
"internal": "Internal",
"repository_authentication": "Authentication required",
"delete_repository": "Delete Repository",
"repository_created": "Repository created",
"repository_deleted": "Repository deleted",
Expand Down
30 changes: 26 additions & 4 deletions src/views/administration/repositories/Repositories.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ import RepositoryCreateRepositoryModal from "./RepositoryCreateRepositoryModal";
return value === true ? '<i class="fa fa-check-square-o" />' : "";
},
},
{
title: this.$t('admin.repository_authentication'),
field: "authenticationRequired",
class: "tight",
sortable: true,
formatter(value, row, index) {
return value === true ? '<i class="fa fa-check-square-o" />' : "";
},
},
{
title: this.$t('admin.enabled'),
field: "enabled",
Expand Down Expand Up @@ -134,22 +143,28 @@ import RepositoryCreateRepositoryModal from "./RepositoryCreateRepositoryModal";
<div>
<c-switch color="primary" v-model="internal" label v-bind="labelIcon" />{{$t('admin.internal')}}
</div>
<div>
<c-switch color="primary" v-model="authenticationRequired" label v-bind="labelIcon" />{{$t('admin.repository_authentication')}}
</div>
<div>
<b-validated-input-group-form-input
id="username" :label="$t('admin.username')"
input-group-size="mb-3"
v-model="username"
v-show="internal"
rules="required"
v-show="authenticationRequired"
v-debounce:750ms="updateRepository" :debounce-events="'keyup'"/>
</div>
<div>
<b-validated-input-group-form-input
id="password" :label="$t('admin.password')"
input-group-size="mb-3"
type="password"
v-model="password"
v-show="internal"
rules="required"
v-show="authenticationRequired"
v-debounce:750ms="updateRepository" :debounce-events="'keyup'"/>
</div>
Expand All @@ -173,8 +188,9 @@ import RepositoryCreateRepositoryModal from "./RepositoryCreateRepositoryModal";
identifier: row.identifier,
url: row.url,
internal: row.internal,
authenticationRequired: row.authenticationRequired,
username: row.username,
password: row.password || null,
password: row.password || "HiddenDecryptedPropertyPlaceholder",
enabled: row.enabled,
uuid: row.uuid,
labelIcon: {
Expand All @@ -189,7 +205,12 @@ import RepositoryCreateRepositoryModal from "./RepositoryCreateRepositoryModal";
},
enabled() {
this.updateRepository();
},
authenticationRequired(){
this.updateRepository();
}
},
methods: {
deleteRepository: function() {
Expand All @@ -207,8 +228,9 @@ import RepositoryCreateRepositoryModal from "./RepositoryCreateRepositoryModal";
identifier: this.identifier,
url: this.url,
internal: this.internal,
authenticationRequired: this.authenticationRequired,
username: this.username,
password: this.password || null,
password: this.password || "HiddenDecryptedPropertyPlaceholder",
enabled: this.enabled,
uuid: this.uuid
}).then((response) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,30 @@
<b-input-group-form-select id="input-repository-type" required="true"
v-model="repositoryType" :options="repositoryTypes"
:label="$t('admin.repository_type')" />

<div>
<c-switch color="primary" v-model="internal" label v-bind="labelIcon" />{{$t('admin.internal')}}
</div>
<div>
<c-switch color="primary" v-model="internal" label v-bind="labelIcon" />{{$t('admin.internal')}}
<c-switch color="primary" v-model="repository_authentication" label v-bind="labelIcon" />{{$t('admin.repository_authentication')}}
</div>

<b-validated-input-group-form-input
<b-validated-input-group-form-input
id="username"
:label="$t('admin.username')"
input-group-size="mb-3"
v-model="username"
v-show="internal"
rules="required"
v-show="repository_authentication"
/>

<b-validated-input-group-form-input
id="password"
:label="$t('admin.password')"
input-group-size="mb-3"
type="password"
rules="required"
v-model="password"
v-show="internal"
v-show="repository_authentication"
/>

<div>
Expand Down Expand Up @@ -74,6 +80,7 @@ import BValidatedInputGroupFormInput from "../../../forms/BValidatedInputGroupFo
repositoryType: null,
initialRepositoryType: null,
internal: false,
repository_authentication: false,
username: null,
password: null,
enabled: true,
Expand Down Expand Up @@ -103,6 +110,7 @@ import BValidatedInputGroupFormInput from "../../../forms/BValidatedInputGroupFo
identifier: this.identifier,
url: this.url,
internal: this.internal,
authenticationRequired: this.repository_authentication,
username: this.username,
password: this.password || null,
enabled: this.enabled
Expand All @@ -124,6 +132,7 @@ import BValidatedInputGroupFormInput from "../../../forms/BValidatedInputGroupFo
this.username = null;
this.password = null;
this.enabled = true;
this.repository_authentication = false;
}
}
}
Expand Down

0 comments on commit 6bd3a46

Please sign in to comment.