Skip to content

Commit

Permalink
Merge pull request #52 from ansibleguy76/release/v3.0.5
Browse files Browse the repository at this point in the history
v3.0.5 into main
  • Loading branch information
ansibleguy76 authored Jul 6, 2022
2 parents 162117e + e685013 commit 93aba0c
Show file tree
Hide file tree
Showing 23 changed files with 521 additions and 42 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.0.5] - 2022-07-06

### Added

- Add object-like default value for dropdowns
- Add email notifications
- Allow custom git user/email per repo

### Fixed

- Allow selfsigned certificates in mailserver
- Auto qdd repo hosts to known_hosts + add gui for manually

## [3.0.4] - 2022-06-09

### Fixed
Expand Down Expand Up @@ -284,7 +297,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Allow change password for current local user
- Start tracking versions

[Unreleased]: https://github.com/ansibleguy76/ansibleforms/compare/3.0.4...HEAD
[Unreleased]: https://github.com/ansibleguy76/ansibleforms/compare/3.0.5...HEAD

[3.0.5]: https://github.com/ansibleguy76/ansibleforms/compare/3.0.4...3.0.5

[3.0.4]: https://github.com/ansibleguy76/ansibleforms/compare/3.0.3...3.0.4

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
![]( wiki/screenshot_forms.jpg)
[More screenshots](https://github.com/ansibleguy76/ansibleforms/wiki/GUI)
[More screenshots](https://github.com/ansibleguy76/ansibleforms/wiki/2.-GUI)
# Intro
Ansible forms is a lightweight node.js webapplication to generate userfriendly and pretty forms to kickoff ansible playbooks or awx (ansible tower) templates.

Expand All @@ -23,6 +23,9 @@ Ansible forms is a lightweight node.js webapplication to generate userfriendly a
- Json web tokens authorization (jwt) (access & refresh)
- Environment variables
- Ldap & local authentication
- Job History & Log
- Approval points
- Multistep forms

# How to install and run in docker
## Use docker compose (recommended)
Expand Down
4 changes: 2 additions & 2 deletions app_versions.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ext.version_code = 030004
ext.version_name = "3.0.4"
ext.version_code = 30005
ext.version_name = "3.0.5"
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ansible_forms_vue",
"version": "3.0.4",
"version": "3.0.5",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
55 changes: 47 additions & 8 deletions client/src/components/BulmaAdvancedTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@
}
},
methods:{
objectEqual(object1,object2){
const keys1 = Object.keys(object1);
const keys2 = Object.keys(object2);
for (let key of keys1) {
if (object1[key] !== object2[key]) {
return false;
}
}
return true;
},
highlightFilter(v,label=undefined){
var s=v+""
var cols=[]
Expand Down Expand Up @@ -305,17 +315,46 @@
this.select(i)
})
}else if(this.defaultValue!="__none__" && this.defaultValue!=undefined){ // if a regular default is set, we select it
this.values.forEach((item,i) => {
var obj
var defaulttype
try{
obj = JSON.parse(this.defaultValue)
if(typeof obj == "object"){
defaulttype="object"
}
}catch(e){
// bad default value
}
if(defaulttype=="object"){
// we search for the value by property
if(obj){
// loop all values
this.values.forEach((item,i) => {
try{
if(this.objectEqual(obj,item)){
this.select(i)
}
}catch(e){
console.log("Bad defaultvalue : " + e)
}
})
}
}else{
// we search for the value by string
this.values.forEach((item,i) => {
if(item && ref.defaultValue==(item[ref.valueLabel]||item)){
this.select(i)
}
if(ref.multiple && Array.isArray(ref.defaultValue)){
if(item && ref.default.includes(item[ref.valueLabel]||item||false)){
if(item && ref.defaultValue==(item[ref.valueLabel]||item)){
this.select(i)
}
}
})
if(ref.multiple && Array.isArray(ref.defaultValue)){
if(item && ref.default.includes(item[ref.valueLabel]||item||false)){
this.select(i)
}
}
})
}
}else{
this.recalc()
}
Expand Down
3 changes: 1 addition & 2 deletions client/src/views/Credentials.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
</div>
</nav>
<div class="columns">
<div class="column">
<div class="column" v-if="credentialList && credentialList.length>0">
<BulmaAdminTable
v-if="credentialList && credentialList.length>0"
:dataList="credentialList"
:labels="['Name','User','Host']"
:columns="['name','user','host']"
Expand Down
3 changes: 1 addition & 2 deletions client/src/views/Groups.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
</div>
</nav>
<div class="columns">
<div class="column">
<div class="column" v-if="groupList && groupList.length>0">
<BulmaAdminTable
v-if="groupList && groupList.length>0"
:dataList="groupList.map(x => ({...x,allowdelete:(x.id!=1 && !hasUsers(x.id))}))"
:labels="['Name']"
:columns="['name']"
Expand Down
71 changes: 60 additions & 11 deletions client/src/views/Repos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<nav class="level">
<!-- Left side -->
<div class="level-left">
<p class="level-item"><BulmaButton icon="plus" label="New Repo" @click="repoItem=-1;loadRepo()"></BulmaButton></p>
<p class="level-item"><BulmaButton icon="plus" label="New Repo" @click="reset();loadRepo()"></BulmaButton></p>
<p class="level-item"><BulmaButton icon="server" label="Add known hosts" @click="reset();known_hosts=1"></BulmaButton></p>
</div>
</nav>
<div class="columns">
<div class="column">
<div class="column" v-if="repoList && repoList.length>0">
<BulmaAdminTable
v-if="repoList && repoList.length>0"
:dataList="repoList"
:labels="['Name']"
:columns="['']"
Expand All @@ -25,17 +25,25 @@
/>
</div>
<transition name="add-column" appear>
<div class="column is-two-thirds" v-if="repoItem!==undefined && !showDelete">
<div class="column is-two-thirds" v-if="repoItem!==undefined && known_hosts!==1 && !showDelete">
<div v-if="repoStatus || loading" class="box is-family-monospace enable-line-break is-size-7">
<span v-if="loading" class="icon"><font-awesome-icon icon="spinner" spin /></span>
<div v-html="repoStatus"></div>
</div>
<BulmaCheckbox v-if="!repoStatus && !loading" checktype="checkbox" v-model="repo.isAdvanced" label="Advanced" />
<BulmaInput v-if="!repoStatus && !loading && !repo.isAdvanced" :icon="['fab','git-square']" v-model="repo.uri" label="Repository Uri" placeholder="[email protected]:myrepo" :required="true" :hasError="$v.repo.uri.$invalid" :errors="[]" />
<BulmaInput v-if="!repoStatus && !loading && repo.isAdvanced" :icon="['fab','git-square']" v-model="repo.command" label="Repository Clone Command" placeholder="git clone --quite --verbose [email protected]:myrepo" :required="true" :hasError="$v.repo.command.$invalid" :errors="[]" />
<BulmaInput v-if="!repoStatus && !loading" icon="user" v-model="repo.username" label="Repository Username" placeholder="Ansibleforms" :required="true" :hasError="$v.repo.username.$invalid" :errors="[]" />
<BulmaInput v-if="!repoStatus && !loading" icon="envelope" v-model="repo.email" label="Repository Email" placeholder="[email protected]" :required="true" :hasError="$v.repo.email.$invalid" :errors="[]" />
<BulmaButton v-if="repoItem==-1 && !loading" icon="save" label="Create Repository" @click="newRepo()"></BulmaButton>
</div>
</transition>
<transition name="add-column" appear>
<div class="column is-two-thirds" v-if="known_hosts==1 && !showDelete">
<BulmaInput icon="server" v-model="hosts" label="Known hosts" placeholder="github.com,bitbucket.com" :required="true" :hasError="$v.hosts.$invalid" :errors="[]" />
<BulmaButton v-if="known_hosts==1 && !loading" icon="server" label="Add to known hosts" @click="addKnownHosts()"></BulmaButton>
</div>
</transition>
</div>
</div>
</section>
Expand Down Expand Up @@ -67,10 +75,14 @@
repo:{
uri:"",
isAdvanced:false,
command:""
command:"",
username:"Ansibleforms",
email:"[email protected]"
},
showDelete:false,
repoItem:undefined,
known_hosts:undefined,
hosts:"",
repoList:[],
alert:{
timeout:undefined,
Expand All @@ -97,6 +109,14 @@
ref.$toast.error(error.message);
};
},
reset(){
this.repoItem=-1
this.known_hosts=-1
this.repo.uri=""
this.repo.command=""
this.repo.username="Ansibleforms"
this.repo.email="[email protected]"
},
selectItem(value){
this.repoItem=value
this.loadRepo()
Expand Down Expand Up @@ -124,9 +144,7 @@
};
}else{
console.log("No item selected")
this.repo = {
name:""
}
this.reset()
this.repoStatus=undefined
}
},deleteRepo(){
Expand All @@ -153,7 +171,7 @@
if(result.data.status=="error"){
ref.$toast.error(result.data.message + ", " + result.data.data.error);
}else{
ref.repo.uri=""
ref.reset()
ref.$toast.success("Created repository");
ref.loadAll();
}
Expand All @@ -162,7 +180,29 @@
ref.$toast.error(error.message);
};
}
},showAlert(type,message){
},
addKnownHosts(){
var ref= this;
if (!this.$v.hosts.$invalid) {
this.loading=true
axios.post('/api/v1/repo/known_hosts',{hosts:this.hosts},TokenStorage.getAuthentication())
.then((result)=>{
ref.loading=false
if(result.data.status=="error"){
ref.$toast.error(result.data.message + ", " + result.data.data.error);
}else{
ref.hosts=""
ref.reset()
ref.$toast.success("Added keys of hosts\n"+result.data.data.output.replaceAll('\n\n','\n'));
ref.loadAll();
}
}),function(error){
ref.loading=false
ref.$toast.error(error.message);
};
}
}
,showAlert(type,message){
var ref=this;
this.alert.message=message;
if(type){
Expand All @@ -186,8 +226,17 @@
return repo.isAdvanced
}),
gitclone
},
email:{
required,
email
},
username:{
required
}
},
hosts:{
required
}
},
mounted() { // when the Vue app is booted up, this is run automatically.
Expand Down
3 changes: 1 addition & 2 deletions client/src/views/Users.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
</div>
</nav>
<div class="columns">
<div class="column">
<div class="column" v-if="userList && userList.length>0 && groupList && groupList.length>0">
<BulmaAdminTable
v-if="userList && userList.length>0 && groupList && groupList.length>0"
:dataList="userList.map(x => ({...x,allowselect:(x.id!=1),allowdelete:(x.id!=1),group:groupName(x.group_id)}))"
:labels="['Name','Group']"
:columns="['username','group']"
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ansible_forms",
"version": "3.0.4",
"version": "3.0.5",
"repository": {
"type": "git",
"url": "git://github.com/ansibleguy76/ansibleforms.git"
Expand Down
50 changes: 50 additions & 0 deletions server/schema/forms_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,31 @@
"type": "string",
"pattern": "^has-background-.+"
},
"notifications":{
"type": "object",
"properties": {
"on": {
"type": "array",
"items": {
"type": "string",
"default": ""
}
},
"recipients": {
"type": "array",
"items": {
"type": "string",
"default": "",
"pattern": "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
}
}
},
"additionalProperties": false,
"required": [
"recipients",
"on"
]
},
"categories": {
"type": "array",
"default": ["Default"],
Expand Down Expand Up @@ -218,6 +243,31 @@
"diff": {"type": "boolean"},
"continue": {"type": "boolean"},
"always": {"type": "boolean"},
"notifications":{
"type": "object",
"properties": {
"on": {
"type": "array",
"items": {
"type": "string",
"default": ""
}
},
"recipients": {
"type": "array",
"items": {
"type": "string",
"default": "",
"pattern": "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
}
}
},
"additionalProperties": false,
"required": [
"recipients",
"on"
]
},
"approval": {
"$id": "/approval",
"type": "object",
Expand Down
Loading

0 comments on commit 93aba0c

Please sign in to comment.