mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-21 09:34:38 +00:00
Add field for image list in Secrets Repo Settings (Web UI) (#638)
- Add field for image list in Secrets Repo Settings (Web UI) Simple comma separated input field, split into images array - validate secret images in backend - trim spaces and filter empty list items Signed-off-by: 6543 <6543@obermui.de> Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
@@ -50,6 +50,13 @@
|
||||
<TextField v-model="selectedSecret.value" placeholder="Value" :lines="5" required />
|
||||
</InputField>
|
||||
|
||||
<InputField label="Available for following images">
|
||||
<TextField
|
||||
v-model="images"
|
||||
placeholder="Comma separated list of images where this secret is available, leave empty to allow all images"
|
||||
/>
|
||||
</InputField>
|
||||
|
||||
<InputField label="Available at following events">
|
||||
<CheckboxesField v-model="selectedSecret.event" :options="secretEventsOptions" />
|
||||
</InputField>
|
||||
@@ -118,6 +125,7 @@ export default defineComponent({
|
||||
const secrets = ref<Secret[]>();
|
||||
const showAddSecret = ref(false);
|
||||
const selectedSecret = ref<Partial<Secret>>({ ...emptySecret });
|
||||
const images = ref('');
|
||||
|
||||
async function loadSecrets() {
|
||||
if (!repo?.value) {
|
||||
@@ -132,6 +140,8 @@ export default defineComponent({
|
||||
throw new Error("Unexpected: Can't load repo");
|
||||
}
|
||||
|
||||
const imageList = images.value.split(',').map((s) => s.trim());
|
||||
selectedSecret.value.image = imageList.filter((s) => s !== '');
|
||||
await apiClient.createSecret(repo.value.owner, repo.value.name, selectedSecret.value);
|
||||
notifications.notify({ title: 'Secret created', type: 'success' });
|
||||
showAddSecret.value = false;
|
||||
@@ -157,6 +167,7 @@ export default defineComponent({
|
||||
secretEventsOptions,
|
||||
selectedSecret,
|
||||
secrets,
|
||||
images,
|
||||
showAddSecret,
|
||||
isSaving,
|
||||
isDeleting,
|
||||
|
Reference in New Issue
Block a user