@appscode/design-system 1.0.43-alpha.98 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/base/utilities/_all.scss +7 -0
  2. package/base/utilities/_customize-bulma.scss +191 -0
  3. package/base/utilities/_default.scss +58 -124
  4. package/base/utilities/_derived-variables.scss +6 -0
  5. package/base/utilities/_grid.scss +29 -0
  6. package/base/utilities/_initial-variables.scss +13 -9
  7. package/base/utilities/_typography.scss +6 -12
  8. package/base/utilities/dark-theme.scss +1 -0
  9. package/components/_ac-accordion.scss +14 -5
  10. package/components/_ac-alert-box.scss +32 -6
  11. package/components/_ac-card.scss +17 -5
  12. package/components/_ac-drag.scss +2 -0
  13. package/components/_ac-input.scss +19 -11
  14. package/components/_ac-modal.scss +1 -1
  15. package/components/_ac-multi-select.scss +60 -4
  16. package/components/_ac-options.scss +1 -0
  17. package/components/_ac-report.scss +53 -0
  18. package/components/_ac-table.scss +60 -2
  19. package/components/_ac-tabs.scss +16 -2
  20. package/components/_ac-tags.scss +85 -0
  21. package/components/_ac-terminal.scss +1 -4
  22. package/components/_all.scss +28 -0
  23. package/components/_buttons.scss +14 -33
  24. package/components/_dashboard-header.scss +32 -0
  25. package/components/_left-sidebar-menu.scss +9 -9
  26. package/components/_navbar.scss +89 -4
  27. package/components/_preview-modal.scss +14 -1
  28. package/components/_transitions.scss +261 -0
  29. package/components/_wizard.scss +1 -0
  30. package/components/bbum/_all.scss +9 -0
  31. package/components/bbum/_single-post-preview.scss +1 -1
  32. package/components/ui-builder/_ui-builder.scss +58 -0
  33. package/components/ui-builder/_vue-open-api.scss +6 -0
  34. package/layouts/_all.scss +2 -0
  35. package/layouts/_code-preview.scss +5 -2
  36. package/main.scss +5 -56
  37. package/package.json +4 -2
  38. package/plugins/caching.ts +243 -0
  39. package/plugins/time-convert.js +49 -0
  40. package/plugins/vue-toaster.js +3 -0
  41. package/vue-components/v2/banner/Banner.vue +2 -2
  42. package/vue-components/v2/breadcrumbs/Breadcrumb.vue +97 -0
  43. package/vue-components/v2/button/Button.vue +5 -0
  44. package/vue-components/v2/button/DownloadBtn.vue +45 -0
  45. package/vue-components/v2/card/Card.vue +1 -0
  46. package/vue-components/v2/content/ContentTable.vue +12 -7
  47. package/vue-components/v2/editor/Editor.vue +37 -24
  48. package/vue-components/v2/editor/FilteredFileEditor.vue +189 -0
  49. package/vue-components/v2/editor/MonacoEditor.vue +125 -0
  50. package/vue-components/v2/editor/ResourceKeyValueEditor.vue +209 -0
  51. package/vue-components/v2/form-fields/Input.vue +1 -1
  52. package/vue-components/v2/loaders/ResourceLoader.vue +101 -0
  53. package/vue-components/v2/loaders/SidebarLoader.vue +43 -0
  54. package/vue-components/v2/modal/Modal.vue +30 -5
  55. package/vue-components/v2/modals/DeleteConfirmationModal.vue +79 -0
  56. package/vue-components/v2/modals/JsonShowModal.vue +12 -2
  57. package/vue-components/v2/navbar/User.vue +229 -17
  58. package/vue-components/v2/notification/Notification.vue +101 -0
  59. package/vue-components/v2/notification/NotificationItem.vue +44 -0
  60. package/vue-components/v2/pagination/Pagination.vue +16 -3
  61. package/vue-components/v2/preloader/Preloader.vue +1 -1
  62. package/vue-components/v2/sidebar/SidebarItemWithDropDown.vue +19 -20
  63. package/vue-components/v2/tab/TabItem.vue +1 -1
  64. package/vue-components/v2/table/Table.vue +49 -8
  65. package/vue-components/v2/table/TableRow.vue +12 -2
  66. package/vue-components/v2/table/table-cell/CellValue.vue +29 -9
  67. package/vue-components/v2/table/table-cell/GenericCell.vue +56 -0
  68. package/vue-components/v2/table/table-cell/ObjectCell.vue +4 -1
  69. package/vue-components/v3/button/Button.vue +6 -1
  70. package/vue-components/v3/content/ContentHeader.vue +2 -1
  71. package/vue-components/v3/content/ContentTable.vue +20 -2
  72. package/vue-components/v3/editor/Editor.vue +36 -33
  73. package/vue-components/v3/editor/FilteredFileEditor.vue +186 -0
  74. package/vue-components/v3/editor/MonacoEditor.vue +131 -0
  75. package/vue-components/v3/editor/ResourceKeyValueEditor.vue +125 -0
  76. package/vue-components/v3/form/Form.vue +63 -0
  77. package/vue-components/v3/form-fields/Input.vue +11 -10
  78. package/vue-components/v3/header/HeaderItem.vue +5 -0
  79. package/vue-components/v3/header/HeaderItems.vue +5 -0
  80. package/vue-components/v3/loaders/ResourceLoader.vue +83 -0
  81. package/vue-components/v3/loaders/SidebarLoader.vue +34 -0
  82. package/vue-components/v3/long-running-tasks/LongRunningTaskItem.vue +92 -0
  83. package/vue-components/v3/modal/Modal.vue +30 -7
  84. package/vue-components/v3/modals/DeleteConfirmationModal.vue +85 -0
  85. package/vue-components/v3/modals/JsonShowModal.vue +25 -16
  86. package/vue-components/v3/modals/LongRunningTasksModal.vue +400 -0
  87. package/vue-components/v3/navbar/ThemeMode.vue +41 -49
  88. package/vue-components/v3/navbar/User.vue +242 -18
  89. package/vue-components/v3/notification/AlertBox.vue +61 -0
  90. package/vue-components/v3/notification/Notification.vue +98 -0
  91. package/vue-components/v3/notification/NotificationItem.vue +52 -0
  92. package/vue-components/v3/pagination/Pagination.vue +16 -3
  93. package/vue-components/v3/sidebar/SidebarItemWithDropDown.vue +120 -0
  94. package/vue-components/v3/tab/TabItem.vue +1 -1
  95. package/vue-components/v3/table/MultiInfoTable.vue +143 -0
  96. package/vue-components/v3/table/Table.vue +52 -13
  97. package/vue-components/v3/table/TableContainer.vue +34 -0
  98. package/vue-components/v3/table/TableRow.vue +93 -6
  99. package/vue-components/v3/table/table-cell/CellValue.vue +23 -7
  100. package/vue-components/v3/table/table-cell/GenericCell.vue +75 -0
  101. package/vue-components/v3/table/table-cell/ObjectCell.vue +7 -2
  102. package/vue-components/v3/terminal/LongRunningTaskTerminal.vue +148 -0
