Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nodecg-io-core/dashboard/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const spanPasswordNotice = document.getElementById("spanPasswordNotice") as HTML

// Add key listener to password input
inputPassword?.addEventListener("keyup", function (event) {
if (event.keyCode === 13) {
if (event.keyCode === 13 || event.key === "Enter") {
event.preventDefault();
loadFramework();
}
Expand Down
9 changes: 8 additions & 1 deletion nodecg-io-core/dashboard/serviceInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export async function deleteInstance(): Promise<void> {

// Create button
export async function createInstance(): Promise<void> {
showError(undefined);
const service = selectService.options[selectService.options.selectedIndex].value;
const name = inputInstanceName.value;

Expand All @@ -154,7 +155,13 @@ export async function createInstance(): Promise<void> {
instanceName: name,
};

await sendAuthenticatedMessage("createServiceInstance", msg);
try {
await sendAuthenticatedMessage("createServiceInstance", msg);
} catch (e) {
showError(e);
return;
}

// Give the browser some time to create the new instance select option and to add them to the DOM
setTimeout(() => {
selectServiceInstance(name);
Expand Down
4 changes: 4 additions & 0 deletions nodecg-io-core/extension/instanceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ export class InstanceManager extends EventEmitter {
* @return void if everything went fine and a string describing the issue if not
*/
createServiceInstance(serviceType: string, instanceName: string): Result<void> {
if (!instanceName) {
return error("Instance name must not be empty.");
}

// Check if a instance with the same name already exists.
if (this.serviceInstances[instanceName] !== undefined) {
return error("A service instance with the same name already exists.");
Expand Down