-
-
Notifications
You must be signed in to change notification settings - Fork 546
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/164_respect_directory_structure_or_at_least_provide_warning (#…
…195) * initial refactor * empty labels validation * non unique labels validation
- Loading branch information
Showing
12 changed files
with
179 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum Notification { | ||
EMPTY_LABEL_NAME_ERROR = 0, | ||
NON_UNIQUE_LABEL_NAMES_ERROR = 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export enum NotificationType { | ||
ERROR = 'ERROR', | ||
SUCCESS = 'SUCCESS', | ||
MESSAGE = 'MESSAGE' | ||
MESSAGE = 'MESSAGE', | ||
WARNING = 'WARNING' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import {Notification} from '../enums/Notification'; | ||
|
||
export type NotificationContent = { | ||
header: string; | ||
description: string; | ||
} | ||
|
||
export type ExportFormatDataMap = Record<Notification, NotificationContent>; | ||
|
||
export const NotificationsDataMap = { | ||
[Notification.EMPTY_LABEL_NAME_ERROR]: { | ||
header: 'Empty label name', | ||
description: "Looks like you didn't assign name to one of your labels. Unfortunately it is mandatory for " + | ||
'every label to have unique name value. Insert correct name or delete empty label and try again.' | ||
}, | ||
[Notification.NON_UNIQUE_LABEL_NAMES_ERROR]: { | ||
header: 'Non unique label names', | ||
description: 'Looks like not all your label names are unique. Unique names are necessary to guarantee correct' + | ||
' data export when you complete your work. Make your names unique and try again.' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,33 @@ | ||
import {INotification} from '../store/notifications/types'; | ||
import {v4 as uuidv4} from 'uuid'; | ||
import {NotificationType} from '../data/enums/NotificationType'; | ||
import {NotificationContent} from "../data/info/NotificationsData"; | ||
|
||
export class NotificationUtil { | ||
public static createErrorNotification(header: string, description: string): INotification { | ||
public static createErrorNotification(content: NotificationContent): INotification { | ||
return { | ||
id: uuidv4(), | ||
type: NotificationType.ERROR, | ||
header, | ||
description | ||
header: content.header, | ||
description: content.description | ||
} | ||
} | ||
|
||
public static createMessageNotification(header: string, description: string): INotification { | ||
public static createMessageNotification(content: NotificationContent): INotification { | ||
return { | ||
id: uuidv4(), | ||
type: NotificationType.MESSAGE, | ||
header, | ||
description | ||
header: content.header, | ||
description: content.description | ||
} | ||
} | ||
|
||
public static createWarningNotification(content: NotificationContent): INotification { | ||
return { | ||
id: uuidv4(), | ||
type: NotificationType.WARNING, | ||
header: content.header, | ||
description: content.description | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.