Skip to content

Commit

Permalink
Show/hide the 'commit message' input in the git commit modal as appro…
Browse files Browse the repository at this point in the history
…priate. Show for git repos, hide for LocalDirectory-type repos
  • Loading branch information
james-strauss-uwa committed Nov 4, 2024
1 parent a0cbd5b commit 7c2e2d2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Modals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ export class Modals {
const repositories: Repository[] = Repositories.getList(repositoryService);
$('#gitCommitModal').data('repositories', repositories);
Utils.updateGitCommitRepositoriesList(repositories, null);

// show/hide commit message input based on whether the repositoryService is git-related or not
$('#gitCommitModalCommitMessageRow').toggle(Utils.repositoryServiceIsGit(repositoryService));
});

// #gitCustomRepositoryModal - requestUserAddCustomRepository()
Expand Down
7 changes: 7 additions & 0 deletions src/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,13 @@ export class Utils {

// validate fileName input
Modals.validateCommitModalFileNameInputText();

// show/hide commit message input based on whether the repositoryService is git-related or not
$('#gitCommitModalCommitMessageRow').toggle(Utils.repositoryServiceIsGit(defaultRepositoryService));
}

static repositoryServiceIsGit(service: Repository.Service): boolean {
return service === Repository.Service.GitHub || service === Repository.Service.GitLab;
}

static requestUserEditField(eagle: Eagle, modalType: Eagle.ModalType, parameterType: Daliuge.FieldType, parameterUsage: Daliuge.FieldUsage, field: Field, choices: string[], callback: (completed: boolean, field: Field) => void) : void {
Expand Down
2 changes: 1 addition & 1 deletion templates/modals.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ <h5 class="modal-title" id="gitCommitModalTitle">Git Commit</h5>
</div>
</div>
</div>
<div class="row">
<div class="row" id="gitCommitModalCommitMessageRow">
<div class="col-3">
<p>Commit Message:</p>
</div>
Expand Down

0 comments on commit 7c2e2d2

Please sign in to comment.