walnut_launchpad.html/js/controllers/website-controller.js

46 lines
1.2 KiB
JavaScript
Raw Normal View History

app.controller('websiteCtrl', [
'$scope', 'azp@oauth3.org',
function ($scope, Oauth3) {
2017-08-14 19:45:19 +00:00
var vm = this;
2017-08-08 06:35:11 +00:00
2017-08-14 19:45:19 +00:00
vm.oauth3 = Oauth3.oauth3;
vm.getDomains = function () {
vm.oauth3.api('domains.list', {}).then(function (result) {
vm.domains = result.registrations || result;
});
};
vm.selectDomain = function (domain) {
vm.domain = domain;
return vm.oauth3.api('dns.list', { }).then(function (records) {
records = records.filter(function (r) {
return /^A(AAA)?$/i.test(r.type) && ((r.sld + '.' + r.tld) === domain || r.zone === domain.domain);
});
vm.records = records;
console.log('records');
console.log(records);
});
};
vm.selectRecord = function (record) {
vm.record = record;
vm.currentHost = record.host; // .replace(new RegExp('\\.' + vm.domain.domain.replace(/\./g, '\\.') + '$', ''));
};
vm.setFiles = function (files) {
console.log('setFiles');
console.log(files);
console.log(vm.newFiles);
};
vm.createWebsite = function () {
var fd = new window.FormData();
var pkg = vm.oauth3.pkg('www@daplie.com');
return pkg.add({ hostname: vm.currentHost, multipart: { site: vm.currentFiles[0] } });
};
//vm.getDomains();
2017-08-08 20:54:25 +00:00
}]);