UNPKG

2.12 kBJavaScriptView Raw
1"use strict";
2/*
3 * Copyright © 2018 Atomist, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17Object.defineProperty(exports, "__esModule", { value: true });
18const RolarProgressLog_1 = require("./RolarProgressLog");
19/**
20 * Persistent Rolar log that displays in the Dashboard
21 */
22class DashboardDisplayProgressLog {
23 constructor(rolarBaseUrl, bufferSize, flushInterval, context, sdmGoal) {
24 this.context = context;
25 this.sdmGoal = sdmGoal;
26 this.rolarProgressLog =
27 new RolarProgressLog_1.RolarProgressLog(rolarBaseUrl, constructLogPath(context, sdmGoal), bufferSize, flushInterval);
28 }
29 get name() {
30 return this.rolarProgressLog.name;
31 }
32 get url() {
33 const path = constructLogPath(this.context, this.sdmGoal);
34 return `https://app.atomist.com/workspace/${path[0]}/logs/${path.slice(1).join("/")}`;
35 }
36 async isAvailable() {
37 return this.rolarProgressLog.isAvailable();
38 }
39 write(what) {
40 this.rolarProgressLog.write(what);
41 }
42 flush() {
43 return this.rolarProgressLog.flush();
44 }
45 close() {
46 return this.rolarProgressLog.close();
47 }
48}
49exports.DashboardDisplayProgressLog = DashboardDisplayProgressLog;
50function constructLogPath(context, sdmGoal) {
51 return [
52 context.teamId,
53 sdmGoal.repo.owner,
54 sdmGoal.repo.name,
55 sdmGoal.sha,
56 sdmGoal.environment,
57 sdmGoal.name,
58 sdmGoal.goalSetId,
59 context.correlationId,
60 ];
61}
62exports.constructLogPath = constructLogPath;
63//# sourceMappingURL=DashboardDisplayProgressLog.js.map
\No newline at end of file