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

only start agent when not running #277

Merged
merged 1 commit into from
Aug 12, 2023
Merged
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
13 changes: 8 additions & 5 deletions OpenFlow/src/public/Controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7893,11 +7893,11 @@ export class AgentCtrl extends entityCtrl<any> {
async processData(): Promise<void> {
if (this.model.stripeprice == null) this.model.stripeprice = "";
if ( this.model.schedules == null) this.model.schedules = [];
if(this.model.packageid != null && this.model.packageid != ""){
var p = this.allpackages.find(x=>x._id == this.model.packageid)
this.model.packageid = "";
if(this.model.package != null && this.model.package != ""){
var p = this.allpackages.find(x=>x._id == this.model.package)
delete this.model.package;
if(p != null) {
this.model.schedules.push({"_id": this.model.packageid, "name": this.model.packagename, "cron": "", "enabled": true})
this.model.schedules.push({"packageid": p._id, "name": p.name, "cron": "", "enabled": true, "env": {}})
}
}
this.searchtext = this.model.runasname
Expand Down Expand Up @@ -8223,6 +8223,7 @@ export class AgentCtrl extends entityCtrl<any> {
packageid: this.newpackage._id,
enabled: true,
cron,
"env": {}
})
}
removepackage(schedule) {
Expand Down Expand Up @@ -8274,7 +8275,9 @@ export class AgentCtrl extends entityCtrl<any> {
}
if (this.model._id) {
await NoderedUtil.UpdateOne({ collectionname: this.collection, item: this.model });
await NoderedUtil.CustomCommand({ command: "startagent", id: this.model._id, name: this.model.slug })
if(this.instances.length == 0 && this.model.image != null && this.model.image != "") {
await NoderedUtil.CustomCommand({ command: "startagent", id: this.model._id, name: this.model.slug })
}
} else {
var tmp = await NoderedUtil.InsertOne({ collectionname: this.collection, item: this.model });
if (this.model) {
Expand Down
Loading