From a08bc87e50d61acdbadd31f8de64685eeda5d83a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20G=C3=B3mez?= Date: Wed, 14 Oct 2020 20:20:28 -0500 Subject: [PATCH 01/11] Agregando componente de Editar grupo --- .../www/js/omegaup/components/group/Edit.vue | 196 ++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 frontend/www/js/omegaup/components/group/Edit.vue diff --git a/frontend/www/js/omegaup/components/group/Edit.vue b/frontend/www/js/omegaup/components/group/Edit.vue new file mode 100644 index 0000000000..8824ed576a --- /dev/null +++ b/frontend/www/js/omegaup/components/group/Edit.vue @@ -0,0 +1,196 @@ + + + From 74d75481e161dc24be6cfe94f19a59ac34f43e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20G=C3=B3mez?= Date: Fri, 16 Oct 2020 13:37:19 -0500 Subject: [PATCH 02/11] Agregando pruebas --- .../js/omegaup/components/group/Edit.test.ts | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 frontend/www/js/omegaup/components/group/Edit.test.ts diff --git a/frontend/www/js/omegaup/components/group/Edit.test.ts b/frontend/www/js/omegaup/components/group/Edit.test.ts new file mode 100644 index 0000000000..60e5570329 --- /dev/null +++ b/frontend/www/js/omegaup/components/group/Edit.test.ts @@ -0,0 +1,48 @@ +import { mount, shallowMount } from '@vue/test-utils'; +import expect from 'expect'; + +import T from '../../lang'; +import { omegaup } from '../../omegaup'; +import { types } from '../../api_types'; + +import group_Edit from './Edit.vue'; + +describe('Edit.vue', () => { + it('Should handle edit view with empty scoreboards and identities', () => { + const wrapper = shallowMount(group_Edit, { + propsData: { + groupAlias: 'Hello', + groupName: 'Hello omegaUp', + countries: [ + { country_id: 'MX', name: 'Mexico' }, + ], + isOrganizer: true, + initialTab: 'members', + initialIdentities: [], + initialIdentitiesCsv: [], + initialScoreboards: [], + }, + }); + + expect(wrapper.text()).toContain('some'); + }); + + it('Should handle edit view with empty scoreboards and identities', () => { + const wrapper = mount(group_Edit, { + propsData: { + groupAlias: 'Hello', + groupName: 'Hello omegaUp', + countries: [ + { country_id: 'MX', name: 'Mexico' }, + ], + isOrganizer: true, + initialTab: 'members', + initialIdentities: [], + initialIdentitiesCsv: [], + initialScoreboards: [], + }, + }); + + expect(wrapper.text()).toContain('some'); + }); +}); From 25ea4e8876ab6c353075d71031e8698bb63a2bb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20G=C3=B3mez?= Date: Thu, 22 Oct 2020 15:49:42 -0500 Subject: [PATCH 03/11] Arreglando pruebas de vue --- .../www/js/omegaup/components/group/Edit.test.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/frontend/www/js/omegaup/components/group/Edit.test.ts b/frontend/www/js/omegaup/components/group/Edit.test.ts index 60e5570329..52031608a8 100644 --- a/frontend/www/js/omegaup/components/group/Edit.test.ts +++ b/frontend/www/js/omegaup/components/group/Edit.test.ts @@ -2,8 +2,6 @@ import { mount, shallowMount } from '@vue/test-utils'; import expect from 'expect'; import T from '../../lang'; -import { omegaup } from '../../omegaup'; -import { types } from '../../api_types'; import group_Edit from './Edit.vue'; @@ -13,9 +11,7 @@ describe('Edit.vue', () => { propsData: { groupAlias: 'Hello', groupName: 'Hello omegaUp', - countries: [ - { country_id: 'MX', name: 'Mexico' }, - ], + countries: [{ country_id: 'MX', name: 'Mexico' }], isOrganizer: true, initialTab: 'members', initialIdentities: [], @@ -24,17 +20,15 @@ describe('Edit.vue', () => { }, }); - expect(wrapper.text()).toContain('some'); + expect(wrapper.text()).toContain('Hello omegaUp'); }); - it('Should handle edit view with empty scoreboards and identities', () => { + it('Should handle edit view getting the subcomponents info', () => { const wrapper = mount(group_Edit, { propsData: { groupAlias: 'Hello', groupName: 'Hello omegaUp', - countries: [ - { country_id: 'MX', name: 'Mexico' }, - ], + countries: [{ country_id: 'MX', name: 'Mexico' }], isOrganizer: true, initialTab: 'members', initialIdentities: [], @@ -43,6 +37,6 @@ describe('Edit.vue', () => { }, }); - expect(wrapper.text()).toContain('some'); + expect(wrapper.text()).toContain(T.groupEditMembers); }); }); From 578e29d134b329f307d268dcfdf6e4c3986e422d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20G=C3=B3mez?= Date: Wed, 28 Oct 2020 22:07:16 -0600 Subject: [PATCH 04/11] Aplicando correcciones --- frontend/server/src/Controllers/Group.php | 2 +- frontend/templates/en.lang | 3 ++- frontend/templates/es.lang | 3 ++- frontend/templates/group.edit.tpl | 2 +- frontend/templates/pseudo.lang | 3 ++- frontend/templates/pt.lang | 3 ++- frontend/www/js/omegaup/components/group/Edit.vue | 12 ++++++++---- frontend/www/js/omegaup/lang.en.json | 3 ++- frontend/www/js/omegaup/lang.en.ts | 3 ++- frontend/www/js/omegaup/lang.es.json | 3 ++- frontend/www/js/omegaup/lang.es.ts | 3 ++- frontend/www/js/omegaup/lang.pseudo.json | 3 ++- frontend/www/js/omegaup/lang.pseudo.ts | 3 ++- frontend/www/js/omegaup/lang.pt.json | 3 ++- frontend/www/js/omegaup/lang.pt.ts | 3 ++- 15 files changed, 34 insertions(+), 18 deletions(-) diff --git a/frontend/server/src/Controllers/Group.php b/frontend/server/src/Controllers/Group.php index eb69e935e4..8b6a411107 100644 --- a/frontend/server/src/Controllers/Group.php +++ b/frontend/server/src/Controllers/Group.php @@ -451,7 +451,7 @@ public static function getGroupEditDetailsForSmarty( 'scoreboards' => $scoreboards, ], 'title' => new \OmegaUp\TranslationString( - 'omegaupTitleGroupsEdit' + 'omegaupTitleGroupsEditDeprecated' ), ], // TODO: Replace the following line with 'entrypoint' => 'group_edit' diff --git a/frontend/templates/en.lang b/frontend/templates/en.lang index 33f61ff5ba..463da0c095 100644 --- a/frontend/templates/en.lang +++ b/frontend/templates/en.lang @@ -572,7 +572,8 @@ omegaupTitleCourseIntro = "Enter course" omegaupTitleCourseNew = "New course" omegaupTitleCourseStatistics = "Course statistics" omegaupTitleGroups = "Groups" -omegaupTitleGroupsEdit = "Edit group" +omegaupTitleGroupsEdit = "Edit group %(name)" +omegaupTitleGroupsEditDeprecated = "Edit group" omegaupTitleGroupsNew = "New group" omegaupTitleGroupsScoreboardEdit = "Edit scoreboard" omegaupTitleLatestSubmissions = "Latest submissions" diff --git a/frontend/templates/es.lang b/frontend/templates/es.lang index af18d9f92b..4945a325c1 100644 --- a/frontend/templates/es.lang +++ b/frontend/templates/es.lang @@ -572,7 +572,8 @@ omegaupTitleCourseIntro = "Entrar al curso" omegaupTitleCourseNew = "Nuevo curso" omegaupTitleCourseStatistics = "Estadisticas del curso" omegaupTitleGroups = "Grupos" -omegaupTitleGroupsEdit = "Editar grupo" +omegaupTitleGroupsEdit = "Editar grupo %(name)" +omegaupTitleGroupsEditDeprecated = "Editar grupo" omegaupTitleGroupsNew = "Nuevo grupo" omegaupTitleGroupsScoreboardEdit = "Editar scoreboard" omegaupTitleLatestSubmissions = "Últimos envíos" diff --git a/frontend/templates/group.edit.tpl b/frontend/templates/group.edit.tpl index 5943c63c5e..a273ac3aef 100644 --- a/frontend/templates/group.edit.tpl +++ b/frontend/templates/group.edit.tpl @@ -1,5 +1,5 @@ {include file='redirect.tpl' inline} -{include file='head.tpl' navbarSection='contests' headerPayload=$headerPayload htmlTitle="{#omegaupTitleGroupsEdit#}" inline} +{include file='head.tpl' navbarSection='contests' headerPayload=$headerPayload htmlTitle="{#omegaupTitleGroupsEditDeprecated#}" inline} diff --git a/frontend/templates/pseudo.lang b/frontend/templates/pseudo.lang index c25db11cee..fc446b1358 100644 --- a/frontend/templates/pseudo.lang +++ b/frontend/templates/pseudo.lang @@ -572,7 +572,8 @@ omegaupTitleCourseIntro = "(En73r c0ur53)" omegaupTitleCourseNew = "(N3w c0ur53)" omegaupTitleCourseStatistics = "(C0ur53 57a7i57ic5)" omegaupTitleGroups = "(Gr0up5)" -omegaupTitleGroupsEdit = "(Edi7 gr0up)" +omegaupTitleGroupsEdit = "(Edi7 gr0up %(name))" +omegaupTitleGroupsEditDeprecated = "(Edi7 gr0up)" omegaupTitleGroupsNew = "(N3w gr0up)" omegaupTitleGroupsScoreboardEdit = "(Edi7 5c0r3b0ard)" omegaupTitleLatestSubmissions = "(La7357 5ubmi55i0n5)" diff --git a/frontend/templates/pt.lang b/frontend/templates/pt.lang index 6968e2a107..45033bac0a 100644 --- a/frontend/templates/pt.lang +++ b/frontend/templates/pt.lang @@ -572,7 +572,8 @@ omegaupTitleCourseIntro = "Acesse o curso" omegaupTitleCourseNew = "Novo curso" omegaupTitleCourseStatistics = "Estatísticas do curso" omegaupTitleGroups = "Grupos" -omegaupTitleGroupsEdit = "Editar grupo" +omegaupTitleGroupsEdit = "Editar grupo %(name)" +omegaupTitleGroupsEditDeprecated = "Editar grupo" omegaupTitleGroupsNew = "Novo grupo" omegaupTitleGroupsScoreboardEdit = "Editar painel de avaliação" omegaupTitleLatestSubmissions = "Últimas submissões" diff --git a/frontend/www/js/omegaup/components/group/Edit.vue b/frontend/www/js/omegaup/components/group/Edit.vue index 8824ed576a..47bd46ea48 100644 --- a/frontend/www/js/omegaup/components/group/Edit.vue +++ b/frontend/www/js/omegaup/components/group/Edit.vue @@ -2,13 +2,15 @@
-
+
@@ -146,7 +150,11 @@ import T from '../../lang'; import { dao, types } from '../../api_types'; import * as ui from '../../ui'; -const availableTabs = ['memebers', 'scoreboards', 'identities']; +export enum AvailableTabs { + Members = 'memebers', + Scoreboards = 'scoreboards', + Identities = 'identities', +} @Component({ components: { @@ -160,41 +168,42 @@ export default class GroupEdit extends Vue { @Prop() groupName!: string; @Prop() countries!: dao.Countries[]; @Prop() isOrganizer!: boolean; - @Prop() initialTab!: string; - @Prop() initialIdentities!: types.Identity[]; - @Prop() initialIdentitiesCsv!: types.Identity[]; - @Prop() initialScoreboards!: types.GroupScoreboard[]; + @Prop() tab!: AvailableTabs; + @Prop() identities!: types.Identity[]; + @Prop() identitiesCsv!: types.Identity[]; + @Prop() scoreboards!: types.GroupScoreboard[]; T = T; ui = ui; - showTab = this.initialTab; - userErrorRow = null; - identities = this.initialIdentities; - identitiesCsv = this.initialIdentitiesCsv; - scoreboards = this.initialScoreboards; + AvailableTabs = AvailableTabs; + selectedTab: AvailableTabs = this.tab; + userErrorRow: string | null = null; + currentIdentities = this.identities; + currentIdentitiesCsv = this.identitiesCsv; + currentScoreboards = this.scoreboards; - @Watch('initialTab') - onInitialTabChanged(newValue: string): void { - if (!availableTabs.includes(this.initialTab)) { - this.showTab = 'members'; + @Watch('tab') + onInitialTabChanged(newValue: AvailableTabs): void { + if (!Object.values(AvailableTabs).includes(this.tab)) { + this.selectedTab = AvailableTabs.Members; return; } - this.showTab = newValue; + this.selectedTab = newValue; } - @Watch('initialIdentities') + @Watch('identities') onInitialIdentitiesChanged(newValue: types.Identity[]): void { - this.identities = newValue; + this.currentIdentities = newValue; } - @Watch('initialIdentitiesCsv') + @Watch('identitiesCsv') onInitialIdentitiesCsvChanged(newValue: types.Identity[]): void { - this.identitiesCsv = newValue; + this.currentIdentitiesCsv = newValue; } - @Watch('initialScoreboards') + @Watch('scoreboards') onInitialScoreboardsChanged(newValue: types.GroupScoreboard[]): void { - this.scoreboards = newValue; + this.currentScoreboards = newValue; } } From 7fe817d033ab312e0786649cea87c166bbc960e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20G=C3=B3mez?= Date: Thu, 26 Nov 2020 15:00:42 -0600 Subject: [PATCH 11/11] nit --- frontend/www/js/omegaup/components/group/Edit.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frontend/www/js/omegaup/components/group/Edit.vue b/frontend/www/js/omegaup/components/group/Edit.vue index 601468d7e3..a9c8f122f8 100644 --- a/frontend/www/js/omegaup/components/group/Edit.vue +++ b/frontend/www/js/omegaup/components/group/Edit.vue @@ -2,9 +2,7 @@