mirror of
https://github.com/google/nomulus.git
synced 2025-06-26 22:34:55 +02:00
Delete admin console
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=116894352
This commit is contained in:
parent
6772b2ef80
commit
f2116093b1
33 changed files with 2 additions and 2912 deletions
|
@ -1,20 +0,0 @@
|
|||
package(default_visibility = ["//java/com/google/domain/registry:registry_project"])
|
||||
|
||||
load("//third_party/closure/compiler:closure_js_library.bzl", "closure_js_library")
|
||||
|
||||
|
||||
filegroup(
|
||||
name = "js_files",
|
||||
srcs = glob(["*.js"]),
|
||||
)
|
||||
|
||||
closure_js_library(
|
||||
name = "admin",
|
||||
srcs = [":js_files"],
|
||||
deps = [
|
||||
"//java/com/google/domain/registry/ui/js",
|
||||
"//java/com/google/domain/registry/ui/soy/admin:Registrar",
|
||||
"//java/com/google/domain/registry/ui/soy/admin:Registry",
|
||||
"//javascript/closure",
|
||||
],
|
||||
)
|
|
@ -1,62 +0,0 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
goog.provide('registry.admin.Console');
|
||||
|
||||
goog.require('registry.Console');
|
||||
goog.require('registry.admin.Registrar');
|
||||
goog.require('registry.admin.Registry');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Admin Console.
|
||||
* @param {string} xsrfToken Populated by server-side soy template.
|
||||
* @constructor
|
||||
* @extends {registry.Console}
|
||||
* @final
|
||||
*/
|
||||
registry.admin.Console = function(xsrfToken) {
|
||||
registry.admin.Console.base(this, 'constructor', null);
|
||||
|
||||
/** @type {string} */
|
||||
this.xsrfToken = xsrfToken;
|
||||
|
||||
// XXX: Parent carries session but currently unused. Just using this class to
|
||||
// get history, butter, etc.
|
||||
// XXX: This was in parent ctor but was triggering event dispatching before
|
||||
// ready here.
|
||||
this.history.setEnabled(true);
|
||||
};
|
||||
goog.inherits(registry.admin.Console, registry.Console);
|
||||
|
||||
|
||||
/** @override */
|
||||
registry.admin.Console.prototype.handleHashChange = function() {
|
||||
var hashToken = this.history.getToken();
|
||||
var collection = hashToken.split('/');
|
||||
var id = null;
|
||||
// XXX: Should be generalized to deeper paths?
|
||||
if (collection.length == 2) {
|
||||
id = collection[1];
|
||||
}
|
||||
// Either the path is a registrar type, or default to registry.
|
||||
if (collection[0] == 'registrar') {
|
||||
new registry.admin.Registrar(
|
||||
this, this.xsrfToken, id).bindToDom(hashToken);
|
||||
} else {
|
||||
new registry.admin.Registry(
|
||||
this, this.xsrfToken, id).bindToDom(hashToken);
|
||||
}
|
||||
};
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview Entry point for Admin Console.
|
||||
*/
|
||||
|
||||
goog.provide('registry.admin.main');
|
||||
|
||||
goog.require('registry.admin.Console');
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a registry object, which syncs with the server.
|
||||
* Sub-templates are invoked based on location/pathname, to choose
|
||||
* either Registry or Registrar pages.
|
||||
* @param {string} xsrfToken populated by server-side soy template.
|
||||
* @export
|
||||
*/
|
||||
registry.admin.main = function(xsrfToken) {
|
||||
new registry.admin.Console(xsrfToken);
|
||||
};
|
|
@ -1,136 +0,0 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
goog.provide('registry.admin.Registrar');
|
||||
|
||||
goog.require('goog.Uri');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('goog.soy');
|
||||
goog.require('registry.Resource');
|
||||
goog.require('registry.ResourceComponent');
|
||||
goog.require('registry.soy.admin.registrar');
|
||||
goog.require('registry.util');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Registrar class represents server state for registrars and
|
||||
* binds UI CRUD operations on them.
|
||||
* @param {!registry.Console} console console singleton.
|
||||
* @param {string} xsrfToken Security token to pass back to the server.
|
||||
* @param {?string} registrarName Optional target registrar name.
|
||||
* @constructor
|
||||
* @extends {registry.ResourceComponent}
|
||||
* @final
|
||||
*/
|
||||
registry.admin.Registrar = function(console, xsrfToken, registrarName) {
|
||||
registry.admin.Registrar.base(
|
||||
this, 'constructor',
|
||||
console,
|
||||
new registry.Resource(
|
||||
new goog.Uri('/_dr/admin/registrar' +
|
||||
(registrarName ? ('/' + registrarName) : '')),
|
||||
xsrfToken),
|
||||
registry.soy.admin.registrar.registrar,
|
||||
goog.bind(this.renderSet, this));
|
||||
};
|
||||
goog.inherits(registry.admin.Registrar, registry.ResourceComponent);
|
||||
|
||||
|
||||
/**
|
||||
* Show the list of registrars.
|
||||
* @param {!Element} parentElt In which to render this template.
|
||||
* @param {!Object} rspObj Result object from server to show.
|
||||
*/
|
||||
registry.admin.Registrar.prototype.renderSet = function(parentElt, rspObj) {
|
||||
goog.soy.renderElement(parentElt,
|
||||
registry.soy.admin.registrar.registrars,
|
||||
rspObj);
|
||||
goog.events.listen(goog.dom.getElement('create-button'),
|
||||
goog.events.EventType.CLICK,
|
||||
goog.bind(this.sendCreate, this));
|
||||
};
|
||||
|
||||
|
||||
/** @override */
|
||||
registry.admin.Registrar.prototype.renderItem = function(objArgs) {
|
||||
goog.soy.renderElement(goog.dom.getRequiredElement('reg-content'),
|
||||
this.itemTmpl,
|
||||
{
|
||||
item: objArgs,
|
||||
readonly: objArgs.readonly
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/** @override */
|
||||
registry.admin.Registrar.prototype.sendCreate = function() {
|
||||
var args = registry.util.parseForm('create');
|
||||
this.resource.create(args,
|
||||
goog.bind(this.handleUpdateResponse, this),
|
||||
args['clientIdentifier']);
|
||||
};
|
||||
|
||||
|
||||
/** @override */
|
||||
registry.admin.Registrar.prototype.setupEditor = function(objArgs) {
|
||||
goog.events.listen(goog.dom.getRequiredElement('add-contact-button'),
|
||||
goog.events.EventType.CLICK,
|
||||
goog.bind(this.addContactInputForm_, this));
|
||||
var childNodes = goog.dom.getChildren(
|
||||
goog.dom.getRequiredElement('contacts'));
|
||||
for (var i = 0; i < childNodes.length; i++) {
|
||||
this.enableRemoveButton(childNodes[i]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** @override */
|
||||
registry.admin.Registrar.prototype.prepareUpdate = function(modelCopy) {
|
||||
var form = registry.util.parseForm('item');
|
||||
for (var ndx in form) {
|
||||
modelCopy[ndx] = form[ndx];
|
||||
}
|
||||
var apply = function(obj, ndx, func) {
|
||||
if (goog.isDefAndNotNull(obj[ndx])) {
|
||||
obj[ndx] = func(obj[ndx]);
|
||||
}
|
||||
};
|
||||
var splitter = function(val) {
|
||||
return val.split(',');
|
||||
};
|
||||
apply(modelCopy, 'billingIdentifier', parseInt);
|
||||
apply(modelCopy, 'ianaIdentifier', parseInt);
|
||||
apply(modelCopy, 'allowedTlds', splitter);
|
||||
apply(modelCopy, 'ipAddressWhitelist', splitter);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Add a contact input entry form to the page.
|
||||
* @private
|
||||
*/
|
||||
registry.admin.Registrar.prototype.addContactInputForm_ = function() {
|
||||
var contactsContainer =
|
||||
goog.dom.getRequiredElement('contacts');
|
||||
var childCount = contactsContainer.childNodes.length;
|
||||
var newContactDiv = goog.soy.renderAsElement(
|
||||
registry.soy.admin.registrar.contactInfo, {
|
||||
namePrefix: 'contacts[' + childCount + '].'
|
||||
});
|
||||
goog.dom.appendChild(contactsContainer, newContactDiv);
|
||||
this.enableRemoveButton(newContactDiv);
|
||||
};
|
|
@ -1,139 +0,0 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
goog.provide('registry.admin.Registry');
|
||||
|
||||
goog.require('goog.Uri');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('goog.soy');
|
||||
goog.require('registry.Resource');
|
||||
goog.require('registry.ResourceComponent');
|
||||
goog.require('registry.soy.admin.registry');
|
||||
goog.require('registry.util');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Registry class respresents server state for registries and
|
||||
* binds UI CRUD operations on them.
|
||||
* @param {!registry.Console} console console singleton.
|
||||
* @param {string} xsrfToken Security token to pass back to the server.
|
||||
* @param {?string} tld Optional target target tld.
|
||||
* @constructor
|
||||
* @extends {registry.ResourceComponent}
|
||||
* @final
|
||||
*/
|
||||
registry.admin.Registry = function(console, xsrfToken, tld) {
|
||||
// XXX: A couple of these args for not complete yet..
|
||||
registry.admin.Registry.base(
|
||||
this, 'constructor',
|
||||
console,
|
||||
new registry.Resource(
|
||||
new goog.Uri('/_dr/admin/registry' + (tld ? ('/' + tld) : '')),
|
||||
xsrfToken),
|
||||
registry.soy.admin.registry.registry,
|
||||
goog.bind(this.renderSet, this));
|
||||
};
|
||||
goog.inherits(registry.admin.Registry, registry.ResourceComponent);
|
||||
|
||||
|
||||
/** @override */
|
||||
registry.admin.Registry.prototype.renderItem = function(objArgs) {
|
||||
goog.soy.renderElement(goog.dom.getRequiredElement('reg-content'),
|
||||
this.itemTmpl,
|
||||
{
|
||||
item: objArgs,
|
||||
readonly: objArgs.readonly
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/** @override */
|
||||
registry.admin.Registry.prototype.processItem = function() {
|
||||
// XXX: Server response syntax should be improved.
|
||||
var tldStateTransitions = this.model['tldStateTransitions'];
|
||||
if (tldStateTransitions) {
|
||||
var transArr = tldStateTransitions.split(',');
|
||||
tldStateTransitions = '';
|
||||
for (var i = 0; i < transArr.length; i++) {
|
||||
var trans = transArr[i];
|
||||
var parts = trans.split('=');
|
||||
var dateTime = parts[0].replace(/[ {}]/, '');
|
||||
// XXX: ACTUALLY improve parsing with server response syntax.
|
||||
if (parts.length == 1) {
|
||||
registry.util.butter('pmy needs to fix this CL');
|
||||
continue;
|
||||
}
|
||||
var state = parts[1].replace(/[ {}]/, '');
|
||||
tldStateTransitions += state + ',' + dateTime;
|
||||
if (i < transArr.length - 1) {
|
||||
tldStateTransitions += ';';
|
||||
}
|
||||
}
|
||||
this.model['tldStateTransitions'] = tldStateTransitions;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {!Element} parentElt In which to render this template.
|
||||
* @param {!Object} rspObj Result object from server to show.
|
||||
*/
|
||||
registry.admin.Registry.prototype.renderSet = function(parentElt, rspObj) {
|
||||
goog.soy.renderElement(parentElt,
|
||||
registry.soy.admin.registry.registries,
|
||||
rspObj);
|
||||
goog.events.listen(goog.dom.getElement('create-button'),
|
||||
goog.events.EventType.CLICK,
|
||||
goog.bind(this.sendCreate, this));
|
||||
};
|
||||
|
||||
|
||||
/** @override */
|
||||
registry.admin.Registry.prototype.sendCreate = function() {
|
||||
var args = registry.util.parseForm('create');
|
||||
this.resource.create(args,
|
||||
goog.bind(this.handleUpdateResponse, this),
|
||||
args['newTldName']);
|
||||
};
|
||||
|
||||
|
||||
/** @override */
|
||||
registry.admin.Registry.prototype.prepareUpdate = function(modelCopy) {
|
||||
var form = registry.util.parseForm('item');
|
||||
for (var ndx in form) {
|
||||
modelCopy[ndx] = form[ndx];
|
||||
}
|
||||
var apply = function(obj, ndx, func) {
|
||||
if (obj[ndx]) {
|
||||
obj[ndx] = func(obj[ndx]);
|
||||
}
|
||||
};
|
||||
var parseStateTransitions = function(s) {
|
||||
var transitions = s.split(';');
|
||||
var transArr = [];
|
||||
for (var i = 0; i < transitions.length; i++) {
|
||||
var trans = transitions[i];
|
||||
var parts = trans.split(',');
|
||||
var args = {};
|
||||
args['tldState'] = parts[0];
|
||||
args['transitionTime'] = parts[1];
|
||||
transArr.push(args);
|
||||
}
|
||||
return transArr;
|
||||
};
|
||||
apply(modelCopy, 'tldStateTransitions', parseStateTransitions);
|
||||
};
|
|
@ -38,8 +38,6 @@ goog.require('registry.util');
|
|||
* |-ui/js/resource_component.js - JSON resources
|
||||
* | ^
|
||||
* | \
|
||||
* | |- ui/js/admin/registrar.js
|
||||
* | |- ui/js/admin/registry.js
|
||||
* | |- ui/js/registrar/settings.js
|
||||
* |
|
||||
* |-ui/js/registrar/xml_resource_component.js - EPP resources
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue