Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1051)

Unified Diff: appengine/monorail/static/js/framework/project-name-check.js

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/monorail/static/js/framework/project-name-check.js
diff --git a/appengine/monorail/static/js/framework/project-name-check.js b/appengine/monorail/static/js/framework/project-name-check.js
new file mode 100644
index 0000000000000000000000000000000000000000..8e3981d45f8ebc418dab81ce81d15483830a110e
--- /dev/null
+++ b/appengine/monorail/static/js/framework/project-name-check.js
@@ -0,0 +1,42 @@
+/* Copyright 2016 The Chromium Authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style
+ * license that can be found in the LICENSE file or at
+ * https://developers.google.com/open-source/licenses/bsd
+ */
+
+/**
+ * @fileoverview Functions that support project name checks when
+ * creating a new project.
+ */
+
+/**
+ * Function that communicates with the server.
+ * @param {string} projectName The proposed project name.
+ */
+function checkProjectName(projectName) {
+ var createProjectUrl = '/hosting/createProject/checkProjectName.do';
+ var args = {
+ 'project': projectName
+ };
+ CS_doPost(createProjectUrl, nameTaken, args);
+}
+
+/**
+ * Function that evaluates the server response and sets the error message.
+ * @param {event} event with xhr server's JSON response to the AJAX request.
+ */
+function nameTaken(event) {
+ var xhr = event.target;
+ if (xhr.readyState != 4 || xhr.status != 200)
+ return;
+ var resp = CS_parseJSON(xhr);
+ var errorMessage = resp['error_message'];
+ document.getElementById('projectnamefeedback').innerText = errorMessage;
+ if (errorMessage != '') {
+ document.getElementById('submit_btn').disabled = 'disabled';
+ }
+}
+
+// Make this function globally available
+_CP_checkProjectName = checkProjectName;
« no previous file with comments | « appengine/monorail/static/js/framework/framework-stars.js ('k') | appengine/monorail/static/js/graveyard/common.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698