mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 06:49:40 +02:00
refactor(namespace): migrate namespace edit to react [r8s-125] (#38)
This commit is contained in:
parent
40c7742e46
commit
ce7e0d8d60
108 changed files with 3183 additions and 2194 deletions
|
@ -0,0 +1,47 @@
|
|||
import { useCurrentStateAndParams } from '@uirouter/react';
|
||||
|
||||
import { InlineLoader } from '@@/InlineLoader';
|
||||
import { Widget } from '@@/Widget/Widget';
|
||||
import { WidgetBody } from '@@/Widget';
|
||||
|
||||
import { YAMLInspector } from '../../components/YAMLInspector';
|
||||
import { useNamespaceYAML } from '../queries/useNamespaceYAML';
|
||||
|
||||
export function NamespaceYAMLEditor() {
|
||||
const {
|
||||
params: { id: namespace, endpointId: environmentId },
|
||||
} = useCurrentStateAndParams();
|
||||
const { data: fullNamespaceYaml, isLoading: isNamespaceYAMLLoading } =
|
||||
useNamespaceYAML(environmentId, namespace);
|
||||
|
||||
if (isNamespaceYAMLLoading) {
|
||||
return (
|
||||
<div className="row">
|
||||
<div className="col-sm-12">
|
||||
<Widget>
|
||||
<WidgetBody>
|
||||
<InlineLoader>Loading namespace YAML...</InlineLoader>
|
||||
</WidgetBody>
|
||||
</Widget>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="row">
|
||||
<div className="col-sm-12">
|
||||
<Widget>
|
||||
<WidgetBody>
|
||||
<YAMLInspector
|
||||
identifier="namespace-yaml"
|
||||
data={fullNamespaceYaml || ''}
|
||||
hideMessage
|
||||
data-cy="namespace-yaml"
|
||||
/>
|
||||
</WidgetBody>
|
||||
</Widget>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue