-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[frontend]Storage Browser Tabs and content component (#3428)
* [frontend]Storage Browser Tabs and content component * [frontend]Fix and improvements
- Loading branch information
1 parent
78a81b1
commit 4bc91b5
Showing
9 changed files
with
195 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
desktop/core/src/desktop/js/apps/storageBrowser/StorageBrowserPage/StorageBrowserPage.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Licensed to Cloudera, Inc. under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. Cloudera, Inc. licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
@use 'variables' as vars; | ||
@import '../../../components/styles/mixins'; | ||
|
||
.hue-storage-browser { | ||
@include fillAbsolute; | ||
@include flexRowLayout; | ||
|
||
display: flex; | ||
|
||
.hue-storage-browser__tab { | ||
background-color: vars.$fluidx-gray-100; | ||
padding: 0 16px; | ||
//TODO: Find fix so the flex is applied | ||
flex: 0 0 100%; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...storageBrowser/StorageBrowserPage/StorageBrowserTabContents/StorageBrowserTabContent.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Licensed to Cloudera, Inc. under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. Cloudera, Inc. licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
@use 'variables' as vars; | ||
|
||
.hue-storage-browser-tabContent { | ||
background-color: vars.$fluidx-white; | ||
margin: 16px 0; | ||
padding: 16px; | ||
//TODO: Set height to content | ||
|
||
.hue-storage-browser__title-bar { | ||
display: flex; | ||
align-items: center; | ||
|
||
.hue-storage-browser__icon { | ||
margin-right: 10px; | ||
flex: 0 0 auto; | ||
height: 24px; | ||
width: 24px; | ||
} | ||
|
||
.hue-storage-browser__folder-name { | ||
flex: 0 0 auto; | ||
font-size: vars.$fluidx-heading-h3-size; | ||
line-height: vars.$fluidx-heading-h3-line-height; | ||
font-weight: vars.$fluidx-heading-h3-weight; | ||
} | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
.../storageBrowser/StorageBrowserPage/StorageBrowserTabContents/StorageBrowserTabContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Licensed to Cloudera, Inc. under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. Cloudera, Inc. licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import React, { useState, useEffect } from 'react'; | ||
import { Spin } from 'antd'; | ||
|
||
import BucketIcon from '@cloudera/cuix-core/icons/react/BucketIcon'; | ||
import { fetchFiles } from '../../../../reactComponents/FileChooser/api'; | ||
import { PathAndFileData } from '../../../../reactComponents/FileChooser/types'; | ||
|
||
import './StorageBrowserTabContent.scss'; | ||
|
||
interface StorageBrowserTabContentProps { | ||
user_home_dir: string; | ||
testId?: string; | ||
} | ||
|
||
const defaultProps = { | ||
testId: 'hue-storage-browser-tabContent' | ||
}; | ||
|
||
const StorageBrowserTabContent: React.FC<StorageBrowserTabContentProps> = ({ | ||
user_home_dir, | ||
testId | ||
}): JSX.Element => { | ||
const [filePath, setFilePath] = useState<string>(user_home_dir); | ||
const [filesData, setFilesData] = useState<PathAndFileData | undefined>(); | ||
const [loadingFiles, setloadingFiles] = useState(true); | ||
|
||
useEffect(() => { | ||
setloadingFiles(true); | ||
fetchFiles(filePath) | ||
.then(responseFilesData => { | ||
setFilesData(responseFilesData); | ||
}) | ||
.catch(error => { | ||
//TODO: handle errors | ||
}) | ||
.finally(() => { | ||
setloadingFiles(false); | ||
}); | ||
}, [filePath]); | ||
|
||
return ( | ||
<Spin spinning={loadingFiles}> | ||
<div className="hue-storage-browser-tabContent" data-testid={testId}> | ||
<div className="hue-storage-browser__title-bar" data-testid={`${testId}-title-bar`}> | ||
<BucketIcon className="hue-storage-browser__icon" data-testid={`${testId}-icon`} /> | ||
<div className="hue-storage-browser__folder-name" data-testid={`${testId}-folder-namer`}> | ||
{filesData?.breadcrumbs[filesData?.breadcrumbs.length - 1].label} | ||
</div> | ||
</div> | ||
</div> | ||
</Spin> | ||
); | ||
}; | ||
|
||
StorageBrowserTabContent.defaultProps = defaultProps; | ||
|
||
export default StorageBrowserTabContent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters