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 () {
debugger;
if (!vm.domains || !vm.domains.length) {
vm.domain = { domain: vm.newDomain };
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 () {
// TODO set record based on (record.host === sub + domain.domain)
var sub = vm.newRecord;
@ -260,7 +271,10 @@ app.controller('websiteCtrl', [
var path = vm.breadcrumbsPath.join('/');
cleanPathQuery(path);
vm.Sites.contents(vm.copyR, vm.cleanedPath);
} else {
$location.url($location.path());
}
});
};
@ -293,7 +307,6 @@ app.controller('websiteCtrl', [
if (!vm.currentHost) {
vm.setRecord();
}
debugger;
if (vm.domain) {
if (!vm.domain.tld || !vm.domain.sld) {
@ -303,6 +316,7 @@ app.controller('websiteCtrl', [
} else {
sld = vm.domain.sld;
tld = vm.domain.tld;
sub = vm.domain.sub;
}
} else {
parts = vm.currentHost.split('.');
@ -311,7 +325,6 @@ app.controller('websiteCtrl', [
sld = parts.pop();
sub = parts.join('.');
}
if (vm.sites.some(function (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)
// 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)
var domainReq = { sld: sld, tld: tld, sub: undefined };
var domainReq = { sld: sld, tld: tld, sub: sub };
return pkg.request(domainReq).then(function (result) {
var sess;
var prom;
@ -757,19 +770,15 @@ app.controller('websiteCtrl', [
// console.log(els);
if (vm.referrerSelectedDomain) {
Object.keys(els).forEach(function (key) {
console.log(key);
console.log(els[key])
if (els[key]['domain'] === vm.referrerSelectedDomainName) {
// vm.domains = els[key];
vm.domains = [];
$scope.domain = vm.domains;
$scope.domain = [];
$scope.domain.push(els[key]);
}
})
} else {
vm.domains = els;
$scope.domain = vm.domains;
}
vm.domains = els;
$scope.domain = vm.domains;
});
vm.listSites();
@ -829,8 +838,12 @@ app.controller('websiteCtrl', [
$scope.$watch('vm.selectedDomain', function (domainSelected) {
if (domainSelected !== undefined) {
vm.dom = domainSelected;
if (domainSelected.description === undefined) {
vm.selectDomain(domainSelected);
} else {
vm.selectDomain(vm.selectedDomain.description);
}
}
});
vm.getSharedAccess = function (access) {

View File

@ -43,7 +43,7 @@
</div>
<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="btn-group">
<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>
<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 ng-if="vm.isZip" >
<label>