Skip to content

Commit

Permalink
Merge pull request #709 from SuperITMan/feature/pages
Browse files Browse the repository at this point in the history
feat(all): add session pages
  • Loading branch information
christophercr authored Sep 26, 2018
2 parents 22e08b8 + 4d13687 commit 8a787f7
Show file tree
Hide file tree
Showing 62 changed files with 1,779 additions and 555 deletions.
1 change: 0 additions & 1 deletion packages/stark-core/src/common.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from "./common/bootstrap";
export * from "./common/environment";
export * from "./common/error";
export * from "./common/routes";
export * from "./common/store";
export * from "./common/translations";
1 change: 0 additions & 1 deletion packages/stark-core/src/common/routes.ts

This file was deleted.

132 changes: 0 additions & 132 deletions packages/stark-core/src/common/routes/routes.ts

This file was deleted.

46 changes: 33 additions & 13 deletions packages/stark-core/src/common/translations/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,12 @@
*/
export const translationsEn: object = {
STARK: {
DATE_RANGE_PICKER: {
FROM: "From",
TO: "To"
},
APP_LOGOUT: {
TITLE: "Log out"
},
LANGUAGES: {
EN: "English",
FR: "Français",
NL: "Nederlands",
DE: "Deutsch"
},
SORTING: {
ASC: "Ascending",
DESC: "Descending"
DATE_RANGE_PICKER: {
FROM: "From",
TO: "To"
},
ICONS: {
ADD_ITEM: "Add",
Expand All @@ -36,6 +26,16 @@ export const translationsEn: object = {
NEW_ITEM: "New",
SAVE_AND_NEXT: "Save And Next"
},
LANGUAGES: {
EN: "English",
FR: "Français",
NL: "Nederlands",
DE: "Deutsch"
},
LOGIN: {
TITLE: "Login",
NO_PROFILE: "No profile available"
},
MULTI_COLUMN_SORTING: {
TITLE: "Multi-Column Sorting",
ADD_SORTING_LEVEL: "Add sorting level",
Expand All @@ -45,6 +45,26 @@ export const translationsEn: object = {
CANCEL: "Cancel",
SAVE: "Save"
},
PRELOADING: {
FETCHING_USER_PROFILE: "Initializing...",
FETCHING_USER_PROFILE_FAILURE: "Initialization failed: could not fetch user profile.",
CONTACT_IT_SUPPORT: "Please contact your IT support department.",
CORRELATION_ID: "Correlation ID",
RELOAD: "Reload"
},
SESSION_EXPIRED: {
TITLE: "Session expired",
MESSAGE: "",
RELOAD: "Reload"
},
SESSION_LOGOUT: {
TITLE: "Logged out",
LOGIN: "Log in again"
},
SORTING: {
ASC: "Ascending",
DESC: "Descending"
},
TABLE: {
NB_SELECTED_ROWS: "Selected",
TOGGLE_SELECTION: "Toggle selection",
Expand Down
46 changes: 33 additions & 13 deletions packages/stark-core/src/common/translations/translations/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,12 @@
*/
export const translationsFr: object = {
STARK: {
DATE_RANGE_PICKER: {
FROM: "De",
TO: "A"
},
APP_LOGOUT: {
TITLE: "Déconnecter"
},
LANGUAGES: {
EN: "English",
FR: "Français",
NL: "Nederlands",
DE: "Deutsch"
},
SORTING: {
ASC: "Ascendant",
DESC: "Descendant"
DATE_RANGE_PICKER: {
FROM: "De",
TO: "A"
},
ICONS: {
ADD_ITEM: "Ajouter",
Expand All @@ -36,6 +26,16 @@ export const translationsFr: object = {
NEW_ITEM: "Nouveau",
SAVE_AND_NEXT: "Sauver et Suivant"
},
LANGUAGES: {
EN: "English",
FR: "Français",
NL: "Nederlands",
DE: "Deutsch"
},
LOGIN: {
TITLE: "Connexion",
NO_PROFILE: "Aucun profil utilisateur disponible"
},
MULTI_COLUMN_SORTING: {
TITLE: "Tri multi-colonnes",
ADD_SORTING_LEVEL: "Ajouter le niveau de tri",
Expand All @@ -45,6 +45,26 @@ export const translationsFr: object = {
CANCEL: "Annuler",
SAVE: "Enregistrer"
},
PRELOADING: {
FETCHING_USER_PROFILE: "Initialisation...",
FETCHING_USER_PROFILE_FAILURE: "Échec de l'initialisation: impossible de récupérer le profil de l'utilisateur.",
CONTACT_IT_SUPPORT: "Veuillez contacter votre service d'assistance informatique.",
CORRELATION_ID: "ID de corrélation",
RELOAD: "Recharger"
},
SESSION_EXPIRED: {
TITLE: "La session a expiré",
MESSAGE: "",
RELOAD: "Recharger"
},
SESSION_LOGOUT: {
TITLE: "Déconnecté",
LOGIN: "Connexion"
},
SORTING: {
ASC: "Ascendant",
DESC: "Descendant"
},
TABLE: {
NB_SELECTED_ROWS: "Sélectionné",
TOGGLE_SELECTION: "Inverser la sélection",
Expand Down
46 changes: 33 additions & 13 deletions packages/stark-core/src/common/translations/translations/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,12 @@
*/
export const translationsNl: object = {
STARK: {
DATE_RANGE_PICKER: {
FROM: "Van",
TO: "Tot"
},
APP_LOGOUT: {
TITLE: "Afmelden"
},
LANGUAGES: {
EN: "English",
FR: "Français",
NL: "Nederlands",
DE: "Deutsch"
},
SORTING: {
ASC: "Oplopend",
DESC: "Aflopend"
DATE_RANGE_PICKER: {
FROM: "Van",
TO: "Tot"
},
ICONS: {
ADD_ITEM: "Toevoegen",
Expand All @@ -36,6 +26,16 @@ export const translationsNl: object = {
NEW_ITEM: "Nieuw",
SAVE_AND_NEXT: "Bewaar en volgende"
},
LANGUAGES: {
EN: "English",
FR: "Français",
NL: "Nederlands",
DE: "Deutsch"
},
LOGIN: {
TITLE: "Aanmelden",
NO_PROFILE: "Geen profiel beschikbaar"
},
MULTI_COLUMN_SORTING: {
TITLE: "Sorteren van meerdere kolommen",
ADD_SORTING_LEVEL: "Voeg sorteringsniveau toe",
Expand All @@ -45,6 +45,26 @@ export const translationsNl: object = {
CANCEL: "Annuleer",
SAVE: "Opslaan"
},
PRELOADING: {
FETCHING_USER_PROFILE: "Initialiseren...",
FETCHING_USER_PROFILE_FAILURE: "Initialisatie mislukt: het gebruikersprofiel kon niet worden opgehaald.",
CONTACT_IT_SUPPORT: "Neem contact op met uw IT-support afdeling.",
CORRELATION_ID: "Correlatie ID",
RELOAD: "Herladen"
},
SESSION_EXPIRED: {
TITLE: "Sessie verlopen",
MESSAGE: "",
RELOAD: "Herladen"
},
SESSION_LOGOUT: {
TITLE: "Afgemeld",
LOGIN: "Opnieuw aanmelden"
},
SORTING: {
ASC: "Oplopend",
DESC: "Aflopend"
},
TABLE: {
NB_SELECTED_ROWS: "Geselecteerd",
TOGGLE_SELECTION: "Selectie omkeren",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ export interface StarkRoutingService {
*/
isCurrentUiState(stateName: string, stateParams?: RawParams): boolean;

/**
* Check whether the stateName passed as parameter is included in the current state.
* @param stateName - Partial name, relative name, glob pattern, or state object to be searched for within the current state name.
* @param stateParams - Param object, e.g. {sectionId: section.id}, to test against the current active state.
*/
isCurrentUiStateIncludedIn(stateName: string, stateParams?: RawParams): boolean;

/**
* Adds a navigation rejection cause to the rejections causes known by the routing service. These known rejection causes
* will be treated differently than any other navigation error (a Rejection action will be dispatched instead of a Failure action).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,31 @@ describe("Service: StarkRoutingService", () => {
});
});

describe("isCurrentUiStateIncludedIn", () => {
it("should return whether or not the state is included in the current state", (done: DoneFn) => {
spyOn($state, "go").and.callThrough();
const statesConfig: StateDeclaration[] = $state.get();
expect(statesConfig.length).toBe(numberOfMockStates); // UI-Router's root state + defined states

routingService
.navigateTo("page-01")
.pipe(
tap((enteredState: StateObject) => {
expect(enteredState).toBeDefined();
expect(enteredState.name).toBe("page-01");
expect($state.go).toHaveBeenCalledTimes(1);
expect($state.go).toHaveBeenCalledWith("page-01", undefined, undefined);
expect(routingService.isCurrentUiStateIncludedIn("page-01")).toBe(true);
expect(routingService.isCurrentUiStateIncludedIn("otherState")).toBe(false);
}),
catchError((error: any) => {
return throwError("navigateTo " + error);
})
)
.subscribe(() => done(), (error: any) => fail(error));
});
});

describe("navigateTo", () => {
it("should navigate to the requested page", (done: DoneFn) => {
spyOn($state, "go").and.callThrough();
Expand Down
Loading

0 comments on commit 8a787f7

Please sign in to comment.