applications.py 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # coding=utf-8
  2. import typing
  3. class Application(object):
  4. """
  5. Application class with data needed for frontend
  6. """
  7. def __init__(
  8. self,
  9. label: str,
  10. slug: str,
  11. fa_icon: str,
  12. hexcolor: str,
  13. is_active: bool,
  14. config: typing.Dict[str, str],
  15. main_route: str,
  16. ) -> None:
  17. """
  18. @param label: public label of application
  19. @param slug: identifier of application
  20. @param icon: font awesome icon class
  21. @param hexcolor: hexa color of application main color
  22. @param is_active: True if application enable, False if inactive
  23. @param config: a dict with eventual application config
  24. @param main_route: the route of the frontend "home" screen of
  25. the application. For exemple, if you have an application
  26. called "calendar", the main route will be something
  27. like /#/workspace/{wid}/calendar.
  28. """
  29. self.label = label
  30. self.slug = slug
  31. self.fa_icon = fa_icon
  32. self.hexcolor = hexcolor
  33. self.is_active = is_active
  34. self.config = config
  35. self.main_route = main_route
  36. # default apps
  37. calendar = Application(
  38. label='Calendar',
  39. slug='calendar',
  40. fa_icon='calendar',
  41. hexcolor='#757575',
  42. is_active=True,
  43. config={},
  44. main_route='/#/workspaces/{workspace_id}/calendar',
  45. )
  46. thread = Application(
  47. label='Threads',
  48. slug='contents/threads',
  49. fa_icon='comments-o',
  50. hexcolor='#ad4cf9',
  51. is_active=True,
  52. config={},
  53. main_route='/#/workspaces/{workspace_id}/contents?type=thread',
  54. )
  55. _file = Application(
  56. label='Files',
  57. slug='contents/files',
  58. fa_icon='paperclip',
  59. hexcolor='#FF9900',
  60. is_active=True,
  61. config={},
  62. main_route='/#/workspaces/{workspace_id}/contents?type=file',
  63. )
  64. markdownpluspage = Application(
  65. label='Markdown Plus Documents', # TODO - G.M - 24-05-2018 - Check label
  66. slug='contents/markdownpluspage',
  67. fa_icon='file-code-o',
  68. hexcolor='#f12d2d',
  69. is_active=True,
  70. config={},
  71. main_route='/#/workspaces/{workspace_id}/contents?type=markdownpluspage',
  72. )
  73. html_documents = Application(
  74. label='Text Documents', # TODO - G.M - 24-05-2018 - Check label
  75. slug='contents/html-documents',
  76. fa_icon='file-text-o',
  77. hexcolor='#3f52e3',
  78. is_active=True,
  79. config={},
  80. main_route='/#/workspaces/{workspace_id}/contents?type=html-documents',
  81. )
  82. # TODO - G.M - 08-06-2018 - This is hardcoded lists of app, make this dynamic.
  83. # List of applications
  84. applications = [
  85. html_documents,
  86. markdownpluspage,
  87. _file,
  88. thread,
  89. calendar,
  90. ]