added upload helper for referrer token

This commit is contained in:
Jon Lambson 2017-11-06 16:05:04 -07:00
parent 8d4337d091
commit ab43fefc49
2 changed files with 26 additions and 13 deletions

View File

@ -129,6 +129,7 @@ app.controller('websiteCtrl', [
}; };
vm.setDomain = function () { vm.setDomain = function () {
debugger;
if (!vm.domains || !vm.domains.length) { if (!vm.domains || !vm.domains.length) {
vm.domain = { domain: vm.newDomain }; vm.domain = { domain: vm.newDomain };
return; return;
@ -176,6 +177,16 @@ app.controller('websiteCtrl', [
}); });
}; };
vm.setRecordDomain = function(domain) {
vm.domain.sub = vm.newRecord || '';
if (vm.record !== undefined) {
debugger;
domain.title = vm.record.host;
domain.description.domain = vm.record.host;
domain.originalObject.domain = vm.record.host;
}
};
vm.setRecord = function () { vm.setRecord = function () {
// TODO set record based on (record.host === sub + domain.domain) // TODO set record based on (record.host === sub + domain.domain)
var sub = vm.newRecord; var sub = vm.newRecord;
@ -260,7 +271,10 @@ app.controller('websiteCtrl', [
var path = vm.breadcrumbsPath.join('/'); var path = vm.breadcrumbsPath.join('/');
cleanPathQuery(path); cleanPathQuery(path);
vm.Sites.contents(vm.copyR, vm.cleanedPath); vm.Sites.contents(vm.copyR, vm.cleanedPath);
} else {
$location.url($location.path());
} }
}); });
}; };
@ -293,7 +307,6 @@ app.controller('websiteCtrl', [
if (!vm.currentHost) { if (!vm.currentHost) {
vm.setRecord(); vm.setRecord();
} }
debugger;
if (vm.domain) { if (vm.domain) {
if (!vm.domain.tld || !vm.domain.sld) { if (!vm.domain.tld || !vm.domain.sld) {
@ -303,6 +316,7 @@ app.controller('websiteCtrl', [
} else { } else {
sld = vm.domain.sld; sld = vm.domain.sld;
tld = vm.domain.tld; tld = vm.domain.tld;
sub = vm.domain.sub;
} }
} else { } else {
parts = vm.currentHost.split('.'); parts = vm.currentHost.split('.');
@ -311,7 +325,6 @@ app.controller('websiteCtrl', [
sld = parts.pop(); sld = parts.pop();
sub = parts.join('.'); sub = parts.join('.');
} }
if (vm.sites.some(function (r) { if (vm.sites.some(function (r) {
return (-1 !== ('.' + vm.currentHost).indexOf(('.' + r.domain))) && domainIsVerified(r); return (-1 !== ('.' + vm.currentHost).indexOf(('.' + r.domain))) && domainIsVerified(r);
})) { })) {
@ -323,7 +336,7 @@ app.controller('websiteCtrl', [
// (because two users could both claim a single domain) // (because two users could both claim a single domain)
// We're claiming it at the top level (i.e. example.com) // We're claiming it at the top level (i.e. example.com)
// but we could also claim it at the subdomain level (needs UI update) // but we could also claim it at the subdomain level (needs UI update)
var domainReq = { sld: sld, tld: tld, sub: undefined }; var domainReq = { sld: sld, tld: tld, sub: sub };
return pkg.request(domainReq).then(function (result) { return pkg.request(domainReq).then(function (result) {
var sess; var sess;
var prom; var prom;
@ -757,19 +770,15 @@ app.controller('websiteCtrl', [
// console.log(els); // console.log(els);
if (vm.referrerSelectedDomain) { if (vm.referrerSelectedDomain) {
Object.keys(els).forEach(function (key) { Object.keys(els).forEach(function (key) {
console.log(key);
console.log(els[key])
if (els[key]['domain'] === vm.referrerSelectedDomainName) { if (els[key]['domain'] === vm.referrerSelectedDomainName) {
// vm.domains = els[key]; $scope.domain = [];
vm.domains = []; $scope.domain.push(els[key]);
$scope.domain = vm.domains;
} }
}) })
} else {
vm.domains = els; vm.domains = els;
$scope.domain = vm.domains; $scope.domain = vm.domains;
} }
vm.domains = els;
$scope.domain = vm.domains;
}); });
vm.listSites(); vm.listSites();
@ -829,7 +838,11 @@ app.controller('websiteCtrl', [
$scope.$watch('vm.selectedDomain', function (domainSelected) { $scope.$watch('vm.selectedDomain', function (domainSelected) {
if (domainSelected !== undefined) { if (domainSelected !== undefined) {
vm.dom = domainSelected; vm.dom = domainSelected;
vm.selectDomain(vm.selectedDomain.description); if (domainSelected.description === undefined) {
vm.selectDomain(domainSelected);
} else {
vm.selectDomain(vm.selectedDomain.description);
}
} }
}); });

View File

@ -43,7 +43,7 @@
</div> </div>
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control" placeholder="www" ng-model="vm.newRecord" ng-change="vm.setRecord()" /> <input type="text" class="form-control" placeholder="www" ng-model="vm.newRecord" ng-change="vm.setRecord()" ng-blur="vm.setRecordDomain(vm.selectedDomain)" />
<div class="input-group-btn"> <div class="input-group-btn">
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span>
@ -58,7 +58,7 @@
<div class="input-group"> <div class="input-group">
<div> <div>
<label>Select .zip upload</label> <label>Select .zip upload</label>
<input type="file" ng-model="vm.newFile" class="form-control" daplie-file-change="vm.Sites.setUpload(vm.dom)" /> <input type="file" ng-model="vm.newFile" class="form-control" daplie-file-change="vm.Sites.setUpload(vm.domain)" />
</div> </div>
<div ng-if="vm.isZip" > <div ng-if="vm.isZip" >
<label> <label>