@pb33f/cowboy-components 0.7.2 → 0.7.3

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.
@@ -93,11 +93,42 @@ export default css `
93
93
  }
94
94
 
95
95
 
96
+ #loading-spinner {
97
+ padding: 5px 50px 5px 50px;
98
+ text-align: center;
99
+ }
100
+
101
+ .spinner-icon {
102
+ display: block;
103
+ margin: 20px auto 0 auto;
104
+ width: 200px;
105
+ color: var(--primary-color);
106
+ font-size: 6rem;
107
+ animation: spin 2s linear infinite;
108
+ }
109
+
110
+ @keyframes spin {
111
+ 0% {
112
+ transform: rotate(0deg);
113
+ }
114
+ 100% {
115
+ transform: rotate(360deg);
116
+ }
117
+ }
118
+
96
119
  .tardis-split-panel {
97
120
  --min: 300px;
98
121
  --max: calc(100vh - 400px);
99
122
  height: calc(100vh - 160px);
100
123
  }
101
-
124
+ .loading {
125
+ position: absolute;
126
+ width: 100%;
127
+ height: 100%;
128
+ top: 0;
129
+ left: 0;
130
+ background: var(--background-color-withopacity);
131
+ z-index: 10
132
+ }
102
133
 
103
134
  `;
@@ -15,6 +15,7 @@ export declare class TardisControl extends Colorful {
15
15
  changeGraph?: GraphResponse;
16
16
  history?: ChangeHistory;
17
17
  chartOptions?: any;
18
+ loading: boolean;
18
19
  changeDoughnut: DoughnutChart;
19
20
  breakingDoughnut: DoughnutChart;
20
21
  specSummary: SpecSummary | null;
@@ -30,6 +30,7 @@ let TardisControl = class TardisControl extends Colorful {
30
30
  this.explorer.renderEqualizer = false;
31
31
  this.explorer.equalizer.renderEqualizer = false;
32
32
  this.timelineView = new TimelineView();
33
+ this.loading = false;
33
34
  //@ts-ignore
34
35
  this.addEventListener(ExplorerNodeClicked, this.explorerNodeClicked.bind(this));
35
36
  }
@@ -53,11 +54,8 @@ let TardisControl = class TardisControl extends Colorful {
53
54
  });
54
55
  }
55
56
  }
56
- // firstUpdated() {
57
- // super.firstUpdated()
58
- // this.fetchHistory()
59
- // }
60
57
  fetchHistory() {
58
+ this.loading = true;
61
59
  TimelineService.fetchHistory().then((history) => {
62
60
  this.history = history;
63
61
  if (history.changeData) {
@@ -73,7 +71,7 @@ let TardisControl = class TardisControl extends Colorful {
73
71
  this.timelineView.qualityLabels = history.qualityData?.labels;
74
72
  }
75
73
  this.timelineView.requestUpdate();
76
- this.requestUpdate();
74
+ this.loading = false;
77
75
  }).catch((e) => {
78
76
  this.dispatchEvent(new CustomEvent(AddToast, {
79
77
  bubbles: true,
@@ -130,6 +128,18 @@ let TardisControl = class TardisControl extends Colorful {
130
128
  ${timelineItem}`;
131
129
  }
132
130
  render() {
131
+ const loading = html `
132
+ <div class="loading">
133
+
134
+ <div class="loader">
135
+ <div id="loading-spinner">
136
+ <sl-icon name="circle-half" class="spinner-icon"></sl-icon>
137
+ <h3>Jumping across the timeline</h3>
138
+ </div>
139
+ </div>
140
+
141
+
142
+ </div>`;
133
143
  if (!this.changeReport && !this.history) {
134
144
  return html `
135
145
  <div class="pb33f-loader">
@@ -141,9 +151,11 @@ let TardisControl = class TardisControl extends Colorful {
141
151
  }
142
152
  if (!this.changeReport && this.history) {
143
153
  return html `
154
+ ${this.loading ? loading : ''}
144
155
  <div class="timeline-view">
145
156
  ${this.timelineView}
146
- </div>`;
157
+ </div>
158
+ `;
147
159
  }
148
160
  let changelist = [];
149
161
  this.changeReport?.changes?.forEach(change => {
@@ -179,13 +191,14 @@ let TardisControl = class TardisControl extends Colorful {
179
191
  </sl-split-panel>`;
180
192
  }
181
193
  return html `
182
-
194
+ ${this.loading ? loading : ''}
183
195
  <header>
184
196
  <strong>${changelist.length}</strong> ${changelist.length > 1 ? 'changes' : 'change'} made</strong>
185
197
  <span style="color: var(--font-color-sub1"> on
186
198
  <sl-format-date time-zone="${userTimeZone}" date="${this.specSummary?.created}"
187
199
  time-zone-name="short" month="long" day="numeric" year="numeric" hour="2-digit"
188
- minute="numeric" second="numeric"></sl-format-date> <em>(<sl-relative-time date="${this.specSummary?.created}"></sl-relative-time>)</em> <br/>
200
+ minute="numeric" second="numeric"></sl-format-date> <em>(<sl-relative-time
201
+ date="${this.specSummary?.created}"></sl-relative-time>)</em> <br/>
189
202
  </span>
190
203
  </header>
191
204
  <div class="changes-container">
@@ -236,9 +249,11 @@ let TardisControl = class TardisControl extends Colorful {
236
249
  set summary(summary) {
237
250
  this.specSummary = summary;
238
251
  if (summary.changeId) {
252
+ this.loading = true;
239
253
  TimelineService.fetchChange(summary.changeId)
240
254
  .then(this.handleChange.bind(this))
241
255
  .catch((e) => {
256
+ this.loading = false;
242
257
  this.dispatchEvent(new CustomEvent(AddToast, {
243
258
  bubbles: true,
244
259
  composed: true,
@@ -258,6 +273,7 @@ let TardisControl = class TardisControl extends Colorful {
258
273
  this.changeReport = resp;
259
274
  this.explorer.updateGraphResponse(resp);
260
275
  this.explorer.buildGraph();
276
+ this.loading = false;
261
277
  }
262
278
  };
263
279
  TardisControl.styles = [specSummaryTimelineItemCss,
@@ -274,6 +290,9 @@ __decorate([
274
290
  __decorate([
275
291
  state()
276
292
  ], TardisControl.prototype, "chartOptions", void 0);
293
+ __decorate([
294
+ state()
295
+ ], TardisControl.prototype, "loading", void 0);
277
296
  __decorate([
278
297
  query('pb33f-doughnut-chart#change-doughnut')
279
298
  ], TardisControl.prototype, "changeDoughnut", void 0);