@@ -8,21 +8,23 @@
8
8
  :secondaryColor="secondaryColor"
9
9
  />
10
10
  </div>
11
- <div v-else class="haha" ref="cellDiv">
11
+ <div v-else ref="cellDiv">
12
12
  <object-cell
13
13
  v-if="valueType === 'object'"
14
14
  :obj="value"
15
15
  :cell-title="cellTitle"
16
16
  :max-character-length="maxCharacterLength"
17
+ data-testid="object-cell-value"
17
18
  />
18
19
  <array-cell
19
20
  v-else-if="valueType === 'array'"
20
21
  :items="value"
21
22
  :cell-title="cellTitle"
22
23
  :max-character-length="maxCharacterLength"
24
+ data-testid="array-cell-value"
23
25
  />
24
26
  <template v-else>
25
- <span class="is-ellipsis-1" :title="value">{{
27
+ <span class="is-ellipsis-1" :title="tooltip" data-testid="cell-value">{{
26
28
  value || (value === 0 ? 0 : "-")
27
29
  }}</span>
28
30
  </template>
@@ -31,7 +33,12 @@
31
33
 
32
34
  <script>
33
35
  import { defineComponent, defineAsyncComponent } from "vue";
34
- import { loaderLightThemePrimaryColor, loaderDarkThemePrimaryColor, loaderLightThemeSecondaryColor, loaderDarkThemeSecondaryColor } from "@appscode/design-system/plugins/theme";
36
+ import {
37
+ loaderLightThemePrimaryColor,
38
+ loaderDarkThemePrimaryColor,
39
+ loaderLightThemeSecondaryColor,
40
+ loaderDarkThemeSecondaryColor,
41
+ } from "@appscode/design-system/plugins/theme";
35
42
 
36
43
  export default defineComponent({
37
44
  props: {
@@ -47,6 +54,10 @@ export default defineComponent({
47
54
  type: null,
48
55
  default: "",
49
56
  },
57
+ tooltip: {
58
+ type: String,
59
+ defualt: "",
60
+ },
50
61
  },
51
62
  components: {
52
63
  ContentLoader: defineAsyncComponent(() =>
@@ -63,7 +74,8 @@ export default defineComponent({
63
74
  computed: {
64
75
  valueType() {
65
76
  if (typeof this.value === "object") {
66
- if (Array.isArray(this.value)) return "array";
77
+ if (this.value === null) return "null";
78
+ else if (Array.isArray(this.value)) return "array";
67
79
  else return "object";
68
80
  } else return typeof this.value;
69
81
  },
@@ -71,11 +83,15 @@ export default defineComponent({
71
83
  return Math.ceil(this.computedCellWidth / 8);
72
84
  },
73
85
  primaryColor() {
74
- return document.documentElement.classList.contains("is-dark-theme") ? loaderDarkThemePrimaryColor : loaderLightThemePrimaryColor;
86
+ return document.documentElement.classList.contains("is-dark-theme")
87
+ ? loaderDarkThemePrimaryColor
88
+ : loaderLightThemePrimaryColor;
75
89
  },
76
90
  secondaryColor() {
77
- return document.documentElement.classList.contains("is-dark-theme") ? loaderDarkThemeSecondaryColor : loaderLightThemeSecondaryColor;
78
- }
91
+ return document.documentElement.classList.contains("is-dark-theme")
92
+ ? loaderDarkThemeSecondaryColor
93
+ : loaderLightThemeSecondaryColor;
94
+ },
79
95
  },
80
96
 
81
97
  data() {
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <span
3
+ :class="{
4
+ 'is-flex': cellDescriptor.type !== 'object',
5
+ 'is-align-items-center': cellValue.icon,
6
+ 'is-justify-content-center': cellDescriptor.textAlign === 'center',
7
+ 'is-justify-content-left': cellDescriptor.textAlign === 'left',
8
+ 'is-justify-content-right': cellDescriptor.textAlign === 'right',
9
+ }"
10
+ >
11
+ <span v-if="cellValue.icon" class="icon p-0 mr-10">
12
+ <img width="15" :src="cellValue.icon" />
13
+ </span>
14
+ <a
15
+ v-if="cellValue.link && cellValue.link.startsWith('http')"
16
+ :href="getCellLink(cellValue)"
17
+ @click.prevent="redirectTo"
18
+ >
19
+ {{ cellValue.data }}
20
+ </a>
21
+ <router-link v-else-if="cellValue.link" :to="getCellLink(cellValue)">
22
+ {{ cellValue.data }}
23
+ </router-link>
24
+ <tag v-else-if="cellValue.color" :class="`is-${cellValue.color}`">
25
+ {{ cellValue.data }}
26
+ </tag>
27
+ <cell-value
28
+ v-else
29
+ :cell-title="cellDescriptor.name"
30
+ :value="cellValue.data || '-'"
31
+ :tooltip="cellValue.tooltip || JSON.stringify(cellValue.data)"
32
+ />
33
+ </span>
34
+ </template>
35
+
36
+ <script>
37
+ import { defineAsyncComponent, defineComponent } from "vue";
38
+ import { useRoute } from "vue-router";
39
+
40
+ export default defineComponent({
41
+ components: {
42
+ Tag: defineAsyncComponent(() => import("../../tag/Tag.vue")),
43
+ CellValue: defineAsyncComponent(() =>
44
+ import("../table-cell/CellValue.vue")
45
+ ),
46
+ },
47
+ props: {
48
+ cellDescriptor: {
49
+ type: Object,
50
+ default: () => ({}),
51
+ },
52
+ cellValue: {
53
+ type: Object,
54
+ default: () => ({}),
55
+ },
56
+ },
57
+ setup() {
58
+ const route = useRoute();
59
+ function getCellLink(cell) {
60
+ const inject = (str, obj) => str.replace(/\${(.*?)}/g, (x, g) => obj[g]);
61
+ const { user, cluster } = route.params;
62
+ const link = inject(cell.link || "", {
63
+ username: user,
64
+ clustername: cluster,
65
+ });
66
+ return link;
67
+ }
68
+ function redirectTo() {
69
+ const link = getCellLink(this.cellValue);
70
+ window.open(link, "_blank");
71
+ }
72
+ return { getCellLink, redirectTo };
73
+ },
74
+ });
75
+ </script>
@@ -6,6 +6,7 @@
6
6
  indexOfCharacterLengthExceed
7
7
  )"
8
8
  :key="printableStringOb.key"
9
+ modifierClasses="is-info is-light"
9
10
  >
10
11
  <value-with-modal
11
12
  v-if="printableStringOb.exceededLength"
@@ -16,7 +17,7 @@
16
17
  <template v-else> {{ printableStringOb.print }} </template>
17
18
  </tag>
18
19
 
19
- <tag v-if="indexOfCharacterLengthExceed !== printableStringObjs.length">
20
+ <tag modifierClasses="is-info is-light" v-if="indexOfCharacterLengthExceed !== printableStringObjs.length">
20
21
  <a @click.prevent.stop="showFullData = true">
21
22
  <ellipsis-icon />
22
23
  <json-show-modal
@@ -79,7 +80,10 @@ export default defineComponent({
79
80
  },
80
81
  printableStringObjs() {
81
82
  return this.objKeys.map((key) => {
82
- const value = this.obj[key];
83
+ let value = this.obj[key];
84
+ if (typeof value === "object" && value !== null) {
85
+ value = JSON.stringify(value);
86
+ }
83
87
  const keyValue = `${key}: ${value}`;
84
88
  const exceededLength = keyValue.length > 30;
85
89
  const print = exceededLength ? key : keyValue;
@@ -103,3 +107,4 @@ export default defineComponent({
103
107
  },
104
108
  });
105
109
  </script>
110
+
@@ -0,0 +1,148 @@
1
+ <template>
2
+ <div ref="terminalRef" class="terminal-body"></div>
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import { computed, nextTick, ref, toRefs, watch, watchPostEffect } from "vue";
7
+ import { Terminal } from "xterm";
8
+ import { FitAddon } from "xterm-addon-fit";
9
+ import { WebglAddon } from "xterm-addon-webgl";
10
+ import { Material, MaterialDark } from "xterm-theme"; //https://github.com/ysk2014/xterm-theme/tree/master/src/iterm
11
+
12
+ const props = withDefaults(
13
+ defineProps<{
14
+ theme: string;
15
+ logs: string[];
16
+ }>(),
17
+ { theme: "light", logs: () => [] }
18
+ );
19
+ // terminal print logic
20
+ const { logs, theme } = toRefs(props);
21
+ const lastPrintIdx = ref(0);
22
+ watch(
23
+ logs,
24
+ (n) => {
25
+ if (n.length > lastPrintIdx.value) {
26
+ nextTick(() => {
27
+ writeOnTerminal(n.slice(lastPrintIdx.value).join("\n"));
28
+ lastPrintIdx.value = n.length;
29
+ });
30
+ }
31
+ },
32
+ { immediate: true, deep: true }
33
+ );
34
+
35
+ //theme
36
+ const bodyBgc = computed(() =>
37
+ theme.value === "light" ? "#eaeaea" : "#232322"
38
+ );
39
+
40
+ // xterm component logic
41
+ const terminalRef = ref<HTMLElement>();
42
+ const terminal = new Terminal({
43
+ windowsMode: false,
44
+ theme: theme.value === "light" ? Material : MaterialDark,
45
+ });
46
+ const fitAddon = new FitAddon();
47
+ terminal.loadAddon(fitAddon);
48
+ const webGlAddon = new WebglAddon();
49
+ webGlAddon.onContextLoss(() => {
50
+ webGlAddon.dispose();
51
+ });
52
+ watchPostEffect(() => {
53
+ if (terminalRef.value) {
54
+ terminal.open(terminalRef.value);
55
+ fitAddon.fit();
56
+ terminal.focus();
57
+ terminal.loadAddon(webGlAddon);
58
+ }
59
+ });
60
+ function writeOnTerminal(msg: string) {
61
+ const lines = msg.split("\n");
62
+ lines.forEach((line, index) => {
63
+ if (lines.length === 1 || index < lines.length - 1) terminal.writeln(line);
64
+ else terminal.write(line);
65
+ });
66
+ }
67
+ </script>
68
+
69
+ <style lang="scss">
70
+ .terminal-body {
71
+ width: 100%;
72
+ height: 100%;
73
+ background-color: v-bind(bodyBgc);
74
+ padding: 5px 0px 0px 10px;
75
+
76
+ // for terminal scroll bar style
77
+ .xterm .xterm-viewport {
78
+ &::-webkit-scrollbar {
79
+ border-radius: 50px;
80
+ width: 3px;
81
+ }
82
+
83
+ &::-moz-scrollbar {
84
+ border-radius: 50px;
85
+ width: 3px;
86
+ }
87
+
88
+ &::-ms-scrollbar {
89
+ border-radius: 50px;
90
+ width: 3px;
91
+ }
92
+
93
+ &::-webkit-scrollbar:hover {
94
+ width: 7px;
95
+ }
96
+
97
+ &::-moz-scrollbar:hover {
98
+ width: 7px;
99
+ }
100
+
101
+ &::-ms-scrollbar:hover {
102
+ width: 7px;
103
+ }
104
+
105
+ &::-webkit-scrollbar-thumb {
106
+ background-color: #929292;
107
+ border-radius: 50px;
108
+ height: 2px !important;
109
+ }
110
+
111
+ &::-moz-scrollbar-thumb {
112
+ background-color: #929292;
113
+ border-radius: 50px;
114
+ height: 2px !important;
115
+ }
116
+
117
+ &::-ms-scrollbar-thumb {
118
+ background-color: #929292;
119
+ border-radius: 50px;
120
+ height: 2px !important;
121
+ }
122
+
123
+ &::-webkit-scrollbar-thumb:hover {
124
+ background-color: #929292;
125
+ }
126
+
127
+ &::-moz-scrollbar-thumb:hover {
128
+ background-color: #929292;
129
+ }
130
+
131
+ &::-ms-scrollbar-thumb:hover {
132
+ background-color: #929292;
133
+ }
134
+
135
+ &:hover::-webkit-scrollbar-corner {
136
+ height: 40px;
137
+ }
138
+
139
+ &:hover::-moz-scrollbar-corner {
140
+ height: 40px;
141
+ }
142
+
143
+ &:hover::-ms-scrollbar-corner {
144
+ height: 40px;
145
+ }
146
+ }
147
+ }
148
+ </style>