@appscode/design-system 1.0.43-alpha.110 → 1.0.43-alpha.113

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appscode/design-system",
3
- "version": "1.0.43-alpha.110",
3
+ "version": "1.0.43-alpha.113",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -0,0 +1,141 @@
1
+ <template>
2
+ <div class="ac-preview is-active is-not-fixed">
3
+ <div class="ac-preview-inner">
4
+ <!-- preview body start -->
5
+ <div class="ac-preview-body mt-0 pt-15 pl-20">
6
+ <div
7
+ v-if="isPreviewLoading || (!isPreviewLoading && previewYamls)"
8
+ class="left-content"
9
+ >
10
+ <div class="ac-files">
11
+ <ul v-if="!isPreviewLoading">
12
+ <li
13
+ v-for="(previewYaml, idx) in filteredYamls"
14
+ :key="previewYaml.name + idx"
15
+ :class="{ 'is-active': activeKey === previewYaml.uid }"
16
+ >
17
+ <a @click.prevent="setActivePreview(previewYaml.uid)">
18
+ <span>
19
+ <img
20
+ src="~@appscode/design-system-images/icons/file-icon.svg"
21
+ alt=""
22
+ />
23
+ </span>
24
+ <span>{{ previewYaml.name }}</span>
25
+ </a>
26
+ </li>
27
+ </ul>
28
+ <sidebar-loader v-else />
29
+ </div>
30
+ </div>
31
+ <div class="right-content">
32
+ <div class="right-content">
33
+ <resource-loader v-if="isPreviewLoading" />
34
+ <editor
35
+ v-else-if="!isPreviewLoading && !hideValue"
36
+ v-model="activeFile.content"
37
+ :original-value="activeFile.content"
38
+ :language="activeFile.format"
39
+ :read-only="isEditorReadOnly"
40
+ :editor-height="60"
41
+ :show-minimap="showMinimap"
42
+ />
43
+ <span v-else> *************** </span>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ </div>
49
+ </template>
50
+ <script>
51
+ export default {
52
+ components: {
53
+ Editor: () => import("./Editor.vue"),
54
+ ResourceLoader: () => import("./../loaders/ResourceLoader.vue"),
55
+ SidebarLoader: () => import("./../loaders/SidebarLoader.vue")
56
+ },
57
+ props: {
58
+ searchText: {
59
+ type: String,
60
+ default: ""
61
+ },
62
+ toggleHideValue: {
63
+ type: Boolean,
64
+ default: true
65
+ },
66
+ isPreviewLoading: {
67
+ type: Boolean,
68
+ default: false
69
+ },
70
+ isEditorReadOnly: {
71
+ type: Boolean,
72
+ default: false
73
+ },
74
+ previewYamls: {
75
+ type: Array,
76
+ default: () => {
77
+ [];
78
+ }
79
+ },
80
+ showMinimap: {
81
+ type: Boolean,
82
+ default: false
83
+ }
84
+ },
85
+ data() {
86
+ return {
87
+ activeKey: "",
88
+ hideValue: ""
89
+ };
90
+ },
91
+ computed: {
92
+ activeFile() {
93
+ const activeFile = this.filteredYamls.find(
94
+ element => element.uid === this.activeKey
95
+ );
96
+ return activeFile || { content: "", format: "yaml" };
97
+ },
98
+ filteredYamls() {
99
+ if (this.searchText) {
100
+ return this.previewYamls.filter(
101
+ element => JSON.stringify(element).search(this.searchText) > -1
102
+ );
103
+ } else return this.previewYamls;
104
+ },
105
+ isKeyAvailable() {
106
+ const val = this.previewYamls.find(element => {
107
+ return element.uid === this.activeKey;
108
+ });
109
+ return val === undefined ? false : true;
110
+ }
111
+ },
112
+ methods: {
113
+ initActivePreview() {
114
+ if (!this.isKeyAvailable) {
115
+ this.activeKey = this.previewYamls[0].uid;
116
+ this.hideValue = this.activeFile.isSecret;
117
+ this.$emit("setActiveKey", this.activeKey);
118
+ }
119
+ },
120
+ setActivePreview(uid) {
121
+ this.activeKey = uid;
122
+ this.hideValue = this.activeFile.isSecret;
123
+ this.$emit("setActiveKey", this.activeKey);
124
+ }
125
+ },
126
+ watch: {
127
+ previewYamls: {
128
+ deep: true,
129
+ immediate: true,
130
+ handler(n) {
131
+ if (n.length) {
132
+ this.initActivePreview();
133
+ }
134
+ }
135
+ },
136
+ toggleHideValue(n) {
137
+ this.hideValue = n;
138
+ }
139
+ }
140
+ };
141
+ </script>
@@ -4,23 +4,23 @@
4
4
  <header-item v-if="showHideBtn">
