@jfvilas/plugin-kwirth-frontend 0.13.4 → 0.13.5

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.
@@ -17,7 +17,7 @@ const ObjectSelector = (props) => {
17
17
  let validPods = getPodList(pods, props.selectedNamespaces);
18
18
  props.selectedPodNames.push(...validPods.map((pod) => pod.name));
19
19
  props.selectedContainerNames.splice(0, props.selectedContainerNames.length);
20
- let containers = getContainerList(pods, props.selectedNamespaces, props.selectedPodNames);
20
+ let containers = getContainerList(pods, props.selectedNamespaces, props.selectedPodNames, props.excludeCotainers || []);
21
21
  props.selectedContainerNames.push(...containers);
22
22
  props.onSelect([...props.selectedNamespaces], [...props.selectedPodNames], [...props.selectedContainerNames]);
23
23
  setRender(!render);
@@ -26,7 +26,7 @@ const ObjectSelector = (props) => {
26
26
  props.selectedPodNames.splice(0, props.selectedPodNames.length);
27
27
  props.selectedPodNames.push(...event.target.value);
28
28
  props.selectedContainerNames.splice(0, props.selectedContainerNames.length);
29
- let containers = getContainerList(pods, props.selectedNamespaces, props.selectedPodNames);
29
+ let containers = getContainerList(pods, props.selectedNamespaces, props.selectedPodNames, props.excludeCotainers || []);
30
30
  if (containers.length === 1) props.selectedContainerNames.push(...containers);
31
31
  props.onSelect([...props.selectedNamespaces], [...props.selectedPodNames], [...props.selectedContainerNames]);
32
32
  setRender(!render);
@@ -58,7 +58,7 @@ const ObjectSelector = (props) => {
58
58
  }
59
59
  })), /* @__PURE__ */ React.createElement(Grid, { container: true, item: true, xs: 12, spacing: 2 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(FormControl, { size: "small", fullWidth: true }, /* @__PURE__ */ React.createElement(Select, { value: props.selectedPodNames, MenuProps: { variant: "menu" }, multiple: true, onChange: onSelectPod, renderValue: (selected) => selected.join(", "), disabled: props.disabled || props.selectedNamespaces.length === 0 || getPodList(pods, props.selectedNamespaces).length === 1 }, getPodList(pods, props.selectedNamespaces).map((pod) => {
60
60
  return /* @__PURE__ */ React.createElement(MenuItem, { key: pod.name, value: pod.name }, /* @__PURE__ */ React.createElement(Checkbox, { checked: props.selectedPodNames.includes(pod.name) }), /* @__PURE__ */ React.createElement(ListItemText, { primary: pod.name }));
61
- })))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(FormControl, { size: "small", fullWidth: true }, /* @__PURE__ */ React.createElement(Select, { value: props.selectedContainerNames, MenuProps: { variant: "menu" }, multiple: true, onChange: onSelectContainer, renderValue: (selected) => selected.join(", "), disabled: props.disabled || props.selectedPodNames.length === 0 || getContainerList(pods, props.selectedNamespaces, props.selectedPodNames).length === 1 }, getContainerList(pods, props.selectedNamespaces, props.selectedPodNames).map((container) => {
61
+ })))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(FormControl, { size: "small", fullWidth: true }, /* @__PURE__ */ React.createElement(Select, { value: props.selectedContainerNames, MenuProps: { variant: "menu" }, multiple: true, onChange: onSelectContainer, renderValue: (selected) => selected.join(", "), disabled: props.disabled || props.selectedPodNames.length === 0 || getContainerList(pods, props.selectedNamespaces, props.selectedPodNames, props.excludeCotainers || []).length < 2 }, getContainerList(pods, props.selectedNamespaces, props.selectedPodNames, props.excludeCotainers || []).map((container) => {
62
62
  return /* @__PURE__ */ React.createElement(MenuItem, { key: container, value: container }, /* @__PURE__ */ React.createElement(Checkbox, { checked: props.selectedContainerNames.includes(container) }), /* @__PURE__ */ React.createElement(ListItemText, { primary: container }));
63
63
  }))))));
