Create view state files for `settings` and `admin` This is the first step of creating all view states in the directory `models/views/`. Release-Notes: skip Google-Bug-Id: b/244279450 Change-Id: I48472e41b3ff24e01d6a9e2b19e95dfb429e5186
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router.ts b/polygerrit-ui/app/elements/core/gr-router/gr-router.ts index 0e88b06..fe298702 100644 --- a/polygerrit-ui/app/elements/core/gr-router/gr-router.ts +++ b/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
@@ -61,6 +61,7 @@ LATEST_ATTEMPT, stringToAttemptChoice, } from '../../../models/checks/checks-util'; +import {AdminChildView} from '../../../models/views/admin'; const RoutePattern = { ROOT: '/', @@ -1201,7 +1202,7 @@ handleGroupListOffsetRoute(data: PageContextWithQueryMap) { this.setParams({ view: GerritView.ADMIN, - adminView: 'gr-admin-group-list', + adminView: AdminChildView.GROUPS, offset: data.params[1] || 0, filter: null, openCreateModal: data.hash === 'create', @@ -1211,7 +1212,7 @@ handleGroupListFilterOffsetRoute(data: PageContextWithQueryMap) { this.setParams({ view: GerritView.ADMIN, - adminView: 'gr-admin-group-list', + adminView: AdminChildView.GROUPS, offset: data.params['offset'], filter: data.params['filter'], }); @@ -1220,7 +1221,7 @@ handleGroupListFilterRoute(data: PageContextWithQueryMap) { this.setParams({ view: GerritView.ADMIN, - adminView: 'gr-admin-group-list', + adminView: AdminChildView.GROUPS, filter: data.params['filter'] || null, }); } @@ -1338,7 +1339,7 @@ handleRepoListOffsetRoute(data: PageContextWithQueryMap) { this.setParams({ view: GerritView.ADMIN, - adminView: 'gr-repo-list', + adminView: AdminChildView.REPOS, offset: data.params[1] || 0, filter: null, openCreateModal: data.hash === 'create', @@ -1348,7 +1349,7 @@ handleRepoListFilterOffsetRoute(data: PageContextWithQueryMap) { this.setParams({ view: GerritView.ADMIN, - adminView: 'gr-repo-list', + adminView: AdminChildView.REPOS, offset: data.params['offset'], filter: data.params['filter'], }); @@ -1357,7 +1358,7 @@ handleRepoListFilterRoute(data: PageContextWithQueryMap) { this.setParams({ view: GerritView.ADMIN, - adminView: 'gr-repo-list', + adminView: AdminChildView.REPOS, filter: data.params['filter'] || null, }); } @@ -1381,7 +1382,7 @@ handlePluginListOffsetRoute(data: PageContextWithQueryMap) { this.setParams({ view: GerritView.ADMIN, - adminView: 'gr-plugin-list', + adminView: AdminChildView.PLUGINS, offset: data.params[1] || 0, filter: null, }); @@ -1390,7 +1391,7 @@ handlePluginListFilterOffsetRoute(data: PageContextWithQueryMap) { this.setParams({ view: GerritView.ADMIN, - adminView: 'gr-plugin-list', + adminView: AdminChildView.PLUGINS, offset: data.params['offset'], filter: data.params['filter'], }); @@ -1399,7 +1400,7 @@ handlePluginListFilterRoute(data: PageContextWithQueryMap) { this.setParams({ view: GerritView.ADMIN, - adminView: 'gr-plugin-list', + adminView: AdminChildView.PLUGINS, filter: data.params['filter'] || null, }); } @@ -1407,7 +1408,7 @@ handlePluginListRoute(_: PageContextWithQueryMap) { this.setParams({ view: GerritView.ADMIN, - adminView: 'gr-plugin-list', + adminView: AdminChildView.PLUGINS, }); }
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts b/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts index 29b8e7a..1528918 100644 --- a/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts +++ b/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts
@@ -43,6 +43,7 @@ RepoDetailView, } from '../../../utils/router-util'; import {assert} from '@open-wc/testing'; +import {AdminChildView} from '../../../models/views/admin'; suite('gr-router tests', () => { let router: GrRouter; @@ -819,7 +820,7 @@ const data = createPageContext(); assertDataToParams(data, 'handleGroupListOffsetRoute', { view: GerritView.ADMIN, - adminView: 'gr-admin-group-list', + adminView: AdminChildView.GROUPS, offset: 0, filter: null, openCreateModal: false, @@ -828,7 +829,7 @@ data.params[1] = '42'; assertDataToParams(data, 'handleGroupListOffsetRoute', { view: GerritView.ADMIN, - adminView: 'gr-admin-group-list', + adminView: AdminChildView.GROUPS, offset: '42', filter: null, openCreateModal: false, @@ -837,7 +838,7 @@ data.hash = 'create'; assertDataToParams(data, 'handleGroupListOffsetRoute', { view: GerritView.ADMIN, - adminView: 'gr-admin-group-list', + adminView: AdminChildView.GROUPS, offset: '42', filter: null, openCreateModal: true, @@ -851,7 +852,7 @@ }; assertDataToParams(data, 'handleGroupListFilterOffsetRoute', { view: GerritView.ADMIN, - adminView: 'gr-admin-group-list', + adminView: AdminChildView.GROUPS, offset: '42', filter: 'foo', }); @@ -861,7 +862,7 @@ const data = {...createPageContext(), params: {filter: 'foo'}}; assertDataToParams(data, 'handleGroupListFilterRoute', { view: GerritView.ADMIN, - adminView: 'gr-admin-group-list', + adminView: AdminChildView.GROUPS, filter: 'foo', }); }); @@ -1042,7 +1043,7 @@ const data = createPageContext(); assertDataToParams(data, 'handleRepoListOffsetRoute', { view: GerritView.ADMIN, - adminView: 'gr-repo-list', + adminView: AdminChildView.REPOS, offset: 0, filter: null, openCreateModal: false, @@ -1051,7 +1052,7 @@ data.params[1] = '42'; assertDataToParams(data, 'handleRepoListOffsetRoute', { view: GerritView.ADMIN, - adminView: 'gr-repo-list', + adminView: AdminChildView.REPOS, offset: '42', filter: null, openCreateModal: false, @@ -1060,7 +1061,7 @@ data.hash = 'create'; assertDataToParams(data, 'handleRepoListOffsetRoute', { view: GerritView.ADMIN, - adminView: 'gr-repo-list', + adminView: AdminChildView.REPOS, offset: '42', filter: null, openCreateModal: true, @@ -1074,7 +1075,7 @@ }; assertDataToParams(data, 'handleRepoListFilterOffsetRoute', { view: GerritView.ADMIN, - adminView: 'gr-repo-list', + adminView: AdminChildView.REPOS, offset: '42', filter: 'foo', }); @@ -1084,14 +1085,14 @@ const data = createPageContext(); assertDataToParams(data, 'handleRepoListFilterRoute', { view: GerritView.ADMIN, - adminView: 'gr-repo-list', + adminView: AdminChildView.REPOS, filter: null, }); data.params.filter = 'foo'; assertDataToParams(data, 'handleRepoListFilterRoute', { view: GerritView.ADMIN, - adminView: 'gr-repo-list', + adminView: AdminChildView.REPOS, filter: 'foo', }); }); @@ -1103,7 +1104,7 @@ const data = createPageContext(); assertDataToParams(data, 'handlePluginListOffsetRoute', { view: GerritView.ADMIN, - adminView: 'gr-plugin-list', + adminView: AdminChildView.PLUGINS, offset: 0, filter: null, }); @@ -1111,7 +1112,7 @@ data.params[1] = '42'; assertDataToParams(data, 'handlePluginListOffsetRoute', { view: GerritView.ADMIN, - adminView: 'gr-plugin-list', + adminView: AdminChildView.PLUGINS, offset: '42', filter: null, }); @@ -1124,7 +1125,7 @@ }; assertDataToParams(data, 'handlePluginListFilterOffsetRoute', { view: GerritView.ADMIN, - adminView: 'gr-plugin-list', + adminView: AdminChildView.PLUGINS, offset: '42', filter: 'foo', }); @@ -1134,14 +1135,14 @@ const data = createPageContext(); assertDataToParams(data, 'handlePluginListFilterRoute', { view: GerritView.ADMIN, - adminView: 'gr-plugin-list', + adminView: AdminChildView.PLUGINS, filter: null, }); data.params.filter = 'foo'; assertDataToParams(data, 'handlePluginListFilterRoute', { view: GerritView.ADMIN, - adminView: 'gr-plugin-list', + adminView: AdminChildView.PLUGINS, filter: 'foo', }); }); @@ -1150,7 +1151,7 @@ const data = createPageContext(); assertDataToParams(data, 'handlePluginListRoute', { view: GerritView.ADMIN, - adminView: 'gr-plugin-list', + adminView: AdminChildView.PLUGINS, }); }); });