From f58d441a899128a10d4bc2277f136e83b3c8a42b Mon Sep 17 00:00:00 2001 From: Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com> Date: Sat, 11 Mar 2023 17:55:15 -0500 Subject: [PATCH] Some renaming --- static/widgets/compiler-picker-popup.ts | 62 ++++++++++++------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/static/widgets/compiler-picker-popup.ts b/static/widgets/compiler-picker-popup.ts index 072d21b0b..2326c7ff6 100644 --- a/static/widgets/compiler-picker-popup.ts +++ b/static/widgets/compiler-picker-popup.ts @@ -35,12 +35,12 @@ import {highlight} from '../highlight'; export class CompilerPickerPopup { modal: JQuery; - modalSearch: JQuery; - modalArchitectures: JQuery; - modalCompilerTypes: JQuery; - compilersRow: JQuery; - modalCompilers: JQuery; - modalFavorites: JQuery; + searchBar: JQuery; + architectures: JQuery; + compilerTypes: JQuery; + compilersContainer: JQuery; + resultsContainer: JQuery; + favoritesContainer: JQuery; groups: {value: string; label: string}[]; options: (CompilerInfo & {$groups: string[]})[]; @@ -54,15 +54,15 @@ export class CompilerPickerPopup { constructor(private readonly compilerPicker: CompilerPicker) { this.modal = $('#compiler-picker-modal').clone(true); - this.modalSearch = this.modal.find('.compiler-search'); - this.modalArchitectures = this.modal.find('.architectures'); - this.modalCompilerTypes = this.modal.find('.compiler-types'); - this.compilersRow = this.modal.find('.compilers-row'); - this.modalCompilers = this.modal.find('.compilers'); - this.modalFavorites = this.modal.find('.favorites'); + this.searchBar = this.modal.find('.compiler-search'); + this.architectures = this.modal.find('.architectures'); + this.compilerTypes = this.modal.find('.compiler-types'); + this.compilersContainer = this.modal.find('.compilers-row'); + this.resultsContainer = this.modal.find('.compilers'); + this.favoritesContainer = this.modal.find('.favorites'); this.modal.on('shown.bs.modal', () => { - this.modalSearch[0].focus(); + this.searchBar[0].focus(); }); } @@ -81,24 +81,24 @@ export class CompilerPickerPopup { const compilers = Object.values(this.compilerPicker.compilerService.getCompilersForLang(this.langId) ?? {}); // If instructionSet is '', just label it unknown const instruction_sets = compilers.map(compiler => compiler.instructionSet || 'other'); - this.modalArchitectures.empty(); - this.modalArchitectures.append( + this.architectures.empty(); + this.architectures.append( ...unique(instruction_sets) .sort() .map(isa => `${isa}`), ); // get available compiler types const compilerTypes = compilers.map(compiler => compiler.compilerCategories ?? ['other']).flat(); - this.modalCompilerTypes.empty(); - this.modalCompilerTypes.append( + this.compilerTypes.empty(); + this.compilerTypes.append( ...unique(compilerTypes) .sort() .map(type => `${type}`), ); // search box - this.modalSearch.on('input', () => { - const query = unwrapString(this.modalSearch.val()).trim(); + this.searchBar.on('input', () => { + const query = unwrapString(this.searchBar.val()).trim(); if (query === '') { this.searchResults = undefined; } else { @@ -112,7 +112,7 @@ export class CompilerPickerPopup { }); // isa filters - $(this.modalArchitectures) + $(this.architectures) .find('.architecture') .on('click', e => { e.preventDefault(); @@ -128,7 +128,7 @@ export class CompilerPickerPopup { }); // category filters - $(this.modalCompilerTypes) + $(this.compilerTypes) .find('.compiler-type') .on('click', e => { e.preventDefault(); @@ -175,8 +175,8 @@ export class CompilerPickerPopup { } } // add the compiler entries / group headers themselves - this.modalCompilers.empty(); - this.modalFavorites.empty(); + this.resultsContainer.empty(); + this.favoritesContainer.empty(); const groupMap: Record = {}; for (const group of this.groups) { if ((groupCounts[group.value] ?? 0) > 0 || group.value == CompilerPicker.favoriteGroupName) { @@ -190,9 +190,9 @@ export class CompilerPickerPopup { `, ); if(group.value == CompilerPicker.favoriteGroupName) { - group_elem.appendTo(this.modalFavorites); + group_elem.appendTo(this.favoritesContainer); } else { - group_elem.appendTo(this.modalCompilers); + group_elem.appendTo(this.resultsContainer); } groupMap[group.value] = group_elem.find('.group'); } @@ -221,17 +221,17 @@ export class CompilerPickerPopup { } } // group header click events - this.compilersRow.find('.group').append('
⋯
'); - this.compilersRow.find('.group > .label').on('click', e => { + this.compilersContainer.find('.group').append('
⋯
'); + this.compilersContainer.find('.group > .label').on('click', e => { $(e.currentTarget).closest('.group').toggleClass('collapsed'); }); // compiler click events - this.compilersRow.find('.compiler').on('click', e => { + this.compilersContainer.find('.compiler').on('click', e => { this.compilerPicker.selectCompiler(unwrap(e.currentTarget.getAttribute("data-value"))); this.hide(); }); // favorite stars - this.compilersRow.find('.compiler .toggle-fav').on('click', e => { + this.compilersContainer.find('.compiler .toggle-fav').on('click', e => { const compilerId = unwrap($(e.currentTarget).closest('.compiler').attr('data-value')); const data = filteredCompilers.filter(c => c.id === compilerId)[0]; const isAddingNewFavorite = !data.$groups.includes(CompilerPicker.favoriteGroupName); @@ -250,8 +250,8 @@ export class CompilerPickerPopup { // reflow the compilers to get any new favorites from the compiler picker dropdown and reset filters and whatnot this.isaFilters = []; this.categoryFilters = []; - this.modalSearch.val(''); - this.modalSearch.trigger('input'); + this.searchBar.val(''); + this.searchBar.trigger('input'); this.modal.find('.architectures .active, .compiler-types .active').toggleClass('active'); this.fillCompilers(); this.modal.modal({});