@nethserver/ns8-ui-lib 0.0.45 → 0.0.49

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": "@nethserver/ns8-ui-lib",
3
- "version": "0.0.45",
3
+ "version": "0.0.49",
4
4
  "description": "Vue.js library for NethServer 8 UI",
5
5
  "keywords": [
6
6
  "nethserver",
@@ -27,121 +27,83 @@
27
27
  </div>
28
28
  </template>
29
29
  <template v-else>
30
- <div v-for="backup in backupsContainingInstance" :key="backup.id">
31
- <div class="row">
32
- <h5
33
- v-if="backupsContainingInstance.length > 1"
34
- class="title mg-top-sm"
35
- >
36
- {{ backup.name }}
37
- </h5>
38
- </div>
39
- <div class="table-wrapper">
40
- <div class="table">
41
- <!-- status -->
42
- <div class="tr">
43
- <div class="td label">{{ statusLabel }}</div>
44
- <div class="td status">
45
- <span v-if="!backup.enabled" class="ns-warning">
46
- {{ backupDisabledLabel }}
47
- </span>
48
- <span
49
- v-else-if="
50
- status[backup.id] && status[backup.id].success == true
51
- "
52
- class="ns-success"
53
- >
54
- <span>{{ statusSuccessLabel }}</span>
55
- </span>
56
- <span
57
- v-else-if="
58
- status[backup.id] && status[backup.id].success == false
59
- "
60
- class="ns-error"
61
- >
62
- {{ statusErrorLabel }}
63
- </span>
64
- <span v-else class="ns-warning">
65
- {{ statusNotRunLabel }}
66
- </span>
67
- </div>
68
- </div>
69
- <!-- repository -->
70
- <div class="tr">
71
- <div class="td label">{{ repositoryLabel }}</div>
72
- <div class="td">
73
- {{ backup.repoName }}
74
- </div>
75
- </div>
76
- <!-- completed -->
77
- <div class="tr">
78
- <div class="td label">{{ completedLabel }}</div>
79
- <div class="td">
80
- <span v-if="status[backup.id] && status[backup.id].end">
81
- <cv-tooltip
82
- alignment="center"
83
- direction="bottom"
84
- :tip="
85
- (status[backup.id].end * 1000)
86
- | date('yyyy-MM-dd HH:mm:ss')
30
+ <div class="backups">
31
+ <div
32
+ v-for="backup in backupsContainingInstance"
33
+ :key="backup.id"
34
+ class="backup"
35
+ >
36
+ <div class="row">
37
+ <h5
38
+ v-if="backupsContainingInstance.length > 1"
39
+ class="title mg-top-sm"
40
+ >
41
+ {{ backup.name }}
42
+ </h5>
43
+ </div>
44
+ <div class="table-wrapper">
45
+ <div class="table">
46
+ <!-- status -->
47
+ <div class="tr">
48
+ <div class="td label">{{ statusLabel }}</div>
49
+ <div class="td status">
50
+ <span v-if="!backup.enabled" class="ns-warning">
51
+ {{ backupDisabledLabel }}
52
+ </span>
53
+ <span
54
+ v-else-if="
55
+ status[backup.id] && status[backup.id].success == true
87
56
  "
88
- class="info tooltip-with-text-trigger"
57
+ class="ns-success"
89
58
  >
90
- {{
91
- formatDateDistance(
92
- status[backup.id].end * 1000,
93
- new Date(),
94
- {
95
- addSuffix: true,
96
- }
97
- )
98
- }}
99
- </cv-tooltip>
100
- </span>
101
- <span v-else>-</span>
102
- </div>
103
- </div>
104
- <!-- duration -->
105
- <div class="tr">
106
- <div class="td label">{{ durationLabel }}</div>
107
- <div class="td">
108
- <span
109
- v-if="
110
- status[backup.id] &&
111
- status[backup.id].end &&
112
- status[backup.id].start
113
- "
114
- >
115
- {{
116
- (status[backup.id].end - status[backup.id].start)
117
- | secondsFormat
118
- }}
119
- </span>
120
- <span v-else>-</span>
121
- </div>
122
- </div>
123
- <!-- total size -->
124
- <div class="tr">
125
- <div class="td label">{{ totalSizeLabel }}</div>
126
- <div class="td">
127
- <span v-if="status[backup.id] && status[backup.id].total_size">
128
- {{ status[backup.id].total_size | byteFormat }}
129
- </span>
130
- <span v-else>-</span>
59
+ <span>{{ statusSuccessLabel }}</span>
60
+ </span>
61
+ <span
62
+ v-else-if="
63
+ status[backup.id] && status[backup.id].success == false
64
+ "
65
+ class="ns-error"
66
+ >
67
+ {{ statusErrorLabel }}
68
+ </span>
69
+ <span v-else class="ns-warning">
70
+ {{ statusNotRunLabel }}
71
+ </span>
72
+ </div>
131
73
  </div>
74
+ <NsBackupCardDetails
75
+ v-if="backupsContainingInstance.length == 1"
76
+ :backup="backup"
77
+ :status="status"
78
+ :repositoryLabel="repositoryLabel"
79
+ :completedLabel="completedLabel"
80
+ :durationLabel="durationLabel"
81
+ :totalSizeLabel="totalSizeLabel"
82
+ :totalFileCountLabel="totalFileCountLabel"
83
+ />
132
84
  </div>
133
- <!-- total file count -->
134
- <div class="tr">
135
- <div class="td label">{{ totalFileCountLabel }}</div>
136
- <div class="td">
137
- <span
138
- v-if="status[backup.id] && status[backup.id].total_file_count"
139
- >
140
- {{ status[backup.id].total_file_count | humanFormat }}
141
- ({{ status[backup.id].total_file_count }})
142
- </span>
143
- <span v-else>-</span>
144
- </div>
85
+ </div>
86
+ <div class="table-wrapper">
87
+ <div class="table">
88
+ <cv-accordion
89
+ v-if="backupsContainingInstance.length > 1"
90
+ ref="accordion"
91
+ >
92
+ <cv-accordion-item :open="toggleAccordion[0]">
93
+ <template slot="title">{{ showMoreLabel }}</template>
94
+ <template slot="content">
95
+ <NsBackupCardDetails
96
+ :backup="backup"
97
+ :status="status"
98
+ :repositoryLabel="repositoryLabel"
99
+ :completedLabel="completedLabel"
100
+ :durationLabel="durationLabel"
101
+ :totalSizeLabel="totalSizeLabel"
102
+ :totalFileCountLabel="totalFileCountLabel"
103
+ />
104
+ </template>
105
+ </cv-accordion-item>
106
+ </cv-accordion>
145
107
  </div>
146
108
  </div>
147
109
  </div>
@@ -163,11 +125,13 @@
163
125
 
164
126
  <script>
165
127
  import IconService from "../lib-mixins/icon.js";
166
- import DateTimeService from "../lib-mixins/dateTime.js";
167
-
128
+ import UtilService from "../lib-mixins/util.js";
129
+ // import DateTimeService from "../lib-mixins/dateTime.js"; ////
130
+ import NsBackupCardDetails from "./NsBackupCardDetails";
168
131
  export default {
169
132
  name: "NsBackupCard",
170
- mixins: [IconService, DateTimeService],
133
+ components: { NsBackupCardDetails },
134
+ mixins: [IconService, UtilService],
171
135
  props: {
172
136
  title: {
173
137
  type: String,
@@ -225,6 +189,10 @@ export default {
225
189
  type: String,
226
190
  default: "Disabled",
227
191
  },
192
+ showMoreLabel: {
193
+ type: String,
194
+ default: "Show more",
195
+ },
228
196
  moduleId: {
229
197
  type: String,
230
198
  required: true,
@@ -307,6 +275,14 @@ export default {
307
275
  min-height: 7rem;
308
276
  }
309
277
 
278
+ .backup {
279
+ margin-bottom: 1rem;
280
+ }
281
+
282
+ .backup:last-child {
283
+ margin-bottom: 0;
284
+ }
285
+
310
286
  .row {
311
287
  display: flex;
312
288
  align-items: center;
@@ -355,3 +331,11 @@ export default {
355
331
  margin-right: 0.25rem;
356
332
  }
357
333
  </style>
334
+
335
+ <style lang="scss">
336
+ // global styles
337
+
338
+ .ns-backup-card .bx--accordion--start .bx--accordion__content {
339
+ margin-left: 0;
340
+ }
341
+ </style>
@@ -0,0 +1,136 @@
1
+ <template>
2
+ <div class="ns-backup-card-details">
3
+ <!-- repository -->
4
+ <div class="tr">
5
+ <div class="td label">{{ repositoryLabel }}</div>
6
+ <div class="td">
7
+ {{ backup.repoName }}
8
+ </div>
9
+ </div>
10
+ <!-- completed -->
11
+ <div class="tr">
12
+ <div class="td label">{{ completedLabel }}</div>
13
+ <div class="td">
14
+ <span v-if="status[backup.id] && status[backup.id].end">
15
+ <cv-interactive-tooltip
16
+ alignment="center"
17
+ direction="bottom"
18
+ class="info tooltip-with-text-trigger"
19
+ >
20
+ <template slot="trigger">
21
+ {{
22
+ formatDateDistance(status[backup.id].end * 1000, new Date(), {
23
+ addSuffix: true,
24
+ })
25
+ }}
26
+ </template>
27
+ <template slot="content">
28
+ {{ (status[backup.id].end * 1000) | date("yyyy-MM-dd HH:mm:ss") }}
29
+ </template>
30
+ </cv-interactive-tooltip>
31
+ </span>
32
+ <span v-else>-</span>
33
+ </div>
34
+ </div>
35
+ <!-- duration -->
36
+ <div class="tr">
37
+ <div class="td label">{{ durationLabel }}</div>
38
+ <div class="td">
39
+ <span
40
+ v-if="
41
+ status[backup.id] &&
42
+ status[backup.id].end &&
43
+ status[backup.id].start
44
+ "
45
+ >
46
+ {{
47
+ (status[backup.id].end - status[backup.id].start) | secondsFormat
48
+ }}
49
+ </span>
50
+ <span v-else>-</span>
51
+ </div>
52
+ </div>
53
+ <!-- total size -->
54
+ <div class="tr">
55
+ <div class="td label">{{ totalSizeLabel }}</div>
56
+ <div class="td">
57
+ <span v-if="status[backup.id] && status[backup.id].total_size">
58
+ {{ status[backup.id].total_size | byteFormat }}
59
+ </span>
60
+ <span v-else>-</span>
61
+ </div>
62
+ </div>
63
+ <!-- total file count -->
64
+ <div class="tr">
65
+ <div class="td label">{{ totalFileCountLabel }}</div>
66
+ <div class="td">
67
+ <span v-if="status[backup.id] && status[backup.id].total_file_count">
68
+ {{ status[backup.id].total_file_count | humanFormat }}
69
+ ({{ status[backup.id].total_file_count }})
70
+ </span>
71
+ <span v-else>-</span>
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </template>
76
+
77
+ <script>
78
+ import DateTimeService from "../lib-mixins/dateTime.js";
79
+
80
+ export default {
81
+ name: "NsBackupCardDetails",
82
+ mixins: [DateTimeService],
83
+ props: {
84
+ backup: {
85
+ type: Object,
86
+ required: true,
87
+ },
88
+ status: {
89
+ type: Array,
90
+ required: true,
91
+ },
92
+ repositoryLabel: {
93
+ type: String,
94
+ default: "Repository",
95
+ },
96
+ completedLabel: {
97
+ type: String,
98
+ required: true,
99
+ },
100
+ durationLabel: {
101
+ type: String,
102
+ required: true,
103
+ },
104
+ totalSizeLabel: {
105
+ type: String,
106
+ required: true,
107
+ },
108
+ totalFileCountLabel: {
109
+ type: String,
110
+ required: true,
111
+ },
112
+ },
113
+ };
114
+ </script>
115
+
116
+ <style scoped lang="scss">
117
+ .ns-backup-card-details {
118
+ // do not render root div, only table rows
119
+ display: contents;
120
+ }
121
+
122
+ .tr {
123
+ display: table-row;
124
+ }
125
+
126
+ .td {
127
+ display: table-cell;
128
+ }
129
+
130
+ .label {
131
+ padding-right: 0.75rem;
132
+ font-weight: bold;
133
+ text-align: right;
134
+ padding-bottom: 0.5rem;
135
+ }
136
+ </style>
@@ -14,7 +14,7 @@
14
14
  <slot name="pictogram"></slot>
15
15
  </template>
16
16
  <template v-else>
17
- <ExclamationMark />
17
+ <ExclamationMarkPictogram />
18
18
  </template>
19
19
  </NsPictogram>
20
20
  <h5 class="title">{{ title }}</h5>
@@ -30,11 +30,11 @@
30
30
  <script>
31
31
  import NsPictogram from "./NsPictogram.vue";
32
32
  import NsLottieAnimation from "./NsLottieAnimation";
33
- import ExclamationMark from "./pictograms/ExclamationMark";
33
+ import ExclamationMarkPictogram from "./pictograms/ExclamationMarkPictogram";
34
34
 
35
35
  export default {
36
36
  name: "NsEmptyState",
37
- components: { NsPictogram, ExclamationMark, NsLottieAnimation },
37
+ components: { NsPictogram, ExclamationMarkPictogram, NsLottieAnimation },
38
38
  props: {
39
39
  title: {
40
40
  type: String,
@@ -50,6 +50,7 @@
50
50
  `${carbonPrefix}--btn`,
51
51
  `${carbonPrefix}--btn--sm`,
52
52
  `${carbonPrefix}--btn--ghost`,
53
+ 'action-button',
53
54
  ]"
54
55
  type="button"
55
56
  >
@@ -118,6 +119,10 @@ export default {
118
119
  flex-grow: 0;
119
120
  }
120
121
 
122
+ .action-button {
123
+ margin-right: 0.5rem;
124
+ }
125
+
121
126
  // place close button on the right
122
127
  .bx--inline-notification__close-button {
123
128
  position: absolute !important;
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <cv-side-nav-divider />
3
+ </template>
4
+
5
+ <script>
6
+ import CvSideNavDivider from "@carbon/vue/src/components/cv-ui-shell/cv-side-nav-divider.vue";
7
+
8
+ export default {
9
+ name: "NsMenuDivider",
10
+ components: { CvSideNavDivider },
11
+ };
12
+ </script>
13
+
14
+ <style scoped lang="scss"></style>
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <div class="ns-menu-item">
3
+ <span v-if="icon == 'edit'" class="icon"><Edit20 /></span>
4
+ <span v-else-if="icon == 'trash'" class="icon"><TrashCan20 /></span>
5
+ <span v-else-if="icon == 'power'" class="icon"><Power20 /></span>
6
+ <span v-else-if="icon == 'rocket'" class="icon"><Rocket20 /></span>
7
+ <span v-else-if="icon == 'launch'" class="icon"><Launch20 /></span>
8
+ <span v-else-if="icon == 'star'" class="icon"><Star20 /></span>
9
+ <span v-else-if="hasIconSlot" class="icon">
10
+ <slot name="icon"></slot>
11
+ </span>
12
+ <span>{{ label }}</span>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ import Edit20 from "@carbon/icons-vue/es/edit/20";
18
+ import TrashCan20 from "@carbon/icons-vue/es/trash-can/20";
19
+ import Power20 from "@carbon/icons-vue/es/power/20";
20
+ import Rocket20 from "@carbon/icons-vue/es/rocket/20";
21
+ import Launch20 from "@carbon/icons-vue/es/launch/20";
22
+ import Star20 from "@carbon/icons-vue/es/star/20";
23
+
24
+ export default {
25
+ name: "NsMenuItem",
26
+ components: { Edit20, TrashCan20, Power20, Rocket20, Launch20, Star20 },
27
+ props: {
28
+ label: {
29
+ type: String,
30
+ required: true,
31
+ },
32
+ icon: {
33
+ type: String,
34
+ validator: (value) =>
35
+ ["", "edit", "trash", "power", "rocket", "launch", "star"].includes(
36
+ value
37
+ ),
38
+ },
39
+ },
40
+ computed: {
41
+ hasIconSlot() {
42
+ return !!this.$slots.icon;
43
+ },
44
+ },
45
+ };
46
+ </script>
47
+
48
+ <style scoped lang="scss">
49
+ .ns-menu-item {
50
+ display: flex;
51
+ align-items: center;
52
+ }
53
+
54
+ .icon {
55
+ margin-right: 0.5rem;
56
+ }
57
+ </style>
@@ -21,35 +21,55 @@
21
21
  <span
22
22
  :class="[
23
23
  'requirement',
24
- { 'requirement-ok': isLengthOk, 'requirement-light': light },
24
+ {
25
+ 'requirement-ok': isLengthOk,
26
+ 'requirement-light': light,
27
+ 'requirement-disabled': disabled,
28
+ },
25
29
  ]"
26
30
  >{{ lengthLabel }}</span
27
31
  >
28
32
  <span
29
33
  :class="[
30
34
  'requirement',
31
- { 'requirement-ok': isLowercaseOk, 'requirement-light': light },
35
+ {
36
+ 'requirement-ok': isLowercaseOk,
37
+ 'requirement-light': light,
38
+ 'requirement-disabled': disabled,
39
+ },
32
40
  ]"
33
41
  >{{ lowercaseLabel }}</span
34
42
  >
35
43
  <span
36
44
  :class="[
37
45
  'requirement',
38
- { 'requirement-ok': isUppercaseOk, 'requirement-light': light },
46
+ {
47
+ 'requirement-ok': isUppercaseOk,
48
+ 'requirement-light': light,
49
+ 'requirement-disabled': disabled,
50
+ },
39
51
  ]"
40
52
  >{{ uppercaseLabel }}</span
41
53
  >
42
54
  <span
43
55
  :class="[
44
56
  'requirement',
45
- { 'requirement-ok': isNumberOk, 'requirement-light': light },
57
+ {
58
+ 'requirement-ok': isNumberOk,
59
+ 'requirement-light': light,
60
+ 'requirement-disabled': disabled,
61
+ },
46
62
  ]"
47
63
  >{{ numberLabel }}</span
48
64
  >
49
65
  <span
50
66
  :class="[
51
67
  'requirement',
52
- { 'requirement-ok': isSymbolOk, 'requirement-light': light },
68
+ {
69
+ 'requirement-ok': isSymbolOk,
70
+ 'requirement-light': light,
71
+ 'requirement-disabled': disabled,
72
+ },
53
73
  ]"
54
74
  >{{ symbolLabel }}</span
55
75
  >
@@ -75,7 +95,11 @@
75
95
  <span
76
96
  :class="[
77
97
  'requirement',
78
- { 'requirement-ok': isEqualOk, 'requirement-light': light },
98
+ {
99
+ 'requirement-ok': isEqualOk,
100
+ 'requirement-light': light,
101
+ 'requirement-disabled': disabled,
102
+ },
79
103
  ]"
80
104
  >{{ equalLabel }}</span
81
105
  >
@@ -263,4 +287,9 @@ export default {
263
287
  color: white;
264
288
  background-color: #198038;
265
289
  }
290
+
291
+ .requirement-disabled {
292
+ color: #c6c6c6;
293
+ background-color: #f4f4f4;
294
+ }
266
295
  </style>
@@ -24,7 +24,7 @@
24
24
  <cv-interactive-tooltip
25
25
  :alignment="tooltipAlignment"
26
26
  :direction="tooltipDirection"
27
- class="tooltip"
27
+ class="tooltip info"
28
28
  >
29
29
  <template slot="content">
30
30
  <slot name="tooltip"></slot>
@@ -6,6 +6,7 @@
6
6
  { [`${carbonPrefix}--tile--light`]: isLight },
7
7
  'ns-tile',
8
8
  { 'pad-bottom': footerIcon },
9
+ { 'disabled-tile': disabled },
9
10
  ]"
10
11
  :checked="selected"
11
12
  :expanded="expanded"
@@ -75,9 +76,15 @@ export default {
75
76
  centered: Boolean,
76
77
  large: Boolean,
77
78
  light: Boolean,
79
+ disabled: Boolean,
78
80
  },
79
81
  computed: {
80
82
  tagType() {
83
+ if (this.disabled) {
84
+ // not selectable nor clickable
85
+ return "cv-tile-standard";
86
+ }
87
+
81
88
  switch (this.kind) {
82
89
  case "clickable":
83
90
  return "cv-tile-clickable";
@@ -129,4 +136,8 @@ export default {
129
136
  .pad-bottom {
130
137
  padding-bottom: 4rem;
131
138
  }
139
+
140
+ .disabled-tile {
141
+ color: #c6c6c6;
142
+ }
132
143
  </style>