Last active
June 21, 2018 21:40
-
-
Save xirdneh/2b4f62125525ef65e9293d10b8e4070b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import template from './../../templates/components/push-keys.modal.html'; | |
class SystemPushKeysController { | |
constructor(SystemsService){ | |
this.SystemsService = SystemsService; | |
this.form = {}; | |
this.ui = {}; | |
//this.ok.bind(this); | |
} | |
ok(){ | |
this.ui.loading = true; | |
this.SystemsService.pushKeys( | |
this.resolve.sys.id, | |
this.form | |
). | |
then((resp)=>{ | |
this.ui.error = false; | |
this.ui.message = "Public Key added successfully"; | |
return; | |
}, (err)=>{ | |
this.ui.error = true; | |
this.ui.message = err.data.message; | |
}). | |
finally(()=>{ | |
this.ui.loading = false; | |
if ( !this.ui.error ){ | |
this.close({ | |
$value: { | |
sys: this.sys, | |
form: this.form | |
} | |
}); | |
} | |
}); | |
} | |
cancel(){ | |
this.dismiss({$value:'cancel'}); | |
} | |
$onInit(){ | |
this.form = { | |
password: '', | |
token: '', | |
hostname: this.resolve.sys.storage.host, | |
name: this.resolve.sys.name | |
}; | |
} | |
} | |
SystemPushKeysController.$inject = [ | |
'SystemsService' | |
]; | |
const systemPushKeysModal = { | |
template: template, | |
bindings: { | |
resolve: '<', | |
close: '&', | |
dismiss: '&' | |
}, | |
controller: SystemPushKeysController, | |
}; | |
export default systemPushKeysModal; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.openPushPublicKeyForm = ()=>{ | |
$scope.browser.ui.pushKeyModalOpening = true; | |
SystemsService.get(options.system) | |
.then((sys)=>{ | |
return $uibModal.open({ | |
component: 'SystemPushKeysModal', | |
resolve: { | |
sys: ()=>{ | |
return sys; | |
}, | |
}, | |
}).result; | |
}, (err)=>{ | |
$scope.browser.error.message = err.data; | |
$scope.browser.error.status = err.status; | |
}).then(()=>{ | |
$scope.browser = DataBrowserService.state(); | |
$scope.browser.error = null; | |
$scope.browser.ui.message.class = 'alert-success'; | |
$scope.browser.ui.message.show = true; | |
$scope.browser.ui.message.content = 'Public key pushed ' + | |
'successfully. Please click on My Data again'; | |
}).finally(()=>{ | |
$scope.browser.ui.pushKeyModalOpening = false; | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import angular from 'angular'; | |
import SystemPushKeysModal from './systems/push-keys.modal.js'; | |
let mod = angular.module('portal.workbench.components', []); | |
mod.component('systemPushKeysModal', SystemPushKeysModal); | |
export default mod; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment