Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | /* Copyright 2016 The Chromium Authors. All Rights Reserved. |
| 2 | * |
| 3 | * Use of this source code is governed by a BSD-style |
| 4 | * license that can be found in the LICENSE file or at |
| 5 | * https://developers.google.com/open-source/licenses/bsd |
| 6 | */ |
| 7 | |
| 8 | /** |
| 9 | * @fileoverview Functions that support project name checks when |
| 10 | * creating a new project. |
| 11 | */ |
| 12 | |
| 13 | /** |
| 14 | * Function that communicates with the server. |
| 15 | * @param {string} projectName The proposed project name. |
| 16 | */ |
| 17 | async function checkProjectName(projectName) { |
| 18 | const message = { |
| 19 | project_name: projectName |
| 20 | }; |
| 21 | const response = await window.prpcClient.call( |
| 22 | 'monorail.Projects', 'CheckProjectName', message); |
| 23 | if (response.error) { |
| 24 | $('projectnamefeedback').textContent = response.error; |
| 25 | $('submit_btn').disabled = 'disabled'; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | // Make this function globally available |
| 30 | _CP_checkProjectName = checkProjectName; |