5
5
  <ac-button
6
6
  modifier-classes="is-square is-primary"
7
- :icon-class="hideValue ? 'eye-slash' : 'eye'"
8
- @click.prevent="hideValue = !hideValue"
7
+ :icon-class="toggleHideValue ? 'eye-slash' : 'eye'"
8
+ @click.prevent="toggleHideValue = !toggleHideValue"
9
9
  />
10
10
  </header-item>
11
11
  <header-item v-if="showCopyBtn">
12
12
  <ac-button
13
13
  modifier-classes="is-square is-primary"
14
14
  icon-class="copy"
15
- v-clipboard:copy="decode(previewYamls[activeKey])"
15
+ v-clipboard:copy="decode(activeFile)"
16
16
  v-clipboard:success="onCopy"
17
17
  v-clipboard:error="onError"
18
18
  />
19
19
  </header-item>
20
20
  <header-item v-if="showDownloadBtn">
21
21
  <download-btn
22
- :file-data="decode(previewYamls[activeKey])"
23
- :file-name="activePreview"
22
+ :file-data="decode(activeFile)"
23
+ :file-name="activeFile.name"
24
24
  />
25
25
  </header-item>
26
26
  <header-item v-if="showUpdateBtn && !isEditorReadOnly">
@@ -28,9 +28,7 @@
28
28
  modifier-classes="is-square is-primary"
29
29
  icon-class="pencil-square-o"
30
30
  :class="{ 'is-loading': isUpdateActive }"
31
- @click.prevent="
32
- $emit('updateData', activeKey, previewYamls[activeKey])
33
- "
31
+ @click.prevent="$emit('updateData', activeKey, activeFile)"
34
32
  />
35
33
  </header-item>
36
34
  <header-item v-if="showDeleteBtn">
@@ -42,7 +40,7 @@
42
40
  <delete-confirmation-modal
43
41
  title="Delete Resource"
44
42
  message="Do you want to delete "
45
- :item-name="activePreview"
43
+ :item-name="activeFile.name"
46
44
  :open="showDeleteDataModal"
47
45
  :is-delete-active="deleteModalStatus === 'loading'"
48
46
  @delete-confirmation-modal$confirm="confirmDelete"
@@ -51,54 +49,16 @@
51
49
  </header-item>
52
50
  <slot name="content-action" />
53
51
  </template>
54
- <template #content>
55
- <div class="ac-preview is-active is-not-fixed">
56
- <div class="ac-preview-inner">
57
- <!-- preview body start -->
58
- <div class="ac-preview-body mt-0 pt-15 pl-20">
59
- <div
60
- v-if="isPreviewLoading || (!isPreviewLoading && previewYamls)"
61
- class="left-content"
62
- >
63
- <div class="ac-files">
64
- <ul v-if="!isPreviewLoading">
65
- <li
66
- v-for="(previewYaml, idx) in previewYamls"
67
- :key="previewYaml.name + idx"
68
- :class="{ 'is-active': activeKey === idx }"
69
- >
70
- <a @click.prevent="setActivePreview(previewYaml, idx)">
71
- <span>
72
- <img
73
- src="~@appscode/design-system-images/icons/file-icon.svg"
74
- alt=""
75
- />
76
- </span>
77
- <span>{{ previewYaml.name }}</span>
78
- </a>
79
- </li>
80
- </ul>
81
- <sidebar-loader v-else />
82
- </div>
83
- </div>
84
- <div class="right-content">
85
- <div class="right-content">
86
- <resource-loader v-if="isPreviewLoading" />
87
- <editor
88
- v-else-if="!isPreviewLoading && !hideValue"
89
- v-model="activeFile.content"
90
- :original-value="activeFile.content"
91
- :language="activeFile.format"
92
- :read-only="isEditorReadOnly"
93
- :editor-height="60"
94
- :show-minimap="showMinimap"
95
- />
96
- <span v-else> *************** </span>
97
- </div>
98
- </div>
99
- </div>
100
- </div>
101
- </div>
52
+ <template #content="{ searchText }">
53
+ <filtered-file-editor
54
+ :search-text="searchText"
55
+ :toggle-hide-value="toggleHideValue"
56
+ :is-preview-loading="isPreviewLoading"
57
+ :is-editor-read-only="isEditorReadOnly"
58
+ :previewYamls="previewYamls"
59
+ :showMinimap="showMinimap"
60
+ @setActiveKey="setActiveKey"
61
+ />
102
62
  </template>
