-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deprecated stack filter on the registry-viewer and fix deprecated…
… Color (#122) * Add deprecated devfile filter Signed-off-by: thepetk <[email protected]> * Add test cases and update existing Signed-off-by: thepetk <[email protected]> * Fix type error Signed-off-by: thepetk <[email protected]> * Update fetch-devfiles Signed-off-by: thepetk <[email protected]> * Update index.tsx Signed-off-by: thepetk <[email protected]> * Fix format Signed-off-by: thepetk <[email protected]> * Update index.tsx Signed-off-by: thepetk <[email protected]> * Fix linting error Signed-off-by: thepetk <[email protected]> * Fix formatting Signed-off-by: thepetk <[email protected]> * Fix deprecated color Signed-off-by: thepetk <[email protected]> * Fix fetch-devfiles tests Signed-off-by: thepetk <[email protected]> --------- Signed-off-by: thepetk <[email protected]>
- Loading branch information
Showing
10 changed files
with
161 additions
and
27 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
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
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
66 changes: 66 additions & 0 deletions
66
libs/core/src/functions/get-deprecated-devfile-value/get-deprecated-devfile-value.spec.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,66 @@ | ||
/** | ||
* Copyright Red Hat | ||
* | ||
* Licensed 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 { DevfileJson } from '../fetch-devfiles/fetch-devfiles'; | ||
import { DeprecatedTag } from '../get-devfile-tags/get-devfile-tags'; | ||
import { | ||
IsNotDeprecatedValue, | ||
IsDeprecatedValue, | ||
getDeprecatedDevfileValue, | ||
} from './get-deprecated-devfile-value'; | ||
|
||
let deprecatedDevfileJson: DevfileJson; | ||
|
||
let nonDeprecatedDevfileJson: DevfileJson; | ||
|
||
describe('getDeprecatedDevfileValue', () => { | ||
it('should execute successfully', () => { | ||
deprecatedDevfileJson = { | ||
name: 'some devfile', | ||
displayName: 'display name', | ||
description: 'some description', | ||
type: 'stack', | ||
tags: ['three', 'four', DeprecatedTag], | ||
icon: '', | ||
projectType: 'python', | ||
language: 'python', | ||
versions: [], | ||
provider: 'provider', | ||
architectures: [], | ||
git: { | ||
remotes: {}, | ||
}, | ||
}; | ||
nonDeprecatedDevfileJson = { | ||
name: 'some devfile', | ||
displayName: 'display name', | ||
description: 'some description', | ||
type: 'stack', | ||
tags: ['three', 'four'], | ||
icon: '', | ||
projectType: 'python', | ||
language: 'python', | ||
versions: [], | ||
provider: 'provider', | ||
architectures: [], | ||
git: { | ||
remotes: {}, | ||
}, | ||
}; | ||
expect(getDeprecatedDevfileValue(deprecatedDevfileJson)).toEqual(IsDeprecatedValue); | ||
expect(getDeprecatedDevfileValue(nonDeprecatedDevfileJson)).toEqual(IsNotDeprecatedValue); | ||
}); | ||
}); |
34 changes: 34 additions & 0 deletions
34
libs/core/src/functions/get-deprecated-devfile-value/get-deprecated-devfile-value.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,34 @@ | ||
/** | ||
* Copyright Red Hat | ||
* | ||
* Licensed 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 { DevfileJson } from '../fetch-devfiles/fetch-devfiles'; | ||
import { DeprecatedTag } from '../get-devfile-tags/get-devfile-tags'; | ||
|
||
export const IsDeprecatedValue = 'Yes'; | ||
|
||
export const IsNotDeprecatedValue = 'No'; | ||
|
||
/** | ||
* Checks if a devfile tags include the DeprecatedTag | ||
* | ||
* @returns 'Yes' or 'No' | ||
*/ | ||
export function getDeprecatedDevfileValue(devfile: DevfileJson): string { | ||
if (devfile.tags.includes(DeprecatedTag)) { | ||
return IsDeprecatedValue; | ||
} | ||
return IsNotDeprecatedValue; | ||
} |
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