64
64
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectSelector.esm.js","sources":["../../src/ObjectSelector/ObjectSelector.tsx"],"sourcesContent":["/*\r\nCopyright 2025 Julio Fernandez\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n*/\r\nimport React, { useState } from 'react'\r\nimport { FormControl, Select, MenuItem, Checkbox, Chip, Grid, ListItemText } from '@material-ui/core'\r\nimport { ClusterValidPods, getContainerList, getPodList } from '@jfvilas/plugin-kwirth-common'\r\nimport { InstanceConfigScopeEnum, parseResources } from '@jfvilas/kwirth-common'\r\n\r\ninterface IProps {\r\n onSelect: (namespaces:string[], podNames:string[], containerNames:string[]) => void,\r\n cluster: ClusterValidPods,\r\n selectedNamespaces: string[],\r\n selectedPodNames: string[],\r\n selectedContainerNames: string[],\r\n scope: InstanceConfigScopeEnum,\r\n disabled: boolean\r\n}\r\n\r\nconst ObjectSelector = (props: IProps) => {\r\n const [render, setRender] = useState(false)\r\n let pods = props.cluster.pods\r\n let namespaceList = Array.from(new Set(pods.map(p => p.namespace)))\r\n\r\n const onNamespaceChange = (namespace:string) => {\r\n let i = props.selectedNamespaces.indexOf(namespace)\r\n if (i>=0)\r\n props.selectedNamespaces.splice(i,1)\r\n else\r\n props.selectedNamespaces.push(namespace)\r\n\r\n props.selectedPodNames.splice(0,props.selectedPodNames.length)\r\n let validPods = getPodList(pods, props.selectedNamespaces)\r\n props.selectedPodNames.push( ...validPods.map(pod => pod.name) )\r\n\r\n props.selectedContainerNames.splice(0,props.selectedContainerNames.length)\r\n let containers = getContainerList(pods, props.selectedNamespaces, props.selectedPodNames)\r\n props.selectedContainerNames.push(...containers)\r\n props.onSelect([...props.selectedNamespaces], [...props.selectedPodNames], [...props.selectedContainerNames])\r\n\r\n setRender(!render)\r\n }\r\n\r\n const onSelectPod = (event : any) => {\r\n props.selectedPodNames.splice(0,props.selectedPodNames.length)\r\n props.selectedPodNames.push( ...event.target.value )\r\n\r\n props.selectedContainerNames.splice(0,props.selectedContainerNames.length)\r\n let containers = getContainerList(pods, props.selectedNamespaces, props.selectedPodNames)\r\n if (containers.length===1) props.selectedContainerNames.push(...containers)\r\n\r\n props.onSelect([...props.selectedNamespaces], [...props.selectedPodNames], [...props.selectedContainerNames])\r\n\r\n setRender(!render)\r\n }\r\n\r\n const onSelectContainer = (event : any) => {\r\n props.selectedContainerNames.splice(0,props.selectedContainerNames.length)\r\n props.selectedContainerNames.push( ...event.target.value )\r\n props.onSelect([...props.selectedNamespaces], [...props.selectedPodNames], [...props.selectedContainerNames])\r\n }\r\n\r\n // const existAccessKey = (namespace:string) => {\r\n // if (!props.cluster.accessKeys.has(InstanceConfigScopeEnum.VIEW)) return false\r\n // let accessKey = props.cluster.accessKeys.get(InstanceConfigScopeEnum.VIEW)\r\n // if (accessKey) {\r\n // let resources = parseResources(accessKey.resources)\r\n // return (resources.find(resource => resource.namespaces === namespace))\r\n // }\r\n // else return false\r\n\r\n // }\r\n const existAccessKey = (namespace:string) => {\r\n if (!props.cluster.accessKeys.has(props.scope)) return false\r\n let accessKey = props.cluster.accessKeys.get(props.scope)\r\n if (accessKey) {\r\n let resources = parseResources(accessKey.resources)\r\n return (resources.find(r => r.namespaces === namespace))\r\n }\r\n else return false\r\n\r\n }\r\n \r\n return (\r\n <Grid container direction='column' spacing={0} style={{marginBottom:6, width:'100%'}}>\r\n <Grid item>\r\n {\r\n namespaceList.map ((namespace,index) => {\r\n if (props.disabled) {\r\n if (existAccessKey(namespace))\r\n return <Chip component={'span'} key={index} label={namespace} variant={props.selectedNamespaces.includes(namespace)?'default':'outlined'} size='small' color='default' />\r\n else\r\n return <Chip component={'span'} key={index} label={namespace} size='small' color='default' variant={'outlined'}/>\r\n }\r\n else {\r\n if (existAccessKey(namespace))\r\n return <Chip component={'span'} key={index} label={namespace} onClick={() => onNamespaceChange(namespace)} variant={props.selectedNamespaces.includes(namespace)?'default':'outlined'} size='small' color='primary' />\r\n else\r\n return <Chip component={'span'} key={index} label={namespace} size='small' color='secondary' variant={'outlined'}/>\r\n }\r\n })\r\n }\r\n </Grid>\r\n <Grid container item xs={12} spacing={2}>\r\n <Grid item xs={6}>\r\n <FormControl size='small' fullWidth>\r\n <Select value={props.selectedPodNames} MenuProps={{variant:'menu'}} multiple onChange={onSelectPod} renderValue={(selected) => (selected as string[]).join(', ')} disabled={props.disabled || props.selectedNamespaces.length===0 || getPodList(pods,props.selectedNamespaces).length===1}>\r\n {\r\n getPodList(pods, props.selectedNamespaces).map(pod => {\r\n return (\r\n <MenuItem key={pod.name} value={pod.name}>\r\n <Checkbox checked={props.selectedPodNames.includes(pod.name)} />\r\n <ListItemText primary={pod.name} />\r\n </MenuItem>\r\n )\r\n })\r\n }\r\n </Select>\r\n </FormControl>\r\n </Grid>\r\n <Grid item xs={6}>\r\n <FormControl size='small' fullWidth>\r\n <Select value={props.selectedContainerNames} MenuProps={{variant:'menu'}} multiple onChange={onSelectContainer} renderValue={(selected) => (selected as string[]).join(', ')} disabled={props.disabled || props.selectedPodNames.length===0 || getContainerList(pods, props.selectedNamespaces, props.selectedPodNames).length===1}>\r\n {\r\n getContainerList(pods, props.selectedNamespaces, props.selectedPodNames).map(container => {\r\n return (\r\n <MenuItem key={container} value={container}>\r\n <Checkbox checked={props.selectedContainerNames.includes(container)} />\r\n <ListItemText primary={container} />\r\n </MenuItem>\r\n )\r\n })\r\n }\r\n </Select>\r\n </FormControl>\r\n </Grid>\r\n </Grid>\r\n </Grid>\r\n )\r\n}\r\n\r\nexport { ObjectSelector }"],"names":[],"mappings":";;;;;AA8BA,MAAM,cAAA,GAAiB,CAAC,KAAA,KAAkB;AACtC,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAS,KAAK,CAAA;AAC1C,EAAA,IAAI,IAAA,GAAO,MAAM,OAAA,CAAQ,IAAA;AACzB,EAAA,IAAI,aAAA,GAAgB,KAAA,CAAM,IAAA,CAAK,IAAI,GAAA,CAAI,IAAA,CAAK,GAAA,CAAI,CAAA,CAAA,KA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AI,CAAA,SAAA,KAAa;AACtF,IAAA,2CACK,QAAA,EAAA,EAAS,GAAA,EAAK,WAAW,KAAA,EAAO,SAAA,EAAA,sCAC5B,QAAA,EAAA,EAAS,OAAA,EAAS,MAAM,sBAAA,CAAuB,QAAA,CAAS,SAAS,CAAA,EAAG,CAAA,sCACpE,YAAA,EAAA,EAAa,OAAA,EAAS,WAAW,CACtC,CAAA;AAAA,EAER,CAAC,CAET,CACJ,CACJ,CACJ,CACJ,CAAA;AAER;;;;"}
1
+ {"version":3,"file":"ObjectSelector.esm.js","sources":["../../src/ObjectSelector/ObjectSelector.tsx"],"sourcesContent":["/*\r\nCopyright 2025 Julio Fernandez\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n*/\r\nimport React, { useState } from 'react'\r\nimport { FormControl, Select, MenuItem, Checkbox, Chip, Grid, ListItemText } from '@material-ui/core'\r\nimport { ClusterValidPods, getContainerList, getPodList } from '@jfvilas/plugin-kwirth-common'\r\nimport { parseResources } from '@jfvilas/kwirth-common'\r\n\r\ninterface IProps {\r\n onSelect: (namespaces:string[], podNames:string[], containerNames:string[]) => void,\r\n cluster: ClusterValidPods,\r\n selectedNamespaces: string[],\r\n selectedPodNames: string[],\r\n selectedContainerNames: string[],\r\n excludeCotainers?: string[],\r\n scope: string,\r\n disabled: boolean\r\n}\r\n\r\nconst ObjectSelector = (props: IProps) => {\r\n const [render, setRender] = useState(false)\r\n let pods = props.cluster.pods\r\n let namespaceList = Array.from(new Set(pods.map(p => p.namespace)))\r\n\r\n const onNamespaceChange = (namespace:string) => {\r\n let i = props.selectedNamespaces.indexOf(namespace)\r\n if (i>=0)\r\n props.selectedNamespaces.splice(i,1)\r\n else\r\n props.selectedNamespaces.push(namespace)\r\n\r\n props.selectedPodNames.splice(0,props.selectedPodNames.length)\r\n let validPods = getPodList(pods, props.selectedNamespaces)\r\n props.selectedPodNames.push( ...validPods.map(pod => pod.name) )\r\n\r\n props.selectedContainerNames.splice(0,props.selectedContainerNames.length)\r\n let containers = getContainerList(pods, props.selectedNamespaces, props.selectedPodNames, props.excludeCotainers || [])\r\n props.selectedContainerNames.push(...containers)\r\n props.onSelect([...props.selectedNamespaces], [...props.selectedPodNames], [...props.selectedContainerNames])\r\n\r\n setRender(!render)\r\n }\r\n\r\n const onSelectPod = (event : any) => {\r\n props.selectedPodNames.splice(0,props.selectedPodNames.length)\r\n props.selectedPodNames.push( ...event.target.value )\r\n\r\n props.selectedContainerNames.splice(0,props.selectedContainerNames.length)\r\n let containers = getContainerList(pods, props.selectedNamespaces, props.selectedPodNames, props.excludeCotainers || [])\r\n if (containers.length===1) props.selectedContainerNames.push(...containers)\r\n\r\n props.onSelect([...props.selectedNamespaces], [...props.selectedPodNames], [...props.selectedContainerNames])\r\n\r\n setRender(!render)\r\n }\r\n\r\n const onSelectContainer = (event : any) => {\r\n props.selectedContainerNames.splice(0,props.selectedContainerNames.length)\r\n props.selectedContainerNames.push( ...event.target.value )\r\n props.onSelect([...props.selectedNamespaces], [...props.selectedPodNames], [...props.selectedContainerNames])\r\n }\r\n\r\n const existAccessKey = (namespace:string) => {\r\n if (!props.cluster.accessKeys.has(props.scope)) return false\r\n let accessKey = props.cluster.accessKeys.get(props.scope)\r\n if (accessKey) {\r\n let resources = parseResources(accessKey.resources)\r\n return (resources.find(r => r.namespaces === namespace))\r\n }\r\n else return false\r\n }\r\n \r\n return (\r\n <Grid container direction='column' spacing={0} style={{marginBottom:6, width:'100%'}}>\r\n <Grid item>\r\n {\r\n namespaceList.map ((namespace,index) => {\r\n if (props.disabled) {\r\n if (existAccessKey(namespace))\r\n return <Chip component={'span'} key={index} label={namespace} variant={props.selectedNamespaces.includes(namespace)?'default':'outlined'} size='small' color='default' />\r\n else\r\n return <Chip component={'span'} key={index} label={namespace} size='small' color='default' variant={'outlined'}/>\r\n }\r\n else {\r\n if (existAccessKey(namespace))\r\n return <Chip component={'span'} key={index} label={namespace} onClick={() => onNamespaceChange(namespace)} variant={props.selectedNamespaces.includes(namespace)?'default':'outlined'} size='small' color='primary' />\r\n else\r\n return <Chip component={'span'} key={index} label={namespace} size='small' color='secondary' variant={'outlined'}/>\r\n }\r\n })\r\n }\r\n </Grid>\r\n <Grid container item xs={12} spacing={2}>\r\n <Grid item xs={6}>\r\n <FormControl size='small' fullWidth>\r\n <Select value={props.selectedPodNames} MenuProps={{variant:'menu'}} multiple onChange={onSelectPod} renderValue={(selected) => (selected as string[]).join(', ')} disabled={props.disabled || props.selectedNamespaces.length===0 || getPodList(pods,props.selectedNamespaces).length===1}>\r\n {\r\n getPodList(pods, props.selectedNamespaces).map(pod => {\r\n return (\r\n <MenuItem key={pod.name} value={pod.name}>\r\n <Checkbox checked={props.selectedPodNames.includes(pod.name)} />\r\n <ListItemText primary={pod.name} />\r\n </MenuItem>\r\n )\r\n })\r\n }\r\n </Select>\r\n </FormControl>\r\n </Grid>\r\n <Grid item xs={6}>\r\n <FormControl size='small' fullWidth>\r\n <Select value={props.selectedContainerNames} MenuProps={{variant:'menu'}} multiple onChange={onSelectContainer} renderValue={(selected) => (selected as string[]).join(', ')} disabled={props.disabled || props.selectedPodNames.length===0 || getContainerList(pods, props.selectedNamespaces, props.selectedPodNames, props.excludeCotainers || []).length<2}>\r\n {\r\n getContainerList(pods, props.selectedNamespaces, props.selectedPodNames, props.excludeCotainers || []).map(container => {\r\n return (\r\n <MenuItem key={container} value={container}>\r\n <Checkbox checked={props.selectedContainerNames.includes(container)} />\r\n <ListItemText primary={container} />\r\n </MenuItem>\r\n )\r\n })\r\n }\r\n </Select>\r\n </FormControl>\r\n </Grid>\r\n </Grid>\r\n </Grid>\r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UAAQ,IAAA,EAAC,QAAA,EAAU,iBAAA,EAAmB,WAAA,EAAa,CAAC,QAAA,KAAc,QAAA,CAAsB,IAAA,CAAK,IAAI,CAAA,EAAG,QAAA,EAAU,KAAA,CAAM,QAAA,IAAY,MAAM,gBAAA,CAAiB,MAAA,KAAS,CAAA,IAAK,gBAAA,CAAiB,IAAA,EAAM,KAAA,CAAM,kBAAA,EAAoB,KAAA,CAAM,kBAAkB,KAAA,CAAM,gBAAA,IAAoB,EAAE,CAAA,CAAE,MAAA,GAAO,CAAA,EAAA,EAErV,gBAAA,CAAiB,MAAM,KAAA,CAAM,kBAAA,EAAoB,KAAA,CAAM,gBAAA,EAAkB,MAAM,gBAAA,IAAoB,EAAE,CAAA,CAAE,IAAI,CAAA,SAAA,KAAa;AACpH,IAAA,2CACK,QAAA,EAAA,EAAS,GAAA,EAAK,WAAW,KAAA,EAAO,SAAA,EAAA,sCAC5B,QAAA,EAAA,EAAS,OAAA,EAAS,MAAM,sBAAA,CAAuB,QAAA,CAAS,SAAS,CAAA,EAAG,CAAA,sCACpE,YAAA,EAAA,EAAa,OAAA,EAAS,WAAW,CACtC,CAAA;AAAA,EAER,CAAC,CAET,CACJ,CACJ,CACJ,CACJ,CAAA;AAER;;;;"}
package/dist/index.d.ts CHANGED
@@ -50,6 +50,6 @@ declare const ShowError: (props: {
50
50
  onClose: () => void;
51
51
  }) => React.JSX.Element;
52
52
 
53
- declare const VERSION = "0.13.2";
53
+ declare const VERSION = "0.13.4";
54
54
 
55
55
  export { ClusterList, ComponentNotFound, ErrorType, KwirthNews, ObjectSelector, ShowError, StatusLog, VERSION };
package/dist/index.esm.js CHANGED
@@ -5,7 +5,7 @@ export { StatusLog } from './StatusLog/StatusLog.esm.js';
5
5
  export { KwirthNews } from './KwirthNews/KwirthNews.esm.js';
6
6
  export { ShowError } from './ShowError/ShowError.esm.js';
7
7
 
8
- const VERSION = "0.13.2";
8
+ const VERSION = "0.13.4";
9
9
 
10
10
  export { VERSION };
11
11
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["export const VERSION='0.13.2'\r\n\r\nexport * from './ComponentNotFound'\r\nexport * from './ObjectSelector'\r\nexport * from './ClusterList'\r\nexport * from './StatusLog'\r\nexport * from './KwirthNews'\r\nexport * from './ShowError'"],"names":[],"mappings":";;;;;;;AAAO,MAAM,OAAA,GAAQ;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["export const VERSION='0.13.4'\r\n\r\nexport * from './ComponentNotFound'\r\nexport * from './ObjectSelector'\r\nexport * from './ClusterList'\r\nexport * from './StatusLog'\r\nexport * from './KwirthNews'\r\nexport * from './ShowError'"],"names":[],"mappings":";;;;;;;AAAO,MAAM,OAAA,GAAQ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jfvilas/plugin-kwirth-frontend",
3
- "version": "0.13.4",
3
+ "version": "0.13.5",
4
4
  "description": "Frontend common artifacts for viewing real-time Kubernetes logs in Backstage",
5
5
  "keywords": [
6
6
  "Backstage",