Commit 40182746 authored by efikalti's avatar efikalti
Browse files

check app running before stopping instance

parent 9d428bcd
......@@ -30,13 +30,20 @@ export default Ember.Component.extend({
return false;
}
var _this = this;
//send request to stop instance
apps.forEach(function(item) {
if (item.get("started"))
if (this.get('check_apps'))
{
_this.set("app_started", true);
apps.forEach(function(item) {
if (item.get("started"))
{
_this.set("app_started", true);
}
});
}
});
else (this.get("started_app"))
{
this.set("app_started", true);
}
//send request to stop instance
if (this.get("app_started")){
if (confirm("There is a deployed application currently running on this lambda-instance.\nAre you sure you want to stop this lambda instance?")) {
instance.set('lambda_instance_id', this.get("instance-id"));
......
......@@ -19,7 +19,7 @@ var LambdaInstance = DS.Model.extend({
status_detail: DS.attr(), // status detail of lambda instance
status_failure_message: DS.attr(), // failure message
applications: DS.hasMany('lambda-app'), // deployed applications
started_app: DS.attr('boolean'), // is specific app started?
running_app: DS.attr('boolean'), // is specific app started?
kafka_topics: DS.attr() // kafka topics of lambda instance
});
......
......@@ -8,7 +8,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
this._super(transition);
this.store.unloadAll('instance-action');
this.store.unloadAll('lambda-instance');
this.store.unloadAll('lambda-app');
},
model: function(params) {
......@@ -19,7 +18,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
var hash = {
instances: this.store.findAll('lambda-instance', params, { reload: true }),
apps: this.store.peekAll('lambda-app'),
};
if (this.store.peekAll('instance-action').get('length') === 0) {
hash.instance_action = this.store.createRecord('instance-action', {});
......@@ -31,7 +29,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
setupController: function(controller, model) {
controller.set('content', model.instances);
controller.set('instance_action', model.instance_action);
controller.set('apps', model.apps);
},
deactivate: function () {
......
......@@ -79,7 +79,7 @@
{{#tool-tip}}
{{#if (compare model.instance.status_code '==' '0')}}
{{instance-action start=true disabled=true status_message=model.instance.status_message}}
{{instance-action apps=model.apps stop=true instance=model.instance_action failure=failure instance-id=model.instance.id request=request message=message action="start_stop"}}
{{instance-action apps=model.apps check_apps=true stop=true instance=model.instance_action failure=failure instance-id=model.instance.id request=request message=message action="start_stop"}}
{{else if (compare model.instance.status_code '==' '1')}}
{{instance-action stop=true disabled=true status_message=model.instance.status_message}}
{{instance-action start=true instance=model.instance_action instance-id=model.instance.id failure=failure request=request message=message action="start_stop"}}
......
......@@ -136,7 +136,7 @@
</td>
{{/tool-tip}}
<td>
{{instance-action apps=apps xs=true stop=true instance=instance_action failure=failure instance-id=lambda-instance.id request=request message=message action="start_stop"}}
{{instance-action apps=apps xs=true stop=true started_app=lambda-instance.running_app instance=instance_action failure=failure instance-id=lambda-instance.id request=request message=message action="start_stop"}}
</td>
<td>
{{#link-to "deploy-app-2" lambda-instance.id}}
......@@ -153,7 +153,7 @@
</td>
{{/tool-tip}}
<td>
{{instance-action start=true xs=true instance=instance_action instance-id=lambda-instance.id failure=failure request=request message=message action="start_stop"}}
{{instance-action start=true xs=true check_apps=false instance=instance_action instance-id=lambda-instance.id failure=failure request=request message=message action="start_stop"}}
</td>
<td>
{{#tool-tip}}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment