Skip to content

Commit

Permalink
Merge pull request #16 from llima/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
llima authored Mar 20, 2023
2 parents 76b6311 + 2fa3ffc commit b876767
Show file tree
Hide file tree
Showing 30 changed files with 1,169 additions and 251 deletions.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,27 @@ It is possible to define several source code models, thus delivering architectur

![03.png](azure/projects/doc/03.png)

| Name | Description |
|--|--|
| Template | Name of template. e.g. **ASP.NET Core Api Service** |
| Template Description | Description of the template. e.g. **Microservice Template for ASP.NET Core** |
| Source Repository* | Repository with source code that will serve as the basis for projects ASP.NET Core |
| Replace Key | The keyword that will be changed when creating the project, such as solution name, namespaces, etc.|
| Tags | Tags of technology, such as C#, API, SQLServer |
| Requires authentication| If the source of the base repository is private, it must have its credentials for the git clone |
| Name | Description |
| ----------------------- | --------------------------------------------------------------------------------------------------- |
| Template | Name of template. e.g. **ASP.NET Core Api Service** |
| Template Description | Description of the template. e.g. **Microservice Template for ASP.NET Core** |
| Source Repository* | Repository with source code that will serve as the basis for projects ASP.NET Core |
| Branch | Name of the branch the source code will be saved to. e.g. **develop**, **main** |
| Replace Key | The keyword that will be changed when creating the project, such as solution name, namespaces, etc. |
| Tags | Tags of technology, such as C#, API, SQLServer |
| Requires authentication | If the source of the base repository is private, it must have its credentials for the git clone |

* *Even for repositories within Azure DevOps itself, the **"Requires authentication"** field is mandatory to perform the process.

### **Create new project**

![02.png](azure/projects/doc/02.png)

| Name | Description |
|--|--|
| Template | Template previously created in the settings screen |
| Name | Project name and word that will be used to replace files and contents |
| Repository Name | Name of the repository that will be created in Azure DevOps |
| Name | Description |
| --------------- | --------------------------------------------------------------------- |
| Template | Template previously created in the settings screen |
| Name | Project name and word that will be used to replace files and contents |
| Repository Name | Name of the repository that will be created in Azure DevOps |

### **Running**

Expand Down
2 changes: 1 addition & 1 deletion azure/license.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Eleven Financial Research
Copyright (c) 2021 Luiz Lima

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 3 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
npm run build --prefix front
npm run build --prefix tasks/stack-board-repos
# npm run build --prefix front
# npm run build --prefix tasks/stack-board-repos
# npm run build --prefix tasks/stack-board-replaces

tfx extension create --manifest-globs vss-extension.json --overrides-file ./configs/release.json --root ./
4 changes: 2 additions & 2 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"homepage": "./",
"repository": {
"type": "git",
"url": "git+/~https://github.com/eleven-financial/stack-board-extension.git"
"url": "git+/~https://github.com/llima/stack-board-extension.git"
},
"bugs": {
"url": "/~https://github.com/eleven-financial/stack-board-extension/issues"
"url": "/~https://github.com/llima/stack-board-extension/issues"
},
"scripts": {
"start": "react-scripts start",
Expand Down
8 changes: 4 additions & 4 deletions front/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ class App extends React.Component<{}, IAppState> {
const { page } = this.state;

switch (page) {
case "elevenlabs.stack-board.stack-board-hub":
case "llima.stack-board.stack-board-hub":
return (<ProjectPage />);
case "elevenlabs.stack-board.tech-radar-hub":
case "llima.stack-board.tech-radar-hub":
return (<Radar />);
case "elevenlabs.stack-board.api-docs-hub":
case "llima.stack-board.api-docs-hub":
return (<Api />);
case "elevenlabs.stack-board.code-quality-hub":
case "llima.stack-board.code-quality-hub":
return (<Code />);
default:
return null;
Expand Down
4 changes: 2 additions & 2 deletions front/src/components/code-quality/code-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ class CodePanel extends React.Component<ICodePanelProps, ICodePanelState> {
}

save(that: this) {

that.setState({ creating: true });
var item = that.state.currentCode;
item.id = Guid.create().toString();


that.storageService.removeAll().then(() => { });
that.storageService.saveCode(item).then(item => {
that.close(that);
});
Expand Down
22 changes: 17 additions & 5 deletions front/src/components/template/template-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class TemplatePanel extends React.Component<ITemplatePanelProps, ITemplatePanelS
gitUrl: "",
user: "",
pass: "",
branch: "",
tags: []
};
}
Expand Down Expand Up @@ -104,7 +105,7 @@ class TemplatePanel extends React.Component<ITemplatePanelProps, ITemplatePanelS
onInputChange(event: React.ChangeEvent, value: string, that: this) {
var prop = event.target.id.replace("__bolt-", "");
that.setState(prevState => ({
currentTemplate: {...prevState.currentTemplate, [prop]: value}
currentTemplate: { ...prevState.currentTemplate, [prop]: value }
}));
}

Expand All @@ -116,8 +117,9 @@ class TemplatePanel extends React.Component<ITemplatePanelProps, ITemplatePanelS
currentTemplate.description && currentTemplate.description.trim() !== "" &&
currentTemplate.gitUrl && currentTemplate.gitUrl.trim() !== "" &&
currentTemplate.replaceKey && currentTemplate.replaceKey.trim() !== "" &&
currentTemplate.branch && currentTemplate.branch.trim() !== "" &&
currentTemplate.tags && currentTemplate.tags.length > 0 &&
(showAuthentication ? currentTemplate.pass && currentTemplate.pass.trim() !== "" : true )
(showAuthentication ? currentTemplate.pass && currentTemplate.pass.trim() !== "" : true)
);
}

