-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make content models connection agnostic (#1079)
**Summary** This PR is a prerequisite for integrating sas server into the extension (see overall design, here: #889). This makes a few additional refactors outside of those mentioned in #889. Favorites. Previously, we were storing a favorite id w/n `ContentItem.flags`. ~This change delays finding that favorite id _until_ we're actually doing something with that favorite.~ Now, we are storing the uri to simplify the deletion process. Notebook -> flow conversion. When we first implemented this change, there was some question around whether this belong in content data provider or not. In this PR, functionality is moved to a `NotebookToFlowConverter` which makes use of a `ContentModel` directly. It's also worth mentioning that this moves some additional properties into `ContentItem` that were previously utils functions, and updates _every_ content adapter method to return a content item decorated with those new properties. Additionally, this splits utils such that `ContentNavigator/utils` has things that are connection agnostic, while `rest/utils` contains things that are connection specific. **Testing** - [x] Test creating file - [x] Test creating folder - [x] Test moving files & folders - [x] Test recycling files & folders - [x] Test deleting files & folders - [x] Test add to favorites for files and folders - [x] Test remove from favorites for files and folders - [x] Test editing files (regular files & favorites & favorites w/n folders) - [x] Test downloading files and folders - [x] Test converting sas notebooks to flows (test in explorer as well as sas content) - [x] Test renaming files & folders - [x] Test emptying recyling bin - [x] Test refreshing content - [x] Test filename statement - [x] Test fetching viya cadence - [x] Test uploading files (context menu, dragging from file system, dragging from explorer) - [x] Test collapsing all files - [x] Make sure multi-select is working the same on this branch and main - [x] Test removing a favorited item from 'my folder' **Todos** - [x] Address test coverage/build issues **Observations** - Unable to download flows. This is because flows are stored at a different endpoint than regular files
- Loading branch information
1 parent
e9be584
commit a325ce1
Showing
13 changed files
with
1,455 additions
and
1,083 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
client/src/components/ContentNavigator/ContentAdapterFactory.ts
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,26 @@ | ||
// Copyright © 2024, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import SASContentAdapter from "../../connection/rest/SASContentAdapter"; | ||
import { ConnectionType } from "../profile"; | ||
import { | ||
ContentAdapter, | ||
ContentNavigatorConfig, | ||
ContentSourceType, | ||
} from "./types"; | ||
|
||
class ContentAdapterFactory { | ||
// TODO #889 Update this to return RestSASServerAdapter & ITCSASServerAdapter | ||
public create( | ||
connectionType: ConnectionType, | ||
sourceType: ContentNavigatorConfig["sourceType"], | ||
): ContentAdapter { | ||
const key = `${connectionType}.${sourceType}`; | ||
switch (key) { | ||
case `${ConnectionType.Rest}.${ContentSourceType.SASContent}`: | ||
default: | ||
return new SASContentAdapter(); | ||
} | ||
} | ||
} | ||
|
||
export default ContentAdapterFactory; |
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
Oops, something went wrong.