Skip to content

Commit ae121c5

Browse files
Merge pull request #10 from Exabyte-io/update/SOF-6182
SOF-6182: rename defaultFlowchartId to generateFlowChartId + lint fixes
2 parents 15e5bce + 24e8430 commit ae121c5

File tree

3 files changed

+24
-17
lines changed

3 files changed

+24
-17
lines changed

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@
3838
"@babel/preset-react": "7.16.7",
3939
"@babel/register": "^7.16.0",
4040
"@babel/runtime-corejs3": "7.16.8",
41-
"@exabyte-io/ade.js": "2022.9.2-0",
42-
"@exabyte-io/ide.js": "2022.7.28-1",
43-
"@exabyte-io/mode.js": "2022.8.31-0",
44-
"@exabyte-io/code.js": "2022.9.2-0",
4541
"js-yaml": "^4.1.0",
4642
"lodash": "^4.17.21",
4743
"mixwith": "^0.1.1",

src/units/base.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ export class BaseUnit extends NamedDefaultableRepetitionRuntimeItemsImportantSet
1010
...config,
1111
status: config.status || UNIT_STATUSES.idle,
1212
statusTrack: config.statusTrack || [],
13-
flowchartId: config.flowchartId || BaseUnit.defaultFlowchartId(),
13+
flowchartId: config.flowchartId || BaseUnit.generateFlowChartId(),
1414
});
1515
}
1616

17-
static defaultFlowchartId() {
17+
static generateFlowChartId() {
1818
return getUUID();
1919
}
2020

@@ -78,7 +78,7 @@ export class BaseUnit extends NamedDefaultableRepetitionRuntimeItemsImportantSet
7878

7979
clone(extraContext) {
8080
const flowchartIDOverrideConfigAsExtraContext = {
81-
flowchartId: BaseUnit.defaultFlowchartId(),
81+
flowchartId: BaseUnit.generateFlowChartId(),
8282
...extraContext,
8383
};
8484
return super.clone(flowchartIDOverrideConfigAsExtraContext);

src/units/builders/UnitConfigBuilder.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import _ from "underscore";
21
import { getUUID } from "@exabyte-io/code.js/dist/utils";
3-
2+
import _ from "underscore";
43

54
export class UnitConfigBuilder {
65
constructor({ name, type }) {
@@ -11,7 +10,7 @@ export class UnitConfigBuilder {
1110
this._monitors = [];
1211
this._preProcessors = [];
1312
this._postProcessors = [];
14-
this._flowchartId = this.constructor.defaultFlowchartId();
13+
this._flowchartId = this.constructor.generateFlowChartId();
1514
}
1615

1716
name(str) {
@@ -24,7 +23,7 @@ export class UnitConfigBuilder {
2423
return this;
2524
}
2625

27-
static defaultFlowchartId() {
26+
static generateFlowChartId() {
2827
return getUUID();
2928
}
3029

@@ -33,27 +32,39 @@ export class UnitConfigBuilder {
3332
return this;
3433
}
3534

36-
_stringArrayToNamedObject(array) {
37-
return array.map(name => _.isString(name) ? {name} : name);
35+
static _stringArrayToNamedObject(array) {
36+
return array.map((name) => (_.isString(name) ? { name } : name));
3837
}
3938

4039
addPreProcessors(preProcessorNames) {
41-
this._preProcessors = _.union(this._stringArrayToNamedObject(preProcessorNames), this._preProcessors);
40+
this._preProcessors = _.union(
41+
this.constructor._stringArrayToNamedObject(preProcessorNames),
42+
this._preProcessors,
43+
);
4244
return this;
4345
}
4446

4547
addPostProcessors(postProcessorNames) {
46-
this._postProcessors = _.union(this._stringArrayToNamedObject(postProcessorNames), this._postProcessors);
48+
this._postProcessors = _.union(
49+
this.constructor._stringArrayToNamedObject(postProcessorNames),
50+
this._postProcessors,
51+
);
4752
return this;
4853
}
4954

5055
addResults(resultNames) {
51-
this._results = _.union(this._stringArrayToNamedObject(resultNames), this._results);
56+
this._results = _.union(
57+
this.constructor._stringArrayToNamedObject(resultNames),
58+
this._results,
59+
);
5260
return this;
5361
}
5462

5563
addMonitors(monitorNames) {
56-
this._monitors = _.union(this._stringArrayToNamedObject(monitorNames), this._monitors);
64+
this._monitors = _.union(
65+
this.constructor._stringArrayToNamedObject(monitorNames),
66+
this._monitors,
67+
);
5768
return this;
5869
}
5970

0 commit comments

Comments
 (0)