story.tsx 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. Copyright (C) 2017 Cloudbase Solutions SRL
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. /* eslint-disable react/jsx-props-no-spreading */
  15. import React from "react";
  16. import { storiesOf } from "@storybook/react";
  17. import MigrationDetailsContent from ".";
  18. const tasks: any = [
  19. {
  20. progress_updates: [
  21. { message: "the task has a progress of 10%", created_at: new Date() },
  22. ],
  23. exception_details: "Exception details",
  24. status: "COMPLETED",
  25. created_at: new Date(),
  26. depends_on: ["depends on id"],
  27. id: "task-1",
  28. task_type: "Task name 1",
  29. },
  30. {
  31. progress_updates: [
  32. { message: "the task has a progress of 50%", created_at: new Date() },
  33. { message: "the task is almost done", created_at: new Date() },
  34. ],
  35. exception_details: "Exception details",
  36. status: "RUNNING",
  37. created_at: new Date(),
  38. depends_on: ["depends on id"],
  39. id: "task-2",
  40. task_type: "Task name 2",
  41. },
  42. ];
  43. const endpoints: any = [
  44. { id: "endpoint-1", name: "Endpoint OPS", type: "openstack" },
  45. { id: "endpoint-2", name: "Endpoint AZURE", type: "azure" },
  46. ];
  47. const item: any = {
  48. origin_endpoint_id: "endpoint-1",
  49. destination_endpoint_id: "endpoint-2",
  50. id: "item-id",
  51. created_at: new Date(2017, 10, 24, 16, 15),
  52. info: {
  53. instance: {
  54. export_info: { devices: { nics: [{ network_name: "map_1" }] } },
  55. },
  56. },
  57. tasks,
  58. destination_environment: {
  59. description: "A description",
  60. network_map: {
  61. map_1: "Mapping 1",
  62. },
  63. },
  64. type: "Migration",
  65. };
  66. const props: any = {};
  67. storiesOf("MigrationDetailsContent", module)
  68. .add("default", () => (
  69. <MigrationDetailsContent
  70. item={item}
  71. endpoints={endpoints}
  72. page=""
  73. {...props}
  74. />
  75. ))
  76. .add("details loading", () => (
  77. <MigrationDetailsContent
  78. item={item}
  79. endpoints={endpoints}
  80. page=""
  81. detailsLoading
  82. {...props}
  83. />
  84. ))
  85. .add("tasks", () => (
  86. <MigrationDetailsContent
  87. item={item}
  88. endpoints={endpoints}
  89. page="tasks"
  90. {...props}
  91. />
  92. ));