Skip to content

Commit ec42d9d

Browse files
committed
refactor: change services schema
type is refactored as category
1 parent c196084 commit ec42d9d

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

src/js/constants/globals.js

+2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export let dataInputs;
88

99
const _initWebservices = async () => {
1010
const xml = await getServicesAPI();
11+
console.log("wefd");
1112
webservices = await Decorators.webservicesDecorator(xml);
13+
console.log("wefd");
1214
};
1315

1416
const _initDataInputs = async () => {

src/js/elements/addElement.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,7 @@ export const transformWebserviceForGraph = webservice => {
130130
alert("problem with ", webservice);
131131
return {};
132132
}
133-
const {
134-
name: label,
135-
description,
136-
inputs = [],
137-
type: category,
138-
ports
139-
} = webservice;
133+
const { name: label, description, inputs = [], category, ports } = webservice;
140134

141135
// handle params
142136
const params = inputs.filter(inp => isParamInput(inp));

src/js/layout/components/leftSidebar.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ const LeftSidebar = Vue.component("LeftSidebar", {
3030
services: (() => {
3131
const mapped = webservices
3232
.map(service => {
33-
const { type, name } = service;
34-
return { type, name };
33+
const { category, name } = service;
34+
return { category, name };
3535
})
3636
.concat(dataInputs);
3737

38-
const servicesPerCategory = groupBy(mapped, "type");
38+
const servicesPerCategory = groupBy(mapped, "category");
3939
const sorted = [];
4040
for (let category of Object.keys(servicesPerCategory).sort()) {
4141
sorted.push(...servicesPerCategory[category].sort(alphabeticalOrder));
@@ -46,7 +46,7 @@ const LeftSidebar = Vue.component("LeftSidebar", {
4646

4747
categories: (() => {
4848
const categories = webservices
49-
.map(algo => algo.type)
49+
.map(algo => algo.category)
5050
.filter((v, i, a) => a.indexOf(v) === i) // get unique value
5151
.sort();
5252
categories.push(DATATEST_TYPE);
@@ -142,7 +142,7 @@ const LeftSidebar = Vue.component("LeftSidebar", {
142142
</div>
143143
<div id="${ALGO_ITEM_WRAPPER}">
144144
<div id="${ALGO_ITEMS}">
145-
<div v-for="{type, name} in results" :class="'${ALGO_ITEM_CLASS} ' + type" :name="name" @click="type == '${DATATEST_TYPE}' ? addData(name) : addElementByName(name)">
145+
<div v-for="{category, name} in results" :class="'${ALGO_ITEM_CLASS} ' + category" :name="name" @click="category == '${DATATEST_TYPE}' ? addData(name) : addElementByName(name)">
146146
<span class="icon"></span><span class="name" v-html="boldRegInString(name)"></span>
147147
</div>
148148
</div>

src/js/layout/utils.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ i++;
186186
*/
187187

188188
export const buildPortAttrs = (name, type, typeAllowed) => {
189+
console.log("TCL: buildPortAttrs -> type", type);
189190
const showPortDetails = layoutSettingsApp.isShowPortsDetailsChecked();
190191
const showPorts = layoutSettingsApp.isShowPortsChecked();
191192
const typeAllowedShort = shortenString(typeAllowed.join(", "), 25);
@@ -223,10 +224,15 @@ export const createPort = (param, group) => {
223224
} else {
224225
// @TODO display !userdefined ports ?
225226
typeAllowed = mimeTypes.allowed;
227+
const typeEnd =
228+
typeAllowed[0].indexOf("/") < 0
229+
? typeAllowed[0].length
230+
: typeAllowed[0].indexOf("/");
231+
console.log("TCL: typeEnd", typeEnd);
226232
type = typeAllowed[0].substr(
227233
//@TODO diff types ?
228234
0,
229-
typeAllowed[0].indexOf("/")
235+
typeEnd
230236
);
231237
}
232238

0 commit comments

Comments
 (0)