103
63
  </content-table>
104
64
  </template>
@@ -112,8 +72,7 @@ export default {
112
72
  DownloadBtn: () => import("./../button/DownloadBtn.vue"),
113
73
  DeleteConfirmationModal: () =>
114
74
  import("./../modals/DeleteConfirmationModal.vue"),
115
- ResourceLoader: () => import("./../loaders/ResourceLoader.vue"),
116
- SidebarLoader: () => import("./../loaders/SidebarLoader.vue")
75
+ FilteredFileEditor: () => import("./FilteredFileEditor.vue")
117
76
  },
118
77
  props: {
119
78
  title: {
@@ -159,15 +118,16 @@ export default {
159
118
  },
160
119
  data() {
161
120
  return {
162
- activePreview: "",
163
121
  activeKey: 0,
164
- hideValue: "",
122
+ toggleHideValue: "",
165
123
  showDeleteDataModal: false
166
124
  };
167
125
  },
168
126
  computed: {
169
127
  activeFile() {
170
- const activeFile = this.previewYamls[this.activeKey];
128
+ const activeFile = this.previewYamls.find(
129
+ element => element.uid === this.activeKey
130
+ );
171
131
  return activeFile || { content: "", format: "yaml" };
172
132
  },
173
133
  showCopyBtn() {
@@ -192,16 +152,6 @@ export default {
192
152
  }
193
153
  },
194
154
  methods: {
195
- initActivePreview() {
196
- this.activePreview = this.previewYamls[0] && this.previewYamls[0].name;
197
- this.hideValue = this.previewYamls[0].isSecret;
198
- this.activeKey = 0;
199
- },
200
- setActivePreview(previewYaml, idx) {
201
- this.activePreview = previewYaml.name;
202
- this.hideValue = previewYaml.isSecret;
203
- this.activeKey = idx;
204
- },
205
155
  onCopy() {
206
156
  this.$toasted.global.success("Value copied successfully").goAway(1000);
207
157
  },
@@ -209,27 +159,22 @@ export default {
209
159
  this.$toasted.global.error("Copying failed").goAway(1000);
210
160
  },
211
161
  decode(str) {
212
- if (str && this.hideValue === false) return str.content;
162
+ if (str && this.toggleHideValue === false) return str.content;
213
163
  else return "";
214
164
  },
215
165
  encode(str) {
216
- if (str && this.hideValue === false) return str.content;
166
+ if (str && this.toggleHideValue === false) return str.content;
217
167
  else return "";
218
168
  },
219
169
  confirmDelete(flag) {
220
170
  if (flag) this.$emit("deleteResource", this.activeKey);
171
+ },
172
+ setActiveKey(key) {
173
+ this.activeKey = key;
174
+ this.toggleHideValue = this.activeFile.isSecret;
221
175
  }
222
176
  },
223
177
  watch: {
224
- previewYamls: {
225
- deep: true,
226
- immediate: true,
227
- handler(n) {
228
- if (n.length) {
229
- this.initActivePreview();
230
- }
231
- }
232
- },
233
178
  deleteModalStatus(n) {
234
179
  if (n === "closed") this.showDeleteDataModal = false;
235
180
  }
@@ -1,7 +1,11 @@
1
1
  <template>
2
2
  <div v-if="isLoaderActive" ref="cellLoaderDiv" :style="{ maxWidth: '300px' }">
3
- <content-loader :height="10" :width="computedCellWidth || 300" :primaryColor="primaryColor"
4
- :secondaryColor="secondaryColor" />
3
+ <content-loader
4
+ :height="10"
5
+ :width="computedCellWidth || 300"
6
+ :primaryColor="primaryColor"
7
+ :secondaryColor="secondaryColor"
8
+ />
5
9
  </div>
6
10
  <div v-else class="haha" ref="cellDiv">
7
11
  <object-cell
@@ -17,7 +21,7 @@
17
21
  :max-character-length="maxCharacterLength"
18
22
  />
19
23
  <template v-else>
20
- <span class="is-ellipsis-1" :title="value">{{
24
+ <span class="is-ellipsis-1" :title="tooltip">{{
21
25
  value || (value === 0 ? 0 : "-")
22
26
  }}</span>
23
27
  </template>
@@ -25,7 +29,12 @@
25
29
  </template>
26
30
 
27
31
  <script>
28
- import {loaderLightThemePrimaryColor, loaderDarkThemePrimaryColor, loaderLightThemeSecondaryColor, loaderDarkThemeSecondaryColor} from "@appscode/design-system/plugins/theme";
32
+ import {
33
+ loaderLightThemePrimaryColor,
34
+ loaderDarkThemePrimaryColor,
35
+ loaderLightThemeSecondaryColor,
36
+ loaderDarkThemeSecondaryColor,
37
+ } from "@appscode/design-system/plugins/theme";
29
38
 
30
39
  export default {
31
40
  props: {
@@ -41,6 +50,10 @@ export default {
41
50
  type: null,
42
51
  default: "",
43
52
  },
53
+ tooltip: {
54
+ type: String,
55
+ defualt: "",
56
+ },
44
57
  },
45
58
  components: {
46
59
  ContentLoader: () =>
@@ -60,11 +73,15 @@ export default {
60
73
  return Math.ceil(this.computedCellWidth / 8);
61
74
  },
62
75
  primaryColor() {
63
- return document.documentElement.classList.contains("is-dark-theme") ? loaderDarkThemePrimaryColor : loaderLightThemePrimaryColor;
76
+ return document.documentElement.classList.contains("is-dark-theme")
77
+ ? loaderDarkThemePrimaryColor
78
+ : loaderLightThemePrimaryColor;
64
79
  },
65
80
  secondaryColor() {
66
- return document.documentElement.classList.contains("is-dark-theme") ? loaderDarkThemeSecondaryColor : loaderLightThemeSecondaryColor;
67
- }
81
+ return document.documentElement.classList.contains("is-dark-theme")
82
+ ? loaderDarkThemeSecondaryColor
83
+ : loaderLightThemeSecondaryColor;
84
+ },
68
85
  },
69
86
 
70
87
  data() {
@@ -22,7 +22,7 @@
22
22
  :max-character-length="maxCharacterLength"
23
23
  />
24
24
  <template v-else>
25
- <span class="is-ellipsis-1" :title="value">{{
25
+ <span class="is-ellipsis-1" :title="tooltip">{{
26
26
  value || (value === 0 ? 0 : "-")
27
27
  }}</span>
28
28
  </template>
@@ -31,7 +31,12 @@
31
31
 
32
32
  <script>
33
33
  import { defineComponent, defineAsyncComponent } from "vue";
34
- import { loaderLightThemePrimaryColor, loaderDarkThemePrimaryColor, loaderLightThemeSecondaryColor, loaderDarkThemeSecondaryColor } from "@appscode/design-system/plugins/theme";
34
+ import {
35
+ loaderLightThemePrimaryColor,
36
+ loaderDarkThemePrimaryColor,
37
+ loaderLightThemeSecondaryColor,
38
+ loaderDarkThemeSecondaryColor,
39
+ } from "@appscode/design-system/plugins/theme";
35
40
 
36
41
  export default defineComponent({
37
42
  props: {
@@ -47,6 +52,10 @@ export default defineComponent({
47
52
  type: null,
48
53
  default: "",
49
54
  },
55
+ tooltip: {
56
+ type: String,
57
+ defualt: "",
58
+ },
50
59
  },
51
60
  components: {
52
61
  ContentLoader: defineAsyncComponent(() =>
@@ -71,11 +80,15 @@ export default defineComponent({
71
80
  return Math.ceil(this.computedCellWidth / 8);
72
81
  },
73
82
  primaryColor() {
74
- return document.documentElement.classList.contains("is-dark-theme") ? loaderDarkThemePrimaryColor : loaderLightThemePrimaryColor;
83
+ return document.documentElement.classList.contains("is-dark-theme")
84
+ ? loaderDarkThemePrimaryColor
85
+ : loaderLightThemePrimaryColor;
75
86
  },
76
87
  secondaryColor() {
77
- return document.documentElement.classList.contains("is-dark-theme") ? loaderDarkThemeSecondaryColor : loaderLightThemeSecondaryColor;
78
- }
88
+ return document.documentElement.classList.contains("is-dark-theme")
89
+ ? loaderDarkThemeSecondaryColor
90
+ : loaderLightThemeSecondaryColor;
91
+ },
79
92
  },
80
93
 
81
94
  data() {