Skip to content

Commit 06be278

Browse files
Cyrille BourgoisJoffrey LEVEUGLE
authored andcommitted
feat: add server-sidebar module (#639)
1 parent 0fc12d7 commit 06be278

File tree

19 files changed

+1767
-1
lines changed

19 files changed

+1767
-1
lines changed

packages/manager/modules/navbar/src/component.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const component = {
77
langOptions: '<?',
88
navbarOptions: '<?',
99
sidebarLinks: '<?',
10+
universeClick: '&?',
1011
},
1112
controller,
1213
template,

packages/manager/modules/navbar/src/controller.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,13 @@ export default class {
8989
}
9090

9191
buildResponsiveLinks() {
92-
if (this.sidebarLinks && !this.responsiveLinks) {
92+
if ((this.sidebarLinks || this.universeClick) && !this.responsiveLinks) {
9393
this.responsiveLinks = this.mainLinks.map((link) => {
9494
if (link.name === get(this.navbarOptions, 'universe')) {
9595
return ({
9696
...omit(link, 'url'),
9797
subLinks: this.sidebarLinks,
98+
click: () => this.universeClick(),
9899
});
99100
}
100101

packages/manager/modules/navbar/src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import navbarComponent from './component';
1515
import service from './service';
1616

1717
import 'ovh-ui-kit/dist/oui.css';
18+
import './index.less';
1819

1920
const moduleName = 'ovhManagerNavbar';
2021

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@import '~ovh-ui-kit/packages/oui-icons/_icons';
2+
3+
.oui-navbar-link_active {
4+
.oui-navbar-link::after {
5+
content: @oui-icon-index-chevron-left;
6+
}
7+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2013-present, OVH SAS
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
* Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# manager-server-sidebar
2+
3+
[![npm version](https://badgen.net/npm/v/@ovh-ux/manager-server-sidebar)](https://www.npmjs.com/package/@ovh-ux/manager-server-sidebar) [![Downloads](https://badgen.net/npm/dt/@ovh-ux/manager-server-sidebar)](https://npmjs.com/package/@ovh-ux/manager-server-sidebar) [![Dependencies](https://badgen.net/david/dep/ovh-ux/manager/packages/manager/modules/sidebar)](https://npmjs.com/package/@ovh-ux/manager-server-sidebar?activeTab=dependencies) [![Dev Dependencies](https://badgen.net/david/dev/ovh-ux/manager/packages/manager/modules/sidebar)](https://npmjs.com/package/@ovh-ux/manager-server-sidebar?activeTab=dependencies) [![Gitter](https://badgen.net/badge/gitter/ovh-ux/blue?icon=gitter)](https://gitter.im/ovh/ux)
4+
5+
## Install
6+
7+
```sh
8+
yarn add @ovh-ux/manager-server-sidebar
9+
```
10+
11+
## Usage
12+
13+
```js
14+
import angular from 'angular';
15+
import ovhManagerServerSidebar from '@ovh-ux/manager-server-sidebar';
16+
17+
angular
18+
.module('myApp', [
19+
ovhManagerServerSidebar,
20+
]);
21+
```
22+
23+
```html
24+
<ovh-manager-server-sidebar universe="'DEDICATED'"></ovh-manager-server-sidebar>
25+
````
26+
27+
## Options
28+
29+
### universe
30+
31+
Pass a string as `universe` to configure universe (`DEDICATED` or `CLOUD`).
32+
33+
```html
34+
<ovh-manager-server-sidebar
35+
universe="'DEDICATED'">
36+
</ovh-manager-server-sidebar>
37+
```
38+
39+
## Build
40+
41+
```sh
42+
# Build in production mode
43+
yarn start
44+
```
45+
46+
## Development
47+
48+
If you want to contribute to the project, follow theses instructions:
49+
50+
Foremost, you should launch a global installation at the root folder of this repository:
51+
52+
```sh
53+
yarn install
54+
```
55+
56+
Then you just have to start the project in development mode. For this, two choices are possible according to your needs:
57+
58+
```sh
59+
# Build the `manager-server-sidebar` workspace and all the nested workspaces in development mode and watch only `manager-server-sidebar` workspace
60+
yarn start:dev
61+
# Build and watch the `manager-server-sidebar` workspace and all the nested workspaces in development mode
62+
yarn start:watch
63+
```
64+
65+
## Contributing
66+
67+
Always feel free to help out! Whether it's [filing bugs and feature requests](https://github.com/ovh-ux/manager/issues/new) or working on some of the [open issues](https://github.com/ovh-ux/manager/issues), our [contributing guide](CONTRIBUTING.md) will help get you started.
68+
69+
## License
70+
71+
[BSD-3-Clause](LICENSE) © OVH SAS
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "@ovh-ux/manager-server-sidebar",
3+
"description": "OVH control panel sidebar",
4+
"version": "0.0.0",
5+
"repository": {
6+
"type": "git",
7+
"url": "git+https://github.com/ovh-ux/manager.git",
8+
"directory": "packages/manager/components/server-sidebar"
9+
},
10+
"license": "BSD-3-Clause",
11+
"files": [
12+
"dist"
13+
],
14+
"main": "./dist/cjs/index.js",
15+
"module": "./dist/esm/index.js",
16+
"browser": "./dist/umd/server-sidebar.js",
17+
"scripts": {
18+
"build": "rollup -c --environment BUILD:production",
19+
"dev": "rollup -c --environment BUILD:development",
20+
"dev:watch": "yarn run dev --watch",
21+
"prepare": "yarn run build",
22+
"start": "lerna exec --stream --scope='@ovh-ux/manager-server-sidebar' --include-filtered-dependencies -- yarn run build",
23+
"start:dev": "lerna exec --stream --scope='@ovh-ux/manager-server-sidebar' --include-filtered-dependencies -- yarn run dev",
24+
"start:watch": "lerna exec --stream --parallel --scope='@ovh-ux/manager-server-sidebar' --include-filtered-dependencies -- yarn run dev:watch"
25+
},
26+
"peerDependencies": {
27+
"@ovh-ux/manager-config": "^0.2.0",
28+
"@ovh-ux/manager-core": "^5.2.1",
29+
"@ovh-ux/ng-ovh-cloud-universe-components": "^1.3.0-alpha.2",
30+
"@ovh-ux/ng-ovh-sidebar-menu": "git+https://github.com/ovh-ux/ng-ovh-sidebar-menu.git#fix/revert-old-style",
31+
"@ovh-ux/ng-translate-async-loader": "^2.0.0",
32+
"angular": "^1.7.8",
33+
"angular-translate": "^2.18.1",
34+
"ovh-api-services": "^6.18.0"
35+
},
36+
"dependencies": {
37+
"@ovh-ux/ng-ovh-sidebar-menu": "^8.0.1",
38+
"jsurl": "^0.1.5",
39+
"lodash": "^4.17.11"
40+
},
41+
"devDependencies": {
42+
"@ovh-ux/component-rollup-config": "^5.0.1",
43+
"ovh-ui-kit": "^2.32.0"
44+
}
45+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import path from 'path';
2+
import rollupConfig from '@ovh-ux/component-rollup-config';
3+
4+
const config = rollupConfig({
5+
input: 'src/index.js',
6+
}, {
7+
lessTildeImporter: {
8+
paths: [
9+
path.resolve(__dirname, 'node_modules'),
10+
path.resolve(__dirname, '../../../../node_modules'),
11+
],
12+
},
13+
});
14+
15+
const outputs = [config.es()];
16+
17+
// if (process.env.BUILD === 'production') {
18+
outputs.push(config.cjs());
19+
outputs.push(
20+
config.umd({
21+
output: {
22+
globals: {
23+
angular: 'angular',
24+
},
25+
},
26+
}),
27+
);
28+
// }
29+
30+
export default outputs;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import controller from './controller';
2+
import template from './template.html';
3+
4+
const component = {
5+
bindings: {
6+
onClick: '&',
7+
isOpen: '<',
8+
universe: '<',
9+
},
10+
controller,
11+
template,
12+
};
13+
14+
export default component;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
export const DEDICATED = 'DEDICATED';
2+
export const CLOUD = 'CLOUD';
3+
4+
export const MANAGER_URLS = {
5+
EU: {
6+
DEDICATED: {
7+
FR: 'https://www.ovh.com/manager/dedicated/',
8+
},
9+
CLOUD: {
10+
FR: 'https://www.ovh.com/manager/cloud/repsac/',
11+
},
12+
},
13+
CA: {
14+
DEDICATED: {
15+
FR: 'https://ca.ovh.com/manager/dedicated/',
16+
},
17+
CLOUD: {
18+
FR: 'https://ca.ovh.com/manager/cloud/repsac/',
19+
},
20+
},
21+
US: {
22+
DEDICATED: {
23+
FR: 'https://us.ovhcloud.com/manager/dedicated/',
24+
},
25+
CLOUD: {
26+
FR: 'https://us.ovhcloud.com/manager/cloud/repsac/',
27+
},
28+
},
29+
};
30+
31+
export default { DEDICATED, CLOUD, MANAGER_URLS };

0 commit comments

Comments
 (0)