Expand Down Expand Up @@ -172,14 +174,24 @@ class TemplatePanel extends React.Component<ITemplatePanelProps, ITemplatePanelS
placeholder="e.g. /~https://github.com/Microsoft/vscode.git"
/>
</div>
<div className="template--group">
<TextField
inputId="branch"
label="Branch *"
value={currentTemplate.branch}
onChange={(event, value) => this.onInputChange(event, value, this)}
required={true}
placeholder="Name of the branch. e.g. develop, main"
/>
</div>
<div className="template--group">
<TextField
inputId="replaceKey"
label="Replace key *"
value={currentTemplate.replaceKey}
onChange={(event, value) => this.onInputChange(event, value, this)}
required={true}
placeholder=""
placeholder="Replaces every instance of 'replaceKey' with project name"
/>
</div>
<div className="template--group">
Expand Down Expand Up @@ -293,7 +305,7 @@ class TemplatePanel extends React.Component<ITemplatePanelProps, ITemplatePanelS
danger={true}
onClick={() => {
this.service.removeTemplate(currentTemplate.id);
this.setState({templates: templates.filter(d => d.id !== currentTemplate.id).sortByProp("text")})
this.setState({ templates: templates.filter(d => d.id !== currentTemplate.id).sortByProp("text") })
this.reset(this);
}} />
<Button
Expand All @@ -304,7 +316,7 @@ class TemplatePanel extends React.Component<ITemplatePanelProps, ITemplatePanelS
let items = templates.filter(d => d.id !== currentTemplate.id);
items.push(currentTemplate);
this.service.saveTemplate(currentTemplate);
this.setState({templates: items.sortByProp("text")})
this.setState({ templates: items.sortByProp("text") })
this.reset(this);
}} />
</ButtonGroup>
Expand Down
1 change: 1 addition & 0 deletions front/src/model/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ export interface ITemplate {
gitUrl: string;
user: string;
pass: string;
branch: string;
tags: IStack[]
}
6 changes: 3 additions & 3 deletions front/src/pages/api-docs/api-page-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ import Api from "./api-page";
export const SampleData2: IApi[] = [
{
id: "1",
name: "Eleven.Service.Push",
name: "Company.Service.Push",
url: "https://petstore.swagger.io/v2/swagger.json",
},
{
id: "2",
name: "Eleven.Service.User",
name: "Company.Service.User",
url: "https://generator.swagger.io/api/swagger.json",
},
{
id: "3",
name: "Eleven.Service.Report",
name: "Company.Service.Report",
url: "https://petstore.swagger.io/v2/swagger.json",
},
];
Expand Down
3 changes: 2 additions & 1 deletion front/src/pages/api-docs/api-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Api extends React.Component<{}, IApiState> {

loadApis() {
this.apiService.getApi().then(apis => {
apis.sortByProp("name");
this.setState({ apis: apis, loading: false });
}).catch(e => {
this.setState({ loading: false });
Expand Down Expand Up @@ -126,7 +127,7 @@ class Api extends React.Component<{}, IApiState> {
}



}


Expand Down
48 changes: 0 additions & 48 deletions front/src/pages/code-quality/code-page-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,6 @@ import { GiCheckedShield, GiPadlock } from "react-icons/gi";
import { ISonarBranch, ISonarMeasure } from "../../model/sonar";


export const projectsMock =
[
{
Title: "Eleven.Service.Mail",
status: "passed",
Props: [
{
label: "Bugs",
value: 1,
status: "C",
icon: <AiFillBug className="icon-tools" />

},
{
label: "Vulnerabilities",
value: 0,
status: "A",
icon: <GiPadlock className="icon-tools" />
},
{
label: "Hotspots",
value: "0.0%",
status: "E",
icon: <GiCheckedShield className="icon-tools" />
},
{
label: "Code Smells",
value: 14,
status: "A",
icon: <FaRadiationAlt className="icon-tools" />
},
{
label: "Coverage",
value: "0.0%"
},
{
label: "Duplications",
value: "2.7%"
},
{
label: "Lines",
value: "1.1k",
status: "S"
}
]
}
]

export function renderBranchStatus(branch: ISonarBranch, className?: string) {

if (!branch)
Expand Down
2 changes: 1 addition & 1 deletion front/src/pages/code-quality/code-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class Code extends React.Component<{}, ICodeState> {
<div className="flex-row" style={{ flexWrap: "wrap", marginTop: "20px" }}>
{branch.measures.sortByProp("metric").map((measure, index) => {
var item = configureMeasure(measure, branch.measures);
console.log(item);

return (item != null &&
<div className="flex-column" style={{ minWidth: "120px" }} key={index}>
<div className="body-m primary-text">{item.icon} {item.label}</div>
Expand Down
57 changes: 1 addition & 56 deletions front/src/pages/project/projects-page-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,61 +19,6 @@ import { Link } from "azure-devops-ui/Link";
import { VssPersona } from "azure-devops-ui/VssPersona";


export const projectsMock: IProject[] = [
{
"id": "dd685ebc-19ee-5517-1b3f-329178b21137",
"name": "Push2",
"repoName": "Eleve.Service.Push2",
"status": "running",
"template": {
"id": "b7a9ce66-96d3-2e69-61c3-80cf54a7eabe",
"replaceKey": "AppName",
"text": "React App",
"description": "um has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to m",
"gitUrl": "https://dev.azure.com/elevenfinancial/Tribe%20-%20PeD/_git/Eleven.Libs.Foundation",
"user": "",
"pass": "",
"tags": [
{
"id": 3,
"text": "React"
},
{
"id": 1,
"text": "C#"
}
],
},
"repoUrl": "https://dev.azure.com/elevenfinancial/Tribe%20-%20PeD/_git/Eleve.Service.Push2",
"buildDefinitionId": 57,
"startTime": new Date(),
},
{
"id": "f121ae71-e50d-db4b-20f4-5b9bd13dfd99",
"name": "Push3",
"repoName": "Eleve.Service.Push3",
"status": "running",
"template": {
"id": "e219db83-30e1-3bec-88bd-b58d13ef842d",
"replaceKey": "ServiceName",
"text": "Microservice",
"description": "um has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to m",
"gitUrl": "https://dev.azure.com/elevenfinancial/Tribe%20-%20PeD/_git/Eleven.Libs.Foundation",
"user": "",
"pass": "",
"tags": [
{
"id": 1,
"text": "C#"
}
],
},
"repoUrl": "https://dev.azure.com/elevenfinancial/Tribe%20-%20PeD/_git/Eleve.Service.Push3",
"buildDefinitionId": 58,
"startTime": new Date(),
}
];

export var columns: ITableColumn<IProject>[] = [
{
id: "Status",
Expand Down Expand Up @@ -223,7 +168,7 @@ export function renderTemplateColumn(
key: "branch-code",
})}
<span>Generated by </span>
<VssPersona identityDetailsProvider={{
<VssPersona identityDetailsProvider={{
getDisplayName() {
return tableItem.user.displayName;
},
Expand Down
5 changes: 4 additions & 1 deletion front/src/pages/project/projects-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class ProjectsPage extends React.Component<{}, IProjectsState> {

var that = this;
var projects = that.state.projects;

await that.verifyProjectStatus(projects, that);

if (projects.filter(d => d.status === ProjectStatus.Running).length > 0) {
Expand All @@ -111,8 +112,10 @@ class ProjectsPage extends React.Component<{}, IProjectsState> {
const element = projects[index];
if (element.status === ProjectStatus.Running) {
element.status = await GetBuildStatusAsync(element.runBuildId)
if (element.status === ProjectStatus.Succeeded)
if (element.status === ProjectStatus.Succeeded) {
await DeletePipelineAsync(element.buildDefinitionId);
await this.projectService.updateProject(element);
}
}
}
if (projects.filter(d => d.status === ProjectStatus.Running).length === 0) {
Expand Down
Loading

0 comments on commit b876767

Please sign in to comment.