@appscode/design-system 1.0.43-alpha.72 → 1.0.43-alpha.76
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/base/utilities/dark-theme.scss +1 -1
- package/components/_ac-options.scss +7 -6
- package/package.json +1 -1
- package/vue-components/v2/editor/Editor.vue +7 -1
- package/vue-components/v2/modal/Modal.vue +10 -1
- package/vue-components/v2/sidebar/ClusterSwitcher.vue +173 -0
- package/vue-components/v3/editor/Editor.vue +7 -1
- package/vue-components/v3/modal/Modal.vue +10 -1
- package/vue-components/v3/sidebar/ClusterSwitcher.vue +173 -0
|
@@ -56,13 +56,14 @@
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
.options-items {
|
|
59
|
-
box-shadow: $ac-shadow-1;
|
|
60
59
|
border-radius: 4px;
|
|
61
60
|
position: absolute;
|
|
62
61
|
z-index: 99;
|
|
63
62
|
background-color: $ac-white;
|
|
64
63
|
min-width: 160px;
|
|
65
64
|
top: 30px;
|
|
65
|
+
padding: 5px 0;
|
|
66
|
+
border: 1px solid $ac-white-light;
|
|
66
67
|
|
|
67
68
|
li {
|
|
68
69
|
.list-button {
|
|
@@ -78,8 +79,8 @@
|
|
|
78
79
|
display: block;
|
|
79
80
|
|
|
80
81
|
&:hover {
|
|
81
|
-
background-color: $ac-
|
|
82
|
-
color: $ac-
|
|
82
|
+
background-color: $ac-bg-light-gray;
|
|
83
|
+
color: $ac-primary;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
span {
|
|
@@ -93,14 +94,14 @@
|
|
|
93
94
|
|
|
94
95
|
a {
|
|
95
96
|
font-size: $font-size-small;
|
|
96
|
-
padding: 10px
|
|
97
|
+
padding: 10px 15px;
|
|
97
98
|
display: block;
|
|
98
99
|
text-decoration: none !important;
|
|
99
100
|
color: $ac-color-text !important;
|
|
100
101
|
|
|
101
102
|
&:hover {
|
|
102
|
-
background-color: $ac-
|
|
103
|
-
color: $ac-
|
|
103
|
+
background-color: $ac-bg-light-gray;
|
|
104
|
+
color: $ac-primary !important;
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
}
|
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
theme: theme,
|
|
21
21
|
readOnly: readOnly,
|
|
22
|
+
wordWrap: wordWrap,
|
|
22
23
|
scrollBeyondLastLine: false
|
|
23
24
|
}"
|
|
24
25
|
/>
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
},
|
|
35
36
|
theme: theme,
|
|
36
37
|
readOnly: true,
|
|
38
|
+
wordWrap: wordWrap,
|
|
37
39
|
scrollBeyondLastLine: false
|
|
38
40
|
}"
|
|
39
41
|
:original="originalEditorContent"
|
|
@@ -72,7 +74,11 @@ export default {
|
|
|
72
74
|
editorTheme: {
|
|
73
75
|
type: String,
|
|
74
76
|
default: ""
|
|
75
|
-
}
|
|
77
|
+
},
|
|
78
|
+
wordWrap: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: "off"
|
|
81
|
+
},
|
|
76
82
|
},
|
|
77
83
|
components: {
|
|
78
84
|
EditorTabs: () => import("../tabs/EditorTabs.vue"),
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
<header-item>
|
|
18
18
|
<ac-button
|
|
19
19
|
modifier-classes="is-square is-transparent"
|
|
20
|
+
:disabled="isCloseOptionDisabled"
|
|
20
21
|
:icon-image="require('@/assets/images/icons/close-icon.svg')"
|
|
21
22
|
@click.stop="destroyModal"
|
|
22
23
|
/>
|
|
@@ -36,7 +37,10 @@
|
|
|
36
37
|
<!-- modal body end -->
|
|
37
38
|
|
|
38
39
|
<!-- modal footer start -->
|
|
39
|
-
<div class="ac-modal-footer action-footer">
|
|
40
|
+
<div class="ac-modal-footer action-footer is-flex is-align-items-center is-justify-content-space-between">
|
|
41
|
+
<div>
|
|
42
|
+
<slot name="modal-footer-left" />
|
|
43
|
+
</div>
|
|
40
44
|
<buttons class="has-text-right is-block">
|
|
41
45
|
<slot name="modal-footer-controls" />
|
|
42
46
|
</buttons>
|
|
@@ -62,6 +66,10 @@ export default {
|
|
|
62
66
|
type: String,
|
|
63
67
|
default: "",
|
|
64
68
|
},
|
|
69
|
+
isCloseOptionDisabled: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false,
|
|
72
|
+
}
|
|
65
73
|
},
|
|
66
74
|
|
|
67
75
|
components: {
|
|
@@ -102,6 +110,7 @@ export default {
|
|
|
102
110
|
document.addEventListener("keydown", this.onKeyDown);
|
|
103
111
|
},
|
|
104
112
|
destroyModal() {
|
|
113
|
+
if (this.isCloseOptionDisabled) return;
|
|
105
114
|
this.showModal = false;
|
|
106
115
|
document.removeEventListener("keydown", this.onKeyDown);
|
|
107
116
|
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="is-cluster-logo" v-if="sidebarCollapsed">
|
|
3
|
+
<img
|
|
4
|
+
width="40"
|
|
5
|
+
:src="getProviderIcon(selectedCluster && selectedCluster.provider)"
|
|
6
|
+
alt=""
|
|
7
|
+
/>
|
|
8
|
+
</div>
|
|
9
|
+
<multiselect
|
|
10
|
+
v-else
|
|
11
|
+
v-model="selectedCluster"
|
|
12
|
+
placeholder="Selected Cluster"
|
|
13
|
+
label="name"
|
|
14
|
+
track-by="uid"
|
|
15
|
+
:options="options"
|
|
16
|
+
:allow-empty="false"
|
|
17
|
+
deselectLabel=""
|
|
18
|
+
selectLabel=""
|
|
19
|
+
selectedLabel=""
|
|
20
|
+
>
|
|
21
|
+
<template slot="singleLabel" slot-scope="props">
|
|
22
|
+
<div class="is-flex is-align-items-center">
|
|
23
|
+
<img
|
|
24
|
+
:src="getProviderIcon(props.option.provider)"
|
|
25
|
+
alt="No cluster selected"
|
|
26
|
+
/><span
|
|
27
|
+
><span>{{ props.option.displayName }}</span></span
|
|
28
|
+
>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
<template slot="option" slot-scope="props">
|
|
32
|
+
<div class="is-flex is-align-items-center">
|
|
33
|
+
<img
|
|
34
|
+
class="mr-15"
|
|
35
|
+
:src="getProviderIcon(props.option.provider)"
|
|
36
|
+
alt="No cluster selected"
|
|
37
|
+
/>
|
|
38
|
+
<div>
|
|
39
|
+
<p>{{ props.option.displayName }}</p>
|
|
40
|
+
<p class="location">{{ props.option.location }}</p>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
</multiselect>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
import { mapGetters } from "vuex";
|
|
49
|
+
export default {
|
|
50
|
+
props: {
|
|
51
|
+
sidebarCollapsed: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false,
|
|
54
|
+
},
|
|
55
|
+
mouseHover: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false,
|
|
58
|
+
},
|
|
59
|
+
username: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "",
|
|
62
|
+
},
|
|
63
|
+
imagePath: {
|
|
64
|
+
type: Object,
|
|
65
|
+
default: () => ({}),
|
|
66
|
+
},
|
|
67
|
+
value: {
|
|
68
|
+
type: Object,
|
|
69
|
+
default: () => ({}),
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
components: {
|
|
74
|
+
Multiselect: () => import("vue-multiselect"),
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
data() {
|
|
78
|
+
return {
|
|
79
|
+
selectedCluster: null,
|
|
80
|
+
clusters: [],
|
|
81
|
+
options: [],
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
computed: {
|
|
86
|
+
selectClusterOptions() {
|
|
87
|
+
return this.clusters
|
|
88
|
+
.filter(
|
|
89
|
+
(cluster) =>
|
|
90
|
+
cluster.status.phase === "Connected" ||
|
|
91
|
+
cluster.status.phase === "PrivateConnected"
|
|
92
|
+
)
|
|
93
|
+
.map((cluster) => {
|
|
94
|
+
return {
|
|
95
|
+
name: cluster.spec.name,
|
|
96
|
+
displayName: cluster.spec.displayName,
|
|
97
|
+
provider: cluster.spec.provider,
|
|
98
|
+
uid: cluster.spec.uid,
|
|
99
|
+
location: cluster.spec.location,
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
methods: {
|
|
106
|
+
async checkStatus(clusterName) {
|
|
107
|
+
try {
|
|
108
|
+
await this.$axios.get(
|
|
109
|
+
`/clusters/${this.username}/${clusterName}/status`
|
|
110
|
+
);
|
|
111
|
+
return true;
|
|
112
|
+
} catch (err) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
async getClusters() {
|
|
117
|
+
if (this.username) {
|
|
118
|
+
const url = `/clusters/${this.username}`;
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
const resp = await this.$axios.get(url);
|
|
122
|
+
this.clusters = (resp.data && resp.data.items) || [];
|
|
123
|
+
|
|
124
|
+
// preselect the cluster
|
|
125
|
+
const selectedCluster = this.clusters.find(
|
|
126
|
+
(cluster) => cluster.spec.name === this.$route.params.cluster
|
|
127
|
+
);
|
|
128
|
+
this.selectedCluster = {
|
|
129
|
+
name: selectedCluster.spec.name,
|
|
130
|
+
displayName: selectedCluster.spec.displayName,
|
|
131
|
+
provider: selectedCluster.spec.provider,
|
|
132
|
+
uid: selectedCluster.spec.uid,
|
|
133
|
+
location: selectedCluster.spec.location,
|
|
134
|
+
};
|
|
135
|
+
} catch (e) {
|
|
136
|
+
console.log(e);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
getProviderIcon(provider) {
|
|
142
|
+
return this.imagePath[provider] || this.imagePath["default"];
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
created() {
|
|
147
|
+
this.getClusters();
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
watch: {
|
|
151
|
+
value: {
|
|
152
|
+
deep: true,
|
|
153
|
+
immediate: true,
|
|
154
|
+
handler(n) {
|
|
155
|
+
this.selectedCluster = n;
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
selectClusterOptions: {
|
|
159
|
+
deep: true,
|
|
160
|
+
immediate: true,
|
|
161
|
+
async handler(list) {
|
|
162
|
+
this.options = [];
|
|
163
|
+
if (list) {
|
|
164
|
+
list.forEach(async (item) => {
|
|
165
|
+
const resp = await this.checkStatus(item.name);
|
|
166
|
+
if (resp) this.options.push(item);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
</script>
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
theme: theme,
|
|
22
22
|
readOnly: readOnly,
|
|
23
|
+
wordWrap: wordWrap,
|
|
23
24
|
scrollBeyondLastLine: false
|
|
24
25
|
}"
|
|
25
26
|
/>
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
},
|
|
36
37
|
theme: theme,
|
|
37
38
|
readOnly: true,
|
|
39
|
+
wordWrap: wordWrap,
|
|
38
40
|
scrollBeyondLastLine: false
|
|
39
41
|
}"
|
|
40
42
|
:original="originalEditorContent"
|
|
@@ -74,7 +76,11 @@ export default defineComponent({
|
|
|
74
76
|
editorTheme: {
|
|
75
77
|
type: String,
|
|
76
78
|
default: ""
|
|
77
|
-
}
|
|
79
|
+
},
|
|
80
|
+
wordWrap: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: "off"
|
|
83
|
+
},
|
|
78
84
|
},
|
|
79
85
|
|
|
80
86
|
emits: ["update:modelValue"],
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
<header-item>
|
|
18
18
|
<ac-button
|
|
19
19
|
modifier-classes="is-square is-transparent"
|
|
20
|
+
:disabled="isCloseOptionDisabled"
|
|
20
21
|
:icon-image="crossIcon"
|
|
21
22
|
@click.stop="destroyModal"
|
|
22
23
|
/>
|
|
@@ -36,7 +37,10 @@
|
|
|
36
37
|
<!-- modal body end -->
|
|
37
38
|
|
|
38
39
|
<!-- modal footer start -->
|
|
39
|
-
<div class="ac-modal-footer action-footer">
|
|
40
|
+
<div class="ac-modal-footer action-footer is-flex is-align-items-center is-justify-content-space-between">
|
|
41
|
+
<div>
|
|
42
|
+
<slot name="modal-footer-left" />
|
|
43
|
+
</div>
|
|
40
44
|
<buttons class="has-text-right is-block">
|
|
41
45
|
<slot name="modal-footer-controls" />
|
|
42
46
|
</buttons>
|
|
@@ -64,6 +68,10 @@ export default defineComponent({
|
|
|
64
68
|
type: String,
|
|
65
69
|
default: "",
|
|
66
70
|
},
|
|
71
|
+
isCloseOptionDisabled: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false,
|
|
74
|
+
}
|
|
67
75
|
},
|
|
68
76
|
emits: ["closemodal"],
|
|
69
77
|
|
|
@@ -116,6 +124,7 @@ export default defineComponent({
|
|
|
116
124
|
document.addEventListener("keydown", this.onKeyDown);
|
|
117
125
|
},
|
|
118
126
|
destroyModal() {
|
|
127
|
+
if (this.isCloseOptionDisabled) return;
|
|
119
128
|
this.showModal = false;
|
|
120
129
|
document.removeEventListener("keydown", this.onKeyDown);
|
|
121
130
|
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="is-cluster-logo" v-if="sidebarCollapsed">
|
|
3
|
+
<img
|
|
4
|
+
width="40"
|
|
5
|
+
:src="getProviderIcon(selectedCluster && selectedCluster.provider)"
|
|
6
|
+
alt=""
|
|
7
|
+
/>
|
|
8
|
+
</div>
|
|
9
|
+
<multiselect
|
|
10
|
+
v-else
|
|
11
|
+
v-model="selectedCluster"
|
|
12
|
+
placeholder="Selected Cluster"
|
|
13
|
+
label="name"
|
|
14
|
+
track-by="uid"
|
|
15
|
+
:options="options"
|
|
16
|
+
:allow-empty="false"
|
|
17
|
+
deselectLabel=""
|
|
18
|
+
selectLabel=""
|
|
19
|
+
selectedLabel=""
|
|
20
|
+
>
|
|
21
|
+
<template slot="singleLabel" slot-scope="props">
|
|
22
|
+
<div class="is-flex is-align-items-center">
|
|
23
|
+
<img
|
|
24
|
+
:src="getProviderIcon(props.option.provider)"
|
|
25
|
+
alt="No cluster selected"
|
|
26
|
+
/><span
|
|
27
|
+
><span>{{ props.option.displayName }}</span></span
|
|
28
|
+
>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
<template slot="option" slot-scope="props">
|
|
32
|
+
<div class="is-flex is-align-items-center">
|
|
33
|
+
<img
|
|
34
|
+
class="mr-15"
|
|
35
|
+
:src="getProviderIcon(props.option.provider)"
|
|
36
|
+
alt="No cluster selected"
|
|
37
|
+
/>
|
|
38
|
+
<div>
|
|
39
|
+
<p>{{ props.option.displayName }}</p>
|
|
40
|
+
<p class="location">{{ props.option.location }}</p>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
</multiselect>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
import { defineComponent, defineAsyncComponent } from "vue";
|
|
49
|
+
export default defineComponent({
|
|
50
|
+
props: {
|
|
51
|
+
sidebarCollapsed: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false,
|
|
54
|
+
},
|
|
55
|
+
mouseHover: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false,
|
|
58
|
+
},
|
|
59
|
+
username: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "",
|
|
62
|
+
},
|
|
63
|
+
imagePath: {
|
|
64
|
+
type: Object,
|
|
65
|
+
default: () => ({}),
|
|
66
|
+
},
|
|
67
|
+
value: {
|
|
68
|
+
type: Object,
|
|
69
|
+
default: () => ({}),
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
components: {
|
|
74
|
+
Multiselect: () => import("vue-multiselect"),
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
data() {
|
|
78
|
+
return {
|
|
79
|
+
selectedCluster: null,
|
|
80
|
+
clusters: [],
|
|
81
|
+
options: [],
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
computed: {
|
|
86
|
+
selectClusterOptions() {
|
|
87
|
+
return this.clusters
|
|
88
|
+
.filter(
|
|
89
|
+
(cluster) =>
|
|
90
|
+
cluster.status.phase === "Connected" ||
|
|
91
|
+
cluster.status.phase === "PrivateConnected"
|
|
92
|
+
)
|
|
93
|
+
.map((cluster) => {
|
|
94
|
+
return {
|
|
95
|
+
name: cluster.spec.name,
|
|
96
|
+
displayName: cluster.spec.displayName,
|
|
97
|
+
provider: cluster.spec.provider,
|
|
98
|
+
uid: cluster.spec.uid,
|
|
99
|
+
location: cluster.spec.location,
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
methods: {
|
|
106
|
+
async checkStatus(clusterName) {
|
|
107
|
+
try {
|
|
108
|
+
await this.$axios.get(
|
|
109
|
+
`/clusters/${this.username}/${clusterName}/status`
|
|
110
|
+
);
|
|
111
|
+
return true;
|
|
112
|
+
} catch (err) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
async getClusters() {
|
|
117
|
+
if (this.username) {
|
|
118
|
+
const url = `/clusters/${this.username}`;
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
const resp = await this.$axios.get(url);
|
|
122
|
+
this.clusters = (resp.data && resp.data.items) || [];
|
|
123
|
+
|
|
124
|
+
// preselect the cluster
|
|
125
|
+
const selectedCluster = this.clusters.find(
|
|
126
|
+
(cluster) => cluster.spec.name === this.$route.params.cluster
|
|
127
|
+
);
|
|
128
|
+
this.selectedCluster = {
|
|
129
|
+
name: selectedCluster.spec.name,
|
|
130
|
+
displayName: selectedCluster.spec.displayName,
|
|
131
|
+
provider: selectedCluster.spec.provider,
|
|
132
|
+
uid: selectedCluster.spec.uid,
|
|
133
|
+
location: selectedCluster.spec.location,
|
|
134
|
+
};
|
|
135
|
+
} catch (e) {
|
|
136
|
+
console.log(e);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
getProviderIcon(provider) {
|
|
142
|
+
return this.imagePath[provider] || this.imagePath["default"];
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
created() {
|
|
147
|
+
this.getClusters();
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
watch: {
|
|
151
|
+
value: {
|
|
152
|
+
deep: true,
|
|
153
|
+
immediate: true,
|
|
154
|
+
handler(n) {
|
|
155
|
+
this.selectedCluster = n;
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
selectClusterOptions: {
|
|
159
|
+
deep: true,
|
|
160
|
+
immediate: true,
|
|
161
|
+
async handler(list) {
|
|
162
|
+
this.options = [];
|
|
163
|
+
if (list) {
|
|
164
|
+
list.forEach(async (item) => {
|
|
165
|
+
const resp = await this.checkStatus(item.name);
|
|
166
|
+
if (resp) this.options.push(item);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
</script>
|